Test Case Title |
TC2.34 - How manage My KPI with IOT Applications |
Goal |
I can manage My KPI Data with microservices in IOT Application I can manage myKPI, time series, with GPS coordinates. It can be used for traking fleets |
Prerequisites |
Have an account on Snap4city Platform Knowing how to use IoT Applications |
Expected successful result |
|
Steps |
The following examples were given on the KPI created in TC2.33 How create My KPI.
The Microservices that are used in this TC are those shown in this figure:
1. Get KPI Data List
We can use a flow created in an IOT Application to request a list of your KPIs. To do this we use the node "get-my-kpidata":
This microservice does not need configuration and if you enter any input, the list of KPIs is returned Date of the logged in user:
2. Get Values of a Own KPI
With this flow we can request the values of a certain KPI that belongs to the logged in user.
In the configuration tab you can choose which KPI (The KPIs belonging to the user are shown automatically) to have the values and whether to have the values within a certain time interval or, alternatively, whether to have a certain number of the last recorded values. If the start and end dates and the number of last values to have are selected, the last values of the selected time interval are returned.
The values are returned as an array of objects, as you can see in the figure below
3. Get Values of a Public KPI
With this flow we can request the values of a certain KPI that has been made public by the user who created it
The configuration and data produced by the microservice are the same as in point 2. The difference lies in the different KPIs that are shown to the user in the configuration.
4. Get Values of a Delegated KPI
With this flow we can request the values of a certain KPI that has been delegated by the user who created it to the user who is logged in.
The configuration and data produced by the microservice are the same as in point 2. The difference lies in the different KPIs that are shown to the user in the configuration.
5. Save Values on a Own KPI
To add values to your KPI (you cannot add values to public KPIs and delegated KPIs if you are not the owner of those KPIs) you can use the "save-my-kpi-data-values" microservice in the following stream where we send random values to a KPI.
N.B. Much attention must be paid to the DataType that has been inserted in the creation of the KPI (TC2.33). For example, it will not be possible to enter a string as a value if the DataType declared for that KPI is a float.
The values entered can be viewed through the microservice described in point 2 of this TC or through the KPI Editor described in TC2.33.