Hi @kstankevitz ,
I have followed the documentation provided at New Tracker - DHIS2 Documentation.
Procedure I followed to test the functionality.
- created a new data element and assigned it to a program
- created a new program rule that would assign a value to the newly created data element based on other data elements in the program
- I have used the following API to get all the event records for a given program, organisation unit.
https://play.dhis2.org/2.38.1.1/api/38/tracker/events.json?skipPaging=true&program=lxAQ7Zs9VYR&programStage=dBwrot7S420&orgUnit=DiszpKrYNg8&ouMode=SELECTED&fields=:all - You can use this section of the documentation New Tracker - DHIS2 Documentation to export the required event records for your use case.
- In the downloaded json file, replace the “instances” key with “events”.
- Now the exported events need to be imported back into the system for the program rules to execute.
- I have used a HTTP client tool to make the following POST request to import the events.
https://play.dhis2.org/2.38.1.1/api/tracker?reportMode=FULL&async=false
with the exported events as payload. - Once the events were successfully imported, I verified the new dataelement has value as per the new program rule in the capture app.
Please test this thoroughly before performing this on production.
Thanks,
Rithvik