Hi there, I need some help to interpret task state in this case.
A patient_assessment triggers a task with 8 events, the task has as action form the moderate_malnutrition_followup form.
here I have got from the couchdb postgresql table the related task (with the patient) and I have joined them with the moderate_malnutrition_followup date_records to correspondant task doc
The first thing that currently I do not understand is that in the code we have:
priority: function (contact) {
const followUps = contact.reports.filter(contactReport =>
contactReport.form === actionForm &&
getField(contactReport, 'inputs.source_id') === this.patientAssessment._id
);
const followUpNumber=indexOfEvent(this.definition.events, this.event);
return {level: 'medium', label: `Suivi ${followUpNumber} - ${followUps.length}/${this.definition.events.length}`};
}
as you see here in the priority label column followUps.length
is giving 4,but we have 5 reports of type moderate_malnutrition_followup associated with our contact
if followup is an array of lenght 4 this means that this.patientAssessment
is not null nor undefined and we have in the code that
appliesIf: function (contact) {
const eligibleReports = contact.reports
.filter(report => report.form === Forms.PATIENT_ASSESSMENT_UNDER_5)
.filter(report => getField(report, `treat_${treatment}`) === 'true')
.filter(report => ageInDays(getDynamicReportedDate(report)) < 86);
this.patientAssessment = getMostRecentReport(eligibleReports, Forms.PATIENT_ASSESSMENT_UNDER_5);
return !!this.patientAssessment;
},
so appliesIf is returning true
Any ideas about how contact.reports
is missing the 5th malnutrition_moderate_followup record ?
here the patient in question https://muso-mali.app.medicmobile.org/#/contacts/79a3360b-0bf8-4dac-9610-741cb6bb14fb