dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #13033
Re: [Dhis2-devs] Aggregating events based on last value of the data element
Hi there Chathura,
it seems that the query you want to make below can be achieved with enrollment program indicators. Assuming the program is built as a multiple event with registration, and the DE1 is part of a repeating program stage, the inherent properties of enrollment program indicators covers much of what you want. Each child will be counted only once, and only the latest value of D1 will be considered for each child.
Can you for example try making a program indicator with analytics type "Enrollment", aggregation type "Sum" and the expression being the value of DE1? Then you can use pivot or the API to query and see if the results match your expectation.
Markus
> 1. apr. 2017 kl. 10.58 skrev chathura widanage <chathurawidanage@xxxxxxxxx>:
>
> Hi,
>
> We are currently using DHIS2 to track nutrition problems of children under 5 years.
>
> Assume we have only two children in the database and DE1 be a certain condition that we monitor continuously,
>
> child 1 -> [event 1, DE1=1, time=t1] [event 2 - DE1=1,time=t2] [event 3 - DE1=0,time=t3]
> child 2 -> [event 1, DE1=0, time=t1] [event 2 - DE1=0,time=t2] [event 3 - DE1=0,time=t3]
>
> Now if I call "events/aggregate/<psi>?dimension=DE1:EQ:1&startDate=T1&endDate=T2&dimension=ou:<ouid>", is there a parameter that we can set in the query to consider only the last value of the data element in the chosen event series.
>
> eg :
>
> case
> T1
> T2
> Result
> Expected result
> 1
> t1
> t1+delta
> 1
> 1
> 2
> t1
> t2+delta
> 2
> 1
> 3
> t1
> t3+delta
> 2
> 0
> 4
> t2
> t3+delta
> 1
> 0
>
> case 1 : child 1 has the condition (because DE1=1), hence result =1
> case 2 : child 1 still has the condition, but we want to consider him only once.
> case 3 : child 1 has got rid of the condition, so we don't want to consider him for the results
>
> Why we need this : we want to analyze the state of org unit during a specific period of time and draw a trend chart to determine whether measures taken to improve child health has actually worked or not.
>
> <image.png>
> And also we need to compare the identified risk factors graphically, so we know which area should get the highest focus or attention.
>
> <image.png>
>
> Please let us know whether above results can be achieved using API version 2.26.
> Currently we are using SQL Views (2 SQL views + 1 Query) to generate above results, but that is extremely inefficient and expensive.
>
> Thanks
>
>
>
> --
> Best Regards,
>
> Chathura Widanage,
> Undergraduate,
> Department of Computer Science and Engineering,
> University of Moratuwa,
> Sri Lanka
> <https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile> <http://facebook.com/chathura.widanage> <https://plus.google.com/u/0/109418781686423002025> <https://github.com/chathurawidanage>_______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
Follow ups
References