Skip to content

Commit

Permalink
Merge pull request #2070 from patryllus/feat/IDSRFlaggingAndReport
Browse files Browse the repository at this point in the history
Updated IDSR flagging for ILi according to changed case definition: Removed requirement for fever for ILI and had it optional for Sari - on reports removed requirement for clinical encounter
  • Loading branch information
njorocs authored Dec 11, 2024
2 parents 21ef2f3 + 89a0c85 commit 35cff97
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,26 +234,34 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
}
//Triage
if (lastTriageEncounter != null) {
//1. SARI and ILI
if (triageEncounterHasFever && triageEncounterHasCough) {
//1.1 ILI
if (triageEncounterHasCough) {
for (Obs obs : lastTriageEncounter.getObs()) {
dateCreated = obs.getDateCreated();
if (obs.getConcept().getUuid().equals(DURATION)) {
duration = obs.getValueNumeric();
}
if (dateCreated != null) {
String createdDate = dateFormat.format(dateCreated);
if ((duration > 0.0 && duration < 10) && tempValue != null && tempValue >= 38.0) {
if (createdDate.equals(todayDate)) {
if (duration > 0.0 && duration < 10 && createdDate.equals(todayDate)) {
if (tempValue != null && tempValue >= 38.0) {
if (!patientAdmissionStatus && !currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(ili);
break;
} else {
eligible = true;
idsrMessage.add(sari);
idsrMessage.add(sari);
break;
}
}
if (triageEncounterHasFever) {
if (patientAdmissionStatus && currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(sari);
break;
}

}
}
}
Expand Down Expand Up @@ -405,16 +413,16 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
//Hiv followup encounter
if (lastHivFollowUpEncounter != null) {
//1. SARI and ILI
if (hivFollowupEncounterHasFever && hivFollowupEncounterHasCough) {
if (hivFollowupEncounterHasCough) {
for (Obs obs : lastHivFollowUpEncounter.getObs()) {
dateCreated = obs.getDateCreated();
if (obs.getConcept().getUuid().equals(DURATION)) {
duration = obs.getValueNumeric();
}
if (dateCreated != null) {
String createdDate = dateFormat.format(dateCreated);
if ((duration > 0.0 && duration < 10) && tempValue != null && tempValue >= 38.0) {
if (createdDate.equals(todayDate)) {
if (duration > 0.0 && duration < 10 && createdDate.equals(todayDate)) {
if (tempValue != null && tempValue >= 38.0) {
if (!patientAdmissionStatus && !currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(ili);
Expand All @@ -425,6 +433,14 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
break;
}
}
if (triageEncounterHasFever) {
if (patientAdmissionStatus && currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(sari);
break;
}

}
}
}
}
Expand Down Expand Up @@ -575,22 +591,29 @@ public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Obj
//Clinical Encounter
if (lastClinicalEncounter != null) {
//1. SARI and ILI
if (clinicalEncounterHasFever && clinicalEncounterHasCough) {
if (clinicalEncounterHasCough) {
for (Obs obs : lastClinicalEncounter.getObs()) {
dateCreated = obs.getDateCreated();
if (obs.getConcept().getUuid().equals(DURATION)) {
duration = obs.getValueNumeric();
if (dateCreated != null) {
String createdDate = dateFormat.format(dateCreated);
if ((duration > 0.0 && duration < 10) && tempValue != null && tempValue >= 38.0) {
if (createdDate.equals(todayDate)) {
if (duration > 0.0 && duration < 10 && createdDate.equals(todayDate)) {
if (tempValue != null && tempValue >= 38.0) {
if (!patientAdmissionStatus && !currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(ili);
idsrMessage.add(ili);
break;
} else {
eligible = true;
idsrMessage.add(sari);
idsrMessage.add(sari);
break;
}
}
if (triageEncounterHasFever) {
if (patientAdmissionStatus && currentVisit.getVisitType().getUuid().equals("a73e2ac6-263b-47fc-99fc-e0f2c09fc914")) {
eligible = true;
idsrMessage.add(sari);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,19 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon
Cohort newCohort = new Cohort();

String qry = "select a.patient_id\n" +
"from (select patient_id, c.complaint as complaint, DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY) as complaint_date, c.visit_date\n" +
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" +
" where c.complaint = 143264\n" +
" and c.complaint_duration < 10\n" +
" and date(c.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by patient_id) a\n" +
" join visit v\n" +
" on a.patient_id = v.patient_id and date(a.visit_date) = date(v.date_started) and v.visit_type_id = 3\n" +
" join kenyaemr_etl.etl_patient_triage t\n" +
" on a.patient_id = t.patient_id and date(t.visit_date) = date(v.date_started) and t.temperature >= 38;";
"from (select patient_id, c.complaint as complaint, DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY) as complaint_date, c.visit_date\n" +
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" +
" where c.complaint = 143264\n" +
" and c.complaint_duration < 10\n" +
" and date(c.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by patient_id) a\n" +
" left join kenyaemr_etl.etl_clinical_encounter e\n" +
" on a.patient_id = e.patient_id and date(e.visit_date) between date(:startDate) and date(:endDate)\n" +
" left join kenyaemr_etl.etl_patient_triage t\n" +
" on a.patient_id = t.patient_id and date(t.visit_date) between date(:startDate) and date(:endDate) and t.temperature >= 38\n" +
" join openmrs.visit v\n" +
" on a.patient_id = v.patient_id and v.visit_type_id = 3 or e.patient_outcome = 1654\n" +
"where e.patient_id is not null or t.patient_id is not null;";

SqlQueryBuilder builder = new SqlQueryBuilder();
builder.append(qry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationC
EvaluatedPersonData c = new EvaluatedPersonData(definition, context);

String qry = "select a.patient_id, if(\n" +
"e.patient_outcome in (1693,160429) or v.visit_type_id = 1, 'OPD', if(e.patient_outcome = 1654 or v.visit_type_id = 2, 'IPD','N/A')) as visit_type\n" +
"e.patient_outcome in (1693,160429) or v.visit_type_id = 1, 'OPD', if(e.patient_outcome = 1654 or v.visit_type_id = 3, 'IPD','N/A')) as visit_type\n" +
"from (select patient_id, c.complaint as complaint, DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY) as complaint_date, c.visit_date\n" +
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" +
" where date(c.visit_date) between date(:startDate) and date(:endDate)\n" +
" group by patient_id) a\n" +
" join openmrs.visit v\n" +
" on a.patient_id = v.patient_id and date(a.visit_date) = date(v.date_started)\n" +
" join kenyaemr_etl.etl_patient_triage t\n" +
" left join kenyaemr_etl.etl_patient_triage t\n" +
" on a.patient_id = t.patient_id and date(t.visit_date) = date(v.date_started)\n" +
"join kenyaemr_etl.etl_clinical_encounter e\n" +
"left join kenyaemr_etl.etl_clinical_encounter e\n" +
"on a.patient_id = e.patient_id and date(a.visit_date) = date(e.visit_date);";

SqlQueryBuilder queryBuilder = new SqlQueryBuilder();
Expand All @@ -59,4 +59,4 @@ public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationC
c.setData(data);
return c;
}
}
}
2 changes: 1 addition & 1 deletion api/src/main/resources/content/kenyaemr.common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@
</set>
</property>
<property name="template" value="kenyaemr:dmi/idsr.xls" />
<property name="repeatingSection" value="sheet:2,row:6,dataset:idsrSuspectedCases | sheet:3,row:6,dataset:dysentery | sheet:4,row:6,dataset:cholera | sheet:5,row:6,dataset:ili | sheet:6,row:6,dataset:sari | sheet:7,row:6,dataset:riftvalleyFever | sheet:8,row:6,dataset:malaria | sheet:9,row:6,dataset:chikungunya | sheet:10,row:6,dataset:poliomyelitis | sheet:11,row:6,dataset:viralHaemorrhagicFever | sheet:12,row:6,dataset:measles" />
<property name="repeatingSection" value="sheet:2,row:6,dataset:idsrSuspectedCases | sheet:3,row:6,dataset:dysentery | sheet:4,row:6,dataset:cholera | sheet:5,row:6,dataset:ili | sheet:6,row:7,dataset:sari | sheet:7,row:6,dataset:riftvalleyFever | sheet:8,row:6,dataset:malaria | sheet:9,row:6,dataset:chikungunya | sheet:10,row:6,dataset:poliomyelitis | sheet:11,row:6,dataset:viralHaemorrhagicFever | sheet:12,row:6,dataset:measles" />
</bean>
<bean id="kenyaemr.ehrReports.report.moh204A" class="org.openmrs.module.kenyacore.report.HybridReportDescriptor">
<property name="targetUuid" value="9902f845-8079-484f-8060-e3cf4f5d0f6f" />
Expand Down

0 comments on commit 35cff97

Please sign in to comment.