Plotting tasks events

Hi,

I have this event task that will show on the user side which is;
will show on 10 days and will due until 20 days.

So, on the events;

events:[{
id: [id of the event],
start: 10,
end: 30,
days: 20
}]

Is this correct?

Thanks for the help.

Hi @Marcelo_De_Guzman.

Every task event has a due date. In tasks.js, it can either be defined as a:

  1. dueDate: a fixed date, or
  2. reported date + days: relative days counted from the task source’s reported date

Either way, we get a due date for a task event.

We can start showing the task a certain number of days before the due date (start) and also for a certain number of days after the due date (end). The time period for which the task will be visible to the user is called task window.

The document (contact or report) triggering the task is called the task source.

I am taking this example from the CHT Docs:

events: [
      {
        id: 'postnatal-followup-1',
        days:7,
        start:2,
        end:2,
      }
    ]

Here, the due date is the task source’s reported date + 7 days.
The task will show from the due date - 2 days (start).
The task will show until the due date + 2 days (end).

That means, the task can be visible to the user for a maximum of 2 + 1 + 2 = 5 days.

We can plot/visualize the task window using a spreadsheet:

Coming back to your requirements:

This can be visualized using the spreadsheet above as:

Assuming the task source is a report, the task will start showing on 10 days from the report date, which matches your requirement.

If not completed earlier, the task will continue to show for 40 days from the due date, or 50 days from the report date. It does not match your requirements. So, please adjust the values accordingly.

Note:

  • days: relative to the task source’s reported date
  • start and end: relative to the due date
1 Like

@binod ,

Thanks for the computation. I am now understand the logic behind the task event days.

I have another question,

  • what about the reschedule / reschedule date, how to calculate that? It was the dueDate, right?

Thanks.

I am not aware of any out-of-the-box rescheduling feature in CHT.

However, it’s possible to build a rescheduling mechanism using the app forms and tasks.

For example:

  • Submit form1, which triggers task1
  • Submit form2 that resolves/cancels task1 and creates task2 at a later date.

Here, we can either:

  • ask the user for the “reschedule date” in form2: we can use it as dueDate in task2
    or,
  • calculate it based on the reported date of form2: if the calculation is done inside form2, we can keep using dueDate in task2. If not, we can use days instead.

Does that answer your question?

Yup,

Thanks for helping me understand this tasks (events). On how to manage, and calculate what is the correct days to be inputted. I thought before just start, days and end will surely running correct, but it was not.
All of my setup was messed-up.

2 Likes

You are welcome. I am happy to help. :slight_smile:

1 Like