hello community
We are running into an issue where tasks for some patients are not displaying in the tasks tab yet the task configuration looks good for example with the current task config below triggered triggered 14 days after the patient missing on the their next appointment date displayed in the condition cards .
{
name: 'no-contact-enrol',
title: 'Refer to B2C',
appliesTo: 'reports',
appliesToType: ['enroll', 'enroll_with_barcode'],
appliesIf: (contact, report ) => {
console.log('contact',contact);
if (!['enroll', 'enroll_with_barcode'].includes(report.form)) {
return false;
}
return contact.contact.rapidpro && contact.contact.rapidpro.visit_date;
},
resolvedIf: (contact, report, event, dueDate) => {
if (contact.contact.muted) {
return true;
}
return Utils.isFormSubmittedInWindow(
contact.reports,
'day14_no_contact',
Utils.addDate(dueDate, event.start).getTime(),
Utils.addDate(dueDate, event.end + 1).getTime()
) ||
Utils.getMostRecentReport(
contact.reports,
'tracing_outcome'
);
},
events: [
{
dueDate: (event, contact) => {
// console.log(contact);
console.log('hey there',Utils.addDate(new Date(contact.contact.rapidpro.visit_date), 14));
return Utils.addDate(new Date(contact.contact.rapidpro.visit_date), 14);
},
start: 3,
end: 14
}
],
actions: [
{
form: 'day14_no_contact'
}
]
},
The task for the contact doc below from the DB failed to appear
{
"_id": "e5927263-4b5c-97a9-cddfa8d98474",
"_rev": "486-93e341c2f37a78737847837878378",
"alt_phone": "",
"consent": "yes",
"filing_number": "FN765654",
"first_name": "xxxxxxx",
"geolocation": {
"accuracy": 26.399999618530273,
"altitude": 1040.9000244140625,
"altitudeAccuracy": null,
"heading": null,
"latitude": -13.9912065,
"longitude": 33.7753626,
"speed": null
},
"language_preference": "xxxxxxx",
"name": "xxxxxxxx",
"national_id": "P1700015",
"parent": {
"_id": "49834he2b-6aab-404e-978e-7fc359346056a",
"parent": {
"_id": "e8b0f5ed-dff7-408b-8388238"
}
},
"patient_id": "91078",
"phone": "+265993664361",
"randomization": "texting",
"rapidpro": {
"adherence": "true",
"language": "",
"optout": "false",
"reminders": "true",
"visit_date": "2024-10-03T00:00:00.000+00:00",
"observation_date": "2024-04-04T11:31:57.000+00:00"
},
"rapidpro_uuid": "7fb489388384893889",
"reported_date": 1646046518065,
"role": "patient",
"surname": "xxxxxxxxxx",
"telegram_id": "",
"type": "person",
"art_status": "AliveOnART",
"art_status_change_date": "2024-09-07T00:00:00.000Z",
"last_visit": "2024-04-04T00:00:00.000Z",
"InternalID": "12345",
"new_national_patient_identifier": "YFKSBVN",
"art_outcome": "On antiretrovirals"
}
yet i see
"rapidpro": {
"adherence": "true",
"language": "",
"optout": "false",
"reminders": "true",
"visit_date": "2024-10-03T00:00:00.000+00:00",
"observation_date": "2024-04-04T11:31:57.000+00:00"
which satisfies the appliesIf in the task configuration
appliesIf: (contact, report ) => {
console.log('contact',contact);
if (!['enroll', 'enroll_with_barcode'].includes(report.form)) {
return false;
}
return contact.contact.rapidpro && contact.contact.rapidpro.visit_date;
},