How can I add indicator values via API??
Hi @SferaDev, Is it possible to add indicator values via API?
I didn’t get initially
Indicators, Program Indicators and Predictors are different pieces of metadata that hold an expression that can be calculated over time. They are quite useful for visualization and other investigation purposes.
Since they hold a value over time but that value should never be manually updated (to ensure it follows the provided formula), there’s no API endpoint that allows you to update the value manually for a single indicator.
You can update the value of all the indicators by running down the analytics. The analytics can be ran using the system tasks endpoint.
However, some organizations find it useful to host the indicator values inside a data value (by mapping it to a data element). At EyeSeeTea we have developed a very complete app that among other things allows that, it is called MetaData Sync. It is part of the most complex tasks in the app but it can be found on the user guide under the mapping chapter.
If you do not want to use any app and call directly the API, in MetaData Sync we internally use the analytics endpoint that returns in dataValueSets format for the indicators as dimensions. The aggregated payload in JSON can be easily imported back into the instance but you need to update the ids from the indicator to the appropriate data element. Some heads up with that endpoint are that period/orgUnit are also aggregated down since they’re analytics, and also bear in mind that if the indicator has COCs they appear in a different format in the payload following a dataElement.categoryOptionCombo structure.
On the other side, you can also use predictors, they behave slightly different than indicators but they can be mapped to an output data element directly from the maintenance app.