Option sets in program indicators

Hi all,

For program indicators, do option set codes count as number values in an expression/filter? I want to create a program indicator that captures whether ANY response was given to a particular data element in a tracker program stage (with response type text using an option set with 11 options, codes: 01, 02, 03…11). I want to sum all of the cases where the user selected ANY option for that data element.

Does this make sense?

Program expression: Enrollment count. [or TEI count?]

Program filter: {#uidofdataelement}

=‘01’ and #{CDbxAsttXzY.mFhpwpIv7ci}<=‘11’

Is there a better way to do this? Am I right that d2:hasValue cannot be used if the response type is an option set?

Thanks,

Natalie

Natalie,

I don’t think your proposed formula would work if the data are stored as text; however, if you convert your option sets to an INTEGER value type, it would. You could update the metadata configuration in place using a PATCH request to the /api/optionSets/id endpoint to update the value type without having to change them in the UI. You’d also need to update the associated data element or tracked entity attribute value type using the same method. Then you could remove the quotes around your number codes.

I haven’t tried with d2:hasValue, but I imagine this would work as well.

Aaron

···

On Tue, Apr 10, 2018 at 12:15 PM, Natalie Tibbels ntibbel1@jhu.edu wrote:

Hi all,

For program indicators, do option set codes count as number values in an expression/filter? I want to create a program indicator that captures whether ANY response was given to a particular data element in a tracker program stage (with response type text using an option set with 11 options, codes: 01, 02, 03…11). I want to sum all of the cases where the user selected ANY option for that data element.

Does this make sense?

Program expression: Enrollment count. [or TEI count?]

Program filter: {#uidofdataelement}

=‘01’ and #{CDbxAsttXzY.mFhpwpIv7ci}<=‘11’

Is there a better way to do this? Am I right that d2:hasValue cannot be used if the response type is an option set?

Thanks,

Natalie


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

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

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

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

Aaron C. White

919.522.5585

1 Like

Dear all, i have got the same issue, but for me still unclear on how to use api to turn the option sets to integers, anyone can help?
Joao

1 Like

Tagging @Natalie_Tibbels for advise on this…

1 Like

I’m flattered to be tagged to give advice on anything! But I didn’t end up using the API, I just treat the codes as text in DHIS2 (and then if I download into excel/stata, destring). The filter is just 10 “ors”.
~Natalie

1 Like