How do filters work in Enrolment program indicators?

Hi devs,

Just a quick question around the operation of the enrolment indicators. I’m trying to do a program indicator which searches a repeatable program stage to see if one or more events include a specific data value (a test result). The catch is that the data value could be in any event, and may even appear multiple times, but I only want to count each enrolment once, regardless of the number of test results.

I’ve tried using an ‘enrolment’ program indicator with a filter that ensures only events which include my data value are included in the indicator calculation; however, this doesn’t seem to be working as I expected, and the entire enrolment is often being filtered out, even though it contains a positive test result.

So I’d be grateful if you could clarify when the filter is applied for ‘enrolment’ program indicators:

· Is it applied at the event level, before the enrolment record takes the ‘latest’ event for each program stage (so I can filter the events that are used to calculate the ‘latest’ event for each enrolment?)

· Or for Enrolment PIs is it actually an enrolment rather than an event filter, ie it’s applied after the ‘latest’ event has been pulled for each program stage (so the filter is only applied to the ‘latest’ events, not all events)?

I think the former would be more powerful, but if it’s the latter (which I suspect), is there another way of counting the number of enrolments that have had a particular value recorded during any one of a number of repeatable events?

Many thanks in advance for any help/thoughts you can share!

Cheers, Sam.

Hi Sam,

your suspicion is correct. In Enrollment program indicators you will always evaluate the newest value for each of the data elements within repeatable program stages - both for filters and expression. This means that for your use case you will have to use the event analyticstype.

I think you can acheive what you seek here by making the following program indicator:
AnalyticsType: Event
Aggregation type: Count
Expression: Enrollment count
Filter: Event macthing the test result

This program indicator will first find all events that matches the filter criteria, then make sure to count only how many distinct enrollments that is represented in this population of events.

Markus

···

8. mai 2017 kl. 12.09 skrev Sam Johnson <samuel.johnson@qebo.co.uk>:

Hi devs,

Just a quick question around the operation of the enrolment indicators. I’m trying to do a program indicator which searches a repeatable program stage to see if one or more events include a specific data value (a test result). The catch is that the data value could be in any event, and may even appear multiple times, but I only want to count each enrolment once, regardless of the number of test results.

I’ve tried using an ‘enrolment’ program indicator with a filter that ensures only events which include my data value are included in the indicator calculation; however, this doesn’t seem to be working as I expected, and the entire enrolment is often being filtered out, even though it contains a positive test result.

So I’d be grateful if you could clarify when the filter is applied for ‘enrolment’ program indicators:
· Is it applied at the event level, before the enrolment record takes the ‘latest’ event for each program stage (so I can filter the events that are used to calculate the ‘latest’ event for each enrolment?)
· Or for Enrolment PIs is it actually an enrolment rather than an event filter, ie it’s applied after the ‘latest’ event has been pulled for each program stage (so the filter is only applied to the ‘latest’ events, not all events)?

I think the former would be more powerful, but if it’s the latter (which I suspect), is there another way of counting the number of enrolments that have had a particular value recorded during any one of a number of repeatable events?

Many thanks in advance for any help/thoughts you can share!

Cheers, Sam.

_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net <mailto:dhis2-devs@lists.launchpad.net>
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help

Hi Markus,

Many thanks for both the clarification and the tip – both really useful. However, my scenario is a slightly complex one – I’m trying to track a cohort of patients over time, including events that extend beyond the reporting period. So for example, I want to pick Q1 last year as my period, and see whether any of the patients enrolled then have ever subsequently had a test.

My understanding is:

· if I use an ‘event’ analytics type, as you suggest below, only events that fall within the selected period will be evaluated – in other words, I’ll see only tests done during that period, regardless of when the patient was actually enrolled (and regardless of whether they’ve had a test before or after that period);

· if, however, I use the ‘enrolment’ analytics type, only enrolments that start within the selected period will be counted, but all ‘newest’ events for each program stage (including those that fall outside of the period) will be evaluated in the expression… allowing me to track a cohort of enrolments beyond the selected period.

Is this understanding of how it all works correct?

Once again, many thanks in advance for any advice/clarification you’re able to provide!

Cheers, Sam.

···

From: Markus Bekken markus@dhis2.org

Date: Monday, 8 May 2017 at 18:48

To: Sam Johnson samuel.johnson@qebo.co.uk

Cc: DHIS2 Developers dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-devs] How do filters work in Enrolment program indicators?

Hi Sam,

your suspicion is correct. In Enrollment program indicators you will always evaluate the newest value for each of the data elements within repeatable program stages - both for filters and expression. This means that for your use case you will have to use the event analyticstype.

I think you can acheive what you seek here by making the following program indicator:

AnalyticsType: Event

Aggregation type: Count

Expression: Enrollment count

Filter: Event macthing the test result

This program indicator will first find all events that matches the filter criteria, then make sure to count only how many distinct enrollments that is represented in this population of events.

Markus

  1. mai 2017 kl. 12.09 skrev Sam Johnson samuel.johnson@qebo.co.uk:

Hi devs,

Just a quick question around the operation of the enrolment indicators. I’m trying to do a program indicator which searches a repeatable program stage to see if one or more events include a specific data value (a test result). The catch is that the data value could be in any event, and may even appear multiple times, but I only want to count each enrolment once, regardless of the number of test results.

I’ve tried using an ‘enrolment’ program indicator with a filter that ensures only events which include my data value are included in the indicator calculation; however, this doesn’t seem to be working as I expected, and the entire enrolment is often being filtered out, even though it contains a positive test result.

So I’d be grateful if you could clarify when the filter is applied for ‘enrolment’ program indicators:

· Is it applied at the event level, before the enrolment record takes the ‘latest’ event for each program stage (so I can filter the events that are used to calculate the ‘latest’ event for each enrolment?)

· Or for Enrolment PIs is it actually an enrolment rather than an event filter, ie it’s applied after the ‘latest’ event has been pulled for each program stage (so the filter is only applied to the ‘latest’ events, not all events)?

I think the former would be more powerful, but if it’s the latter (which I suspect), is there another way of counting the number of enrolments that have had a particular value recorded during any one of a number of repeatable events?

Many thanks in advance for any help/thoughts you can share!

Cheers, Sam.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

1 Like

Hi Sam,

It has been ages. Do you mind sharing the solution to this issue you have encountered earlier.

Cheers

1 Like