The goal of dhis2_pi_generator
is to help DHIS2 system
admins to develop new program indicators in bulk.
The Shiny app will allow you to pass in DHIS2 credentials and download
all data elements, attributes, and option sets associated with Tracker
programs in your instance. You can then build basic event
or
enrollment
program indicators with filters for definable values of any
data element or attribute.
After you select the basis for program indicators filters, click “download PI metadata” for a json file of metadata. These you can import into DHIS2 through the import/export app. The Shiny app logic is designed so different PI names and codes are unique for your export, and within the character limit. Both event and enrollment type indicators are available, with congruous defaults for period boundaries, expression, and filter expressions.
Demo here: https://iambodo.shinyapps.io/pi_generator/
For example, an infant health program has a data element for
Feeding Type
which is associated with an option set, and those options
(values) could be “Exclusive” or “Mixed” or “Replacement”.
Data Element | Value |
---|---|
Feeding Type | Exclusive |
Feeding Type | Mixed |
Feeding Type | Replacement |
But a tracked entity attribute for Infant Weight
would have numeric
values. You want to break these up into ranges, from 0-2kg, 2-4kg, and
4kg+
Data Element | Value |
---|---|
Feeding Type | Exclusive |
Feeding Type | Mixed |
Feeding Type | Replacement |
Infant Weight (g) | 0-2000 |
Infant Weight (g) | 2000-4000 |
Infant Weight (g) | 4000+ |
You can select any or all of these values and ranges, building Program Indicator filters in the Shiny app (go to “Filter options” to select the numeric ranges).
This will save you building separate 6 program indicators in the DHIS2 UI, which can be difficult to do with consistent syntax.
pi_filter | pi_name | pi_code |
---|---|---|
#{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} <2000 | Mch infant weight (g): 0_2000 | MCH INFANT WEIGHT (G): 0_2000 |
#{ZzYYXq4fJie.GQY2lXrypjO} >=2000 && #{ZzYYXq4fJie.GQY2lXrypjO} <4000 | Mch infant weight (g): 2000_4000 | MCH INFANT WEIGHT (G): 2000_4000 |
#{ZzYYXq4fJie.GQY2lXrypjO} >=4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 | Mch infant weight (g): 4000_6000 | MCH INFANT WEIGHT (G): 4000_6000 |
#{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ | Mch infant feeding: exclusive | MCH INFANT FEEDING: EXCLUSIVE |
#{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ | Mch infant feeding: mixed | MCH INFANT FEEDING: MIXED |
#{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ | Mch infant feeding: replacement | MCH INFANT FEEDING: REPLACEMENT |
Now say you want program indicator filters for each possible combination of Feeding Type and Weight range.
Alternatively, filter for events with two possible values for the same data element, e.g. “Exclusive” OR “Mixed”.
There are 15 possibilities for such combinations.
V1 | V2 |
---|---|
Exclusive | Mixed |
Exclusive | Replacement |
Exclusive | 0-2000 |
Exclusive | 2000-4000 |
Exclusive | 4000+ |
Mixed | Replacement |
Mixed | 0-2000 |
Mixed | 2000-4000 |
Mixed | 4000+ |
Replacement | 0-2000 |
Replacement | 2000-4000 |
Replacement | 4000+ |
0-2000 | 2000-4000 |
0-2000 | 4000+ |
2000-4000 | 4000+ |
Use the option for Combination Filters and you can build all possible
combinations of the data values. Change the “Combo Filter Junction” to
||
to join each filter condition with OR
instead of the default
AND
.
You can add more up to five filter values for the “choice without replacement” operation.
pi_name | pi_code | pi_filter |
---|---|---|
MCH Infant Weight (g): 0_2000 + MCH Infant Weight (g): 2000_4000 | MCH INFANT WEIGHT (G): 0_2000 + MCH …_COMBO_1 | #{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} =2000 && #{ZzYYXq4fJie.GQY2lXrypjO} <4000 |
MCH Infant Weight (g): 0_2000 + MCH Infant Weight (g): 4000_6000 | MCH INFANT WEIGHT (G): 0_2000 + MCH …_COMBO_2 | #{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} =4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 |
MCH Infant Weight (g): 0_2000 + MCH Infant Feeding: Exclusive | MCH INFANT WEIGHT (G): 0_2000 + MCH …_COMBO_3 | #{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} <2000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ |
MCH Infant Weight (g): 0_2000 + MCH Infant Feeding: Mixed | MCH INFANT WEIGHT (G): 0_2000 + MCH …_COMBO_4 | #{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} <2000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ |
MCH Infant Weight (g): 0_2000 + MCH Infant Feeding: Replacement | MCH INFANT WEIGHT (G): 0_2000 + MCH …_COMBO_5 | #{ZzYYXq4fJie.GQY2lXrypjO} >=0 && #{ZzYYXq4fJie.GQY2lXrypjO} <2000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ |
MCH Infant Weight (g): 2000_4000 + MCH Infant Weight (g): 4000_6000 | MCH INFANT WEIGHT (G): 2000_4000 + M…_COMBO_6 | #{ZzYYXq4fJie.GQY2lXrypjO} >=2000 && #{ZzYYXq4fJie.GQY2lXrypjO} =4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 |
MCH Infant Weight (g): 2000_4000 + MCH Infant Feeding: Exclusive | MCH INFANT WEIGHT (G): 2000_4000 + M…_COMBO_7 | #{ZzYYXq4fJie.GQY2lXrypjO} >=2000 && #{ZzYYXq4fJie.GQY2lXrypjO} <4000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ |
MCH Infant Weight (g): 2000_4000 + MCH Infant Feeding: Mixed | MCH INFANT WEIGHT (G): 2000_4000 + M…_COMBO_8 | #{ZzYYXq4fJie.GQY2lXrypjO} >=2000 && #{ZzYYXq4fJie.GQY2lXrypjO} <4000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ |
MCH Infant Weight (g): 2000_4000 + MCH Infant Feeding: Replacement | MCH INFANT WEIGHT (G): 2000_4000 + M…_COMBO_9 | #{ZzYYXq4fJie.GQY2lXrypjO} >=2000 && #{ZzYYXq4fJie.GQY2lXrypjO} <4000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ |
MCH Infant Weight (g): 4000_6000 + MCH Infant Feeding: Exclusive | MCH INFANT WEIGHT (G): 4000_6000 + M…_COMBO_10 | #{ZzYYXq4fJie.GQY2lXrypjO} >=4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ |
MCH Infant Weight (g): 4000_6000 + MCH Infant Feeding: Mixed | MCH INFANT WEIGHT (G): 4000_6000 + M…_COMBO_11 | #{ZzYYXq4fJie.GQY2lXrypjO} >=4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ |
MCH Infant Weight (g): 4000_6000 + MCH Infant Feeding: Replacement | MCH INFANT WEIGHT (G): 4000_6000 + M…_COMBO_12 | #{ZzYYXq4fJie.GQY2lXrypjO} >=4000 && #{ZzYYXq4fJie.GQY2lXrypjO} <6000 && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ |
MCH Infant Feeding: Exclusive + MCH Infant Feeding: Mixed | MCH INFANT FEEDING: EXCLUSIVE + MCH I…_COMBO_13 | #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ |
MCH Infant Feeding: Exclusive + MCH Infant Feeding: Replacement | MCH INFANT FEEDING: EXCLUSIVE + MCH I…_COMBO_14 | #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Exclusive’ && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ |
MCH Infant Feeding: Mixed + MCH Infant Feeding: Replacement | MCH INFANT FEEDING: MIXED + MCH INFAN…_COMBO_15 | #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Mixed’ && #{ZzYYXq4fJie.X8zyunlgUfM} == ‘Replacement’ |