← Back to team overview

dhis2-devs team mailing list archive

Re: Aggregating events based on last value of the data element

 

Hi Markus,

Thanks for the response.  Based on the scenario described above, we want to
draw a trend chart which is similar to the one in attached png.

So basically, given a date, api should consider the latest event(upto given
date) of each entity when aggregating.

Thanks

On 10 Apr 2017 7:41 p.m., "Pamod Amarakoon" <pamodm@xxxxxxxxx> wrote:

> Forgot to add we also need to consider the fact that B gets positive for
> the disease again in May 2017 where we enroll him again and the total
> becomes *6* again.
>
> Thanx.
>
> On Mon, Apr 10, 2017 at 6:06 PM, Pamod Amarakoon <pamodm@xxxxxxxxx> wrote:
>
>> Dear Markus,
>>
>> If I elaborate more, suppose there are 6 children A,B,C,D,E and F.
>> A, B, and C are enrolled to the program in July 2016 being positive for
>> the disease X (yes/no DE)
>> D,E gets enrolled to programme in August 2016 also being positive for X
>> F gets enrolled in September 2016 being positive for X.
>>
>> All the 6 children are being monthly followed up to assess the existence
>> of the Disease X.
>>
>> B gets cured of disease X in January 2017and enrollment gets completed.
>> D is lost to follow up from October 2016.
>> A, C, E and F are being followed up till  now and all positive for
>> Disease X.
>> Although children D has not turned up at clinic we still consider him as
>> positive for Disease X.
>>
>> So what I'm interested is to develop a table or trend chart (line chart)
>> for prevalence (old+new) of Disease X in the given community. Should be
>> something like below
>>
>> July 2016 - *3*
>> August 2016 - *5*
>> September 2016 - *6*
>> October 2016 - *6*
>> November 2016 - *6*
>> December 2016 - *6*
>> January 2017 - *5*
>> February 2017 - *5*
>> March 2017 - *5*
>> April 2017 - *5*
>>
>> Is it possible to get this output using a program indicator.
>>
>> Thank you.
>>
>> On Mon, Apr 10, 2017 at 5:53 PM, Markus Bekken <markus@xxxxxxxxx> wrote:
>>
>>> Dear Pamod,
>>> to put it simply - if you use October 2016 as reporting date and display
>>> this enrollment program indicator, the pivot will be populated only with
>>> the data for the children enrolled in October 2016. The child enrolled in
>>> October will not show up un the numbers for November. If you want to make a
>>> report of all currently positive children, you would have to define a long
>>> enough reporting period to capture all enrollment dates, and filter out
>>> anyone not positive.
>>>
>>> As a reminder there is a planned improvement to allow other dates to be
>>> the basis of aggregation: DHIS2-1398
>>> <https://jira.dhis2.org/browse/DHIS2-1398>
>>>
>>> Curious to hear how this covers your use case.
>>>
>>> Markus
>>>
>>> 10. apr. 2017 kl. 13.37 skrev Pamod Amarakoon <pamodm@xxxxxxxxx>:
>>>
>>> Dear Marcus,
>>>
>>> Want to clarify something.
>>>
>>> Suppose for example Child A has been marked positive for a disease in
>>> October 2016 and he has not turned up for further clinic followups. If we
>>> configure the program indicator the way you mentioned and select period
>>> dimension as last 12 months from pivot table and consider the output, we
>>> are interested in obtaining the cross sectional view of number of affected
>>> children at a given time.
>>>
>>> Will the child A only be calculated for the month of October 2016 or
>>> will he be counted on subsequent months as well. (In the output we are
>>> expecting to see the prevalence of the disease per month).
>>>
>>> Thank you
>>>
>>> On Mon, Apr 10, 2017 at 2:47 PM, Markus Bekken <markus@xxxxxxxxx> wrote:
>>>
>>>> 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
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards,
>>> Dr. Pamod Amarakoon
>>> MBBS (SL)
>>> MSc (Biomedical Informatics), EMSc (Health Admin)
>>> Medical Officer in Health Informatics
>>> Nutrition Coordination Division
>>> Ministry of Health, Nutrition and Indigenous Medicine,
>>> Sri Lanka
>>>
>>> Confidentiality Notice: the information contained in this email and any
>>> attachments may be legally privileged and confidential. If you are not an
>>> intended recipient, you are hereby notified that any dissemination,
>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>> received this e-mail in error, please notify the sender and permanently
>>> delete the e-mail and any attachments immediately. You should not retain,
>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>> all or any part of the contents to any other person.
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Regards,
>> Dr. Pamod Amarakoon
>> MBBS (SL)
>> MSc (Biomedical Informatics), EMSc (Health Admin)
>> Medical Officer in Health Informatics
>> Nutrition Coordination Division
>> Ministry of Health, Nutrition and Indigenous Medicine,
>> Sri Lanka
>>
>> Confidentiality Notice: the information contained in this email and any
>> attachments may be legally privileged and confidential. If you are not an
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this e-mail is strictly prohibited. If you have
>> received this e-mail in error, please notify the sender and permanently
>> delete the e-mail and any attachments immediately. You should not retain,
>> copy or use this e-mail or any attachments for any purpose, nor disclose
>> all or any part of the contents to any other person.
>>
>>
>>
>>
>
>
> --
> Regards,
> Dr. Pamod Amarakoon
> MBBS (SL)
> MSc (Biomedical Informatics), EMSc (Health Admin)
> Medical Officer in Health Informatics
> Nutrition Coordination Division
> Ministry of Health, Nutrition and Indigenous Medicine,
> Sri Lanka
>
> Confidentiality Notice: the information contained in this email and any
> attachments may be legally privileged and confidential. If you are not an
> intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this e-mail is strictly prohibited. If you have
> received this e-mail in error, please notify the sender and permanently
> delete the e-mail and any attachments immediately. You should not retain,
> copy or use this e-mail or any attachments for any purpose, nor disclose
> all or any part of the contents to any other person.
>
>
>
>

Attachment: blank.png
Description: PNG image


Follow ups

References