Analytics API

Hello all,

I’ve an option set with two values (Done and Update)

I’m trying to use NE (Not Equal To) operator with analystic API to return all events that do not have a value ‘Done’. I want to get events which have no value or that the value is ‘update’ but I get nothing in result.

Here is the query

api/29/analytics/events/query/c9m3ufPy8D6.json?dimension=pe:THIS_MONTH,ou:Ky2CzFdfBuO,etZ2map5UjF.ENZzol6OWdD:NE:Done&stage=etZ2map5UjF&displayProperty=SHORTNAME&outputType=EVENT&desc=eventdate&pageSize=100&page=1

result

Regards

1 Like

Hey @didate
It’s always great to hear from you. I’d start by using something like: https://play.dhis2.org/2.36.3/api/events/query?program=VBqh0ynB2wv&programStage=pTo4uMt3xur

I can see here all the info needed for all events recorded in the stage, but I don’t know how to filter all these results in the API get request (maybe you can share with me the parameters you’d use here) but if you add .csv after the word query you’ll be able to filter it in a sheet.
https://play.dhis2.org/2.36.3/api/events/query.csv?program=VBqh0ynB2wv&programStage=pTo4uMt3xur

I hope this helps a bit. ( :

You can see the result is in a “grid query” so if you want more info on this, please search for Event grid query here: WebAPI events | DHIS2 Docs

Hello @Gassim, Thank you so much :grinning:

I probably didn’t explain my problem very well (my English is poor :grin:).

In fact I’m doing an automatic script that takes the data from dhis 2 (with over 1,000,000 enrollments) to another database. The script runs every day at midnight.
Each time I process an enrollment I put its status in dhis 2 at DONE, which will prevent the script from looping back to all enrollments.

So if there is an update on an enrollment in dhis 2, for it to be processed by the script, its status must be set to UPDATE in dhis 2.

So that’s kind of the scenario.

1 Like

Hey,
You’re welcome! Your English is pretty good :smiling_face: It’s very interesting that you are creating scripts, maybe discuss the script with other developers in the Development - Développement category?