-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added height in Active on ART Line list
- Loading branch information
1 parent
5a4e479
commit ced397b
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
...rs/module/kenyaemr/reporting/data/converter/definition/art/HeightAtArtDataDefinition.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,47 @@ | ||
/** | ||
* 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.data.converter.definition.art; | ||
|
||
import org.openmrs.module.reporting.data.BaseDataDefinition; | ||
import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; | ||
import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; | ||
import org.openmrs.module.reporting.evaluation.caching.Caching; | ||
|
||
/** | ||
* Art Cohort Height Data Definition | ||
*/ | ||
@Caching(strategy=ConfigurationPropertyCachingStrategy.class) | ||
public class HeightAtArtDataDefinition extends BaseDataDefinition implements PersonDataDefinition { | ||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public HeightAtArtDataDefinition() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Constructor to populate name only | ||
*/ | ||
public HeightAtArtDataDefinition(String name) { | ||
super(name); | ||
} | ||
|
||
//***** INSTANCE METHODS ***** | ||
|
||
/** | ||
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType() | ||
*/ | ||
public Class<?> getDataType() { | ||
return Double.class; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../kenyaemr/reporting/data/converter/definition/evaluator/art/HeightAtArtDataEvaluator.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,47 @@ | ||
/** | ||
* 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.data.converter.definition.evaluator.art; | ||
|
||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.HeightAtArtDataDefinition; | ||
import org.openmrs.module.reporting.data.person.EvaluatedPersonData; | ||
import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; | ||
import org.openmrs.module.reporting.data.person.evaluator.PersonDataEvaluator; | ||
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.Map; | ||
|
||
/** | ||
* Evaluates Current Height Data Definition | ||
*/ | ||
@Handler(supports=HeightAtArtDataDefinition.class, order=50) | ||
public class HeightAtArtDataEvaluator implements PersonDataEvaluator { | ||
|
||
@Autowired | ||
private EvaluationService evaluationService; | ||
|
||
public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationContext context) throws EvaluationException { | ||
EvaluatedPersonData c = new EvaluatedPersonData(definition, context); | ||
|
||
String qry = "select t.patient_id,\n" + | ||
" mid(max(concat(t.visit_date,t.height)),11) as height from kenyaemr_etl.etl_patient_triage t inner join kenyaemr_etl.etl_patient_hiv_followup f on t.patient_id = f.patient_id and t.visit_date = f.visit_date\n" + | ||
"GROUP BY t.patient_id;"; | ||
|
||
SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); | ||
queryBuilder.append(qry); | ||
Map<Integer, Object> data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); | ||
c.setData(data); | ||
return c; | ||
} | ||
} |