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 #2056 from njorocs/dmi-case-report
Dmi case report
- Loading branch information
Showing
65 changed files
with
3,756 additions
and
0 deletions.
There are no files selected for viewing
318 changes: 318 additions & 0 deletions
318
.../java/org/openmrs/module/kenyaemr/reporting/builder/dmi/CaseReportsListReportBuilder.java
Large diffs are not rendered by default.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...e/kenyaemr/reporting/cohort/definition/dmi/casereport/CaseComplaintsCohortDefinition.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,43 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.openmrs.Visit; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
import org.openmrs.module.reporting.query.BaseQuery; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Surveillance cases cohort definition | ||
*/ | ||
|
||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.CaseComplaintsCohortDefinition") | ||
public class CaseComplaintsCohortDefinition extends BaseQuery<Visit> implements VisitQuery { | ||
@ConfigurationProperty | ||
private Date asOfDate; | ||
|
||
public CaseComplaintsCohortDefinition() { | ||
} | ||
|
||
public Date getAsOfDate() { | ||
return asOfDate; | ||
} | ||
|
||
public void setAsOfDate(Date asOfDate) { | ||
this.asOfDate = asOfDate; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...le/kenyaemr/reporting/cohort/definition/dmi/casereport/CaseDiagnosisCohortDefinition.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,43 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.openmrs.Visit; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
import org.openmrs.module.reporting.query.BaseQuery; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Surveillance cases cohort definition | ||
*/ | ||
|
||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.CaseDiagnosisCohortDefinition") | ||
public class CaseDiagnosisCohortDefinition extends BaseQuery<Visit> implements VisitQuery { | ||
@ConfigurationProperty | ||
private Date asOfDate; | ||
|
||
public CaseDiagnosisCohortDefinition() { | ||
} | ||
|
||
public Date getAsOfDate() { | ||
return asOfDate; | ||
} | ||
|
||
public void setAsOfDate(Date asOfDate) { | ||
this.asOfDate = asOfDate; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
.../module/kenyaemr/reporting/cohort/definition/dmi/casereport/CaseLabsCohortDefinition.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,43 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.openmrs.Visit; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
import org.openmrs.module.reporting.query.BaseQuery; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Surveillance cases cohort definition | ||
*/ | ||
|
||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.CaseLabsCohortDefinition") | ||
public class CaseLabsCohortDefinition extends BaseQuery<Visit> implements VisitQuery { | ||
@ConfigurationProperty | ||
private Date asOfDate; | ||
|
||
public CaseLabsCohortDefinition() { | ||
} | ||
|
||
public Date getAsOfDate() { | ||
return asOfDate; | ||
} | ||
|
||
public void setAsOfDate(Date asOfDate) { | ||
this.asOfDate = asOfDate; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...odule/kenyaemr/reporting/cohort/definition/dmi/casereport/CaseVitalsCohortDefinition.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,43 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.openmrs.Visit; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
import org.openmrs.module.reporting.query.BaseQuery; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Surveillance cases cohort definition | ||
*/ | ||
|
||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.CaseVitalsCohortDefinition") | ||
public class CaseVitalsCohortDefinition extends BaseQuery<Visit> implements VisitQuery { | ||
@ConfigurationProperty | ||
private Date asOfDate; | ||
|
||
public CaseVitalsCohortDefinition() { | ||
} | ||
|
||
public Date getAsOfDate() { | ||
return asOfDate; | ||
} | ||
|
||
public void setAsOfDate(Date asOfDate) { | ||
this.asOfDate = asOfDate; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
.../module/kenyaemr/reporting/cohort/definition/dmi/casereport/IllCasesCohortDefinition.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,43 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.openmrs.Visit; | ||
import org.openmrs.module.reporting.common.Localized; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
import org.openmrs.module.reporting.query.BaseQuery; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Surveillance cases cohort definition | ||
*/ | ||
|
||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
@Localized("reporting.IllCasesCohortDefinition") | ||
public class IllCasesCohortDefinition extends BaseQuery<Visit> implements VisitQuery { | ||
@ConfigurationProperty | ||
private Date asOfDate; | ||
|
||
public IllCasesCohortDefinition() { | ||
} | ||
|
||
public Date getAsOfDate() { | ||
return asOfDate; | ||
} | ||
|
||
public void setAsOfDate(Date asOfDate) { | ||
this.asOfDate = asOfDate; | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
...g/cohort/definition/evaluator/dmi/casereport/CaseComplaintsCohortDefinitionEvaluator.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,62 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi.casereport.CaseComplaintsCohortDefinition; | ||
import org.openmrs.module.reporting.common.ObjectUtil; | ||
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.openmrs.module.reporting.query.visit.VisitQueryResult; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
import org.openmrs.module.reporting.query.visit.evaluator.VisitQueryEvaluator; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* Evaluator for case complaints Cohort | ||
*/ | ||
@Handler(supports = {CaseComplaintsCohortDefinition.class}) | ||
public class CaseComplaintsCohortDefinitionEvaluator implements VisitQueryEvaluator { | ||
|
||
private final Log log = LogFactory.getLog(this.getClass()); | ||
|
||
@Autowired | ||
EvaluationService evaluationService; | ||
|
||
@Override | ||
public VisitQueryResult evaluate(VisitQuery visitQuery, EvaluationContext context) throws EvaluationException { | ||
context = ObjectUtil.nvl(context, new EvaluationContext()); | ||
VisitQueryResult queryResult = new VisitQueryResult(visitQuery, context); | ||
|
||
String qry = "select i.visit_id\n" + | ||
"from kenyaemr_etl.etl_allergy_chronic_illness i\n" + | ||
"where i.visit_date between date(:startDate) and date(:endDate)\n" + | ||
" and i.complaint is not null\n" + | ||
"group by visit_id;"; | ||
|
||
SqlQueryBuilder builder = new SqlQueryBuilder(); | ||
builder.append(qry); | ||
Date startDate = (Date) context.getParameterValue("startDate"); | ||
Date endDate = (Date) context.getParameterValue("endDate"); | ||
builder.addParameter("endDate", endDate); | ||
builder.addParameter("startDate", startDate); | ||
|
||
List<Integer> results = evaluationService.evaluateToList(builder, Integer.class, context); | ||
queryResult.getMemberIds().addAll(results); | ||
return queryResult; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...ng/cohort/definition/evaluator/dmi/casereport/CaseDiagnosisCohortDefinitionEvaluator.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,63 @@ | ||
/** | ||
* 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.casereport; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemr.reporting.cohort.definition.dmi.casereport.CaseDiagnosisCohortDefinition; | ||
import org.openmrs.module.reporting.common.ObjectUtil; | ||
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.openmrs.module.reporting.query.visit.VisitQueryResult; | ||
import org.openmrs.module.reporting.query.visit.definition.VisitQuery; | ||
import org.openmrs.module.reporting.query.visit.evaluator.VisitQueryEvaluator; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* Evaluator for case complaints Cohort | ||
*/ | ||
@Handler(supports = {CaseDiagnosisCohortDefinition.class}) | ||
public class CaseDiagnosisCohortDefinitionEvaluator implements VisitQueryEvaluator { | ||
|
||
private final Log log = LogFactory.getLog(this.getClass()); | ||
|
||
@Autowired | ||
EvaluationService evaluationService; | ||
|
||
@Override | ||
public VisitQueryResult evaluate(VisitQuery visitQuery, EvaluationContext context) throws EvaluationException { | ||
context = ObjectUtil.nvl(context, new EvaluationContext()); | ||
VisitQueryResult queryResult = new VisitQueryResult(visitQuery, context); | ||
|
||
String qry = "select e.visit_id\n" + | ||
"from kenyaemr_etl.etl_clinical_encounter e\n" + | ||
" inner join openmrs.encounter_diagnosis d\n" + | ||
" on e.encounter_id = d.encounter_id and d.dx_rank = 2 and d.voided = 0\n" + | ||
"where e.visit_date between date(:startDate) and date(:endDate)\n" + | ||
"GROUP BY e.visit_id;"; | ||
|
||
SqlQueryBuilder builder = new SqlQueryBuilder(); | ||
builder.append(qry); | ||
Date startDate = (Date) context.getParameterValue("startDate"); | ||
Date endDate = (Date) context.getParameterValue("endDate"); | ||
builder.addParameter("endDate", endDate); | ||
builder.addParameter("startDate", startDate); | ||
|
||
List<Integer> results = evaluationService.evaluateToList(builder, Integer.class, context); | ||
queryResult.getMemberIds().addAll(results); | ||
return queryResult; | ||
} | ||
} |
Oops, something went wrong.