V{event_status} missing from the program indicator variable list in 2.43

Hi all,

I’ve run into a couple of related issues with V{event_status} in program indicators on 2.43 and I’d appreciate some clarification from the team.

First, it is not offered in the Maintenance app. When building a program indicator expression or filter in the Maintenance app, V{event_status} does not appear in the list of available variables. V{enrollment_status} is there, but event_status is not.

However, V{event_status} is listed in the official documentation for this version: Programs - DHIS2 Documentation

So my questions are:

  • Is this an intentional deprecation, with removal planned for a future release?
  • Or is it simply missing from the variable picker in the UI while still being fully supported by the analytics engine?
  • If it is being removed, what is the recommended replacement for filtering on event status?

For what it’s worth, if I type V{event_status} manually it saves and validates without complaint.

Second, the expression validator doesn’t validate the compared value. The expression/filter validator appears to only check syntax, not the semantics of the comparison. For example, this passes validation as “Valid”:

V{event_status} == 'idk_something'

Obviously that filter can never match anything, but nothing warns you about it. This is an easy way to silently end up with a program indicator that always returns 0, and it can take a long time to track down.

Would it be feasible for the validator to check string comparisons against the known status enums (at least as a warning rather than a hard error, to avoid breaking existing metadata)?

Thanks!

Hi @malekpour

Thank you for these questions! Yes, you’re right, it’s mentioned in the docs, but there are Jira tickets about these variable not showing..

@tzemp mentions in a related ticket:

Finally, we will eventually add in event_status to the maintenance app, but we need to do some additional testing to confirm the situations in which it should be selectable.

Hi @Gassim

Thanks for your response and link to the related ticket. I see that the Jira ticket is dated back to about three years ago which looks like stale. Additionally, in the ticket description, @Karoline mentioned that:

Comment from Markus on Slack:

event_status, I suspect this one can only be used for PIs that has analyticsType Event, meaning there is one unambiguous event that is evaluated in the PI. The docs is quite weak here though, so we should perhaps confirm in the code that there is no fallback for PIs of analtyicsType Enrollment is used. Like we have for event_date where the latest event in the enrollment is used when the PI is of analyticsType Enrollment.

However, we are using event_status in Enrollment PIs to filter out last events that are ACTIVE and haven’t passed program rule validation. In other words, when user enters wrong data (or leave required fields empty), program rules prevent marking the event COMPLETED. We use V{event_status} == 'COMPLETED' in almost all of our Enrollment PIs to filter out these events.

Hi @malekpour

Thank you for sharing your notes. I see you’ve reported related bug issue: DHIS2-22070 - Enrollment program indicator filter combining V{event_status} with any other condition throws ParserException. Quite helpful… :folded_hands:

Hi @malekpour,

Regarding your comment

However, we are using event_status in Enrollment PIs to filter out last events that are ACTIVE and haven’t passed program rule validation. In other words, when user enters wrong data (or leave required fields empty), program rules prevent marking the event COMPLETED. We use V{event_status} == 'COMPLETED' in almost all of our Enrollment PIs to filter out these events.

I wanted to highlight that in Data Visualizer app, this is possible to do without applying the filter in the PI.

You can check if it works as expected on your side. This way you might get a temporary workaround until the root cause is solved.

Hi @Pablo_Del_Medico,

Thanks for your suggestion but unfortunately that doesn’t work because under the hood, it passes completedOnly flag which based on documentation at Visualizations - DHIS2 Documentation

completedOnly: Flag used in analytics requests. If true, only completed events/enrollments will be taken into consideration. Boolean value.

Thus, in Enrollment PIs, it will consider completed “Enrollments” rather than “Events”.

I guess we found another issue, this time in the UI. The item that your red arrow points to, should be revised to completed events/enrollments as per documentation.

Hi, sorry, my fault. I thought we’re talking about EVENT PI :frowning: