← Back to team overview

dhis2-devs team mailing list archive

Re: 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

> 8. mai 2017 kl. 12.09 skrev Sam Johnson <samuel.johnson@xxxxxxxxxx>:
> 
> 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 <https://launchpad.net/~dhis2-devs>
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx <mailto:dhis2-devs@xxxxxxxxxxxxxxxxxxx>
> Unsubscribe : https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs>
> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>


Follow ups

References