How to trigger program rules on a list of event

We have recently added program rules setting values to some data element to an existing program with some thousand events. Those works well, and each time we open a specific event we see them computed and the values correctly set in the related Data Elements.

The problem is now that we would like to “trigger” the rules on all our events. Our logic would be to call the API and iterate using a small script, but we’re unsure how to “force” DHIS2 to trigger program rules on a single event - any tips here?

Martin

3 Likes

Hello Martin,
Did you find a solution to this? I have a similar use case.

Thank you,

John

@mva and @jesplana,

There is work in progress to expand the backend rules engine in 2.35, and trigger program rules by “pinging” the event with a PUT or POST request.

See this CoP post with explanation: Backend program rules - #2 by jomutsani

And this JIRA ticket: DHIS2-7310 - Expand backend rules engine functionality: Assigning, errors and warnings

Currently the only PR Action available to trigger through this method is the SCHEDULEMESSAGE or SENDMESSAGE for SMS Program Notifications.

Maybe @Markus and @dhis2-tracker team could address this?

1 Like

Thanks Brian for sending the link.

John

It looks like according to JIRA this was implemented in 2.36… has anyone successfully done this?

Hi @kstankevitz ,

Looks like the new APIs are working. I gave it a try on 2.38.1.1 by adding a new program rule to assign a value and I was able to successfully assign value to past event records and update them. But unfortunately the Import/Export app is still using the old APIs. The procedure which I followed requires some technical expertise. If you are interested to know the process I followed, I would be happy to share.

Thanks,
Rithvik

Yes, I would appreciate more information about your process. We have a number of different cases where we would like to trigger the PRs across multiple events.

Best,
Kayla

Hi @kstankevitz ,

I have followed the documentation provided at New Tracker - DHIS2 Documentation.

Procedure I followed to test the functionality.

Please test this thoroughly before performing this on production.

Thanks,
Rithvik

2 Likes

Hi @rithvik,

I have the following scenario and I would like some help.

In the image below, I have ten data elements in which data is not entered sequentially. i.e the user can enter data in any filed, but the sum of values entered must be less or equal to 25. Can you help me create a program rule to solve my problem.

And the program rule should be triggered when the user clicks on the complete button in a program stage.

Thanks.