forked from IntelliSOFT-Consulting/cht-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtargets.js
71 lines (70 loc) · 1.95 KB
/
targets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module.exports = [
{
id: 'pregnancy-all-time',
type: 'count',
icon: 'icon-healthcare-assessment',
goal: -1,
translation_key: 'targets.pregnancy.title',
subtitle_translation_key: 'targets.all_time.subtitle',
appliesTo: 'reports',
appliesToType: ['pregnancy_form'],
date: 'now',
},
{
id: 'pregnancy-follow-up-all-time',
type: 'count',
icon: 'icon-healthcare-assessment',
goal: 11,
translation_key: 'targets.pregnancy-follow-up.title',
subtitle_translation_key: 'targets.all_time.subtitle',
appliesTo: 'reports',
appliesToType: ['pregnancyfollowup'],
date: 'now',
},
{
id: 'pregnancy-this-month',
type: 'count',
icon: 'icon-healthcare-assessment',
goal: 2,
translation_key: 'targets.pregnancy.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'reports',
appliesToType: ['pregnancy_form'],
date: 'reported',
},
{
id: 'total-contacts-with-cough-this-month',
type: 'count',
icon: 'icon-cough',
goal: -1,
translation_key: 'targets.pregnancy.total.cough.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'reports',
appliesToType: ['pregnancy_form'],
appliesIf: function (contact, report) {
return Utils.getField(report, 'group_assessment.cough') === 'yes';
},
idType: 'contact',
date: 'reported',
},
{
id: 'households-with-pregnancy-this-month',
type: 'count',
icon: 'icon-household',
goal: 2,
translation_key: 'targets.households.with.pregnancy.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'reports',
appliesToType: ['pregnancy_form'],
date: 'reported',
emitCustom: (emit, original, contact) => {
const householdId = contact.contact && contact.contact.parent._id;
emit(
Object.assign({}, original, {
_id: householdId,
pass: true,
})
);
},
}
];