diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java index dd49c855c..b551b1ae5 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java @@ -76,13 +76,8 @@ protected List> buildDataSets(ReportDescriptor descrip ReportUtils.map(dysenteryDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map( choleraDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), - ReportUtils.map(riftValleyFeverDataSetDefinitionColumns(), - "startDate=${startDate},endDate=${endDate}"), ReportUtils.map( - malariaDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), - ReportUtils.map(chikungunyaDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map(poliomyelitisDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map(viralHaemorrhagicFeverDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), - ReportUtils.map(measlesDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map(mPoxDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map(jaundiceDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), ReportUtils.map(febrileIllnessDataSetDefinitionColumns(), "startDate=${startDate},endDate=${endDate}"), @@ -100,31 +95,16 @@ protected DataSetDefinition caseIdentificationClassificationIndicators() { cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); String indParams = "startDate=${startDate},endDate=${endDate}"; - cohortDsd.addColumn("Dysentery", "", - ReportUtils.map(idsrIndicatorLibrary.dysenteryCases(), indParams), ""); - cohortDsd.addColumn("Cholera", "", - ReportUtils.map(idsrIndicatorLibrary.choleraCases(), indParams), ""); cohortDsd.addColumn("ILI", "", ReportUtils.map(idsrIndicatorLibrary.iliCases(), indParams), ""); cohortDsd.addColumn("SARI", "", ReportUtils.map(idsrIndicatorLibrary.sariCases(), indParams), ""); - cohortDsd.addColumn( - "Riftvalley Fever", "", - ReportUtils.map(idsrIndicatorLibrary.riftvalleyFeverCases(), indParams), ""); - cohortDsd.addColumn( - "Malaria", "", - ReportUtils.map(idsrIndicatorLibrary.malariaCases(), indParams), ""); - cohortDsd.addColumn("Chikungunya", "", - ReportUtils.map(idsrIndicatorLibrary.chikungunyaCases(), indParams), ""); cohortDsd.addColumn( "Acute Flaccid Paralysis", "", ReportUtils.map(idsrIndicatorLibrary.poliomyelitisCases(), indParams), ""); cohortDsd.addColumn( "Acute Haemorrhagic Fever", "", ReportUtils.map(idsrIndicatorLibrary.viralHaemorrhagicFeverCases(), indParams), ""); - cohortDsd.addColumn( - "Measles", - "", ReportUtils.map(idsrIndicatorLibrary.measlesCases(), indParams), ""); cohortDsd.addColumn( "Monkey Pox", "", ReportUtils.map(idsrIndicatorLibrary.monkeyPoxCases(), indParams), ""); @@ -591,179 +571,6 @@ protected DataSetDefinition sariDataSetDefinitionColumns() { return dsd; } - protected DataSetDefinition riftValleyFeverDataSetDefinitionColumns() { - PatientDataSetDefinition dsd = new PatientDataSetDefinition(); - dsd.setName("riftvalleyFever"); - dsd.setDescription("Riftvalley Fever"); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - String paramMapping = "startDate=${startDate},endDate=${endDate}"; - - PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, - HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); - PatientIdentifierType nupi = MetadataUtils.existing(PatientIdentifierType.class, - CommonMetadata._PatientIdentifierType.NATIONAL_UNIQUE_PATIENT_IDENTIFIER); - DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); - DataDefinition identifierDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - upn.getName(), upn), identifierFormatter); - DataDefinition nupiDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - nupi.getName(), nupi), identifierFormatter); - AgeAtReportingDataDefinition ageAtReportingDataDefinition = new AgeAtReportingDataDefinition(); - ageAtReportingDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ETLNextAppointmentDateDataDefinition lastAppointmentDateDataDefinition = new ETLNextAppointmentDateDataDefinition(); - lastAppointmentDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - lastAppointmentDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - VisitTypeWithComplaintsDataDefinition visitTypeDataDefinition = new VisitTypeWithComplaintsDataDefinition(); - visitTypeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitTypeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ComplaintAttendantProviderDataDefinition attendedByDataDefinition = new ComplaintAttendantProviderDataDefinition(); - attendedByDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - attendedByDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - VisitDateWithComplaintsDataDefinition visitDateWithComplaintsDataDefinition = new VisitDateWithComplaintsDataDefinition(); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - DataConverter formatter = new ObjectFormatter("{familyName}, {givenName}"); - DataDefinition nameDef = new ConvertedPersonDataDefinition("name", - new PreferredNameDataDefinition(), formatter); - PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, - CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); - dsd.addColumn("id", new PersonIdDataDefinition(), ""); - dsd.addColumn("Name", nameDef, ""); - // dsd.addColumn("Hospital Unit", new MFLCodeDataDefinition(), ""); - dsd.addColumn("Visit Type", visitTypeDataDefinition, paramMapping); - dsd.addColumn("Sex", new GenderDataDefinition(), "", null); - dsd.addColumn("Age", ageAtReportingDataDefinition, "endDate=${endDate}"); - dsd.addColumn("Visit Date", visitDateWithComplaintsDataDefinition, paramMapping); - dsd.addColumn("Attended By", attendedByDataDefinition, paramMapping); - dsd.addColumn("Next Visit", lastAppointmentDateDataDefinition, paramMapping); - - RiftValleyFeverCohortDefinition cd = new RiftValleyFeverCohortDefinition(); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - - dsd.addRowFilter(cd, paramMapping); - return dsd; - } - - protected DataSetDefinition malariaDataSetDefinitionColumns() { - PatientDataSetDefinition dsd = new PatientDataSetDefinition(); - dsd.setName("malaria"); - dsd.setDescription("Malaria Information"); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - String paramMapping = "startDate=${startDate},endDate=${endDate}"; - - PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, - HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); - PatientIdentifierType nupi = MetadataUtils.existing(PatientIdentifierType.class, - CommonMetadata._PatientIdentifierType.NATIONAL_UNIQUE_PATIENT_IDENTIFIER); - DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); - DataDefinition identifierDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - upn.getName(), upn), identifierFormatter); - DataDefinition nupiDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - nupi.getName(), nupi), identifierFormatter); - AgeAtReportingDataDefinition ageAtReportingDataDefinition = new AgeAtReportingDataDefinition(); - ageAtReportingDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ETLNextAppointmentDateDataDefinition lastAppointmentDateDataDefinition = new ETLNextAppointmentDateDataDefinition(); - lastAppointmentDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - lastAppointmentDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - VisitTypeWithComplaintsDataDefinition visitTypeDataDefinition = new VisitTypeWithComplaintsDataDefinition(); - visitTypeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitTypeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ComplaintAttendantProviderDataDefinition attendedByDataDefinition = new ComplaintAttendantProviderDataDefinition(); - attendedByDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - attendedByDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - VisitDateWithComplaintsDataDefinition visitDateWithComplaintsDataDefinition = new VisitDateWithComplaintsDataDefinition(); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - DataConverter formatter = new ObjectFormatter("{familyName}, {givenName}"); - DataDefinition nameDef = new ConvertedPersonDataDefinition("name", - new PreferredNameDataDefinition(), formatter); - PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, - CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); - dsd.addColumn("id", new PersonIdDataDefinition(), ""); - dsd.addColumn("Name", nameDef, ""); - // dsd.addColumn("Hospital Unit", new MFLCodeDataDefinition(), ""); - dsd.addColumn("Visit Type", visitTypeDataDefinition, paramMapping); - dsd.addColumn("Sex", new GenderDataDefinition(), "", null); - dsd.addColumn("Age", ageAtReportingDataDefinition, "endDate=${endDate}"); - dsd.addColumn("Visit Date", visitDateWithComplaintsDataDefinition, paramMapping); - dsd.addColumn("Attended By", attendedByDataDefinition, paramMapping); - dsd.addColumn("Next Visit", lastAppointmentDateDataDefinition, paramMapping); - - MalariaCohortDefinition cd = new MalariaCohortDefinition(); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - - dsd.addRowFilter(cd, paramMapping); - return dsd; - } - - protected DataSetDefinition chikungunyaDataSetDefinitionColumns() { - PatientDataSetDefinition dsd = new PatientDataSetDefinition(); - dsd.setName("chikungunya"); - dsd.setDescription("Chikungunya"); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - String paramMapping = "startDate=${startDate},endDate=${endDate}"; - - PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, - HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); - PatientIdentifierType nupi = MetadataUtils.existing(PatientIdentifierType.class, - CommonMetadata._PatientIdentifierType.NATIONAL_UNIQUE_PATIENT_IDENTIFIER); - DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); - DataDefinition identifierDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - upn.getName(), upn), identifierFormatter); - DataDefinition nupiDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - nupi.getName(), nupi), identifierFormatter); - AgeAtReportingDataDefinition ageAtReportingDataDefinition = new AgeAtReportingDataDefinition(); - ageAtReportingDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ETLNextAppointmentDateDataDefinition lastAppointmentDateDataDefinition = new ETLNextAppointmentDateDataDefinition(); - lastAppointmentDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - lastAppointmentDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - VisitTypeWithComplaintsDataDefinition visitTypeDataDefinition = new VisitTypeWithComplaintsDataDefinition(); - visitTypeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitTypeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ComplaintAttendantProviderDataDefinition attendedByDataDefinition = new ComplaintAttendantProviderDataDefinition(); - attendedByDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - attendedByDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - VisitDateWithComplaintsDataDefinition visitDateWithComplaintsDataDefinition = new VisitDateWithComplaintsDataDefinition(); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - DataConverter formatter = new ObjectFormatter("{familyName}, {givenName}"); - DataDefinition nameDef = new ConvertedPersonDataDefinition("name", - new PreferredNameDataDefinition(), formatter); - PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, - CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); - dsd.addColumn("id", new PersonIdDataDefinition(), ""); - dsd.addColumn("Name", nameDef, ""); - // dsd.addColumn("Hospital Unit", new MFLCodeDataDefinition(), ""); - dsd.addColumn("Visit Type", visitTypeDataDefinition, paramMapping); - dsd.addColumn("Sex", new GenderDataDefinition(), "", null); - dsd.addColumn("Age", ageAtReportingDataDefinition, "endDate=${endDate}"); - dsd.addColumn("Visit Date", visitDateWithComplaintsDataDefinition, paramMapping); - dsd.addColumn("Attended By", attendedByDataDefinition, paramMapping); - dsd.addColumn("Next Visit", lastAppointmentDateDataDefinition, paramMapping); - - ChikungunyaCohortDefinition cd = new ChikungunyaCohortDefinition(); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - - dsd.addRowFilter(cd, paramMapping); - return dsd; - } protected DataSetDefinition poliomyelitisDataSetDefinitionColumns() { PatientDataSetDefinition dsd = new PatientDataSetDefinition(); @@ -881,64 +688,6 @@ protected DataSetDefinition viralHaemorrhagicFeverDataSetDefinitionColumns() { return dsd; } - protected DataSetDefinition measlesDataSetDefinitionColumns() { - PatientDataSetDefinition dsd = new PatientDataSetDefinition(); - dsd.setName("measles"); - dsd.setDescription("Measles"); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - String paramMapping = "startDate=${startDate},endDate=${endDate}"; - - PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, - HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); - PatientIdentifierType nupi = MetadataUtils.existing(PatientIdentifierType.class, - CommonMetadata._PatientIdentifierType.NATIONAL_UNIQUE_PATIENT_IDENTIFIER); - DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); - DataDefinition identifierDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - upn.getName(), upn), identifierFormatter); - DataDefinition nupiDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition( - nupi.getName(), nupi), identifierFormatter); - AgeAtReportingDataDefinition ageAtReportingDataDefinition = new AgeAtReportingDataDefinition(); - ageAtReportingDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ETLNextAppointmentDateDataDefinition lastAppointmentDateDataDefinition = new ETLNextAppointmentDateDataDefinition(); - lastAppointmentDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - lastAppointmentDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - VisitTypeWithComplaintsDataDefinition visitTypeDataDefinition = new VisitTypeWithComplaintsDataDefinition(); - visitTypeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitTypeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - ComplaintAttendantProviderDataDefinition attendedByDataDefinition = new ComplaintAttendantProviderDataDefinition(); - attendedByDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - attendedByDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - VisitDateWithComplaintsDataDefinition visitDateWithComplaintsDataDefinition = new VisitDateWithComplaintsDataDefinition(); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); - visitDateWithComplaintsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); - - DataConverter formatter = new ObjectFormatter("{familyName}, {givenName}"); - DataDefinition nameDef = new ConvertedPersonDataDefinition("name", - new PreferredNameDataDefinition(), formatter); - PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, - CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); - dsd.addColumn("id", new PersonIdDataDefinition(), ""); - dsd.addColumn("Name", nameDef, ""); - // dsd.addColumn("Hospital Unit", new MFLCodeDataDefinition(), ""); - dsd.addColumn("Visit Type", visitTypeDataDefinition, paramMapping); - dsd.addColumn("Sex", new GenderDataDefinition(), "", null); - dsd.addColumn("Age", ageAtReportingDataDefinition, "endDate=${endDate}"); - dsd.addColumn("Visit Date", visitDateWithComplaintsDataDefinition, paramMapping); - dsd.addColumn("Attended By", attendedByDataDefinition, paramMapping); - dsd.addColumn("Next Visit", lastAppointmentDateDataDefinition, paramMapping); - - MeaslesCohortDefinition cd = new MeaslesCohortDefinition(); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - - dsd.addRowFilter(cd, paramMapping); - return dsd; - } - protected DataSetDefinition mPoxDataSetDefinitionColumns() { PatientDataSetDefinition dsd = new PatientDataSetDefinition(); dsd.setName("mPox"); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java index e106780b4..40069bb07 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java @@ -28,55 +28,6 @@ @Component public class IDSRCohortLibrary { - - /** - * Dysentery cases - * @return - */ - public CohortDefinition dysenteryCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - String sqlQuery = "select a.patient_id\n" + - "from (select patient_id, group_concat(c.complaint) as complaint\n" + - " from kenyaemr_etl.etl_allergy_chronic_illness c\n" + - " where c.complaint in (117671, 142412)\n" + - " and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + - " group by patient_id) a\n" + - "where FIND_IN_SET(117671, a.complaint) > 0\n" + - " and FIND_IN_SET(142412, a.complaint) > 0;"; - cd.setName("dysenteryCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Dysentery cases"); - - return cd; - } - - /** - * Cholera cases - * @return - */ - public CohortDefinition choleraCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - String sqlQuery = "select a.patient_id\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(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;"; - cd.setName("choleraCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Cholera cases"); - - return cd; - } - /** * ILI Cases * @return @@ -128,105 +79,6 @@ public CohortDefinition sariCases() { return cd; } - - /** - * Riftvalley Fever Cases - * @return - */ - public CohortDefinition riftvalleyFeverCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - 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 in (140238,141830,136443,135367)\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 > 37.5 and date(a.visit_date) between date(:startDate) and date(:endDate)\n" + - "where FIND_IN_SET(140238, a.complaint) > 0\n" + - " and (FIND_IN_SET(141830, a.complaint) > 0 and a.fever_duration_from_days > 2)\n" + - " and FIND_IN_SET(136443, a.complaint) > 0\n" + - " and FIND_IN_SET(135367, a.complaint) > 0;"; - cd.setName("riftvalleyFeverCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Riftvalley Fever Cases"); - - return cd; - } - - /** - * Malaria Cases - * @return - */ - public CohortDefinition malariaCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - 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 in (140238,139084,871)\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 > 37.5 and date(a.visit_date) between date(:startDate) and date(:endDate)\n" + - "where FIND_IN_SET(140238, a.complaint) > 0\n" + - " and FIND_IN_SET(139084, a.complaint) > 0\n" + - " and FIND_IN_SET(871, a.complaint) > 0\n" + - " and a.fever_duration_from_days > 1;"; - cd.setName("malariaCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Malaria cases"); - - return cd; - } - - /** - * Chikungunya Cases - * @return - */ - public CohortDefinition chikungunyaCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - 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 in (140238, 116558)\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 fever_duration_from_days > 2\n" + - " and FIND_IN_SET(140238, a.complaint) > 0\n" + - " and FIND_IN_SET(116558, a.complaint) > 0"; - cd.setName("chikungunyaCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Chikungunya cases"); - - return cd; - } - /** * Poliomyelitis Cases * @return @@ -278,36 +130,6 @@ public CohortDefinition viralHaemorrhagicFeverCases() { cd.setDescription("Acute Haemorrhagic Fever"); return cd;} - /** - * Measles Cases - * @return - */ - public CohortDefinition measlesCases() { - SqlCohortDefinition cd = new SqlCohortDefinition(); - 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 in (140238,512,106,516,143264)\n" + - " and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + - " group by patient_id) a\n" + - " where fever_duration_from_days > 2\n" + - " and FIND_IN_SET(140238, a.complaint) > 0\n" + - " and FIND_IN_SET(512, a.complaint) > 0\n" + - " and FIND_IN_SET(106, a.complaint) > 0\n" + - " and FIND_IN_SET(516, a.complaint) > 0\n" + - " and FIND_IN_SET(143264, a.complaint) > 0;"; - cd.setName("measlesCases"); - cd.setQuery(sqlQuery); - cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Measles Cases"); - - return cd; - } /** * Monkey Pox Cases * @return @@ -343,13 +165,10 @@ public CohortDefinition monkeyPoxCases() { return cd; } - - /** * Jaundice cases * @return */ - public CohortDefinition jaundiceCases() { SqlCohortDefinition cd = new SqlCohortDefinition(); String sqlQuery = "SELECT a.patient_id\n" + diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRIndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRIndicatorLibrary.java index fb142d1e2..bdbecd5a7 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRIndicatorLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRIndicatorLibrary.java @@ -31,23 +31,6 @@ public class IDSRIndicatorLibrary { @Autowired private IDSRCohortLibrary idsrCohortLibrary; - - /** - * Dysentery Cases - * @return indicator - */ - public CohortIndicator dysenteryCases() { - return cohortIndicator("Individuals tested at the facility", map(idsrCohortLibrary.dysenteryCases(), "startDate=${startDate},endDate=${endDate}")); - } - - /** - * Cholera Cases - * @return indicator - */ - public CohortIndicator choleraCases() { - return cohortIndicator("Individuals tested", map(idsrCohortLibrary.choleraCases(), "startDate=${startDate},endDate=${endDate}")); - } - /** * ILI Cases * @return indicator @@ -64,30 +47,6 @@ public CohortIndicator sariCases() { return cohortIndicator("New tests", map(idsrCohortLibrary.sariCases(), "startDate=${startDate},endDate=${endDate}")); } - /** - * Riftvalley Fever Cases - * @return indicator - */ - public CohortIndicator riftvalleyFeverCases() { - return cohortIndicator("Repeat tests", map(idsrCohortLibrary.riftvalleyFeverCases(), "startDate=${startDate},endDate=${endDate}")); - } - - /** - * Malaria - * @return indicator - */ - public CohortIndicator malariaCases() { - return cohortIndicator("Couple testing", map(idsrCohortLibrary.malariaCases(), "startDate=${startDate},endDate=${endDate}")); - } - - /** - * Chikungunya Cases - * @return indicator - */ - public CohortIndicator chikungunyaCases() { - return cohortIndicator("Key population testing", map(idsrCohortLibrary.chikungunyaCases(), "startDate=${startDate},endDate=${endDate}")); - } - /** * Poliomyelitis Cases * @return indicator @@ -104,14 +63,6 @@ public CohortIndicator viralHaemorrhagicFeverCases() { return cohortIndicator("Acute Haemorrhagic Fever", map(idsrCohortLibrary.viralHaemorrhagicFeverCases(), "startDate=${startDate},endDate=${endDate}")); } - /** - * Measles cases - * @return indicator - */ - public CohortIndicator measlesCases() { - return cohortIndicator("Measles cases", map(idsrCohortLibrary.measlesCases(), "startDate=${startDate},endDate=${endDate}")); - } - /** * Monkey Pox Cases * @return indicator