Using the dataElements API, how can you filter to 1 particular Event Program?

Hello,

I need to find the list of dataElements associated with 1 Event Program (of which I know the ID).

I’m used to query dataElements associated to one particular dataSet by using this filter:

filter = 'dataSetElements.dataSet.id:eq:__xxx__'

However this doesn’t work for programs.
How can we do this with Event Programs?

Here is one example of a dataElement that is associate with an event program (from DHIS 2 Demo - Sierra Leone)

{'pager': {'page': 1, 'pageCount': 1, 'total': 1, 'pageSize': 100},
 'dataElements': [{'code': 'DE_3000003',
   'lastUpdated': '2017-06-02T11:41:14.500',
   'id': 'qrur9Dvnyt5',
   'created': '2012-11-14T14:41:39.639',
   'name': 'Age in years',
   'shortName': 'Age in years',
   'aggregationType': 'AVERAGE',
   'domainType': 'TRACKER',
   'displayName': 'Age in years',
   'publicAccess': 'rw------',
   'description': 'Age of person in years.',
   'displayShortName': 'Age in years',
   'externalAccess': False,
   'periodOffset': 0,
   'valueType': 'INTEGER',
   'formName': 'Age (years)',
   'displayDescription': 'Age of person in years.',
   'dimensionItem': 'qrur9Dvnyt5',
   'displayFormName': 'Age (years)',
   'zeroIsSignificant': False,
   'favorite': False,
   'optionSetValue': False,
   'dimensionItemType': 'DATA_ELEMENT',
   'access': {'read': True,
    'update': True,
    'externalize': False,
    'delete': True,
    'write': True,
    'manage': True},
   'categoryCombo': {'id': 'bjDvmb4bfuf'},
   'lastUpdatedBy': {'displayName': 'Tom Wakiki',
    'name': 'Tom Wakiki',
    'id': 'GOLswS44mh8',
    'username': 'system'},
   'sharing': {'owner': 'GOLswS44mh8',
    'external': False,
    'public': 'rw------'},
   'createdBy': {'displayName': 'Tom Wakiki',
    'name': 'Tom Wakiki',
    'id': 'GOLswS44mh8',
    'username': 'system'},
   'legendSet': {'id': 'Yf6UHoPkdS6'},
   'user': {'displayName': 'Tom Wakiki',
    'name': 'Tom Wakiki',
    'id': 'GOLswS44mh8',
    'username': 'system'},
   'dataSetElements': [],
   'legendSets': [{'id': 'Yf6UHoPkdS6'}, {'id': 'TiOkbpGEud4'}],
   'aggregationLevels': []}]}

The dataSetElements is empty.
Also there is no equivalent such as ‘programElements’.

Thanks,

1 Like

Hi @Mat

Thank you for the question and sharing the details! Would a request similar to this one work?
INSTANCE-URL-HERE/api/programs/PROGRAM-ID-HERE?fields=programStages[programStageDataElements[dataElement[*]]]

You’d need to work a bit more on which fields you want to retrieve but in the request above all the data elements in the program are being listed for one particular program.

2 Likes