Storing value type 'Age' in numeric form

adding dhis-users list

image

···

On Thu, Mar 23, 2017 at 1:57 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi

We are using DHIS version 2.26. We are exploring the new value type “Age” that has been introduced with this release. On the UI, when we enter a date, it calculates the age in years, months and days perfectly. But we observe that the calculated age in years is not stored in the DB. The value of an Age type data element is stored only as a date (YYYY-MM-DD) in the database. We would like to use the age in years in analytics on the visualisation apps. We have tried using program indicators for the same, but that did not work as expected.

Could you please suggest how we could leverage the use of age in years, given the existing functionality.

Cheers,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

Hi

I am facing the same issue. I could enter age of a patient in Tracker form ( in a attribute type of Age) , but not able to create any indicators based on it , for example ‘No. of events where Age is less than 1 year’.

Does it work yet?

Thank you in advance

Deepali

image

···

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

On Thu, Mar 23, 2017 at 1:57 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi

We are using DHIS version 2.26. We are exploring the new value type “Age” that has been introduced with this release. On the UI, when we enter a date, it calculates the age in years, months and days perfectly. But we observe that the calculated age in years is not stored in the DB. The value of an Age type data element is stored only as a date (YYYY-MM-DD) in the database. We would like to use the age in years in analytics on the visualisation apps. We have tried using program indicators for the same, but that did not work as expected.

Could you please suggest how we could leverage the use of age in years, given the existing functionality.

Cheers,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

Hi,

I am not using the new age type at all in any application where you want to do analytics or reporting on the age (in years, months, days etc) AS IT WAS AT THE TIME OF THE ENROLLMENT AND/OR STAGE VISIT.

The “Age” data type as it is now defined/designed is probably only relevant for use in applications where you have stored the date of birth and you simply want to know the patient’s age at any point in time - i.e. the primary usage is patient-centric and not analytics centric.

In the case of Disease Surveillance, for instance, we are capturing CASES and not PATIENTS per se (the same patient presenting with malaria in January and Measles in May will be two separate cases). So for any post-analysis of such data, you want to know e.g. the break-down of cases per age group AS THOSE AGES WERE ON THE DAY OF DIAGNOSIS/PRESENTATION.

So my recommendation is to instead define three additional attributes/data elements: Age (years), Age (months), and Age (days) - then you use three ASSIGN program rules to calculate and assign the relevant values. Those values are now permanent and locked as long as the DoB or enrollment/report date don’t change.

Best regards

Calle

image

···

On 21 May 2017 at 11:23, Dipali Sahu dipali.sahu@gmail.com wrote:

Hi

I am facing the same issue. I could enter age of a patient in Tracker form ( in a attribute type of Age) , but not able to create any indicators based on it , for example ‘No. of events where Age is less than 1 year’.

Does it work yet?

Thank you in advance

Deepali

---------- Forwarded message ----------
From: Archana Chillala archanac@thoughtworks.com
Date: Thu, Mar 23, 2017 at 2:03 PM
Subject: Re: [Dhis2-users] Storing value type ‘Age’ in numeric form
To: dhis2-devs dhis2-devs@lists.launchpad.net
Cc: dhis2-users dhis2-users@lists.launchpad.net, Jane GREIG jane.greig@london.msf.org, Theo Krommydakis theo.krommydakis@london.msf.org, twoca twoca@thoughtworks.com, carolyn.tauro@london.msf.org

adding dhis-users list


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


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

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

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

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

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

On Thu, Mar 23, 2017 at 1:57 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi

We are using DHIS version 2.26. We are exploring the new value type “Age” that has been introduced with this release. On the UI, when we enter a date, it calculates the age in years, months and days perfectly. But we observe that the calculated age in years is not stored in the DB. The value of an Age type data element is stored only as a date (YYYY-MM-DD) in the database. We would like to use the age in years in analytics on the visualisation apps. We have tried using program indicators for the same, but that did not work as expected.

Could you please suggest how we could leverage the use of age in years, given the existing functionality.

Cheers,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Thanks Calle.

image

···

On Sun, May 21, 2017 at 9:35 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi,

I am not using the new age type at all in any application where you want to do analytics or reporting on the age (in years, months, days etc) AS IT WAS AT THE TIME OF THE ENROLLMENT AND/OR STAGE VISIT.

The “Age” data type as it is now defined/designed is probably only relevant for use in applications where you have stored the date of birth and you simply want to know the patient’s age at any point in time - i.e. the primary usage is patient-centric and not analytics centric.

In the case of Disease Surveillance, for instance, we are capturing CASES and not PATIENTS per se (the same patient presenting with malaria in January and Measles in May will be two separate cases). So for any post-analysis of such data, you want to know e.g. the break-down of cases per age group AS THOSE AGES WERE ON THE DAY OF DIAGNOSIS/PRESENTATION.

So my recommendation is to instead define three additional attributes/data elements: Age (years), Age (months), and Age (days) - then you use three ASSIGN program rules to calculate and assign the relevant values. Those values are now permanent and locked as long as the DoB or enrollment/report date don’t change.

