I have gone through the documentation of Target.
I am trying to modify the target.js. The target.js is successfully uploaded.
In the target section, the newly added translation_key is shown.
But the counting is not working. It’s zero, not increasing at all .
// I guess it should increase
In the example below,
I first created an app form. .i.e screening_form .
Then tried counting the form filled as mentioned in the CHT documentation examples.
1. Define an All-Time Target Widge
Define the Total Screening Form Monthly Target Widget
Define the patient with Smoking == yes
module.exports = [
{
id: 'screenings-all-time',
type: 'count',
goal: -1,
translation_key: 'targets.screenings.title',
subtitle_translation_key: 'targets.all_time.subtitle',
appliesTo: 'reports',
appliesToType: ['screening_form'],
date: 'now'
},
{
id: 'screenings-this-month',
type: 'count',
goal: 2,
translation_key: 'targets.screenings.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'reports',
appliesToType: ['screening_form'],
date: 'reported'
},
{
id: 'total-contacts-with-smoke-yes',
type: 'count',
goal: -1,
translation_key: 'targets.hypertension.total.smoke.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'reports',
appliesToType: ['screening_form'],
appliesIf: function (contact, report) {
return Utils.getField(report, 'BP_measurement_preparation.smoke_history_30m') ==='yes';
},
idType: 'contact',
date: 'reported'
},
];