dueDate in Tracker Capture

Hello Devs!

I am working on an app using the d2 APIs related to tracker capture. I have successfully registered and enrolled the new trackedEntityInstances to the selected orgUnit and Program.

Now what I want to do is add events, for which I have to POST a payload containing dueDate for the event. My doubt is, how do I calculate due date ? The program stage model gives me info like ‘minDaysFromStart’, ‘lastUpdated’ but I do not see ‘dueDate’ anywhere. Is it a separately calculated value ?

Should, dueDate = createdOn + minDaysFromStart ?

Regards,

Shivee

Hi there Shivee,
As you might now, the dueDate basically represents which date the event was supposed to take place at. For events that has actually taken place, you would also fill in the eventDate of the event that is posted, and the dueDate would not be that important anymore.

When creating events, Tracker Capture suggests due dates automatically based on config parameters like you mention. If you want to implement the whole or parts of the same logic that applies in tracker capture, you can have a look at the functions getEventDueDate and getEventDueDatePeriod in the EventUtils service in tracker capture(scripts/services.js).

Each app is however free to post due dates that makes sense in their own functional scenario. In some cases it might be enough to always use the same dueDate as eventDate - if you do not specifically need to handle the dates separately.

Best regards,

Markus

···
  1. mai 2016 kl. 13.25 skrev Shivee Gupta shiveegpt77@gmail.com:

Hello Devs!

I am working on an app using the d2 APIs related to tracker capture. I have successfully registered and enrolled the new trackedEntityInstances to the selected orgUnit and Program.

Now what I want to do is add events, for which I have to POST a payload containing dueDate for the event. My doubt is, how do I calculate due date ? The program stage model gives me info like ‘minDaysFromStart’, ‘lastUpdated’ but I do not see ‘dueDate’ anywhere. Is it a separately calculated value ?

Should, dueDate = createdOn + minDaysFromStart ?

Regards,

Shivee


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

Thanks a lot Markus! This was very helpful :slight_smile:

···

From: Markus Bekken
Sent: ‎5/‎18/‎2016 3:34 AM
To: Shivee Gupta
Cc: dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] dueDate in Tracker Capture

Hi there Shivee,
As you might now, the dueDate basically represents which date the event was supposed to take place at. For events that has actually taken place, you would also fill in the eventDate of the event that is posted, and the dueDate would not be that important anymore.

When creating events, Tracker Capture suggests due dates automatically based on config parameters like you mention. If you want to implement the whole or parts of the same logic that applies in tracker capture, you can have a look at the functions getEventDueDate and getEventDueDatePeriod in the EventUtils service in tracker capture(scripts/services.js).

Each app is however free to post due dates that makes sense in their own functional scenario. In some cases it might be enough to always use the same dueDate as eventDate - if you do not specifically need to handle the dates separately.

Best regards,

Markus

  1. mai 2016 kl. 13.25 skrev Shivee Gupta shiveegpt77@gmail.com:

Hello Devs!

I am working on an app using the d2 APIs related to tracker capture. I have successfully registered and enrolled the new trackedEntityInstances to the selected orgUnit and Program.

Now what I want to do is add events, for which I have to POST a payload containing dueDate for the event. My doubt is, how do I calculate due date ? The program stage model gives me info like ‘minDaysFromStart’, ‘lastUpdated’ but I do not see ‘dueDate’ anywhere. Is it a separately calculated value ?

Should, dueDate = createdOn + minDaysFromStart ?

Regards,

Shivee


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