Building Target Widgets

How to build CHT monthly and all time target widgets

This tutorial will take you through how to build target widgets.

Target widgets provide a summary or analysis of the data in submitted reports.

You will be adding target widgets that will allow Community Health Workers to track the number of assessments done.

Brief Overview of Key Concepts

Targets is the user dashboard or analytics tab.

Target widgets provide a summary or analysis of the data in submitted reports.

Count widgets show a tally of a particular report that has been submitted or data within a report that matches a set of criteria.

Percent widgets display a ratio, which helps to provide insight into the proportion that matches a defined criteria.

Required Resources

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

Implementation Steps

Create a targets.js file (this may have already been created by the initialise-project-layout command).

1. Define an All-Time Target Widget

Edit the targets.js file to define an all-time widget as shown below:

module.exports = [
  {
    id: 'assessments-all-time',
    type: 'count',
    icon: 'icon-healthcare-assessment',
    goal: -1,
    translation_key: 'targets.assessments.title',
    subtitle_translation_key: 'targets.all_time.subtitle',

    appliesTo: 'reports',
    appliesToType: ['assessment'],
    date: 'now'
  }
];

2. Define a Monthly Target Widget

Edit the targets.js file and add another target widget definition object to define a monthly widget as shown below:

module.exports = [
  {
    id: 'assessments-all-time',
    type: 'count',
    icon: 'icon-healthcare-assessment',
    goal: -1,
    translation_key: 'targets.assessments.title',
    subtitle_translation_key: 'targets.all_time.subtitle',

    appliesTo: 'reports',
    appliesToType: ['assessment'],
    date: 'now'
  },
  {
    id: 'assessments-this-month',
    type: 'count',
    icon: 'icon-healthcare-assessment',
    goal: -1,
    translation_key: 'targets.assessments.title',
    subtitle_translation_key: 'targets.this_month.subtitle',

    appliesTo: 'reports',
    appliesToType: ['assessment'],
    date: 'reported'
  }
];

See Also: Targets overview

3. Compile and Upload App Settings

To compile and upload app settings to your local instance, run the following command:

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

Frequently Asked Questions


CHT Applications > Features > Targets

Dashboards to track metrics for an individual CHW or for an entire health facility

CHT Applications > Reference > targets.js

Targets: Definition of target widgets calculated and seen in the app

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.