-
Notifications
You must be signed in to change notification settings - Fork 13
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 #213 from njorocs/dqa-2023
Removed ccc 10 digit and format validation.Revised Current on ART reg…
- Loading branch information
Showing
16 changed files
with
466 additions
and
34 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
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
...enyaemrextras/reporting/data/definition/DQATBScreeningLastVisitOutcomeDataDefinition.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.kenyaemrextras.reporting.data.definition; | ||
|
||
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; | ||
|
||
/** | ||
* DQA TB screening Outcome Data Definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
public class DQATBScreeningLastVisitOutcomeDataDefinition extends BaseDataDefinition implements PersonDataDefinition { | ||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public DQATBScreeningLastVisitOutcomeDataDefinition() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Constructor to populate name only | ||
*/ | ||
public DQATBScreeningLastVisitOutcomeDataDefinition(String name) { | ||
super(name); | ||
} | ||
|
||
//***** INSTANCE METHODS ***** | ||
|
||
/** | ||
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType() | ||
*/ | ||
public Class<?> getDataType() { | ||
return Integer.class; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...nmrs/module/kenyaemrextras/reporting/data/definition/DQATPTOutcomeDateDataDefinition.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,49 @@ | ||
/** | ||
* 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.kenyaemrextras.reporting.data.definition; | ||
|
||
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; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* DQA TPT outcome Date Data Definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
public class DQATPTOutcomeDateDataDefinition extends BaseDataDefinition implements PersonDataDefinition { | ||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public DQATPTOutcomeDateDataDefinition() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Constructor to populate name only | ||
*/ | ||
public DQATPTOutcomeDateDataDefinition(String name) { | ||
super(name); | ||
} | ||
|
||
//***** INSTANCE METHODS ***** | ||
|
||
/** | ||
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType() | ||
*/ | ||
public Class<?> getDataType() { | ||
return Date.class; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...penmrs/module/kenyaemrextras/reporting/data/definition/DQATPTStartDateDataDefinition.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,49 @@ | ||
/** | ||
* 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.kenyaemrextras.reporting.data.definition; | ||
|
||
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; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* DQA TPT start Date Data Definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
public class DQATPTStartDateDataDefinition extends BaseDataDefinition implements PersonDataDefinition { | ||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public DQATPTStartDateDataDefinition() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Constructor to populate name only | ||
*/ | ||
public DQATPTStartDateDataDefinition(String name) { | ||
super(name); | ||
} | ||
|
||
//***** INSTANCE METHODS ***** | ||
|
||
/** | ||
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType() | ||
*/ | ||
public Class<?> getDataType() { | ||
return Date.class; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...g/openmrs/module/kenyaemrextras/reporting/data/definition/DQATPTStatusDataDefinition.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.kenyaemrextras.reporting.data.definition; | ||
|
||
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; | ||
|
||
/** | ||
* DQA TPT status Data Definition | ||
*/ | ||
@Caching(strategy = ConfigurationPropertyCachingStrategy.class) | ||
public class DQATPTStatusDataDefinition extends BaseDataDefinition implements PersonDataDefinition { | ||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public DQATPTStatusDataDefinition() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Constructor to populate name only | ||
*/ | ||
public DQATPTStatusDataDefinition(String name) { | ||
super(name); | ||
} | ||
|
||
//***** INSTANCE METHODS ***** | ||
|
||
/** | ||
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType() | ||
*/ | ||
public Class<?> getDataType() { | ||
return Integer.class; | ||
} | ||
} |
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
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
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
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
59 changes: 59 additions & 0 deletions
59
...tras/reporting/data/definition/evaluator/DQATBScreeningLastVisitOutcomeDataEvaluator.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,59 @@ | ||
/** | ||
* 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.kenyaemrextras.reporting.data.definition.evaluator; | ||
|
||
import org.openmrs.annotation.Handler; | ||
import org.openmrs.module.kenyaemrextras.reporting.data.definition.DQATBScreeningLastVisitDataDefinition; | ||
import org.openmrs.module.kenyaemrextras.reporting.data.definition.DQATBScreeningLastVisitOutcomeDataDefinition; | ||
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.Date; | ||
import java.util.Map; | ||
|
||
/** | ||
* Evaluates TB screening outcome on last visit Data Definition | ||
*/ | ||
@Handler(supports = DQATBScreeningLastVisitOutcomeDataDefinition.class, order = 50) | ||
public class DQATBScreeningLastVisitOutcomeDataEvaluator implements PersonDataEvaluator { | ||
|
||
@Autowired | ||
private EvaluationService evaluationService; | ||
|
||
public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationContext context) | ||
throws EvaluationException { | ||
EvaluatedPersonData c = new EvaluatedPersonData(definition, context); | ||
|
||
String qry = "select a.patient_id,\n" | ||
+ " if(person_present = 978 and screened_for_tb = 'Yes',case a.tb_status when 1660 then 'No TB' when 1662 then 'TB Confirmed' when 142177 then 'Pr TB' end,null) as tb_status\n" | ||
+ " from (select tb.patient_id,\n" | ||
+ " mid(max(concat(date (tb.visit_date), ifnull(tb.tb_status, 0))), 11) as tb_status,\n" | ||
+ " mid(max(concat(date (tb.visit_date),tb.person_present)),11) as person_present,\n" | ||
+ " mid(max(concat(date (tb.visit_date), tb.screened_for_tb)), 11) as screened_for_tb\n" | ||
+ " from kenyaemr_etl.etl_patient_hiv_followup tb where tb.visit_date <= date (:endDate)\n" | ||
+ " group by tb.patient_id) a;"; | ||
|
||
SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); | ||
Date startDate = (Date) context.getParameterValue("startDate"); | ||
Date endDate = (Date) context.getParameterValue("endDate"); | ||
queryBuilder.addParameter("endDate", endDate); | ||
queryBuilder.addParameter("startDate", startDate); | ||
queryBuilder.append(qry); | ||
Map<Integer, Object> data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); | ||
c.setData(data); | ||
return c; | ||
} | ||
} |
Oops, something went wrong.