Before submitting a roadmap request I would like to inquire whether it is possible to use Program Indicators or another calculation based on a Tracker program Data element in a Program rule.
We have the following LMIS use case:
Data element named “Suggested stock replenishment”
Program rule calculates the value and “writes” it to the Data element field of the respective TEI using a Program rule (“Assign to”)
It seems that currently Program rules are not available for configuring Program rules.
An alternative would be a d2: function which would need to calculate the sum of a Tracker program Data element (“Distribution”) for a predetermined period, for example 90 days (which is exactly what a Program indicator which is already available does).
The short answer to your question is no, its not possible to embed a PI specifically into a Program Rule. I understand you want to use PI to sum up a DE from all events of the enrollment where the event date was within the last 90 days of the present event date.
But is there a reason it needs to be assigned to a data element, per se?
I suppose you are familiar with the “Display in Form” parameter on PI. This allows you to see the value of your PI in the “program indicator widget” on the TC/Capture app or the Android app.
It would be less obvious than an autofilled DE within the form, of course. For that youd need to schedule some sort of nightly script that would pull data for each event, calculate suggested stock replenishment, and then post the result to a TE Attribute or DE value.
Thanks a lot Brian for the quick answer.
The reason we are looking into a Program rule is that we need this calculation for each of up to 300 items so we need a structured table in the UI.
Moreover, the calculation results are needed in the custom DHIS2-RTS user interface which does not support the usual DHIS2 features.
I have submitted a roadmap idea (either allowing PIs in Program rules are creating a new d2: feature) but let me know if you have any good idea for a work around. Please also let me know if there is already a related request (JIRA ticked or roadmap idea) to avoid duplication of requests.