简体   繁体   中英

DHIS2 API get dataset instead of individual data elements

I'm already able to fetch json back from the API related to DATA ELEMENTS. I'd like to get DATA SET results instead (containing all DATA ELEMENTS that are part of this particular DATA SET) Thanks!

To fetch dataSets you can use /api/dataSets.json or /api/dataSets.json?fields=dataSetElements[dataSet] .

You can find more information on the Web API documentation.

To fetch data elements that are assigned to a particular dataSet you query for the dataSetElements:

In the example of the dataSet ART monthly summary ( lyLU2wR22tC ):

/api/dataSets/lyLU2wR22tC?fields=id,name,dataSetElements[dataElement[id,name]]

or as a specific play.dhis2.org link:

https://play.dhis2.org/2.35.1/api/dataSets/lyLU2wR22tC?fields=id,name,dataSetElements[dataElement[id,name]]

would return:

<dataSet xmlns="http://dhis2.org/schema/dxf/2.0" name="ART monthly summary" id="lyLU2wR22tC">
<dataSetElements>
<dataSetElement>
<dataElement name="ART entry point: No PMTCT" id="kVOiLDV4OC6"/>
</dataSetElement>
<dataSetElement>
<dataElement name="New on ABC 300mg + ddI 200mg + LPV/r 133.3/33.3mg" id="la1f7sqY9sb"/>
</dataSetElement>
<dataSetElement>
<dataElement name="Shift to d4T 30mg + 3TC 150mg + EFV 600mg" id="qUY0i7PnaLS"/>
</dataSetElement>
<dataSetElement>
<dataElement name="Prev. month on NVP + AZT + 3TC 10mg/ml (2mg/kg) + 10mg/ml + 10mg/ml for 7 days" id="CUVDjGzRmmU"/>
</dataSetElement>
...
</dataSet>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM