forked from I-TECH/openmrs-module-kenyaemr
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2019 from gabriel090/KHP3-6713
Develop a case report for the flagged syndromes
- Loading branch information
Showing
24 changed files
with
2,169 additions
and
1,001 deletions.
There are no files selected for viewing
758 changes: 0 additions & 758 deletions
758
...mrs/module/kenyaemr/calculation/library/surveillance/EligibleForIDSRFlagsCalculation.java
This file was deleted.
Oops, something went wrong.
924 changes: 924 additions & 0 deletions
924
...le/kenyaemr/calculation/library/surveillance/EligibleForIDSRSymptomsFlagsCalculation.java
Large diffs are not rendered by default.
Oops, something went wrong.
280 changes: 235 additions & 45 deletions
280
...org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...enmrs/module/kenyaemr/reporting/cohort/definition/dmi/FebrileIllnessCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Febrile illness cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.FebrileIllnessCohortDefinition") | ||
public class FebrileIllnessCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
.../openmrs/module/kenyaemr/reporting/cohort/definition/dmi/FebrileRashCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Febrile Rash cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.FebrileRashCohortDefinition") | ||
public class FebrileRashCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...org/openmrs/module/kenyaemr/reporting/cohort/definition/dmi/JaundiceCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Jaundice cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.JaundiceCohortDefinition") | ||
public class JaundiceCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...g/openmrs/module/kenyaemr/reporting/cohort/definition/dmi/MeningitisCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Meningitis cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.MeningitisCohortDefinition") | ||
public class MeningitisCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ava/org/openmrs/module/kenyaemr/reporting/cohort/definition/dmi/MpoxCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* mpox cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.MpoxCohortDefinition") | ||
public class MpoxCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...module/kenyaemr/reporting/cohort/definition/dmi/NeurologicalSyndromeCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Neurological Syndrome cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.NeurologicalSyndromeCohortDefinition") | ||
public class NeurologicalSyndromeCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...nmrs/module/kenyaemr/reporting/cohort/definition/dmi/WateryDiarrhoeaCohortDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi; | ||
|
||
import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Watery Diarrhoea cohort definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.WateryDiarrhoeaCohortDefinition") | ||
public class WateryDiarrhoeaCohortDefinition extends BaseCohortDefinition { | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
...mr/reporting/cohort/definition/evaluator/dmi/FebrileIllnessCohortDefinitionEvaluator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.evaluator.dmi; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.openmrs.Cohort; | ||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi.FebrileIllnessCohortDefinition; | ||
import org.openmrs.module.reporting.cohort.EvaluatedCohort; | ||
import org.openmrs.module.reporting.cohort.definition.CohortDefinition; | ||
import org.openmrs.module.reporting.cohort.definition.evaluator.CohortDefinitionEvaluator; | ||
import org.openmrs.module.reporting.evaluation.EvaluationContext; | ||
import org.openmrs.module.reporting.evaluation.EvaluationException; | ||
import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; | ||
import org.openmrs.module.reporting.evaluation.service.EvaluationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Date; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
||
/** | ||
* Evaluator for Febrile Illness Cohort | ||
*/ | ||
@Handler(supports = { FebrileIllnessCohortDefinition.class }) | ||
public class FebrileIllnessCohortDefinitionEvaluator implements CohortDefinitionEvaluator { | ||
|
||
private final Log log = LogFactory.getLog(this.getClass()); | ||
|
||
@Autowired | ||
EvaluationService evaluationService; | ||
|
||
@Override | ||
public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationContext context) throws EvaluationException { | ||
|
||
FebrileIllnessCohortDefinition definition = (FebrileIllnessCohortDefinition) cohortDefinition; | ||
|
||
if (definition == null) | ||
return null; | ||
Cohort newCohort = new Cohort(); | ||
String sqlQuery = "select a.patient_id\n" + | ||
" from (select patient_id, c.visit_date,group_concat(c.complaint) as complaint,\n" + | ||
" CASE\n" + | ||
" WHEN group_concat(concat_ws('|',c.complaint,c.complaint_duration)) LIKE '%140238%' THEN\n" + | ||
" SUBSTRING_INDEX(SUBSTRING_INDEX(group_concat(concat_ws('|',c.complaint,c.complaint_duration)) , '|', -1), ',', 1)\n" + | ||
" END AS fever_duration_from_days\n" + | ||
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" + | ||
" where c.complaint = 140238\n" + | ||
" AND c.complaint_duration < 14\n" + | ||
" and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + | ||
" group by patient_id) a\n" + | ||
" join kenyaemr_etl.etl_patient_demographics d on a.patient_id = d.patient_id\n" + | ||
" 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\n" + | ||
" t.temperature > 38.5 and date(a.visit_date) between date(:startDate) and date(:endDate)\n" + | ||
" where FIND_IN_SET(140238, a.complaint) > 0;"; | ||
|
||
SqlQueryBuilder builder = new SqlQueryBuilder(); | ||
builder.append(sqlQuery); | ||
Date startDate = (Date) context.getParameterValue("startDate"); | ||
Date endDate = (Date) context.getParameterValue("endDate"); | ||
builder.addParameter("startDate", startDate); | ||
builder.addParameter("endDate", endDate); | ||
|
||
List<Integer> ptIds = evaluationService.evaluateToList(builder, Integer.class, context); | ||
newCohort.setMemberIds(new HashSet<Integer>(ptIds)); | ||
return new EvaluatedCohort(newCohort, definition, context); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...yaemr/reporting/cohort/definition/evaluator/dmi/FebrileRashCohortDefinitionEvaluator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.kenyaemr.reporting.cohort.definition.evaluator.dmi; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.openmrs.Cohort; | ||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi.FebrileRashCohortDefinition; | ||
import org.openmrs.module.reporting.cohort.EvaluatedCohort; | ||
import org.openmrs.module.reporting.cohort.definition.CohortDefinition; | ||
import org.openmrs.module.reporting.cohort.definition.evaluator.CohortDefinitionEvaluator; | ||
import org.openmrs.module.reporting.evaluation.EvaluationContext; | ||
import org.openmrs.module.reporting.evaluation.EvaluationException; | ||
import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; | ||
import org.openmrs.module.reporting.evaluation.service.EvaluationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Date; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
||
/** | ||
* Evaluator for FebrileRash Cohort | ||
*/ | ||
@Handler(supports = { FebrileRashCohortDefinition.class }) | ||
public class FebrileRashCohortDefinitionEvaluator implements CohortDefinitionEvaluator { | ||
|
||
private final Log log = LogFactory.getLog(this.getClass()); | ||
|
||
@Autowired | ||
EvaluationService evaluationService; | ||
|
||
@Override | ||
public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationContext context) throws EvaluationException { | ||
|
||
FebrileRashCohortDefinition definition = (FebrileRashCohortDefinition) cohortDefinition; | ||
|
||
if (definition == null) | ||
return null; | ||
|
||
Cohort newCohort = new Cohort(); | ||
String sqlQuery = "SELECT a.patient_id\n" + | ||
"FROM (\n" + | ||
" SELECT\n" + | ||
" patient_id,\n" + | ||
" c.visit_date,\n" + | ||
" GROUP_CONCAT(c.complaint) AS complaint,\n" + | ||
" DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY) AS complaint_date,\n" + | ||
" c.complaint_duration\n" + | ||
" FROM\n" + | ||
" kenyaemr_etl.etl_allergy_chronic_illness c\n" + | ||
" WHERE\n" + | ||
" c.complaint IN (140238, 512)\n" + | ||
" AND c.complaint_duration < 14\n" + | ||
" AND DATE(c.visit_date) BETWEEN DATE(:startDate) AND DATE(:endDate)\n" + | ||
" GROUP BY patient_id) a\n" + | ||
"WHERE\n" + | ||
" FIND_IN_SET(140238, a.complaint) > 0\n" + | ||
" AND FIND_IN_SET(512, a.complaint) > 0;"; | ||
|
||
SqlQueryBuilder builder = new SqlQueryBuilder(); | ||
builder.append(sqlQuery); | ||
Date startDate = (Date) context.getParameterValue("startDate"); | ||
Date endDate = (Date) context.getParameterValue("endDate"); | ||
builder.addParameter("startDate", startDate); | ||
builder.addParameter("endDate", endDate); | ||
|
||
List<Integer> ptIds = evaluationService.evaluateToList(builder, Integer.class, context); | ||
newCohort.setMemberIds(new HashSet<Integer>(ptIds)); | ||
return new EvaluatedCohort(newCohort, definition, context); | ||
} | ||
} |
Oops, something went wrong.