Strapi Component Elastickpi - kwantu/platformconfiguration GitHub Wiki

Return to Components

1. Elastic Kpi

1.1 What are Elastic Kpi?

An Elastic Kpi component renders a Kpi from Betterdata. This component builds a query in elastic based on the users inputs to the fields. The component will then run that query in elastic to get the data required to populate the kpi. This component will only render the value of a single field. You can run aggregations on that field.

1.2 Setup in Betterdata

The benefit of the elastic kpi is that we no longer need to create a report to pull the data from. This means the setup is simpler.

1.2.1 Properties

There is only one type of elastic kpi and so the properties are always the same.

Kpi Example 1

image

Field Description Required?
Node ID Unique Identifier for the node (randomly generated) Yes
Box title Title for the box the chart will be inside, this title only shows when you hover over the box with a mouse Yes
Widget All dashboard nodes require you to pick a widget. For this case select Elastic Chart Yes
SDO This is where you select your data object that will be used as the data source Yes
Field This defines which fields from the data source will be selected in the query. yes
Context filter This defines the context of the data. Currently this only works for Strapi. The case for this is where you want the chart to be filtered on a specific field. For example: filtering on a specific District. No
Function This defines what aggregate function will be applied to the above field. Currently the choices are: Sum, Average, Count, Distinct Count No
Prefix This defines a prefix label that will appear above the field value No
Suffix This defines a suffix label that will appear after the field value No
JS Function JS stands for Java Script. The only option for this is Percentage. This is only used in certain circumstances. To use this you MUST provide 2 fields comma separated with no whitespace, For example: Numerator,Denominator. This function will then calculate the percentage difference of the 2 fields provided No
Run across communities If the community this dashboard is on has child communities and you would like to pull data from all communities then tick this No
filter Here select which fields correspond to which filters you have defined No

1.2.2 Gaps in Kpi

  1. Is it possible to have where clauses for kpis so that, For example: A user may want a count of the field gender where that value is equal to 'Male'
  2. Double check JS Function