Skip to content

Commit

Permalink
Merge pull request #1943 from njorocs/idsr-jun27
Browse files Browse the repository at this point in the history
Idsr jun27
  • Loading branch information
patryllus authored Jul 5, 2024
2 parents 525168a + 79ea41c commit b3d8fbf
Show file tree
Hide file tree
Showing 51 changed files with 2,010 additions and 130 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public EncounterQueryResult evaluate(EncounterQuery definition, EvaluationContex
EncounterQueryResult queryResult = new EncounterQueryResult(definition, context);

String qry = "select i.encounter_id \n" +
"from kenyaemr_etl.etl_hei_immunization i inner join kenyaemr_etl.etl_hei_enrollment e on e.patient_id=i.patient_id\n" +
"from kenyaemr_etl.etl_immunization i inner join kenyaemr_etl.etl_hei_enrollment e on e.patient_id=i.patient_id\n" +
"where e.visit_date between date(:startDate) and (:endDate) ; ";

SqlQueryBuilder builder = new SqlQueryBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon
Cohort newCohort = new Cohort();

String qry = "select a.patient_id\n" +
"from (select patient_id, c.visit_date,group_concat(c.complaint) as complaint, c.complaint_date as complaint_date\n" +
"from (select patient_id, c.visit_date,group_concat(c.complaint) as complaint, DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY) as complaint_date,\n" +
" c.complaint_duration\n" +
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" +
" where c.complaint in (161887,122983)\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" +
"where timestampdiff(YEAR,date(d.DOB),coalesce(date(a.complaint_date),date(a.visit_date))) > 2 and FIND_IN_SET(122983, a.complaint) > 0\n" +
"where timestampdiff(YEAR,date(d.DOB),coalesce(date(DATE_SUB(a.visit_date, INTERVAL a.complaint_duration DAY)),date(a.visit_date))) > 2 and FIND_IN_SET(122983, a.complaint) > 0\n" +
" and FIND_IN_SET(161887, a.complaint) > 0;";

SqlQueryBuilder builder = new SqlQueryBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon
"from (select c.patient_id,\n" +
" group_concat(c.complaint) as complaint,\n" +
" epd.dob,\n" +
" c.complaint_date,\n" +
" DATE_SUB(c.visit_date, INTERVAL c.complaint_duration DAY),\n" +
" c.visit_date,\n" +
" v.visit_type_id,\n" +
" t.temperature,\n" +
Expand All @@ -61,7 +61,8 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon
" SUBSTRING_INDEX(\n" +
" SUBSTRING_INDEX(group_concat(concat_ws('|', c.complaint, c.complaint_duration)), '|', -1),\n" +
" ',', 1)\n" +
" END AS fever_duration_from_days\n" +
" END AS fever_duration_from_days,\n" +
" c.complaint_duration\n" +
" from kenyaemr_etl.etl_allergy_chronic_illness c\n" +
" inner join kenyaemr_etl.etl_patient_demographics epd on c.patient_id = epd.patient_id\n" +
" inner join openmrs.visit v ON c.patient_id = v.patient_id AND DATE(c.visit_date) = DATE(v.date_started)\n" +
Expand All @@ -71,8 +72,8 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon
" group by patient_id) a\n" +
"where ((FIND_IN_SET(117671, a.complaint) > 0 AND FIND_IN_SET(142412, a.complaint) > 0)\n" +
" OR (FIND_IN_SET(161887, a.complaint) > 0 AND FIND_IN_SET(122983, a.complaint) > 0 AND\n" +
" timestampdiff(YEAR, date(a.DOB), coalesce(date(a.complaint_date), date(a.visit_date))) > 2)\n" +
" OR (FIND_IN_SET(143264, a.complaint) > 0 AND timestampdiff(DAY, date(a.complaint_date), date(a.visit_date)) < 10 AND\n" +
" timestampdiff(YEAR, date(a.DOB), coalesce(date(DATE_SUB(a.visit_date, INTERVAL a.complaint_duration DAY)), date(a.visit_date))) > 2)\n" +
" OR (FIND_IN_SET(143264, a.complaint) > 0 AND timestampdiff(DAY, date(DATE_SUB(a.visit_date, INTERVAL a.complaint_duration DAY)), date(a.visit_date)) < 10 AND\n" +
" date(a.visit_date) BETWEEN DATE(:startDate) AND DATE(:endDate) AND a.visit_type_id IN (1, 3) AND\n" +
" a.temperature >= 38)\n" +
" OR (FIND_IN_SET(140238, a.complaint) > 0 AND FIND_IN_SET(141830, a.complaint) > 0 AND\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ 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, c.complaint_date as complaint_date, c.visit_date\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 timestampdiff(DAY, date(c.complaint_date), date(c.visit_date)) < 10\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" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ 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, c.complaint_date as complaint_date, c.visit_date\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 timestampdiff(DAY, date(c.complaint_date), date(c.visit_date)) < 10\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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class AdmittedInICUOrHDUDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public AdmittedInICUOrHDUDataDefinition() {
super();
}


/**
* Constructor to populate name only
*/
public AdmittedInICUOrHDUDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class ComplaintsOnsetDateDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public ComplaintsOnsetDateDataDefinition() {
super();
}

/**
* Constructor to populate name only
*/
public ComplaintsOnsetDateDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class Covid19DosesGivenDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public Covid19DosesGivenDataDefinition() {
super();
}


/**
* Constructor to populate name only
*/
public Covid19DosesGivenDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class Covid19SpecimenCollectedDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public Covid19SpecimenCollectedDataDefinition() {
super();
}


/**
* Constructor to populate name only
*/
public Covid19SpecimenCollectedDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class Covid19SpecimenCollectionDateDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public Covid19SpecimenCollectionDateDataDefinition() {
super();
}


/**
* Constructor to populate name only
*/
public Covid19SpecimenCollectionDateDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.dmi;

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;

/**
* Provider Column
*/
@Caching(strategy=ConfigurationPropertyCachingStrategy.class)
public class Covid19TestResultsDataDefinition extends BaseDataDefinition implements PersonDataDefinition {

public static final long serialVersionUID = 1L;

/**
* Default Constructor
*/
public Covid19TestResultsDataDefinition() {
super();
}


/**
* Constructor to populate name only
*/
public Covid19TestResultsDataDefinition(String name) {
super(name);
}

//***** INSTANCE METHODS *****

/**
* @see org.openmrs.module.reporting.data.DataDefinition#getDataType()
*/
public Class<?> getDataType() {
return Double.class;
}
}
Loading

0 comments on commit b3d8fbf

Please sign in to comment.