Since version 3.1.0-KickOff, Ontologies have been referred to as "Entities" in the Control Panel. This does not alter any functionality; the nomenclature has simply been changed for a better understanding of the concept.
Updating this article
Introduction
A KPI (Key Performance Indicator) is mainly a metric to help us measure and quantify a progress following some started goals and objectives. That is to say, a KPI is designed to show how the progress is in a specific process or product.
KPIs are widely used in the world of marketing (where KPI are specific metrics (quantitative and qualitative) that allow you analyze each of the dissemination, performance, loyalty, positioning and branding channels in your publicity campaigns), and in general if I intend that my solution's objectives can be measured and reached, in other words, that they be SMART:
S for specific.
M for Measurable.
A for Attainable.
R for Realist.
T for Timely.
Steps
Create the Entity
From the Control Panel, navigate to the Development > My Entities menu.
This will take us to the list of available Entities. To create the Entity, click on the "+" button at the top right of the screen.
From the different Entities that we will be able to create, we will select the "Creation of a KPI Entity" one:
Fill in general information
This will open the Entity creation wizard, where we will first have to indicate if we are going to generate a new Entity, or if we want to reuse an existing one.
If we are going to reuse a new Entity, we will uncheck the "New Entity" toggle switch, which will enable a selector where we will be able to search for the Entity we want to use.
In case a new Entity is going to be created, we will have to enter some basic information like the rest of the Entities.
Identification: the unique name with which to identify the Entity.
Meta-Information: tags to characterize the Entity, which will be used for filtering when searching.
Description: extended descriptive text of the Entity, such as its use, properties, characteristics, etc.
Database Instance: here you can indicate the type of database to be used for this Entity.
In addition, we have some more options to characterize the Entity:
Active: so that the Entity works or is blocked.
Public entity: if we want the Entity to be public, or if we want it to be private.
Allows encryption of fields: if we want some fields to store sensitive information and be encrypted (more information).
ContextData Enable: if you want the Entity to internally record write and management changes (more information).
nce the Entity's general information and options have been defined, click on the "Continue" button to access to the KPI configuration.
KPI configuration
In this screen, we must first define the Cron Job of the KPI, i.e. assign a periodicity of execution.
For this guide, we will indicate a daily periodicity, at 00:00:
We will also be able to select whether the generation of this KPI will be carried out within a specific period of dates (for example, if we are running a campaign and we are interested in generating the KPI only for a few specific days):
Next, below these temporary options, there is a code window where we will be able to enter a query, which will be used to indicate what data will be extracted, its grouping, transformation and aggregation of other Entities that serve as the basis for the creation of the KPI.
The result of this query will be what is stored in the Entity of type KPI that we are generating.
As an example, let's say that we are interested in knowing from the "Restaurants" Entity, the rating of the restaurants by type of food and neighborhood. So, we will generate the following query:
SELECT c.Restaurant.cuisine as cuisine, c.Restaurant.borough as borough, sum(c.Restaurant.grades[0].score) as score FROM Restaurants as c GROUP BY c.Restaurant.cuisine,c.Restaurant.borough
If we launch the query, the result we will obtain will be the following:
If we need to process the query information to adapt it in some way, we can activate the "Enable processing" toggle switch to enable a JavaScript code editing window, where we can modify the query result:
Once the query is as we need it, click on the "Create" button to finish the creation of the Entity.
A window will then be displayed with the available options to be performed with the Entity created.
Clicking on the "Close" button will take you back to the Entities list, where the newly created Entity will appear.
KPI Management
After creating the Entity, we will return to the Entity list where it will be listed, with its properties. There we will see that it is of type KPI:
The KPI Entity will be running according to the assigned temporality, storing the data obtained by the query we have defined.
In the entity options, we will be able to stop the execution of the task by clicking on the "Stop" option:
To reactivate the task, we can do it from the same menu by clicking on "Play":
In addition, we will be able to run the KPI at any time (to check that it is working, for example), by clicking on "Execute KPI":