nmrs-nigeria / openmrs-module-nigeriaemr

NMRS NDR Extration Module for NigeriaMRS
1 stars 15 forks source link

Date Enrolled Into Care points only to DATE_CONFIRMED_POSITIVE instead of patient_program table #207

Open brightoibe opened 3 years ago

brightoibe commented 3 years ago

Hello Team we observed that the plugin does not pull EnrollmentDates entered into the HIVEnrollmentForm. Date Enrolled Into Care was pointed to DATE_CONFIRMED_POSITIVE as defined in this code base.

public static Date extractEnrollmentDate(Map<Object, List<Obs>> groupedpatientBaselineObsByConcept) { Date enrollmentDate = null; List<Obs> obsList = groupedpatientBaselineObsByConcept.get(Utils.DATE_OF_HIV_DIAGNOSIS_CONCEPT); if (obsList != null && obsList.size() > 0) { enrollmentDate = obsList.get(0).getValueDate(); } return enrollmentDate; } line 657 to 666 of the Utils class.

Date Enrolled Into Care submits to the patient_program table and is not stored as a concept

ProgramWorkflowService workFlowService = Context.getProgramWorkflowService(); List<PatientProgram> patientProgramList = new ArrayList<PatientProgram>(); patientProgramList.addAll(workFlowService.getPatientPrograms(patient)); patientProgram = extractProgramByID(patientProgramList, HIV_ENROLLMENT_PROGRAM_ID); if (patientProgram != null) { enrollmentDate = patientProgram.getDateEnrolled(); }else{ // Read the DATE_CONFIRMED_POSITIVE }