ASSIGN program rules in backend: old vs new Tracker API

Hello Tracker devs,

Are backend program rules of action type “ASSIGN” supported in the (old) /api/events endpoint?

Assumptions:

  • Event program with two DEs
  • a simple Program rule to copy from DE1 to DE2 – confirmed to work in Frontend / Capture app.
  • Versions tested: 2.37.2 and 2.36.7.
  • The dhis.conf property is turned on for system.program_rule.server_execution as per DHIS2-10380 (and Tomcat restarted).

I noticed with exactly the same payload (except the property for eventDate is switched to occuredAt to conform to the new Tracker API) the value from DE1 gets assigned to DE2 in the new Tracker API endpoint via POST /api/tracker, but not via POST /api/events .

Is this expected?

There is no such mention in the documentation, so I’m wondering whether this is a bug or not.

A few related JIRA issues I found while looking what already exists:

DHIS2-10116

DHIS2-7310

Thank you!

1 Like

Hi @dhuser ,

ProgramRules was originally only supported by the clients (Web and Android); However, in the new tracker importer (/api/tracker) we also implemented any relevant program rules to be run during import as well. However, this process is not in the old importer. So it’s correct that with the /api/tracker endpoint, program rules will be run, while in the old endpoints, they will not. This is also because they use a completely different codebase for running the import itself :slight_smile:
Hope this helps!

3 Likes

thanks @Stian makes sense! Just wondering what the config property is for if (backend) program rules only can run for the new tracker importer? Would it not make sense to default to off?

asking same question