Best regards

Calle

On 21 May 2017 at 11:23, Dipali Sahu dipali.sahu@gmail.com wrote:

Hi

I am facing the same issue. I could enter age of a patient in Tracker form ( in a attribute type of Age) , but not able to create any indicators based on it , for example ‘No. of events where Age is less than 1 year’.

Does it work yet?

Thank you in advance

Deepali

---------- Forwarded message ----------
From: Archana Chillala archanac@thoughtworks.com
Date: Thu, Mar 23, 2017 at 2:03 PM
Subject: Re: [Dhis2-users] Storing value type ‘Age’ in numeric form
To: dhis2-devs dhis2-devs@lists.launchpad.net
Cc: dhis2-users dhis2-users@lists.launchpad.net, Jane GREIG jane.greig@london.msf.org, Theo Krommydakis theo.krommydakis@london.msf.org, twoca twoca@thoughtworks.com, carolyn.tauro@london.msf.org

adding dhis-users list


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


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

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

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

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


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

On Thu, Mar 23, 2017 at 1:57 PM, Archana Chillala archanac@thoughtworks.com wrote:

Hi

We are using DHIS version 2.26. We are exploring the new value type “Age” that has been introduced with this release. On the UI, when we enter a date, it calculates the age in years, months and days perfectly. But we observe that the calculated age in years is not stored in the DB. The value of an Age type data element is stored only as a date (YYYY-MM-DD) in the database. We would like to use the age in years in analytics on the visualisation apps. We have tried using program indicators for the same, but that did not work as expected.

Could you please suggest how we could leverage the use of age in years, given the existing functionality.

Cheers,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533

Hi Calle! Was just searching the site related to this question. Wanted to confirm that if one wanted to have age in years as a TEI attribute, we should have an assign value program rule for age using yearsBetween(DOB, current date). That way, the age is calculated, stored and locked (I’m assuming V{current_date} evaluates to the report/enrollment date?). Then any program indicators based on age would be counting based on the age at the time of the enrollment. Thank you for this!

1 Like

Natalie,

If you want the set of program rules and program rule variables to do exactly that, let me know. I’m happy to share (it was actually Markus who wrote them!)

Best regards

Calle

1 Like

That would be great! I have ours already set up but haven’t been able to find in the documentation (probably there but I’m not looking in the right place) whether the assign value is then a “permanent” number linked to the enrollment/report date or whether it shifts over time with the yearsBetween/current_date function, so if you run the analytics a year later, the person would be counted as a year older.

1 Like

@Natalie_Tibbels

Firstly, program rules are not executed when you run analytics (you are mixing it up with program INDICATORS, which ARE executed during any analytics run). They are only executed when opening or editing cases in the Tracker Capture or Capture Apps.

Secondly, you must set the ASSIGN rules up so that they use the Date of Birth and e.g. the enrollment date, which both stay as they are, unless any of them is edited to fix a capturing error (DoB can of course be corrected in the dashboard - enrollment date mistakes are currently not editable in the UI, you have to update it directly in the database. Ref JIRA #5942).

We use the following rules:

Program rules:
1.
Name: Calculate age in days for children less than one month old
Expression: d2:hasValue(‘enrollment_date’) && d2:hasValue(‘dateOfBirth’) && d2:monthsBetween(A{dateOfBirth},V{enrollment_date}) < 1
Action items:
Assign value to Age (years), expression: d2:floor(1/2) (returns 0)
Assign value to Age (months), expression: d2:floor(1/2) (returns 0)
Assign value to Age (days), expression: d2:daysBetween(A{dateOfBirth},V{enrollment_date})

Name: Calculate age in months for children 1-11 months
Expression: d2:hasValue(‘enrollment_date’) && d2:hasValue(‘dateOfBirth’) && d2:monthsBetween(A{dateOfBirth},V{enrollment_date}) >= 1 && d2:yearsBetween(A{dateOfBirth},V{enrollment_date}) < 1
Action items:
Assign value to Age (years), expression: d2:floor(1/2) (returns 0)
Assign value to Age (months), expression: d2:monthsBetween(A{dateOfBirth},V{enrollment_date})
Assign value to Age (days), expression: d2:floor(1/2) (returns 0)

Name: Calculate age in years and months for patients 1 year and older
Expression: d2:hasValue(‘enrollment_date’) && d2:hasValue(‘dateOfBirth’) && d2:yearsBetween(A{dateOfBirth},V{enrollment_date}) >= 1
Action items:
Assign value to Age (years), expression: d2:yearsBetween(A{dateOfBirth},V{enrollment_date})
Assign value to Age (months), expression: d2:monthsBetween(A{dateOfBirth},V{enrollment_date}) - (d2:yearsBetween(A{dateOfBirth},V{enrollment_date}) * 12)
Assign value to Age (days), expression: d2:floor(1/2) (returns 0)

Best regards
Calle

1 Like

Thanks so much to both of you!

1 Like