Generators - KPI Generator

EXPERIMENTAL

This generator builds a KPI wall.

With specific parameters for each KPI card, it will compare values, compute a progression or analyse how your data evolved over time on a specific period.

Like any other generator, it deals with all the complexity of manipulating dates, refining specific context, computing and comparing aggregation etc…

As the code is complex, and the resource might be difficult to reuse, we consider it experimental and share it in an early stage. Do not hesitate to send us your feedbacks, we highly appreciate your help to make this generator evolve.

Numeric, difference between 2 values

The main KPI settings

  • title : name of the KPI, below the value

Dataset setting :

  • dataset_id

Dataset filter (simple way, with 1 refine) :

  • dataset_refine_key: a facet field,
  • dataset_refine_value: a value,

Dataset filters (advanced way, with 1 object) :

  • dataset_advanced_refine_parameters : an object, ex: {'q':'some text query', 'refine.field':'value'}

Value settings, to setup the aggregation :

  • aggregation_function: can be SUM, AVG, MIN, MAX, STD, COUNT

  • aggregation_expression: a numerical field id

  • link: a link to redirect the user

  • image_url: the url of the item image

Then, the reference value, and how to compare it

  • compare_mode: can be date or numeric
  • compare_strategie: can be none, diff or progression

 

  • valref_dataset_id

  • valref_dataset_refine_key

  • valref_dataset_refine_value

  • valref_dataset_advanced_refine_parameters

  • valref_aggregation_function

  • valref_aggregation_expression

  • valref_aggregation_unit

  • valref_prefix: a sentence to add before the reference value

  • valref_suffix: a sentence to add after the reference value

Visual documentation with 1 example here

Date : progression between 2 periods

For date period comparison, additional parameters are required such as :

  • compare_date_strategie: If compare mode is date, select the strategy to get the period of time for the value and reference value. It can be RM/RM-1, RM/RM-12, FM/FM-1, FM/FM-12, SM/SM-1, SM/SM-12, RY/RY-1, FY/FY-1, SY/SY-1

1st letter:

  • R = running
  • S = sliding
  • F = full

2nd letter:

  • M = month
  • Y = year

Digit is -1 (for previous) or -12 for last 12th month (ie last year).

  • get_date_from: can be data to take the last date of the dataset, or now to take the day of the user browser
  • date_field_id: the date field id

For compare_strategie = progression it’s also important to set if a positive progression is good or not

  • higher: can be isbetter or isworse

Turn the KPI component into a flip card

  • link_label: set a custom label for the link button
  • link_mode: can be empty for standard links, or popin to open a modal

For additional information, you can switch the kpi card into a flip kpi card :

  • flip_additional_description: displayed on the back face
  • flip_hint: Displayed on the front face
  • flip_additional_link: an additional link
  • flip_additional_link_label: and it’s optional link button label

Tab navigation with KPI category

KPIs can be splited into several tabs by providing a category for each items:

  • category : Regroup the item in the specified category,

Compare different fields or datasets

As the settings for the KPI and the reference value are separated, they can be computed from different fields or datasets.

In this example:

  • 1st KPI compares different fields: 2007 France population and 2012 France population.
  • 2nd KPI compares different datasets: population in France vs population in Belgium