Program Indicator calculations, Converting Dates in Months or Years

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

···

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Hi Andrew,

See this related emails from Markus

The d2:yearsBetween() is not yet supported in the server side aggregation of program indicators. For now you would have to use d2:daysBetween() / 365 - which is not 100% correct as the leap years is not considered. You wrote d2daysBetween in your mail below(without the colon between d2 and daysBetween), but i assume that was a typo in the mail.

If you used the expression d2:daysBetween(A{yourDateOfBirthAttributeUID},V{event_date}) / 365 that should work fine on both the server and client side. Let me know if this was the expression you tried. Note that the attribute UID should be prefixed with A.

In the dev instance the example indicators on the MNCH / PHC program use the V{event_date} as basis for the age calculation. This causes the indicators to be calculated to NaN until you enter an event date. If you do not explicitly want the age at the event, you can use V{enrollment_date} instead.

Markus

P.S. The attributes of type date is not shown in the expression part of the Program Indicator UI, only in the filter further down. This is all getting reworked and sorted out soon, but as a workaround for avoiding typos you can add the attribute in the filter part of the UI then cut’n’paste.

···

On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

Prosper Behumbiize, MPH
DHIS2 Implementation| HISP Uganda/University Of Oslo
+256 752 751 776 | +256 776 139 139

prosper@hispuganda.org | prosper@dhis2.org | Skype: prospertb

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Dear Andrew,

You can use (current_date - Date of Birth)/30 to estimate months or (current_date - Date of Birth)/365 to get estimate years.

Alex

···

On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "

Dear Andrew,

You can use (V{current_date} - A{Date of Birth UID})/30 to estimate months or (V{current_date} - A{Date of Birth UID})/365 to get estimate years.

Alex

···

On Fri, Nov 4, 2016 at 3:06 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Andrew,

You can use (current_date - Date of Birth)/30 to estimate months or (current_date - Date of Birth)/365 to get estimate years.

Alex

On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "

Thanks Lars,

I came to find an expression in indicators that does this in tracker:

like 40 - d2:weeksBetween(mother visit LMP, Current date)

The above gives the count down of the weeks remaining for the mother to deliver since the delivery has approximately 40 weeks.

Another expression was to display the age of the child for each visit to guide the nutritionist:

d2:monthsBetween(Child Birth date, current date)

The above gives the current months based on the date of visit.

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

···

On Friday, November 4, 2016 1:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Thanks Prosper and team,

This is helpful too.

Hi Andrew,

See this related emails from Markus

The d2:yearsBetween() is not yet supported in the server side aggregation of program indicators. For now you would have to use d2:daysBetween() / 365 - which is not 100% correct as the leap years is not considered. You wrote d2daysBetween in your mail below(without the colon between d2 and daysBetween), but i assume that was a typo in the mail.

If you used the expression d2:daysBetween(A{ yourDateOfBirthAttributeUID}, V{event_date}) / 365 that should work fine on both the server and client side. Let me know if this was the expression you tried. Note that the attribute UID should be prefixed with A.

In the dev instance the example indicators on the MNCH / PHC program use the V{event_date} as basis for the age calculation. This causes the indicators to be calculated to NaN until you enter an event date. If you do not explicitly want the age at the event, you can use V{enrollment_date} instead.

Markus

P.S. The attributes of type date is not shown in the expression part of the Program Indicator UI, only in the filter further down. This is all getting reworked and sorted out soon, but as a workaround for avoiding typos you can add the attribute in the filter part of the UI then cut’n’paste.

Prosper Behumbiize, MPH
DHIS2 Implementation| HISP Uganda/University Of Oslo
+256 752 751 776 | +256 776 139 139

prosper@hispuganda.org | prosper@dhis2.org | Skype: prospertb

···

On Friday, November 4, 2016 1:59 PM, Prosper BT ptb3000@gmail.com wrote:

On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Hi Andrew, thanks that looks good.

···

On Fri, Nov 4, 2016 at 2:59 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Thanks Lars,

I came to find an expression in indicators that does this in tracker:

like 40 - d2:weeksBetween(mother visit LMP, Current date)

The above gives the count down of the weeks remaining for the mother to deliver since the delivery has approximately 40 weeks.

Another expression was to display the age of the child for each visit to guide the nutritionist:

d2:monthsBetween(Child Birth date, current date)

The above gives the current months based on the date of visit.

On Friday, November 4, 2016 1:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Thanks Alex,

This is helpful.

Dear Andrew,

You can use (V{current_date} - A{Date of Birth UID})/30 to estimate months or (V{current_date} - A{Date of Birth UID})/365 to get estimate years.

Alex

···

On Friday, November 4, 2016 2:10 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

On Fri, Nov 4, 2016 at 3:06 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Andrew,

You can use (current_date - Date of Birth)/30 to estimate months or (current_date - Date of Birth)/365 to get estimate years.

Alex

On Fri, Nov 4, 2016 at 2:52 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Andrew,

how are you doing? First of all, would you mind asking this on the dev list? There are more people who can help you there.

Also it would be good if you could elaborate a bit about what you need to do regarding date conversion. Is the problem that you are asking beneficiaries about their age in months, and that you later would like to do aggregation based on months/quarters in dhis analytics apps?

best regards,

Lars

On Fri, Oct 28, 2016 at 12:22 PM, Muhire Andrew muhireandrew@yahoo.com wrote:

Dear All,

We are developing the case based nutrition system [Using DHIS2] that is targeting to track Pregnant Women, Lactating and Children under 2years.What we are tracking is Attributes and tracker variables like Date of Birth, hight, weight, LMP Date and We would like to Display on our program dashboard the indicators like BMI, Height for Age, Weight for Age and also expected deliveries using the LMP dates which is our data element that is set to date type.

Is there anyone who knows how to convert the dates into Months or years without use of coding, i mean during the calculation of Program indicators? . We also need users to enter the date of Birth of a Baby or Mother and the system popup the Age in months or Years.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org


Mailing list: https://launchpad.net/~dhis2-u sers

Post to : dhis2-users@lists.launchpad.ne t

Unsubscribe : https://launchpad.net/~dhis2-u sers

More help : https://help.launchpad.net/Lis tHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET | HISP Uganda

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "