Configuring Tasks

Configuring CHT tasks

Tasks guide health workers through their days and weeks.

This tutorial will take you through how to configure tasks for CHT applications, including:

  • Authoring tasks
  • Compiling tasks into app settings and uploading

You will be configuring a task that allows Community Health Workers to conduct a health assessment follow up for children under the age of 5 that have a cough lasting more than 3 days, within 24 hours.

Brief Overview of Key Concepts

Tasks gives a UI overview of tasks.

Anatomy of a Task takes you through the anatomy of a task

Task schema details a set of properties for tasks.

Utils define a set of utility functions in the Core Framework can make common tasks much easier.

Nools extras where helper variables and functions for Tasks and Targets are defined.

Required Resources

You should have a functioning CHT instance with cht-conf installed locally, completed a project folder setup, and an assessment form.

Implementation Steps

It is good practice to set up a reference document for the tasks similar to the one below. Other formats may also be used.

SourceUI LabelConditionDue DateResolvedWindow period
Assessment formAssessment follow upcough_duration > 3reported + 1 daysWhen assessment follow up or another assessment report is submitted7 days

Create the task as per the detail above.

1. Define the task

{
    name: 'cough-gt-3-days-follow-up',
    icon: 'icon-followup-general',
    title: 'task.cough_gt_3_days.follow_up',
    appliesTo: 'reports',
    appliesToType: ['assessment'],
    appliesIf: function(contact, report) {
      return report && report.fields.group_assessment && parseInt(report.fields.group_assessment.cough_duration) > 3;
    },
    actions: [
      {
        type: 'report',
        form: 'assessment_follow_up'
      }
    ],
    events: [
      {
        id: 'cough-gt-3-days-follow-up',
        days: 0,
        start: 2,
        end: 7
      }
    ],
    resolvedIf: function(contact, report, event, dueDate) {
      const startTime = Math.max(addDays(dueDate, -event.start).getTime(), report.reported_date);
      const endTime = addDays(dueDate, event.end + 1).getTime();
      return isFormArraySubmittedInWindow(
        contact.reports, ['assessment_follow_up'], startTime, endTime
      );
    }
}

2. Create an assessment_follow_up form as specified below referenced by the task you created. Refer to the app-forms tutorial.

Data fields
typenamelabelrequiredrelevantappearanceconstraintconstraint_messagecalculationchoice_filterhintdefault
begin groupgroup_assessmentAssessment
select_one yes_novisited_hfDid ${patient_name} go to a health facility for treatment?yes
select_one progress_since_last_visitprogressHow is ${patient_name}‘s condition since the last visit?yes${visited_hf} = ‘yes’
end group
Choices
list_namenamelabel
yes_noyesYes
yes_nonoNo
progress_since_last_visitimprovedImproved
progress_since_last_visitsameStayed same
progress_since_last_visitworseWorsened
Settings
form_titleform_idversionstylepathinstance_namedefault_language
Follow upassessment_follow_up1pagesdataen
Sub-folder
forms/app

Build

To build your tasks into your app, you must compile them into app-settings, then upload them to your instance.

cht --url=https://<username>:<password>@localhost --accept-self-signed-certs compile-app-settings backup-app-settings upload-app-settings

Remember to convert and upload your assessment_follow_up form

cht --url=https://<username>:<password>@localhost --accept-self-signed-certs convert-app-forms upload-app-forms -- assessment_follow_up

Frequently Asked Questions


CHT Applications > Features > Tasks

Ensuring that the right actions are taken for the right people at the right time

CHT Applications > Reference > tasks.js

Tasks: Definition of tasks shown to app users

CHT Applications > Concepts > Workflows

Building connections between people, actions, and data systems

Design System > Best Practices : Anatomy of a Task

This document covers the configuration best practices of forms, tasks, targets, and contact profiles when building your own community health app.