← Back to team overview

dhis2-devs team mailing list archive

Re: Confirming 'official' handling of Yes and No in program indicators

 

Hi Sam,

On Mon, Oct 31, 2016 at 10:51 AM, Sam Johnson <samuel.johnson@xxxxxxxxxx>
wrote:

> Hi Devs,
>
>
>
> I’ve been working on some quite complex program indicators, and before I
> commit them to production, I would be very grateful if you could confirm
> how Yes and No are supposed to be handled in program indicator expressions.
>
>
>
> I’ve noticed that within the program indicators, they currently resolve as
> Yes=1, No=0 and non-response=null.  So for example:
>
> ·         Putting the data element ‘YesNoDE’ itself into an Event Report
> displays: Yes
>
> ·         Creating an indicator containing #{YesNoDE} displays: 1
>
> ·         You can do complex indicators involving the Yes/No data
> element, eg an index calculation:
> 1.2345 + #{YesNoDE_A}*2.3456+#{YesNoDE_B}*0.7654.
>
> ·         You can even put these complex calculations within a
> d2:condition, eg to test thresholds:
> d2:condition('1.2345 + #{YesNoDEa}*2.3456+#{YesNoDEb}*0.7654>3.1',1,0)
>
>
>
> This is all excellent, as it enables us to do all sorts of powerful
> calculations/conditions with Yes/No responses interpreted as 1 or 0.  J
>
>
>
> So my question: *is this expected behaviour, and will it remain
> consistent in future versions of DHIS2?*  I’ve noticed, for example, that
> there are some rendering bugs in Event Capture, where ‘No’ appears as ‘0’
> etc – is there any chance that the handling above will be broken when those
> bugs are fixed, or will I be able to continue to rely on it?
>

Yes, it is expected, and will be continued.

To elaborate: In the trackedentity datavalue table we store boolean values
as true | false. We convert this to 0 | 1 when we generate the analytics
tables to make it more suited for aggregation (as you point out above).

Re the event capture bug - please report with a bit more context and we
will try to fix - it is strange that it shows up as 0.

best regards,

Lars




>
>
> Cheers, Sam.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
lars@xxxxxxxxx
http://www.dhis2.org <https://www.dhis2.org/>

Follow ups

References