From 1735d3938cf041b0b8379a12c35df7b748bf9efa Mon Sep 17 00:00:00 2001 From: njorocs Date: Thu, 12 Sep 2024 15:22:33 +0300 Subject: [PATCH] Restoring MOH731 Revision Y18 report to facilitate Aug 2024 reporting. To be retired once clients fully adopt revision Y23 tools. --- .../hiv/OldMoh731KDoDReportBuilder.java | 321 ++ .../builder/hiv/OldMoh731ReportBuilder.java | 372 ++ .../ETLOldMoh731GreenCardCohortLibrary.java | 3366 +++++++++++++++++ ...ETLOldMoh731GreenCardIndicatorLibrary.java | 1324 +++++++ .../resources/content/kenyaemr.common.xml | 27 +- .../resources/reports/moh731-KDoD-old.xls | Bin 0 -> 68096 bytes ...{moh731_retired.xls => moh731_old_y18.xls} | Bin 7 files changed, 5408 insertions(+), 2 deletions(-) create mode 100644 api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731KDoDReportBuilder.java create mode 100644 api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731ReportBuilder.java create mode 100644 api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardCohortLibrary.java create mode 100644 api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardIndicatorLibrary.java create mode 100644 omod/src/main/webapp/resources/reports/moh731-KDoD-old.xls rename omod/src/main/webapp/resources/reports/{moh731_retired.xls => moh731_old_y18.xls} (100%) diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731KDoDReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731KDoDReportBuilder.java new file mode 100644 index 0000000000..c927a4df8a --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731KDoDReportBuilder.java @@ -0,0 +1,321 @@ +/** + * 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.builder.hiv; + +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyaemr.reporting.ColumnParameters; +import org.openmrs.module.kenyaemr.reporting.EmrReportingUtils; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.RevisedDatim.DatimIndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.moh731Old.ETLOldMoh731GreenCardIndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; +import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * Report builder for ETL MOH 731 KDoD + */ +@Component +@Builds({"kenyaemr.etl.common.report.Moh731KDoD.old"}) +public class OldMoh731KDoDReportBuilder extends AbstractReportBuilder { + @Autowired + private CommonDimensionLibrary commonDimensions; + + @Autowired + private ETLOldMoh731GreenCardIndicatorLibrary moh731GreenCardIndicators; + @Autowired + private DatimIndicatorLibrary datimIndicators; + + public static final String DATE_FORMAT = "yyyy-MM-dd"; + + ColumnParameters colInfants_T = new ColumnParameters(null, "<1, Troop", "age=<1|cadre=T"); + ColumnParameters colInfants_C = new ColumnParameters(null, "<1, Civilian", "age=<1|cadre=C"); + + ColumnParameters _10_to_14_T = new ColumnParameters(null, "10-14, Troop", "cadre=T|age=10-14"); + ColumnParameters _10_to_14_C = new ColumnParameters(null, "10-14, Civilian", "cadre=C|age=10-14"); + + ColumnParameters _15_to_19_T = new ColumnParameters(null, "15-19, Troop", "cadre=T|age=15-19"); + ColumnParameters _15_to_19_C = new ColumnParameters(null, "15-19, Civilian", "cadre=C|age=15-19"); + + ColumnParameters _20_to_24_T = new ColumnParameters(null, "20-24, Troop", "cadre=T|age=20-24"); + ColumnParameters _20_to_24_C = new ColumnParameters(null, "20-24, Civilian", "cadre=C|age=20-24"); + + ColumnParameters _25_to_49_T = new ColumnParameters(null, "25-49, Troop", "cadre=T|age=25-49"); + ColumnParameters _25_to_49_C = new ColumnParameters(null, "25-49, Civilian", "cadre=C|age=25-49"); + + ColumnParameters above_50_T = new ColumnParameters(null, "50+, Troop", "cadre=T|age=50+"); + ColumnParameters above_50_C = new ColumnParameters(null, "50+, Civilian", "cadre=C|age=50+"); + + ColumnParameters colTotal = new ColumnParameters(null, "Total", ""); + ColumnParameters children_1_to_9_T = new ColumnParameters(null, "1-9,Troop", "age=1-9|cadre=T"); + ColumnParameters children_1_to_9_C = new ColumnParameters(null, "1-9,Civilian", "age=1-9|cadre=C"); + + ColumnParameters adult_15_to_19_T = new ColumnParameters(null, "15-19,Troop", "age=15-19|cadre=T"); + ColumnParameters adult_15_to_19_C = new ColumnParameters(null, "15-19,Civilian", "age=15-19|cadre=C"); + ColumnParameters adult_20_to_24_T = new ColumnParameters(null, "20-24,Troop", "age=20-24|cadre=T"); + ColumnParameters adult_20_to_24_C = new ColumnParameters(null, "20-24,Civilian", "age=20-24|cadre=C"); + + ColumnParameters _0_to_14_T = new ColumnParameters(null, "0-14,Troop", "age=0-14|cadre=T"); + ColumnParameters _0_to_14_C = new ColumnParameters(null, "0-14,Civilian", "age=0-14|cadre=C"); + ColumnParameters adult_15_and_above_T = new ColumnParameters(null, "15+,Troop", "age=15+|cadre=T"); + ColumnParameters adult_15_and_above_C = new ColumnParameters(null, "15+,Civilian", "age=15+|cadre=C"); + + ColumnParameters m_10_to_14_T = new ColumnParameters(null, "10-14, Male,Troop", "gender=M|age=10-14|cadre=T"); + ColumnParameters m_10_to_14_C = new ColumnParameters(null, "10-14, Male,Civilian", "gender=M|age=10-14|cadre=C"); + ColumnParameters f_10_to_14_T = new ColumnParameters(null, "10-14, Female,Troop", "gender=F|age=10-14|cadre=T"); + ColumnParameters f_10_to_14_C = new ColumnParameters(null, "10-14, Female,Civilian", "gender=F|age=10-14|cadre=C"); + + ColumnParameters m_15_to_19_T = new ColumnParameters(null, "15-19, Male,Troop", "gender=M|age=15-19|cadre=T"); + ColumnParameters m_15_to_19_C = new ColumnParameters(null, "15-19, Male,Civilian", "gender=M|age=15-19|cadre=C"); + ColumnParameters f_15_to_19_T = new ColumnParameters(null, "15-19, Female,Troop", "gender=F|age=15-19|cadre=T"); + ColumnParameters f_15_to_19_C = new ColumnParameters(null, "15-19, Female,Civilian", "gender=F|age=15-19|cadre=C"); + + ColumnParameters m_20_to_24_T = new ColumnParameters(null, "20-24, Male,Troop", "gender=M|age=20-24|cadre=T"); + ColumnParameters m_20_to_24_C = new ColumnParameters(null, "20-24, Male,Civilian", "gender=M|age=20-24|cadre=C"); + ColumnParameters f_20_to_24_T = new ColumnParameters(null, "20-24, Female,Troop", "gender=F|age=20-24|cadre=T"); + ColumnParameters f_20_to_24_C = new ColumnParameters(null, "20-24, Female,Civilian", "gender=F|age=20-24|cadre=C"); + + + ColumnParameters m_25_to_49_T = new ColumnParameters(null, "25-49, Male,Troop", "gender=M|age=25-49|cadre=T"); + ColumnParameters m_25_to_49_C = new ColumnParameters(null, "25-49, Male,Civilian", "gender=M|age=25-49|cadre=C"); + ColumnParameters f_25_to_49_T = new ColumnParameters(null, "25-49, Female,Troop", "gender=F|age=25-49|cadre=T"); + ColumnParameters f_25_to_49_C = new ColumnParameters(null, "25-49, Female,Civilian", "gender=F|age=25-49|cadre=C"); + ColumnParameters m_50_and_above_T = new ColumnParameters(null, "50+, Male,Troop", "gender=M|age=50+|cadre=T"); + ColumnParameters m_50_and_above_C = new ColumnParameters(null, "50+, Male,Civilian", "gender=M|age=50+|cadre=C"); + ColumnParameters f_50_and_above_T = new ColumnParameters(null, "50+, Female,Troop", "gender=F|age=50+|cadre=T"); + ColumnParameters f_50_and_above_C = new ColumnParameters(null, "50+, Female,Civilian", "gender=F|age=50+|cadre=C"); + ColumnParameters troop_dimension = new ColumnParameters(null, "Troop", "cadre=T"); + ColumnParameters civilian_dimension = new ColumnParameters(null, "Civilian", "cadre=C"); + + List kdodDisaggregation = Arrays.asList( + children_1_to_9_T,children_1_to_9_C, m_10_to_14_T,m_10_to_14_C, f_10_to_14_T,f_10_to_14_C, m_15_to_19_T,m_15_to_19_C,f_15_to_19_T,f_15_to_19_C, + m_20_to_24_T,m_20_to_24_C, f_20_to_24_T,f_20_to_24_C, m_25_to_49_T,m_25_to_49_C, f_25_to_49_T,f_25_to_49_C,m_50_and_above_T, + m_50_and_above_C,f_50_and_above_T,f_50_and_above_C,colTotal); + + List standardKDoDDisaggregation = Arrays.asList( + colInfants_T,colInfants_C, children_1_to_9_T,children_1_to_9_C, m_10_to_14_T, m_10_to_14_C, f_10_to_14_T, f_10_to_14_C, + m_15_to_19_T, m_15_to_19_C, f_15_to_19_T, f_15_to_19_C ,m_20_to_24_T,m_20_to_24_C,f_20_to_24_T,f_20_to_24_C,m_25_to_49_T,m_25_to_49_C,f_25_to_49_T,f_25_to_49_C,m_50_and_above_T, + m_50_and_above_C,f_50_and_above_T,f_50_and_above_C, colTotal); + + List ageAndCadreDisaggregation = Arrays.asList( + colInfants_T,colInfants_C, children_1_to_9_T,children_1_to_9_C, _10_to_14_T,_10_to_14_C, adult_15_to_19_T,adult_15_to_19_C, + adult_20_to_24_T,adult_20_to_24_C,_25_to_49_T,_25_to_49_C, above_50_T,above_50_C, colTotal); + + List kdodCadreWithAge = Arrays.asList( + children_1_to_9_T,children_1_to_9_C, _10_to_14_T,_10_to_14_C, _15_to_19_T,_15_to_19_C, _20_to_24_T,_20_to_24_C,_25_to_49_T,_25_to_49_C, above_50_T,above_50_C,colTotal); + + List preARTDisaggregation = Arrays.asList( + _0_to_14_T,_0_to_14_C, adult_15_and_above_T,adult_15_and_above_C , colTotal); + + List cadreDisaggregation = Arrays.asList( + troop_dimension, civilian_dimension , colTotal); + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList( + new Parameter("startDate", "Start Date", Date.class), + new Parameter("endDate", "End Date", Date.class), + new Parameter("dateBasedReporting", "", String.class) + ); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, ReportDefinition reportDefinition) { + return Arrays.asList( + ReportUtils.map(hivTestingAndCouselingDatasetDefinition(), "startDate=${startDate},endDate=${endDate}"), + ReportUtils.map(pmtctDataSetKDoD(), "startDate=${startDate},endDate=${endDate}"), + ReportUtils.map(careAndTreatmentDataSet(), "startDate=${startDate},endDate=${endDate}") + ); + } + /** + * Creates the dataset for section #2: Prevention of Mother-to-Child Transmission + * + * @return the dataset + */ + protected DataSetDefinition pmtctDataSetKDoD() { + CohortIndicatorDataSetDefinition indicatorDsd = new CohortIndicatorDataSetDefinition(); + indicatorDsd.setName("2"); + indicatorDsd.setDescription("Prevention of Mother-to-Child Transmission"); + indicatorDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + indicatorDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + indicatorDsd.addDimension("cadre", ReportUtils.map(commonDimensions.cadre())); + + String indParams = "startDate=${startDate},endDate=${endDate}"; +//Updates + EmrReportingUtils.addRow(indicatorDsd,"HV02-01", "First ANC Visit", ReportUtils.map(moh731GreenCardIndicators.firstANCVisitMchmsAntenatal(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-02", "Delivery from HIV+ Mothers(Labor and Delivery)", ReportUtils.map(moh731GreenCardIndicators.deliveryFromHIVPositiveMothers(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-03", "Known Positive at 1st ANC (Antenatal)", ReportUtils.map(moh731GreenCardIndicators.knownPositiveAtFirstANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-04", "Initial test at ANC (Antenatal)", ReportUtils.map(moh731GreenCardIndicators.initialHIVTestInMchmsAntenatal(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-05", "Initial Test at Labor and Delivery", ReportUtils.map(moh731GreenCardIndicators.testedForHivInMchmsDelivery(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-06", "Initial Test at PNC <=6 Weeks)", ReportUtils.map(moh731GreenCardIndicators.initialTestAtPNCUpto6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-07", "Known HIV Status Total", ReportUtils.map(moh731GreenCardIndicators.testedForHivInMchms(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-08", "PNC Retest within 6 weeks)", ReportUtils.map(moh731GreenCardIndicators.pncRetestUpto6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-09", "PNC Testing between 7 weeks - 6 months)", ReportUtils.map(moh731GreenCardIndicators.pncTestBtwn6WeeksAnd6Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-10", "HIV positive Before First ANC)", ReportUtils.map(moh731GreenCardIndicators.knownHivPositiveAtFirstANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-11", "HIV positive results ANC", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInMchmsAntenatal(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-12", "HIV positive results (Labor and Delivery)", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInMchmsDelivery(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-13", "HIV positive results <=6 weeks)", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInPNCWithin6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-14", "Total HIV positive Mothers)", ReportUtils.map(moh731GreenCardIndicators.totalHivPositiveInMchms(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-15", "PNC >6 weeks and <=6 months", ReportUtils.map(moh731GreenCardIndicators.pncHIVPositiveBetween7weeksAnd6Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-16", "On HAART at 1st ANC", ReportUtils.map(moh731GreenCardIndicators.onHAARTAtFirstANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-17", "Start HAART during ANC", ReportUtils.map(moh731GreenCardIndicators.startHAARTANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-18", "Start HAART During Labour and Delivery", ReportUtils.map(moh731GreenCardIndicators.startedHAARTLabourAndDelivery(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-19", "Started HAART upto 6 weeks", ReportUtils.map(moh731GreenCardIndicators.startedHAARTPNCUpto6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-21", "Started HAART from 7 weeks to 6 months", ReportUtils.map(moh731GreenCardIndicators.onHAARTFrom7WeeksTo6Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-22", "On HAART Upto 12 months", ReportUtils.map(moh731GreenCardIndicators.onHAARTUpto12Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-23", "Net Cohort at 12 months", ReportUtils.map(moh731GreenCardIndicators.netCohortAt12Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-24", "Syphilis screened at 1st ANC", ReportUtils.map(moh731GreenCardIndicators.syphilisScreenedAtANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-25", "Syphilis screened Positive", ReportUtils.map(moh731GreenCardIndicators.syphilisScreenedPositive(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-26", "Syphilis Treated", ReportUtils.map(moh731GreenCardIndicators.syphilisTreated(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-27", "HIV+ on Modern FP at 6 weeks", ReportUtils.map(moh731GreenCardIndicators.HIVPositiveOnModernFPUpto6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-28", "HIV+ PNC visits at 6 weeks", ReportUtils.map(moh731GreenCardIndicators.HIVPositivePNCVisitsAt6Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-29", "Known HIV+ 1st Contact", ReportUtils.map(moh731GreenCardIndicators.knownHIVStatusAt1stContact(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-30", "Initial Test at ANC Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtANCForMale(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-31", "Initial Test at Delivery Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtDeliveryForMale(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-32", "Initial Test at PNC Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtPNCForMale(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-34", "1st ANC KP Adolescent (10-19)", ReportUtils.map(moh731GreenCardIndicators.firstANCKPAdolescents(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-35", "HIV Positive Adolescents", ReportUtils.map(moh731GreenCardIndicators.adolescentsHIVPositive(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-36", "Adolescents started on HAART", ReportUtils.map(moh731GreenCardIndicators.adolescentsStartedOnHAART(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + //Infant HIV Exposure status at Penta 1 + EmrReportingUtils.addRow(indicatorDsd,"HV02-37", "Known Exposure at Penta 1", ReportUtils.map(moh731GreenCardIndicators.knownExposureAtPenta1(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-38", "Total due for Penta 1", ReportUtils.map(moh731GreenCardIndicators.totalGivenPenta1(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + //Infant ARV Prophylaxis + EmrReportingUtils.addRow(indicatorDsd,"HV02-39", "Infant ARV Prophylaxis at ANC", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisANC(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-40", "Infant ARV Prophylaxis at Labour and Delivery", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisLabourAndDelivery(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-41", "Infant ARV Prophylaxis <8 weeks PNC", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisPNCLessThan8Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-43", "HEI CTS/DDS Start <2 months", ReportUtils.map(moh731GreenCardIndicators.heiDDSCTXStartLessThan2Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-44", "Initial PCR <8 weeks", ReportUtils.map(moh731GreenCardIndicators.initialPCRLessThan8Weeks(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-45", "Initial PCR >8 weeks to 12 months", ReportUtils.map(moh731GreenCardIndicators.initialPCROver8WeeksTo12Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-46", "Total Initial PCR Test <12 months", ReportUtils.map(moh731GreenCardIndicators.totalInitialPCRTestLessThan12Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-47", "Infected in 24 months", ReportUtils.map(datimIndicators.hivInfectedHEI(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-48", "Uninfected in 24 months", ReportUtils.map(datimIndicators.hivUninfectedHEI(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-49", "Unknown Outcomes in 24 months", ReportUtils.map(datimIndicators.unknownHIVStatusHEI(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-50", "Net Cohort HEI in 24 months", ReportUtils.map(moh731GreenCardIndicators.netCohortHeiIn24Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-51", "Mother-baby pairs in 24 months", ReportUtils.map(moh731GreenCardIndicators.motherBabyPairsIn24Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-52", "Pair net cohort in 24 months", ReportUtils.map(moh731GreenCardIndicators.pairNetCohortIn24Months(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-53", "Exclusive Breastfeeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.exclusiveBFAt6Months12MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-54", "Exclusive Replacement Feeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.exclusiveRFAt6Months12MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-55", "Mixed Feeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.mixedFeedingAt6Months12MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-56", "Breast Feeding at 12 months", ReportUtils.map(moh731GreenCardIndicators.breastFeedingAt12Months12MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-57", "Not Breast Feeding at 12 months", ReportUtils.map(moh731GreenCardIndicators.notBreastFeedingAt12Months12MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-58", "Breast Feeding at 18 months", ReportUtils.map(moh731GreenCardIndicators.breastFeedingAt18Months24MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + EmrReportingUtils.addRow(indicatorDsd,"HV02-59", "Not Breast Feeding at 18 months", ReportUtils.map(moh731GreenCardIndicators.notBreastFeedingAt18Months24MonthCohort(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); + + return indicatorDsd; + } + /** + * Creates the dataset for section #3: Care and Treatment + * + * @return the dataset + */ + protected DataSetDefinition careAndTreatmentDataSet() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.setName("3"); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + cohortDsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + cohortDsd.addDimension("cadre", ReportUtils.map(commonDimensions.cadre())); + + String indParams = "startDate=${startDate},endDate=${endDate}"; + + // 3.1 (Enrolled in Care) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Enrolled in care", ReportUtils.map(moh731GreenCardIndicators.newHivEnrollment(), indParams), standardKDoDDisaggregation, Arrays.asList("001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011","012","013","014","015","016","017","018","019","020","021","022","023","024","025")); + // 3.2 (Pre-ART) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Pre-Art", ReportUtils.map(moh731GreenCardIndicators.preArtCohort(), indParams), preARTDisaggregation, Arrays.asList("15", "16", "17","18","19")); + + // 3.3 (Starting ART) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Starting ART", ReportUtils.map(moh731GreenCardIndicators.startedOnArt(), indParams), standardKDoDDisaggregation, Arrays.asList("026", "027", "028", "029", "030", "031", "032", "033", "034", "035", "036","037","038","039","040","041","042","043","044","045","046","047","048","049","050")); + + // 3.4 (Currently on ART [All]) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Current on ART", ReportUtils.map(moh731GreenCardIndicators.currentlyOnArt(), indParams), standardKDoDDisaggregation, Arrays.asList("051","052","053","054","055","056", "057", "058", "059", "060", "061", "062", "063", "064", "065", "066","067","068","069","070","071","072","073","074","075")); + + // 3.5 (Survival and Retention on ART at 12 months) + EmrReportingUtils.addRow(cohortDsd,"HV03-046", "On therapy at 12 months", ReportUtils.map(moh731GreenCardIndicators.onTherapyAt12Months(), indParams), cadreDisaggregation,Arrays.asList("4","5","6")); + EmrReportingUtils.addRow(cohortDsd,"HV03-047", "ART Net Cohort at 12 months", ReportUtils.map(moh731GreenCardIndicators.art12MonthNetCohort(), indParams), cadreDisaggregation,Arrays.asList("7","8","9")); + + EmrReportingUtils.addRow(cohortDsd,"HV03-048", " Viral load Suppressed <1000cp/mls last 12 mths ", ReportUtils.map(moh731GreenCardIndicators.patientsWithSuppressedVlLast12Months(), indParams), cadreDisaggregation,Arrays.asList("10","11","12")); + + EmrReportingUtils.addRow(cohortDsd,"HV03-049", " Patients with Viral load results last 12 mths ", ReportUtils.map(moh731GreenCardIndicators.patientsWithVLResultsLast12Months(), indParams), cadreDisaggregation,Arrays.asList("13","14","15")); + + // 3.6 on CTX/Dapsone + EmrReportingUtils.addRow(cohortDsd, "HV03", "On CTX/Dapsone", ReportUtils.map(moh731GreenCardIndicators.onCotrimoxazoleProphylaxis(), indParams), ageAndCadreDisaggregation, Arrays.asList("073", "074", "075", "076", "077", "078", "079","080","081","082","083","084","085","086","087")); + + // 3.7 TB Screening and presumed TB + EmrReportingUtils.addRow(cohortDsd, "HV03", "TB Screening", ReportUtils.map(moh731GreenCardIndicators.screenedForTb(), indParams), ageAndCadreDisaggregation, Arrays.asList("088", "089", "090", "091", "092", "093", "094","095","096","097","098","099","100","101","102")); + EmrReportingUtils.addRow(cohortDsd,"HV03-058", "Presumed TB_Total", ReportUtils.map(moh731GreenCardIndicators.presumedForTb(), indParams), cadreDisaggregation,Arrays.asList("16","17","18")); + + // 3.8 + EmrReportingUtils.addRow(cohortDsd, "HV03", "Started on IPT", ReportUtils.map(moh731GreenCardIndicators.startedOnIPT(), indParams), ageAndCadreDisaggregation, Arrays.asList("103", "104", "105", "106", "107", "108", "109","110","111","112","113","114","115","116","117")); + EmrReportingUtils.addRow(cohortDsd,"HV03-066", "Completed IPT 12 months", ReportUtils.map(moh731GreenCardIndicators.ipt12MonthsCohort(), indParams),cadreDisaggregation,Arrays.asList("19","20","21")); + // 3.10 + EmrReportingUtils.addRow(cohortDsd,"HV03-076", "TB new cases", ReportUtils.map(moh731GreenCardIndicators.tbEnrollment(), indParams),cadreDisaggregation,Arrays.asList("22","23","24")); + EmrReportingUtils.addRow(cohortDsd,"HV03-077", "TB new cases, Known Positive", ReportUtils.map(moh731GreenCardIndicators.tbNewKnownPositive(), indParams),cadreDisaggregation,Arrays.asList("25","26","27")); + EmrReportingUtils.addRow(cohortDsd,"HV03-078", "TB new cases, tested for HIV", ReportUtils.map(moh731GreenCardIndicators.tbTestedForHIV(), indParams),cadreDisaggregation,Arrays.asList("28","29","30")); + EmrReportingUtils.addRow(cohortDsd,"HV03-080", "TB new cases, HIV positive", ReportUtils.map(moh731GreenCardIndicators.tbNewTestedHIVPositive(), indParams),cadreDisaggregation,Arrays.asList("31","32","33")); + EmrReportingUtils.addRow(cohortDsd,"HV03-082", "TB already on HAART", ReportUtils.map(moh731GreenCardIndicators.tbNewAlreadyOnHAART(), indParams),cadreDisaggregation,Arrays.asList("34","35","36")); + EmrReportingUtils.addRow(cohortDsd,"HV03-083", "TB new cases start HAART", ReportUtils.map(moh731GreenCardIndicators.tbNewStartingHAART(), indParams),cadreDisaggregation,Arrays.asList("37","38","39")); + EmrReportingUtils.addRow(cohortDsd,"HV03-084", "TB total on HAART", ReportUtils.map(moh731GreenCardIndicators.tbTotalOnHAART(), indParams),cadreDisaggregation,Arrays.asList("40","41","42")); + // 3.12 + EmrReportingUtils.addRow(cohortDsd,"HV03-087", "Screen Cacx new F18+", ReportUtils.map(moh731GreenCardIndicators.screenedforCaCx(), indParams),cadreDisaggregation,Arrays.asList("43","44","45")); + EmrReportingUtils.addRow(cohortDsd,"HV03-088", "Clinical Visits (F18+)", ReportUtils.map(moh731GreenCardIndicators.hivCareVisitsTotal(), indParams),cadreDisaggregation,Arrays.asList("46","47","48")); + EmrReportingUtils.addRow(cohortDsd,"HV03-089", "Modern contraceptive methods", ReportUtils.map(moh731GreenCardIndicators.modernContraceptivesProvided(), indParams), cadreDisaggregation,Arrays.asList("49","50","51")); + return cohortDsd; + + } + /** + * Creates the dataset for section #1: hiv testing and counseling + * + * @return the dataset + */ + protected DataSetDefinition hivTestingAndCouselingDatasetDefinition() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.setName("1"); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + cohortDsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + cohortDsd.addDimension("cadre", ReportUtils.map(commonDimensions.cadre())); + String indParams = "startDate=${startDate},endDate=${endDate}"; + + // 3.1 HIV testing and counseling + EmrReportingUtils.addRow(cohortDsd, "HV01", "Tested", ReportUtils.map(moh731GreenCardIndicators.htsNumberTested(), indParams), kdodDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10","11","12","13","14","15","16","17","18","19","20","21","22","23")); + EmrReportingUtils.addRow(cohortDsd,"HV01-13", "Tested Facility", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAtFacility(), indParams),cadreDisaggregation,Arrays.asList("52","53","54")); + EmrReportingUtils.addRow(cohortDsd,"HV01-14", "Tested Community", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAtCommunity(), indParams),cadreDisaggregation,Arrays.asList("55","56","57")); + EmrReportingUtils.addRow(cohortDsd,"HV01-15", "Tested New", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedNew(), indParams),cadreDisaggregation,Arrays.asList("58","59","60")); + EmrReportingUtils.addRow(cohortDsd,"HV01-16", "Tested Repeat", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedRepeat(), indParams),cadreDisaggregation,Arrays.asList("61","62","63")); + EmrReportingUtils.addRow(cohortDsd,"HV01-17", "Tested Couples", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAsCouple(), indParams),cadreDisaggregation,Arrays.asList("64","65","66")); + EmrReportingUtils.addRow(cohortDsd,"HV01-18", "Tested Key Pop", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedKeyPopulation(), indParams),cadreDisaggregation,Arrays.asList("67","68","69")); + + EmrReportingUtils.addRow(cohortDsd, "HV01", "Positive", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositive(), indParams), kdodDisaggregation, Arrays.asList("24", "25", "26", "27", "28", "29", "30", "31", "32", "33","34","35","36","37","38","39","40","41","42","43","44","45","46")); + EmrReportingUtils.addRow(cohortDsd,"HV01-27", "Negative Total", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedNegative(), indParams),cadreDisaggregation,Arrays.asList("70","71","72")); + EmrReportingUtils.addRow(cohortDsd,"HV01-28", "Discordant", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedDiscordant(), indParams),cadreDisaggregation,Arrays.asList("73","74","75")); + EmrReportingUtils.addRow(cohortDsd,"HV01-29", "Positive Key Pop", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedKeypopPositive(), indParams),cadreDisaggregation,Arrays.asList("76","77","78")); + + // number linked + EmrReportingUtils.addRow(cohortDsd, "HV01", "Linked", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositiveAndLinked(), indParams), kdodDisaggregation, Arrays.asList("47", "48", "49", "50", "51", "52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69")); + EmrReportingUtils.addRow(cohortDsd,"HV01-36", "Total tested positive (3 months ago)", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositiveThreeMonthsAgo(), indParams),kdodCadreWithAge,Arrays.asList("79","80","81","82","83","84","85","86","87","88","89","90","91")); + + return cohortDsd; + + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731ReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731ReportBuilder.java new file mode 100644 index 0000000000..5807c2945d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/OldMoh731ReportBuilder.java @@ -0,0 +1,372 @@ +/** + * 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.builder.hiv; + +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyaemr.reporting.ColumnParameters; +import org.openmrs.module.kenyaemr.reporting.EmrReportingUtils; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.RevisedDatim.DatimIndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.moh731Old.ETLOldMoh731GreenCardIndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; +import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * Report builder for ETL MOH 731 + */ +@Component +@Builds({"kenyaemr.etl.common.report.oldmoh731"}) +public class OldMoh731ReportBuilder extends AbstractReportBuilder { + @Autowired + private CommonDimensionLibrary commonDimensions; + + @Autowired + private ETLOldMoh731GreenCardIndicatorLibrary moh731GreenCardIndicators; + + @Autowired + private DatimIndicatorLibrary datimIndicators; + + public static final String DATE_FORMAT = "yyyy-MM-dd"; + + ColumnParameters colInfants = new ColumnParameters(null, "<1", "age=<1"); + + ColumnParameters maleInfants = new ColumnParameters(null, "<1, Male", "gender=M|age=<1"); + ColumnParameters femaleInfants = new ColumnParameters(null, "<1, Female", "gender=F|age=<1"); + + ColumnParameters children_0_to_9 = new ColumnParameters(null, "1-9", "age=0-9"); + ColumnParameters children_1_to_9 = new ColumnParameters(null, "1-9", "age=1-9"); + ColumnParameters adult_10_to_14 = new ColumnParameters(null, "10-14", "age=10-14"); + ColumnParameters adult_15_to_19 = new ColumnParameters(null, "15-19", "age=15-19"); + ColumnParameters adult_20_to_24 = new ColumnParameters(null, "20-24", "age=20-24"); + ColumnParameters adult_25_and_above = new ColumnParameters(null, "25+", "age=25+"); + + // specific to pre-art + ColumnParameters adult_0_to_14 = new ColumnParameters(null, "0-14", "age=0-14"); + ColumnParameters adult_15_and_above = new ColumnParameters(null, "15+", "age=15+"); + // end of pre-art + + ColumnParameters m_1_to_4 = new ColumnParameters(null, "1-4, Male", "gender=M|age=1-4"); + ColumnParameters f_1_to_4 = new ColumnParameters(null, "1-4, Female", "gender=F|age=1-4"); + + ColumnParameters m_5_to_9 = new ColumnParameters(null, "5-9, Male", "gender=M|age=5-9"); + ColumnParameters f_5_to_9 = new ColumnParameters(null, "5-9, Female", "gender=F|age=5-9"); + + ColumnParameters m_10_to_14 = new ColumnParameters(null, "10-14, Male", "gender=M|age=10-14"); + ColumnParameters f_10_to_14 = new ColumnParameters(null, "10-14, Female", "gender=F|age=10-14"); + + ColumnParameters m_15_to_19 = new ColumnParameters(null, "15-19, Male", "gender=M|age=15-19"); + ColumnParameters f_15_to_19 = new ColumnParameters(null, "15-19, Female", "gender=F|age=15-19"); + ColumnParameters f10_to_19 = new ColumnParameters(null, "10-19, Female", "gender=F|age=10-19"); + ColumnParameters f_18Plus = new ColumnParameters(null, "18+, Female", "gender=F|age=18+"); + ColumnParameters m_20_to_24 = new ColumnParameters(null, "20-24, Male", "gender=M|age=20-24"); + ColumnParameters f_20_to_24 = new ColumnParameters(null, "20-24, Female", "gender=F|age=20-24"); + ColumnParameters m_25_to_29 = new ColumnParameters(null, "25-29, Male", "gender=M|age=25-29"); + ColumnParameters f_25_to_29 = new ColumnParameters(null, "25-29, Female", "gender=F|age=25-29"); + ColumnParameters m_25_and_above = new ColumnParameters(null, "25+, Male", "gender=M|age=25+"); + ColumnParameters f_25_and_above = new ColumnParameters(null, "25+, Female", "gender=F|age=25+"); + ColumnParameters m_30_and_above = new ColumnParameters(null, "30+, Male", "gender=M|age=30+"); + ColumnParameters f_30_and_above = new ColumnParameters(null, "30+, Female", "gender=F|age=30+"); + ColumnParameters m_1_to_9 = new ColumnParameters(null, "1-9, Male", "gender=M|age=1-9"); + + ColumnParameters colTotal = new ColumnParameters(null, "Total", ""); + + List standardDisaggregationAgeAndSex = Arrays.asList( + colInfants, children_1_to_9, m_10_to_14, f_10_to_14, m_15_to_19, f_15_to_19, + m_20_to_24, f_20_to_24, m_25_and_above, f_25_and_above , colTotal); + + List standardAgeOnlyDisaggregation = Arrays.asList( + children_0_to_9, adult_10_to_14, adult_15_to_19, + adult_20_to_24, adult_25_and_above , colTotal); + + List standardAgeOnlyDisaggregationWithInfants = Arrays.asList( + colInfants, children_1_to_9, adult_10_to_14, adult_15_to_19, + adult_20_to_24, adult_25_and_above , colTotal); + + List hivAssessmentDisaggregations = Arrays.asList( + m_15_to_19, m_20_to_24, m_25_to_29, m_30_and_above, f_15_to_19, f_20_to_24, f_25_to_29, f_30_and_above, colTotal); + + List disaggregationWithInfants = Arrays.asList( + children_0_to_9, m_10_to_14, f_10_to_14,m_15_to_19, f_15_to_19, + m_20_to_24,f_20_to_24,m_25_and_above, f_25_and_above , colTotal); + + List allAgeDisaggregation = Arrays.asList( + maleInfants, femaleInfants, m_1_to_4, f_1_to_4, m_5_to_9, f_5_to_9, m_10_to_14, f_10_to_14,m_15_to_19, f_15_to_19, + m_20_to_24, f_20_to_24, m_25_and_above, f_25_and_above , colTotal); + + List preARTDisaggregation = Arrays.asList( + adult_0_to_14, adult_15_and_above , colTotal); + List females18PlusDisaggregation = Arrays.asList(f_18Plus); + List vmmcDisaggregation = Arrays.asList( + maleInfants, m_1_to_9, m_10_to_14, m_15_to_19, m_20_to_24, m_25_and_above, colTotal); + + List adolescentWomenAgeDisagregation = Arrays.asList(f10_to_19,colTotal); + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList( + new Parameter("startDate", "Start Date", Date.class), + new Parameter("endDate", "End Date", Date.class), + new Parameter("dateBasedReporting", "", String.class) + ); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, ReportDefinition reportDefinition) { + return Arrays.asList( + ReportUtils.map(hivTestingAndCouselingDatasetDefinition(), "startDate=${startDate},endDate=${endDate}"), + ReportUtils.map(pmtctDataSet(), "startDate=${startDate},endDate=${endDate}"), + ReportUtils.map(careAndTreatmentDataSet(), "startDate=${startDate},endDate=${endDate}"), + ReportUtils.map(voluntaryMaleCircumcisionDatasetDefinition(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Creates the dataset for section #2: Prevention of Mother-to-Child Transmission + * + * @return the dataset + */ + protected DataSetDefinition pmtctDataSet() { + CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + dsd.setName("2"); + dsd.setDescription("Prevention of Mother-to-Child Transmission"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + dsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + + String indParams = "startDate=${startDate},endDate=${endDate}"; +//Updates + dsd.addColumn("HV02-01", "First ANC Visit", ReportUtils.map(moh731GreenCardIndicators.firstANCVisitMchmsAntenatal(), indParams), ""); + dsd.addColumn("HV02-02", "Delivery from HIV+ Mothers(Labor and Delivery)", ReportUtils.map(moh731GreenCardIndicators.deliveryFromHIVPositiveMothers(), indParams), ""); + dsd.addColumn("HV02-03", "Known Positive at 1st ANC (Antenatal)", ReportUtils.map(moh731GreenCardIndicators.knownPositiveAtFirstANC(), indParams), ""); + dsd.addColumn("HV02-04", "Initial test at ANC (Antenatal)", ReportUtils.map(moh731GreenCardIndicators.initialHIVTestInMchmsAntenatal(), indParams), ""); + dsd.addColumn("HV02-05", "Initial Test at Labor and Delivery", ReportUtils.map(moh731GreenCardIndicators.testedForHivInMchmsDelivery(), indParams), ""); + dsd.addColumn("HV02-06", "Initial Test at PNC <=6 Weeks)", ReportUtils.map(moh731GreenCardIndicators.initialTestAtPNCUpto6Weeks(), indParams), ""); + dsd.addColumn("HV02-07", "Known HIV Status Total)", ReportUtils.map(moh731GreenCardIndicators.testedForHivInMchms(), indParams), ""); + dsd.addColumn("HV02-08", "PNC Retest within 6 weeks)", ReportUtils.map(moh731GreenCardIndicators.pncRetestUpto6Weeks(), indParams), ""); + dsd.addColumn("HV02-09", "PNC Testing >6 weeks - 6 months)", ReportUtils.map(moh731GreenCardIndicators.pncTestBtwn6WeeksAnd6Months(), indParams), ""); + dsd.addColumn("HV02-10", "HIV positive Before First ANC)", ReportUtils.map(moh731GreenCardIndicators.knownHivPositiveAtFirstANC(), indParams), ""); + dsd.addColumn("HV02-11", "HIV positive results ANC", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInMchmsAntenatal(), indParams), ""); + dsd.addColumn("HV02-12", "HIV positive results (Labor and Delivery)", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInMchmsDelivery(), indParams), ""); + dsd.addColumn("HV02-13", "HIV positive results PNC <=6 weeks)", ReportUtils.map(moh731GreenCardIndicators.testedHivPositiveInPNCWithin6Weeks(), indParams), ""); + dsd.addColumn("HV02-14", "Total HIV positive Mothers)", ReportUtils.map(moh731GreenCardIndicators.totalHivPositiveInMchms(), indParams), ""); + dsd.addColumn("HV02-15", "HIV Positive results PNC >6 weeks and <=6 months", ReportUtils.map(moh731GreenCardIndicators.pncHIVPositiveBetween7weeksAnd6Months(), indParams), ""); + dsd.addColumn("HV02-16", "On HAART at 1st ANC", ReportUtils.map(moh731GreenCardIndicators.onHAARTAtFirstANC(), indParams), ""); + dsd.addColumn("HV02-17", "Start HAART during ANC", ReportUtils.map(moh731GreenCardIndicators.startHAARTANC(), indParams), ""); + dsd.addColumn("HV02-18", "Start HAART During Labour and Delivery", ReportUtils.map(moh731GreenCardIndicators.startedHAARTLabourAndDelivery(), indParams), ""); + dsd.addColumn("HV02-19", "Start HAART PNC <=6 weeks", ReportUtils.map(moh731GreenCardIndicators.startedHAARTPNCUpto6Weeks(), indParams), ""); + //dsd.addColumn("HV02-20", "Total Maternal HAART", ReportUtils.map(moh731GreenCardIndicators.totalMaternalHAART(), indParams), ""); + dsd.addColumn("HV02-21", "Started HAART from 7 weeks to 6 months", ReportUtils.map(moh731GreenCardIndicators.onHAARTFrom7WeeksTo6Months(), indParams), ""); + dsd.addColumn("HV02-22", "On HAART Upto 12 months", ReportUtils.map(moh731GreenCardIndicators.onHAARTUpto12Months(), indParams), ""); + dsd.addColumn("HV02-23", "Net Cohort at 12 months", ReportUtils.map(moh731GreenCardIndicators.netCohortAt12Months(), indParams), ""); + dsd.addColumn("HV02-24", "Syphilis screened at ANC", ReportUtils.map(moh731GreenCardIndicators.syphilisScreenedAtANC(), indParams), ""); + dsd.addColumn("HV02-25", "Syphilis screened Positive", ReportUtils.map(moh731GreenCardIndicators.syphilisScreenedPositive(), indParams), ""); + dsd.addColumn("HV02-26", "Syphilis Treated", ReportUtils.map(moh731GreenCardIndicators.syphilisTreated(), indParams), ""); + dsd.addColumn("HV02-27", "HIV+ on Modern FP at 6 weeks", ReportUtils.map(moh731GreenCardIndicators.HIVPositiveOnModernFPUpto6Weeks(), indParams), ""); + dsd.addColumn("HV02-28", "HIV+ PNC visits at 6 weeks", ReportUtils.map(moh731GreenCardIndicators.HIVPositivePNCVisitsAt6Weeks(), indParams), ""); + dsd.addColumn("HV02-29", "Known partner HIV status at 1st Contact", ReportUtils.map(moh731GreenCardIndicators.knownHIVStatusAt1stContact(), indParams), ""); + dsd.addColumn("HV02-30", "Initial Test at ANC Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtANCForMale(), indParams), ""); + dsd.addColumn("HV02-31", "Initial Test at Delivery Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtDeliveryForMale(), indParams), ""); + dsd.addColumn("HV02-32", "Initial Test at PNC Male", ReportUtils.map(moh731GreenCardIndicators.initialTestAtPNCForMale(), indParams), ""); + //dsd.addColumn("HV02-32", "Total Known status Male", ReportUtils.map(moh731GreenCardIndicators.totalKnownHIVStatusMale(), indParams), ""); + /*Adolescents (10-19 years) Testing results*/ + EmrReportingUtils.addRow(dsd, "HV02-34","1st ANC KP Adolescent", ReportUtils.map(moh731GreenCardIndicators.firstANCKPAdolescents(), indParams), adolescentWomenAgeDisagregation, Arrays.asList("01", "02")); + EmrReportingUtils.addRow(dsd, "HV02-35", "HIV Positive Adolescents", ReportUtils.map(moh731GreenCardIndicators.adolescentsHIVPositive(), indParams), adolescentWomenAgeDisagregation, Arrays.asList("01", "02")); + EmrReportingUtils.addRow(dsd, "HV02-36", "Adolescents started on HAART", ReportUtils.map(moh731GreenCardIndicators.adolescentsStartedOnHAART(), indParams), adolescentWomenAgeDisagregation, Arrays.asList("01", "02")); + /*Infant HIV Exposure status at Penta 1*/ + dsd.addColumn("HV02-37", "Known Exposure at Penta 1", ReportUtils.map(moh731GreenCardIndicators.knownExposureAtPenta1(), indParams), ""); + dsd.addColumn("HV02-38", "Total given Penta 1", ReportUtils.map(moh731GreenCardIndicators.totalGivenPenta1(), indParams), ""); + /*Infant ARV Prophylaxis*/ + dsd.addColumn("HV02-39", "Infant ARV Prophylaxis at ANC", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisANC(), indParams), ""); + dsd.addColumn("HV02-40", "Infant ARV Prophylaxis at Labour and Delivery", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisLabourAndDelivery(), indParams), ""); + dsd.addColumn("HV02-41", "Infant ARV Prophylaxis <8 weeks PNC", ReportUtils.map(moh731GreenCardIndicators.infantArvProphylaxisPNCLessThan8Weeks(), indParams), ""); + dsd.addColumn("HV02-42", "Total Infant ARV Prophylaxis", ReportUtils.map(moh731GreenCardIndicators.totalInfantARVProphylaxis(), indParams), ""); + dsd.addColumn("HV02-43", "HEI CTS/DDS Start <2 months", ReportUtils.map(moh731GreenCardIndicators.heiDDSCTXStartLessThan2Months(), indParams), ""); + dsd.addColumn("HV02-44", "Initial PCR <8 weeks", ReportUtils.map(moh731GreenCardIndicators.initialPCRLessThan8Weeks(), indParams), ""); + dsd.addColumn("HV02-45", "Initial PCR >8 weeks to 12 months", ReportUtils.map(moh731GreenCardIndicators.initialPCROver8WeeksTo12Months(), indParams), ""); + dsd.addColumn("HV02-46", "Total Initial PCR Test <12 months", ReportUtils.map(moh731GreenCardIndicators.totalInitialPCRTestLessThan12Months(), indParams), ""); + dsd.addColumn("HV02-47", "Infected in 24 months", ReportUtils.map(datimIndicators.hivInfectedHEI(), indParams), ""); + dsd.addColumn("HV02-48", "Uninfected in 24 months", ReportUtils.map(datimIndicators.hivUninfectedHEI(), indParams), ""); + dsd.addColumn("HV02-49", "Unknown Outcomes in 24 months", ReportUtils.map(datimIndicators.unknownHIVStatusHEI(), indParams), ""); + dsd.addColumn("HV02-50", "Net Cohort HEI in 24 months", ReportUtils.map(moh731GreenCardIndicators.netCohortHeiIn24Months(), indParams), ""); + dsd.addColumn("HV02-51", "Mother-baby pairs in 24 months", ReportUtils.map(moh731GreenCardIndicators.motherBabyPairsIn24Months(), indParams), ""); + dsd.addColumn("HV02-52", "Pair net cohort in 24 months", ReportUtils.map(moh731GreenCardIndicators.pairNetCohortIn24Months(), indParams), ""); + dsd.addColumn("HV02-53", "Exclusive Breastfeeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.exclusiveBFAt6Months12MonthCohort(), indParams), ""); + dsd.addColumn("HV02-54", "Exclusive Replacement Feeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.exclusiveRFAt6Months12MonthCohort(), indParams), ""); + dsd.addColumn("HV02-55", "Mixed Feeding at 6 months", ReportUtils.map(moh731GreenCardIndicators.mixedFeedingAt6Months12MonthCohort(), indParams), ""); + dsd.addColumn("HV02-56", "Breast Feeding at 12 months", ReportUtils.map(moh731GreenCardIndicators.breastFeedingAt12Months12MonthCohort(), indParams), ""); + dsd.addColumn("HV02-57", "Not Breast Feeding at 12 months", ReportUtils.map(moh731GreenCardIndicators.notBreastFeedingAt12Months12MonthCohort(), indParams), ""); + dsd.addColumn("HV02-58", "Breast Feeding at 18 months", ReportUtils.map(moh731GreenCardIndicators.breastFeedingAt18Months24MonthCohort(), indParams), ""); + dsd.addColumn("HV02-59", "Not Breast Feeding at 18 months", ReportUtils.map(moh731GreenCardIndicators.notBreastFeedingAt18Months24MonthCohort(), indParams), ""); + + //End updates + + return dsd; + } + + + /** + * Creates the dataset for section #3: Care and Treatment + * + * @return the dataset + */ + protected DataSetDefinition careAndTreatmentDataSet() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.setName("3"); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + cohortDsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + + String indParams = "startDate=${startDate},endDate=${endDate}"; + + /* cohortDsd.addColumn("HV03-01", "HIV Exposed Infants (within 2 months)", ReportUtils.map(moh731GreenCardIndicators.hivExposedInfantsWithin2Months(), indParams), ""); + cohortDsd.addColumn("HV03-02", "HIV Exposed Infants (Eligible for CTX at 2 months)", ReportUtils.map(moh731GreenCardIndicators.hivExposedInfantsWithin2MonthsAndEligibleForCTX(), indParams), "");*/ + + + // 3.1 (Enrolled in Care) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Enrolled in care", ReportUtils.map(moh731GreenCardIndicators.newHivEnrollment(), indParams), standardDisaggregationAgeAndSex, Arrays.asList("001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011")); + + // 3.1 (KPs Enrolled in Care) + cohortDsd.addColumn( "HV03-12", "KPs Enrolled in care", ReportUtils.map(moh731GreenCardIndicators.hivEnrolledKPs(), indParams), ""); + + // 3.2 (Pre-ART) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Pre-Art", ReportUtils.map(moh731GreenCardIndicators.preArtCohort(), indParams), preARTDisaggregation, Arrays.asList("013", "014", "015")); + + // 3.3 (Starting ART) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Starting ART", ReportUtils.map(moh731GreenCardIndicators.startedOnArt(), indParams), standardDisaggregationAgeAndSex, Arrays.asList("016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026")); + + // 3.3 (KPs starting ART) + cohortDsd.addColumn( "HV03-027", "KPs Starting ART", ReportUtils.map(moh731GreenCardIndicators.kpsStartedOnART(), indParams), ""); + + // 3.4 (Currently on ART [All]) + EmrReportingUtils.addRow(cohortDsd, "HV03", "Current on ART", ReportUtils.map(moh731GreenCardIndicators.currentlyOnArt(), indParams), standardDisaggregationAgeAndSex, Arrays.asList("028", "029", "030", "031", "032", "033", "034", "035", "036", "037", "038")); + + // 3.4 (KPs Currently on ART) + cohortDsd.addColumn( "HV03-039", "KPs Current on ART", ReportUtils.map(moh731GreenCardIndicators.kpsCurrentlyOnArtOnART(), indParams), ""); + + // 3.5 (Survival and Retention on ART at 12 months) + cohortDsd.addColumn("HV03-040", "On therapy at 12 months (Total) ", ReportUtils.map(moh731GreenCardIndicators.onTherapyAt12Months(), indParams), ""); + cohortDsd.addColumn("HV03-041", "ART Net Cohort at 12 months", ReportUtils.map(moh731GreenCardIndicators.art12MonthNetCohort(), indParams), ""); + + + cohortDsd.addColumn("HV03-042", " Viral load Suppressed <1000cp/mls last 12 mths ", ReportUtils.map(moh731GreenCardIndicators.patientsWithSuppressedVlLast12Months(), indParams), ""); + cohortDsd.addColumn("HV03-043", " Patients with Viral load results last 12 mths ", ReportUtils.map(moh731GreenCardIndicators.patientsWithVLResultsLast12Months(), indParams), ""); + + + // 3.6 on CTX/Dapsone + EmrReportingUtils.addRow(cohortDsd, "HV03", "On CTX/Dapsone", ReportUtils.map(moh731GreenCardIndicators.onCotrimoxazoleProphylaxis(), indParams), standardAgeOnlyDisaggregationWithInfants, Arrays.asList("044", "045", "046", "047", "048", "049", "050")); + + // 3.7 TB Screening and presumed TB + EmrReportingUtils.addRow(cohortDsd, "HV03", "TB Screening", ReportUtils.map(moh731GreenCardIndicators.screenedForTb(), indParams), standardAgeOnlyDisaggregationWithInfants, Arrays.asList("051", "052", "053", "054", "055", "056", "057")); + cohortDsd.addColumn("HV03-058", "Presumed TB_Total", ReportUtils.map(moh731GreenCardIndicators.presumedForTb(), indParams),""); + + // 3.8 + EmrReportingUtils.addRow(cohortDsd, "HV03", "Started on TPT", ReportUtils.map(moh731GreenCardIndicators.startedOnIPT(), indParams), standardAgeOnlyDisaggregationWithInfants, Arrays.asList("059", "060", "061", "062", "063", "064", "065")); + cohortDsd.addColumn("HV03-066", "Completed TPT 12 months", ReportUtils.map(moh731GreenCardIndicators.ipt12MonthsCohort(), indParams),""); + + //3.9 Nutrition and HIV + EmrReportingUtils.addRow(cohortDsd, "HV03", "Nutrition assessment", ReportUtils.map(moh731GreenCardIndicators.assessedForNutritionInHIV(), indParams), preARTDisaggregation, Arrays.asList("067", "068","069")); + EmrReportingUtils.addRow(cohortDsd, "HV03", "Malnourished", ReportUtils.map(moh731GreenCardIndicators.malnourishedInHIV(), indParams), preARTDisaggregation, Arrays.asList("070","071","072")); + // 3.10 + cohortDsd.addColumn("HV03-076", "TB new cases", ReportUtils.map(moh731GreenCardIndicators.tbEnrollment(), indParams),""); + cohortDsd.addColumn("HV03-077", "TB new cases, Known Positive", ReportUtils.map(moh731GreenCardIndicators.tbNewKnownPositive(), indParams),""); + cohortDsd.addColumn("HV03-078", "TB new cases, tested for HIV", ReportUtils.map(moh731GreenCardIndicators.tbTestedForHIV(), indParams),""); + cohortDsd.addColumn("HV03-080", "TB new cases, HIV positive", ReportUtils.map(moh731GreenCardIndicators.tbNewTestedHIVPositive(), indParams),""); + cohortDsd.addColumn("HV03-082", "TB already on HAART", ReportUtils.map(moh731GreenCardIndicators.tbNewAlreadyOnHAART(), indParams),""); + cohortDsd.addColumn("HV03-083", "TB new cases start HAART", ReportUtils.map(moh731GreenCardIndicators.tbNewStartingHAART(), indParams),""); + cohortDsd.addColumn("HV03-084", "TB total on HAART", ReportUtils.map(moh731GreenCardIndicators.tbTotalOnHAART(), indParams),""); + // 3.12 + cohortDsd.addColumn("HV03-087", "Screen Cacx new F18+", ReportUtils.map(moh731GreenCardIndicators.screenedforCaCx(), indParams),""); + EmrReportingUtils.addRow(cohortDsd, "HV03-088","Clinical Visits", ReportUtils.map(moh731GreenCardIndicators.hivCareVisitsTotal(), indParams),females18PlusDisaggregation, Arrays.asList("01")); + cohortDsd.addColumn("HV03-089", "Modern contraceptive methods", ReportUtils.map(moh731GreenCardIndicators.modernContraceptivesProvided(), indParams), ""); + return cohortDsd; + + } + + /** + * Creates the dataset for section #1: hiv testing and counseling + * + * @return the dataset + */ + protected DataSetDefinition hivTestingAndCouselingDatasetDefinition() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.setName("1"); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + cohortDsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + String indParams = "startDate=${startDate},endDate=${endDate}"; + + // 3.1 HIV testing and counseling + EmrReportingUtils.addRow(cohortDsd, "HV01", "Tested", ReportUtils.map(moh731GreenCardIndicators.htsNumberTested(), indParams), disaggregationWithInfants, Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10")); + cohortDsd.addColumn("HV01-11", "Tested Facility", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAtFacility(), indParams),""); + cohortDsd.addColumn("HV01-12", "Tested Community", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAtCommunity(), indParams),""); + cohortDsd.addColumn("HV01-13", "Tested New", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedNew(), indParams),""); + cohortDsd.addColumn("HV01-14", "Tested Repeat", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedRepeat(), indParams),""); + cohortDsd.addColumn("HV01-15", "Tested Couples", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedAsCouple(), indParams),""); + cohortDsd.addColumn("HV01-16", "Tested Key Pop", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedKeyPopulation(), indParams),""); + + EmrReportingUtils.addRow(cohortDsd, "HV01", "Positive", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositive(), indParams), disaggregationWithInfants, Arrays.asList("17", "18", "19", "20", "21", "22", "23", "24", "25", "26")); + cohortDsd.addColumn("HV01-27", "Negative Total", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedNegative(), indParams),""); + cohortDsd.addColumn("HV01-28", "Discordant", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedDiscordant(), indParams),""); + cohortDsd.addColumn("HV01-29", "Positive Key Pop", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedKeypopPositive(), indParams),""); + + // number linked + EmrReportingUtils.addRow(cohortDsd, "HV01", "Linked", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositiveAndLinked(), indParams), standardAgeOnlyDisaggregation, Arrays.asList("30", "31", "32", "33", "34", "35")); + cohortDsd.addColumn("HV01-36", "Total tested positive (3 months ago)", ReportUtils.map(moh731GreenCardIndicators.htsNumberTestedPositiveThreeMonthsAgo(), indParams),""); + EmrReportingUtils.addRow(cohortDsd, "HV01", "Number assessed for HIV risk", ReportUtils.map(moh731GreenCardIndicators.numberAssessedForHIVRisk(), indParams), hivAssessmentDisaggregations, Arrays.asList("37", "38", "39", "40", "41", "42", "43", "44","45")); + return cohortDsd; + + } + + /** + * Creates the dataset for section #4: Voluntary Male Circumcision + * + * @return the dataset + */ + protected DataSetDefinition voluntaryMaleCircumcisionDatasetDefinition() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.setName("4"); + cohortDsd.setDescription("Voluntary Male Circumcision"); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.addDimension("age", ReportUtils.map(commonDimensions.moh731GreenCardAgeGroups(), "onDate=${endDate}")); + cohortDsd.addDimension("gender", ReportUtils.map(commonDimensions.gender())); + String indParams = "startDate=${startDate},endDate=${endDate}"; + + // 4.1 Voluntary Male Circumcision + EmrReportingUtils.addRow(cohortDsd, "HV04", "Tested", ReportUtils.map(moh731GreenCardIndicators.numberCircumcised(), indParams), vmmcDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07")); + cohortDsd.addColumn("HV04-08", "Circumcised HIV+", ReportUtils.map(moh731GreenCardIndicators.numberCircumcisedHivPositive(), indParams),""); + cohortDsd.addColumn("HV04-09", "Circumcised HIV-", ReportUtils.map(moh731GreenCardIndicators.numberCircumcisedHivNegative(), indParams),""); + cohortDsd.addColumn("HV04-10", "Circumcised HIV NK", ReportUtils.map(moh731GreenCardIndicators.numberCircumcisedHivUnknown(), indParams),""); + cohortDsd.addColumn("HV04-11", "Circumcised Surgical", ReportUtils.map(moh731GreenCardIndicators.numberCircumcisedSurgically(), indParams),""); + cohortDsd.addColumn("HV04-12", "Circumcised Device", ReportUtils.map(moh731GreenCardIndicators.numberCircumcisedUsingDevice(), indParams),""); + cohortDsd.addColumn("HV04-13", "AE During Moderate", ReportUtils.map(moh731GreenCardIndicators.circumcisedWithModerateAEDuringProcedure(), indParams),""); + cohortDsd.addColumn("HV04-14", "AE During Severe", ReportUtils.map(moh731GreenCardIndicators.circumcisedWithSevereAEDuringProcedure(), indParams),""); + cohortDsd.addColumn("HV04-15", "AE Post Moderate", ReportUtils.map(moh731GreenCardIndicators.circumcisedWithModerateAEPostProcedure(), indParams),""); + cohortDsd.addColumn("HV04-16", "AE Post Servere", ReportUtils.map(moh731GreenCardIndicators.circumcisedWithSevereAEPostProcedure(), indParams),""); + cohortDsd.addColumn("HV04-17", "Follow Up Visit <14 days", ReportUtils.map(moh731GreenCardIndicators.followedUpWithin14daysOfVMMCProcedure(), indParams),""); + return cohortDsd; + + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardCohortLibrary.java new file mode 100644 index 0000000000..5a2bee0f01 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardCohortLibrary.java @@ -0,0 +1,3366 @@ +/** + * 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.library.ETLReports.moh731Old; + +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.CompositionCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.RevisedDatim.DatimCohortLibrary; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * Created by dev on 1/14/17. + */ + +/** + * Library of cohort definitions used specifically in the MOH731 report based on ETL tables. It has incorporated green card components + */ + + +@Component + + +public class ETLOldMoh731GreenCardCohortLibrary { + + @Autowired + private DatimCohortLibrary datimCohortLibrary; + + + public CohortDefinition hivEnrollment(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_hiv_enrollment e\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id = e.patient_id\n" + + "where date(e.visit_date) between date(:startDate) and date(:endDate)\n" + + " and (e.patient_type = 164144 or (e.patient_type is null and transfer_in_date is null));"; + cd.setName("newHhivEnrollment"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New HIV Enrollment"); + + return cd; + } + public CohortDefinition kpsWithHIVFollowupVisit(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from kenyaemr_etl.etl_patient_hiv_followup f\n" + + "where date(f.visit_date) <= date(:endDate)\n" + + " and f.population_type is not null\n" + + "group by f.patient_id\n" + + "having mid(max(concat(f.visit_date, f.population_type)), 11) = 164929;"; + cd.setName("kpsWithHIVFollowupVisit"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("KPS with HIV followup visit"); + + return cd; + } + + /** + * KPs who were newly enrolled to care within the month + * @return + */ + public CohortDefinition hivEnrolledKPs() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("kpsWithHIVFollowupVisit",ReportUtils.map(kpsWithHIVFollowupVisit(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("hivEnrollment", ReportUtils.map(hivEnrollment(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("kpsWithHIVFollowupVisit AND hivEnrollment"); + return cd; + } + /** + * TODO: Review query. It takes time to execute + * @return + */ + public CohortDefinition currentlyInCare() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery=" select e.patient_id\n" + + "from ( \n" + + "select fup.visit_date,fup.patient_id, min(e.visit_date) as enroll_date,\n" + + "max(fup.visit_date) as latest_vis_date,\n" + + "mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca,\n" + + " max(d.visit_date) as date_discontinued,\n" + + " d.patient_id as disc_patient \n" + + "from kenyaemr_etl.etl_patient_hiv_followup fup \n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=fup.patient_id \n" + + "join kenyaemr_etl.etl_hiv_enrollment e on fup.patient_id=e.patient_id \n" + + // ensure those discontinued are catered for + "left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= date(:endDate) and program_name='HIV'\n" + + " group by patient_id\n" + //check if this line is necessary + " ) d on d.patient_id = fup.patient_id \n" + + "where fup.visit_date <= date(:endDate) \n" + + "group by patient_id \n" + +// "-- we may need to filter lost to follow-up using this\n" + + "having ((date(latest_tca) > date(:endDate) and (date(latest_tca) > date(date_discontinued) or disc_patient is null ) and (date(latest_vis_date) > date(date_discontinued) or disc_patient is null)) or \n" + + "(((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_vis_date) >= date(latest_tca)) or date(latest_tca) > curdate()) ) and (date(latest_tca) > date(date_discontinued) or disc_patient is null ))\n" + +// "-- drop missd completely\n" + + ") e\n" ; + + + cd.setName("currentlyInCare"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("currently In Care"); + + return cd; + } + + public CohortDefinition startedOnART() { + String sqlQuery="select net.patient_id\n" + + " from (\n" + + " select e.patient_id,e.date_started,\n" + + " d.visit_date as dis_date,\n" + + " if(d.visit_date is not null, 1, 0) as TOut,\n" + + " e.regimen, e.regimen_line, e.alternative_regimen,\n" + + " mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca,\n" + + " max(if(enr.date_started_art_at_transferring_facility is not null and enr.facility_transferred_from is not null, 1, 0)) as TI_on_art,\n" + + " max(if(enr.transfer_in_date is not null, 1, 0)) as TIn,\n" + + " max(enr.patient_type) as latest_patient_type,\n" + + " max(fup.visit_date) as latest_vis_date\n" + + " from (select e.patient_id, min(e.date_started) as date_started,\n" + + " mid(min(concat(e.date_started,e.regimen_name)),11) as regimen,\n" + + " mid(min(concat(e.date_started,e.regimen_line)),11) as regimen_line,\n" + + " max(if(discontinued,1,0))as alternative_regimen\n" + + " from kenyaemr_etl.etl_drug_event e\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id\n" + + " where e.program = 'HIV'\n" + + " group by e.patient_id) e\n" + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id\n" + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id\n" + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id\n" + + " where date(e.date_started) between date(:startDate) and date(:endDate)\n" + + " group by e.patient_id\n" + + " having TI_on_art=0 and latest_patient_type in (164144,160563,159833)\n" + + " )net;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("startingART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Started on ART"); + return cd; + } + + /** + * KPs started on ART + * @return + */ + public CohortDefinition kpsStartedOnART() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("kpsWithHIVFollowupVisit",ReportUtils.map(kpsWithHIVFollowupVisit(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("startedOnART", ReportUtils.map(startedOnART(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("kpsWithHIVFollowupVisit AND startedOnART"); + return cd; + } + + public CohortDefinition currentlyOnArt() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery="select t.patient_id\n" + + "from (select fup.visit_date,\n" + + " fup.patient_id,\n" + + " max(e.visit_date) as enroll_date,\n" + + " greatest(max(fup.visit_date), ifnull(max(d.visit_date), '0000-00-00')) as latest_vis_date,\n" + + " greatest(mid(max(concat(fup.visit_date, fup.next_appointment_date)), 11),\n" + + " ifnull(max(d.visit_date), '0000-00-00')) as latest_tca,\n" + + " d.patient_id as disc_patient,\n" + + " d.effective_disc_date as effective_disc_date,\n" + + " max(d.visit_date) as date_discontinued,\n" + + " de.patient_id as started_on_drugs\n" + + " from kenyaemr_etl.etl_patient_hiv_followup fup\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id = fup.patient_id\n" + + " join kenyaemr_etl.etl_hiv_enrollment e on fup.patient_id=e.patient_id\n" + + " left join kenyaemr_etl.etl_drug_event de\n" + + " on e.patient_id = de.patient_id and de.program = 'HIV' and date(de.date_started) <= date(:endDate)\n" + + " left outer JOIN\n" + + " (select patient_id,\n" + + " coalesce(date(effective_discontinuation_date), visit_date) visit_date,\n" + + " max(date(effective_discontinuation_date)) as effective_disc_date\n" + + " from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= date(:endDate)\n" + + " and program_name = 'HIV'\n" + + " group by patient_id) d on d.patient_id = fup.patient_id\n" + + " where fup.visit_date <= date(:endDate)\n" + + " group by patient_id\n" + + " having (started_on_drugs is not null and started_on_drugs <> '')\n" + + " and (\n" + + " (\n" + + " (timestampdiff(DAY, date(latest_tca), date(:endDate)) <= 30 and\n" + + " ((date(d.effective_disc_date) > date(:endDate) or date(enroll_date) > date(d.effective_disc_date)) or\n" + + " d.effective_disc_date is null))\n" + + " and\n" + + " (date(latest_vis_date) >= date(date_discontinued) or date(latest_tca) >= date(date_discontinued) or\n" + + " disc_patient is null)\n" + + " )\n" + + " )) t;"; + + cd.setName("currentlyOnArt"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("currently on ART"); + return cd; + } + + /** + * Clients enrolled in KP program + * @return + */ + public CohortDefinition enrolledKPs() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery="select c.client_id from kenyaemr_etl.etl_contact c\n" + + " where date(c.visit_date) <= date(:endDate)\n" + + " group by c.client_id having mid(max(concat(date(c.visit_date), c.key_population_type)), 11)\n" + + " in ('FSW','MSM','MSW','PWUD','PWID','Transgender','People in prison and other closed settings');"; + cd.setName("enrolledKPs"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("KP clients"); + return cd; + } + /** + * KPs currently on ART + * @return + */ + public CohortDefinition kpsCurrentlyOnArtOnART() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("kpsWithHIVFollowupVisit",ReportUtils.map(kpsWithHIVFollowupVisit(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("currentlyOnArt", ReportUtils.map(currentlyOnArt(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("kpsWithHIVFollowupVisit AND currentlyOnArt"); + return cd; + } + public CohortDefinition revisitsArt() { + String sqlQuery="select e.patient_id\n" + + "from (\n" + + "select fup.visit_date,fup.patient_id,\n" + + "min(e.visit_date) as enroll_date,\n" + + "max(fup.visit_date) as latest_vis_date,\n" + + "mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca\n" + + "from kenyaemr_etl.etl_patient_hiv_followup fup\n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=fup.patient_id\n" + + "join kenyaemr_etl.etl_hiv_enrollment e on fup.patient_id=e.patient_id\n" + + "where (fup.visit_date between date_sub(date(:startDate), interval 3 month) and date(:endDate))\n" + + "group by patient_id\n" + + "having (latest_tca>date(:endDate) or\n" + + "(latest_tca between date(:startDate) and date(:endDate) and latest_vis_date between date(:startDate) and date(:endDate)) )\n" + + ") e\n" + + "where e.patient_id not in (select patient_id from kenyaemr_etl.etl_patient_program_discontinuation\n" + + "where date(visit_date) <= date(:endDate) and program_name='HIV'\n" + + "group by patient_id\n" + + "having if(e.latest_tca>max(visit_date),1,0)=0)\n" + + "and e.patient_id in (select patient_id\n" + + "from (select e.patient_id,min(e.date_started) as date_started,\n" + + "mid(min(concat(e.date_started,e.regimen_name)),11) as regimen,\n" + + "mid(min(concat(e.date_started,e.regimen_line)),11) as regimen_line,\n" + + "max(if(discontinued,1,0))as alternative_regimen\n" + + "from kenyaemr_etl.etl_drug_event e\n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + "where e.program = 'HIV'\n" + + "group by e.patient_id) e\n" + + "where date(e.date_started)190) ;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("pwpModernContraceptivesProvided"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("PWP - Modern Contraceptives Provided"); + return cd; + } + + + + public CohortDefinition art12MonthNetCohort() { + + String sqlQuery = " select net.patient_id\n" + + " from ( \n" + + " select e.patient_id,e.date_started, d.visit_date as dis_date, if(d.visit_date is not null and d.discontinuation_reason=159492, 1, 0) as TOut, d.date_died,\n" + + " mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, \n" + + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date\n" + + " from (select e.patient_id,p.dob,p.Gender,min(e.date_started) as date_started\n" + + " from kenyaemr_etl.etl_drug_event e \n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + " where e.program='HIV' \n" + + " group by e.patient_id) e \n" + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' \n" + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id \n" + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id \n" + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) \n" + + " group by e.patient_id \n" + + " having (dis_date>date(:endDate) or dis_date is null or TOut=0 ) \n" + + " )net; "; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("art12MonthNetCohort"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("art 12 Months Net Cohort"); + return cd; + + } + + public CohortDefinition onOriginalFirstLineAt12Months() { + + String sqlQuery = " select net.patient_id " + + " from ( " + + " select e.patient_id,e.date_started, d.visit_date as dis_date, if(d.visit_date is not null, 1, 0) as TOut," + + " e.regimen, e.regimen_line, e.alternative_regimen, mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, "+ + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date" + + " from (select e.patient_id,min(e.date_started) as date_started, " + + " mid(min(concat(e.date_started,e.regimen_name)),11) as regimen, " + + " mid(min(concat(e.date_started,e.regimen_line)),11) as regimen_line, " + + " max(if(discontinued,1,0))as alternative_regimen " + + " from kenyaemr_etl.etl_drug_event e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where e.program='HIV' " + + " group by e.patient_id) e " + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' " + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id " + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id " + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) " + + " group by e.patient_id " + + " having (dis_date>date(:endDate) or dis_date is null) and (regimen_line='1st Line' and alternative_regimen=0) )net; "; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("onOriginalFirstLineAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("on Original FirstLine At 12 Months"); + return cd; + + } + + public CohortDefinition onAlternateFirstLineAt12Months() { + + String sqlQuery = " select net.patient_id " + + " from ( " + + " select e.patient_id,e.date_started,d.visit_date as dis_date, if(d.visit_date is not null, 1, 0) as TOut," + + " e.regimen, e.regimen_line, e.alternative_regimen, mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, "+ + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date" + + " from (select e.patient_id,min(e.date_started) as date_started, " + + " mid(min(concat(e.date_started,e.regimen_name)),11) as regimen, " + + " mid(min(concat(e.date_started,e.regimen_line)),11) as regimen_line, " + + " max(if(discontinued,1,0))as alternative_regimen " + + " from kenyaemr_etl.etl_drug_event e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where e.program='HIV' " + + " group by e.patient_id) e " + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' " + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id " + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id " + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) " + + " group by e.patient_id " + + " having (dis_date>date(:endDate) or dis_date is null) and (regimen_line='1st Line' and alternative_regimen=1) )net; "; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("onAlternateFirstLineAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("on Alternate First Line At 12 Months"); + return cd; + + } + + public CohortDefinition onSecondLineAt12Months() { + + String sqlQuery = " select net.patient_id " + + " from ( " + + " select e.patient_id,e.date_started,d.visit_date as dis_date, if(d.visit_date is not null, 1, 0) as TOut," + + " e.regimen, e.regimen_line, e.alternative_regimen, mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, "+ + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date" + + " from (select e.patient_id,min(e.date_started) as date_started, " + + " mid(min(concat(e.date_started,e.regimen_name)),11) as regimen, " + + " mid(min(concat(e.date_started,e.regimen_line)),11) as regimen_line, " + + " max(if(discontinued,1,0))as alternative_regimen " + + " from kenyaemr_etl.etl_drug_event e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where e.program='HIV' " + + " group by e.patient_id) e " + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' " + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id " + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id " + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) " + + " group by e.patient_id " + + " having (dis_date>date(:endDate) or dis_date is null) and (regimen_line='2nd Line') )net; "; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("onSecondLineAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("on Second Line At 12Months"); + return cd; + + } + + public CohortDefinition onTherapyAt12Months() { + + String sqlQuery = " select net.patient_id\n" + + " from ( \n" + + " select e.patient_id,e.date_started, d.visit_date as dis_date, if(d.visit_date is not null and d.discontinuation_reason=159492, 1, 0) as TOut, d.date_died,\n" + + " mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, \n" + + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date\n" + + " from (select e.patient_id,p.dob,p.Gender,min(e.date_started) as date_started\n" + + " from kenyaemr_etl.etl_drug_event e \n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + " where e.program='HIV' \n" + + " group by e.patient_id) e \n" + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' \n" + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id \n" + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id \n" + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) \n" + + " group by e.patient_id \n" + + " having (dis_date>date(:endDate) or dis_date is null or TOut=0 ) and (\n" + + " (date(latest_tca) > date(:endDate) and (date(latest_tca) > date(dis_date) or dis_date is null )) or \n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_tca) >= date(latest_vis_date)) ) ) or \n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_vis_date) >= date(latest_tca)) or date(latest_tca) > curdate()) ) and \n" + + " (date(latest_tca) > date(dis_date) or dis_date is null )\n" + + " )\n" + + " )net; "; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("onTherapyAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("on Therapy At 12 Months"); + return cd; + + } + + /*Patients with Suppressed VL within last 12 Months*/ + public CohortDefinition patientsWithSuppressedVlLast12Months() { + + String sqlQuery = "select e.patient_id\n" + + "from (\n" + + "select net.patient_id as patient_id\n" + + "from (\n" + + "select e.patient_id,e.date_started, d.visit_date as dis_date, if(d.visit_date is not null and d.discontinuation_reason=159492, 1, 0) as TOut, d.date_died,\n" + + "mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca,\n" + + "if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date\n" + + " from (select e.patient_id,p.dob,p.Gender,min(e.date_started) as date_started\n" + + " from kenyaemr_etl.etl_drug_event e\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id\n" + + " where e.program='HIV'\n" + + " group by e.patient_id) e\n" + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee'\n" + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id\n" + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id\n" + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year)\n" + + " group by e.patient_id\n" + + "having (dis_date>date(:endDate) or dis_date is null or TOut=0 ) and (\n" + + " (date(latest_tca) > date(:endDate) and (date(latest_tca) > date(dis_date) or dis_date is null )) or\n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_tca) >= date(latest_vis_date)) ) ) or\n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_vis_date) >= date(latest_tca)) or date(latest_tca) > curdate()) ) and\n" + + " (date(latest_tca) > date(dis_date) or dis_date is null )\n" + + " )\n" + + " )net ) e\n" + + "inner join\n" + + "(\n" + + "select\n" + + " b.patient_id,\n" + + " max(b.visit_date) as vl_date,\n" + + " mid(max(concat(b.visit_date,b.lab_test)),11) as lab_test,\n" + + " if(mid(max(concat(b.visit_date,b.lab_test)),11) = 856, mid(max(concat(b.visit_date,b.test_result)),11), if(mid(max(concat(b.visit_date,b.lab_test)),11)=1305 and mid(max(concat(visit_date,test_result)),11) = 1302, \"LDL\",\"\")) as vl_result,\n" + + " mid(max(concat(b.visit_date,b.urgency)),11) as urgency\n" + + "from (select x.patient_id as patient_id,x.visit_date as visit_date,x.lab_test as lab_test, x.test_result as test_result,urgency as urgency\n" + + " from kenyaemr_etl.etl_laboratory_extract x where x.lab_test in (1305,856)\n" + + " group by x.patient_id,x.visit_date order by visit_date desc)b\n" + + "group by patient_id\n" + + "having max(visit_date) between\n" + + " date_sub(date(:startDate) , interval 12 MONTH) and date(:endDate)\n" + + ") vl_result on vl_result.patient_id = e.patient_id\n" + + "group by e.patient_id\n" + + "having mid(max(concat(vl_result.vl_date, vl_result.vl_result)), 11)='LDL' or mid(max(concat(vl_result.vl_date, vl_result.vl_result)), 11)<1000;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("patientsWithSuppressedVlLast12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients on ART with Suppressed VL within last 12 Months"); + return cd; + } + + /*Patients with VL results within last 12 Months*/ + public CohortDefinition patientsWithVLResultsLast12Months() { + + String sqlQuery = "select e.patient_id\n" + + " from (\n" + + " select net.patient_id as patient_id\n" + + " from ( \n" + + " select e.patient_id,e.date_started, d.visit_date as dis_date, if(d.visit_date is not null and d.discontinuation_reason=159492, 1, 0) as TOut, d.date_died,\n" + + " mid(max(concat(fup.visit_date,fup.next_appointment_date)),11) as latest_tca, \n" + + " if(enr.transfer_in_date is not null, 1, 0) as TIn, max(fup.visit_date) as latest_vis_date\n" + + " from (select e.patient_id,p.dob,p.Gender,min(e.date_started) as date_started\n" + + " from kenyaemr_etl.etl_drug_event e \n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + " where e.program='HIV' \n" + + " group by e.patient_id) e \n" + + " left outer join kenyaemr_etl.etl_patient_program_discontinuation d on d.patient_id=e.patient_id and d.program_uuid='2bdada65-4c72-4a48-8730-859890e25cee' \n" + + " left outer join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id \n" + + " left outer join kenyaemr_etl.etl_patient_hiv_followup fup on fup.patient_id=e.patient_id \n" + + " where date(e.date_started) between date_sub(date(:startDate) , interval 1 year) and date_sub(date(:endDate) , interval 1 year) \n" + + " group by e.patient_id\n" + + " having (dis_date>date(:endDate) or dis_date is null or TOut=0 ) and (\n" + + " (date(latest_tca) > date(:endDate) and (date(latest_tca) > date(dis_date) or dis_date is null )) or\n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_tca) >= date(latest_vis_date)) ) ) or\n" + + " (((date(latest_tca) between date(:startDate) and date(:endDate)) and (date(latest_vis_date) >= date(latest_tca)) or date(latest_tca) > curdate()) ) and\n" + + " (date(latest_tca) > date(dis_date) or dis_date is null )\n" + + " )\n" + + " )net ) e\n" + + " inner join\n" + + " (\n" + + " select\n" + + " patient_id,\n" + + " visit_date,\n" + + " if(lab_test = 856, test_result, if(lab_test=1305 and test_result = 1302, 'LDL','')) as vl_result,\n" + + " urgency\n" + + " from kenyaemr_etl.etl_laboratory_extract\n" + + " where lab_test in (1305, 856) and visit_date between date_sub(date(:startDate) , interval 12 MONTH) and date(:endDate)\n" + + " ) vl_result on vl_result.patient_id = e.patient_id\n" + + " group by e.patient_id\n" + + " ;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("patientsWithVLResultsLast12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients on ART with VL results within last 12 Months"); + return cd; + } + + public CohortDefinition hivCareVisitsFemale18() { + + String sqlQuery = "select e.patient_id " + + "from kenyaemr_etl.etl_patient_hiv_followup e " + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + "join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=e.patient_id " + + "where timestampdiff(year,p.dob,date(:endDate))>=18 and p.gender='F' and date(e.visit_date) between date(:startDate) and date(:endDate);"; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivCareVisitsFemales18"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Care Visits Female 18 and above"); + return cd; + + } + + public CohortDefinition hivCareVisitsScheduled() { + + String sqlQuery = " select patient_id \n" + + "from (\n" + + "select f1.patient_id,max(f1.visit_date) as visit_date, max(f2.next_appointment_date) as next_appointment_date \n" + + "from kenyaemr_etl.etl_patient_hiv_followup f1\n" + + "join kenyaemr_etl.etl_patient_hiv_followup f2 on f1.visit_date>f2.visit_date\n" + + "and f1.patient_id=f2.patient_id\n" + + "join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=f1.patient_id\n" + + "where date(f1.visit_date) between date(:startDate) and date(:endDate)\n" + + "group by f1.patient_id, f1.visit_date)vis where visit_date=next_appointment_date"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivCareVisitsScheduled"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Care Visits Scheduled"); + return cd; + + } + + public CohortDefinition hivCareVisitsUnscheduled() { + + String sqlQuery = " select patient_id \n" + + "from (\n" + + "select f1.patient_id,max(f1.visit_date) as visit_date, max(f2.next_appointment_date) as next_appointment_date \n" + + "from kenyaemr_etl.etl_patient_hiv_followup f1\n" + + "join kenyaemr_etl.etl_patient_hiv_followup f2 on f1.visit_date>f2.visit_date\n" + + "and f1.patient_id=f2.patient_id\n" + + "join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id=f1.patient_id\n" + + "where date(f1.visit_date) between date(:startDate) and date(:endDate)\n" + + "group by f1.patient_id, f1.visit_date)vis where visit_date<>next_appointment_date"; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivCareVisitsUnscheduled"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Care Visits Unscheduled"); + return cd; + + } + + public CohortDefinition hivCareVisitsTotal() { + + String sqlQuery = "select f.patient_id\n" + + "from kenyaemr_etl.etl_patient_hiv_followup f\n" + + " join kenyaemr_etl.etl_hiv_enrollment enr on enr.patient_id = f.patient_id\n" + + "where date(f.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivCareVisitsTotal"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Care Visits Total"); + return cd; + + } + + public CohortDefinition onCtxProphylaxis() { + String sqlQuery="select e.patient_id\n" + + "from (select fup.patient_id,\n" + + " if(mid(max(concat(date(fup.visit_date), fup.ctx_dispensed)), 11) in (105281, 74250, 1065), 1,\n" + + " 0) as ctx_dispensed,\n" + + " if(mid(max(concat(date(fup.visit_date), fup.dapsone_dispensed)), 11) in (105281, 74250, 1065), 1,\n" + + " 0) as dapsone_dispensed,\n" + + " if(mid(max(concat(date(fup.visit_date), fup.prophylaxis_given)), 11) in (105281, 74250), 1,\n" + + " 0) as prophylaxis_dispensed\n" + + " from kenyaemr_etl.etl_patient_hiv_followup fup\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id = fup.patient_id\n" + + " where fup.visit_date <= date(:endDate)\n" + + " group by fup.patient_id\n" + + " having (\n" + + " ((ctx_dispensed = 1 or dapsone_dispensed = 1) and prophylaxis_dispensed = 1)\n" + + " )) e;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("onCtxProphylaxis"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("On Ctx Prophylaxis"); + return cd; + } + public CohortDefinition inHivProgramAndOnCtxProphylaxis() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("txcurr", ReportUtils.map(currentlyOnArt(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("onCtxProphylaxis",ReportUtils.map(onCtxProphylaxis(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("txcurr AND onCtxProphylaxis"); + return cd; + } + + protected CohortDefinition hivExposedInfantsWithin2Months() { + String sqlQuery = " select e.patient_id " + + " from kenyaemr_etl.etl_hei_enrollment e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where child_exposed=822 and timestampdiff(month,p.dob,:endDate)<=2 and date(e.visit_date) between :startDate and :endDate"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivExposedInfantsWithin2Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Exposed Infants Within 2 Months"); + return cd; + } + + protected CohortDefinition hivExposedInfantsWithin2MonthsAndEligibleForCTX() { + String sqlQuery = " select e.patient_id " + + " from kenyaemr_etl.etl_hei_enrollment e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where child_exposed=822 and timestampdiff(month,p.dob,:endDate)<=2 and date(e.visit_date) between :startDate and :endDate"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("hivExposedInfantsWithin2Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Exposed Infants Within 2 Months"); + return cd; + } + + /** + * HTS Cohort Definitions + */ + /** + * HIV testing cohort includes those who tested during the reporting period excluding pmtct clients + * Composed using htsALLNumberTested AND NOT testedPmtct + * + * @return + */ + public CohortDefinition htsNumberTested() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTested", ReportUtils.map(htsAllNumberTested(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedPositivePmtctANC1",ReportUtils.map(datimCohortLibrary.testedPositivePmtctANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedNegativePmtctANC1",ReportUtils.map(datimCohortLibrary.testedNegativePmtctANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedPositivePmtctPostANC1",ReportUtils.map(datimCohortLibrary.testedPositivePmtctPostANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedNegativePmtctPostANC1",ReportUtils.map(datimCohortLibrary.testedNegativePmtctPostANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTested OR testedPositivePmtctANC1 OR testedNegativePmtctANC1 OR testedPositivePmtctPostANC1 OR testedNegativePmtctPostANC1"); + return cd; + } + // HIV testing cohort. includes all those who tested during the reporting period + public CohortDefinition htsAllNumberTested() { + String sqlQuery = "select t.patient_id from kenyaemr_etl.etl_hts_test t inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = t.patient_id where test_type = 1 and\n" + + " t.final_test_result in ('Positive','Negative') and t.voided = 0 and t.visit_date between date (:startDate) and date (:endDate)\n" + + " group by t.patient_id;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTested"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested"); + return cd; + + } +/* +* HIV testing cohort includes those who tested at facility during the reporting period excluding pmtct clients +* Composed using htsAllNumberTestedAtFacility AND NOT testedPmtct +* */ + + public CohortDefinition htsNumberTestedAtFacility() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedAtFacility", ReportUtils.map(htsAllNumberTestedAtFacility(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedAtFacility"); + return cd; + } + + /** + * HIV testing cohort. includes all those who tested at the facility during the reporting period + * facility strategies include PITC, Non Provider initiated testing, integrated vct, stand alone vct + * Composition for htsNumberTestedAtFacility + * @return + */ + public CohortDefinition htsAllNumberTestedAtFacility() { + String sqlQuery = "select patient_id\n" + + "from kenyaemr_etl.etl_hts_test\n" + + "WHERE test_type = 1\n" + + " AND setting = 'Facility' AND final_test_result in ('Positive','Negative')\n" + + " AND visit_date between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedAtFacility"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested At Facility"); + return cd; + + } +/* +* HIV testing cohort includes those who tested at community during the reporting period excluding pmtct clients +* community strategies include Home based testing, mobile outreaches and other +* */ + + public CohortDefinition htsNumberTestedAtCommunity() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedAtCommunity", ReportUtils.map(htsAllNumberTestedAtCommunity(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedAtCommunity"); + return cd; + } + + /** + * HIV testing cohort. includes all those who tested at the facility during the reporting period + * Composition for htsNumberTestedAtCommunity + * community strategies include Home based testing, mobile outreaches and other + * @return + */ + public CohortDefinition htsAllNumberTestedAtCommunity() { + String sqlQuery = "select patient_id\n" + + "FROM kenyaemr_etl.etl_hts_test\n" + + "WHERE test_type = 1\n" + + " AND setting = 'Community' AND final_test_result in ('Positive','Negative')\n" + + " AND visit_date between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedAtCommunity"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested At Community"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested as a couple during the reporting period + * excluding pmtct tests + * Composition for htsNumberTestedAsCouple * + * @return + */ + protected CohortDefinition htsNumberTestedAsCouple() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedAsCouple", ReportUtils.map(htsAllNumberTestedAsCouple(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedAsCouple"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested as a couple during the reporting period + * Composition for htsNumberTestedAsCouple * + * @return + */ + protected CohortDefinition htsAllNumberTestedAsCouple() { + String sqlQuery = "select patient_id from kenyaemr_etl.etl_hts_test where test_type =1 AND final_test_result in ('Positive','Negative')\n" + + " and client_tested_as ='Couple' and date(visit_date) between date(:startDate) and date(:endDate)"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedAsCouple"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested As a Couple"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested as a Key population during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedKeyPopulation() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedKeyPopulation", ReportUtils.map(htsAllNumberTestedKeyPopulation(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedKeyPopulation"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested as a Key population during the reporting period + * Composition for htsNumberTestedKeyPopulation * + * @return + */ + protected CohortDefinition htsAllNumberTestedKeyPopulation() { + String sqlQuery = "select patient_id from kenyaemr_etl.etl_hts_test where test_type =1 AND final_test_result in ('Positive','Negative')\n" + + " and population_type ='Key Population' and visit_date between date(:startDate) and date(:endDate)"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedKeyPopulation"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested As a Key population"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested Positive during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedPositive() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedPositive", ReportUtils.map(htsAllNumberTestedPositive(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedPositive"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested positive during the reporting period + * Composition for htsNumberTestedPositive * + * @return + */ + public CohortDefinition htsAllNumberTestedPositive() { + String sqlQuery = "select t.patient_id\n" + + "from kenyaemr_etl.etl_hts_test t\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = t.patient_id\n" + + "where t.voided = 0\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " and t.test_type = 1\n" + + " and t.final_test_result = 'Positive'\n" + + "group by t.patient_id;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Total Number Tested Positive"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested Negative during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedNegative() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedNegative", ReportUtils.map(htsAllNumberTestedNegative(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedNegative"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested positive during the reporting period + * Composition for htsNumberTestedNegative * + * @return + */ + public CohortDefinition htsAllNumberTestedNegative() { + String sqlQuery = "select t.patient_id\n" + + "from kenyaemr_etl.etl_hts_test t\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = t.patient_id\n" + + "where t.voided = 0\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " and t.test_type = 1\n" + + " and t.final_test_result = 'Negative'\n" + + "group by t.patient_id;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedNegative"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested Negative"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested Discordant during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedDiscordant() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedDiscordant", ReportUtils.map(htsAllNumberTestedDiscordant(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedDiscordant"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested Discordant during the reporting period + * Composition for htsNumberTestedDiscordant * + * @return + */ + public CohortDefinition htsAllNumberTestedDiscordant() { + String sqlQuery = "select patient_id from kenyaemr_etl.etl_hts_test where test_type =1\n" + + " and couple_discordant ='Yes' and final_test_result in ('Positive','Negative') and date(visit_date) between date(:startDate) and date(:endDate)"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedDiscordant"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested Discordant"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested as Key Population and were Positive during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedKeypopPositive() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedKeypopPositive", ReportUtils.map(htsAllNumberTestedKeypopPositive(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedKeypopPositive"); + return cd; + } + /** + * HIV testing cohort. includes all those who tested as Key Population and were Positive during the reporting period + * Composition for htsNumberTestedKeypopPositive * + * @return + */ + public CohortDefinition htsAllNumberTestedKeypopPositive() { + String sqlQuery = "select patient_id from kenyaemr_etl.etl_hts_test where test_type =1\n" + + " and population_type ='Key Population' and final_test_result='Positive' and date(visit_date) between date(:startDate) and date(:endDate)"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedKeypopPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested Key population"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested Positive and Linked during the reporting period + * excluding pmtct tests + * @return + */ + protected CohortDefinition htsNumberTestedPositiveAndLinked() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("referredAndLinkedSinceThreeMonthsAgo", ReportUtils.map(referredAndLinkedSinceThreeMonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("enrolledToHIVAndOnDrugsSinceThreeMonthsAgo", ReportUtils.map(enrolledToHIVAndOnDrugsSinceThreeMonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("htsNumberTestedPositiveThreeMonthsAgo",ReportUtils.map(htsNumberTestedPositiveThreeMonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(htsNumberTestedPositiveThreeMonthsAgo AND (referredAndLinkedSinceThreeMonthsAgo or enrolledToHIVAndOnDrugsSinceThreeMonthsAgo)"); + return cd; + } + /** + * Clients who were referred and linked since 3 months ago. Must be on drugs + * @return + */ + public CohortDefinition referredAndLinkedSinceThreeMonthsAgo() { + String sqlQuery = "select r.patient_id\n" + + "from kenyaemr_etl.etl_hts_referral_and_linkage r\n" + + "where (r.ccc_number != '' or r.ccc_number IS NOT NULL)\n" + + " and (r.facility_linked_to != '' or r.facility_linked_to IS NOT NULL)\n" + + " and (r.art_start_date is not null)\n" + + " and (r.enrollment_date is not null)\n" + + " and r.visit_date between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 3 MONTH) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("referredAndLinked"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Referred and linked since 3 months ago"); + return cd; + + } + + /** + * Clients enrolled to HIV program since three months ago and started on drugs + * @return + */ + public CohortDefinition enrolledToHIVAndOnDrugsSinceThreeMonthsAgo() { + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_hiv_enrollment e\n" + + " inner join kenyaemr_etl.etl_drug_event d on e.patient_id = d.patient_id and d.program = 'HIV'\n" + + "where date(e.visit_date) >= date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 3 MONTH)\n" + + " and date(d.date_started) between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 3 MONTH) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("enrolledToHIVAndOnDrugsSinceThreeMonthsAgo"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Enrolled to HIV program since three months ago and started on drugs"); + return cd; + + } + /** + * HIV testing cohort. includes all those who tested Positive 3 months ago + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedPositiveThreeMonthsAgo() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedPositiveThreeMonthsAgo", ReportUtils.map(htsAllNumberTestedPositiveThreeMonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(htsAllNumberTestedPositiveThreeMonthsAgo"); + return cd; + } + + /** + * Ever tested HIV positive + * @return + */ + public CohortDefinition everTestedHIVPositive() { + String sqlQuery = "select t.patient_id from kenyaemr_etl.etl_hts_test t where t.final_test_result = 'Positive' and date(t.visit_date) <= date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("Ever tested positive for HIV"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Ever tested positive for HIV"); + return cd; + } + + /** + * Assessed for HIV risk within the period + * @return + */ + public CohortDefinition assessedForHIVRiskWithinPeriod() { + String sqlQuery = "select a.patient_id from kenyaemr_etl.etl_prep_behaviour_risk_assessment a where date(a.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("Assessed for HIV risk within the period"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Assessed for HIV risk within the period"); + return cd; + } + + /** + * Assessed for HIV risk. Excludes anyone ever tested HIV positive as of reporting period + * @return + */ + protected CohortDefinition numberAssessedForHIVRisk() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("assessedForHIVRiskWithinPeriod", ReportUtils.map(assessedForHIVRiskWithinPeriod(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("everTestedHIVPositive", ReportUtils.map(everTestedHIVPositive(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("assessedForHIVRiskWithinPeriod AND NOT everTestedHIVPositive"); + return cd; + } + + /** + * Tested in PMTCT 3 months ago + * @return + */ + private CohortDefinition testedPmtct3MonthsAgo() { + String sqlQuery = "select hts.patient_id\n" + + "from kenyaemr_etl.etl_hts_test hts\n" + + "where hts.hts_entry_point in (160538, 160456, 1623)\n" + + " and hts.patient_given_result = 'Yes'\n" + + " and hts.voided = 0\n" + + " and hts.visit_date\n" + + " between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 3 MONTH)\n" + + " and date_sub(date(:endDate), interval 3 MONTH);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("testedPmtct3MonthsAgo"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested in PMTCT Three Months AGO"); + return cd; + } + + /** + * HIV testing cohort. includes all those who tested Positive in the last 3 months + * Composition for htsNumberTestedPositiveInLastThreeMonths * + * @return + */ + public CohortDefinition htsAllNumberTestedPositiveThreeMonthsAgo() { + String sqlQuery = "select patient_id\n" + + "from kenyaemr_etl.etl_hts_test t\n" + + "where test_type = 1\n" + + " and final_test_result = 'Positive'\n" + + " and t.visit_date between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 3 MONTH)\n" + + " and date_sub(date(:endDate), interval 3 MONTH);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsNumberTestedPositiveInLastThreeMonths"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested Positive in The Last Three Months"); + return cd; + + } + /** + * HIV testing cohort. includes all those who were newly tested during the reporting period + * @return + */ + protected CohortDefinition htsNumberTestedNew() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedNew", ReportUtils.map(htsClientsForTheFirstTimeEver(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("htsClientsWithPreviousTestOver12MonthsAgo", ReportUtils.map(htsClientsWithPreviousTestOver12MonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedNew or htsClientsWithPreviousTestOver12MonthsAgo"); + return cd; + } + /** + * HIV testing cohort. includes all those who were newly tested during the reporting period + * Composition for htsNumberTestedNew * + * @return + */ + /** + * Clients testing for the first time in their lives + * @return + */ + public CohortDefinition htsClientsForTheFirstTimeEver() { + String sqlQuery = "select patient_id\n" + + " from (\n" + + " SELECT\n" + + " patient_id,\n" + + " visit_date AS test_date\n" + + " FROM kenyaemr_etl.etl_hts_test\n" + + " WHERE test_type = 1 and final_test_result in ('Positive','Negative')\n" + + " and ever_tested_for_hiv = 'No'\n" + + " GROUP BY patient_id\n" + + " having count(patient_id) = 1\n" + + " ) t\n" + + " where date(test_date) between date(:startDate) and date(:endDate)\n" + + " GROUP BY patient_id;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsClientsForTheFirstTimeEver"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Clients testing for the first time in their lives"); + return cd; + + } + + /** + * HTS clients testing again with previous test greater than 12 months ago + * @return + */ + public CohortDefinition htsClientsWithPreviousTestOver12MonthsAgo() { + String sqlQuery = "SELECT patient_id\n" + + "FROM kenyaemr_etl.etl_hts_test\n" + + "WHERE test_type = 1 AND final_test_result in ('Positive','Negative')\n" + + " and ever_tested_for_hiv = 'Yes'\n" + + " and months_since_last_test > 12\n" + + " and date(visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsClientsWithPreviousTestOver12MonthsAgo"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Clients testing for the first time in their lives"); + return cd; + + } + /** + * HIV testing cohort. Repeat tests during the reporting period + * excluding pmtct tests * + * @return + */ + protected CohortDefinition htsNumberTestedRepeat() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("htsAllNumberTestedRepeat", ReportUtils.map(htsRepeatTestsMuxEnc(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("htsRepeatClientReported", ReportUtils.map(htsRepeatClientReported(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("htsAllNumberTestedRepeat or htsRepeatClientReported"); + return cd; + } + /** + * HIV testing cohort. Clients with a repeat test within 12 months. Checking for multiple HTS encounters + * @return + */ + public CohortDefinition htsRepeatTestsMuxEnc() { + String sqlQuery = "select patient_id\n" + + " from (\n" + + " SELECT\n" + + " patient_id,\n" + + " max(visit_date) AS latest_test_date,\n" + + " min(visit_date) AS first_test_date\n" + + " FROM kenyaemr_etl.etl_hts_test\n" + + " WHERE test_type = 1 AND final_test_result in ('Positive','Negative')\n" + + " GROUP BY patient_id\n" + + " having latest_test_date between date(:startDate) and date(:endDate)\n" + + " and (latest_test_date > first_test_date and timestampdiff(MONTH,first_test_date,latest_test_date) <= 12)\n" + + " ) t;\n"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsRepeatTestsMuxEnc"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Hiv Number Tested repeat"); + return cd; + + } + + /** + * Clients who reported having had a HIV test within the last 12 months + * @return + */ + public CohortDefinition htsRepeatClientReported() { + String sqlQuery = "SELECT patient_id\n" + + "FROM kenyaemr_etl.etl_hts_test\n" + + "WHERE test_type = 1 AND final_test_result in ('Positive','Negative')\n" + + " and ever_tested_for_hiv = 'Yes'\n" + + " and months_since_last_test <= 12\n" + + " and date(visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("htsRepeatClientReported"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Clients who reported having had a HIV test within the last 12 months"); + return cd; + + } + + /** + * pre-art cohort + * looks for those qualify to be current in care but haven't started on arvs + */ + public CohortDefinition preArtCohort() { + String sqlQuery = "select patient_id from (\n" + + "SELECT\n" + + " fup.visit_date,\n" + + " fup.patient_id,\n" + + " min(e.visit_date) AS enroll_date,\n" + + " max(fup.visit_date) AS latest_vis_date,\n" + + " mid(max(concat(fup.visit_date, fup.next_appointment_date)), 11) AS latest_tca,\n" + + " disc.patient_id AS disc_patient,\n" + + "disc.disc_date as date_disc,\n" + + " de.date_started AS date_started_drugs,\n" + + " de.patient_id AS on_drugs\n" + + "FROM kenyaemr_etl.etl_patient_hiv_followup fup\n" + + " JOIN kenyaemr_etl.etl_hiv_enrollment e ON fup.patient_id = e.patient_id\n" + + " LEFT OUTER JOIN (select de.patient_id, de.date_started as date_started from kenyaemr_etl.etl_drug_event de group by de.patient_id)de ON e.patient_id = de.patient_id\n" + + " LEFT OUTER JOIN\n" + + " (select disc.patient_id,max(disc.visit_date) as disc_date from kenyaemr_etl.etl_patient_program_discontinuation disc where\n" + + " program_name='HIV' group by patient_id) disc ON disc.patient_id = fup.patient_id\n" + + "GROUP BY fup.patient_id\n" + + "HAVING (\n" + + " (date(latest_tca) > date(:endDate)\n" + + " AND (date(latest_tca) > date(date_disc) OR disc_patient IS NULL))\n" + + " OR (\n" + + " (\n" + + " (date(latest_tca) BETWEEN date(:startDate) AND date(:endDate)) OR (date(latest_vis_date) BETWEEN date(:startDate) AND date(:endDate))) AND\n" + + " (latest_tca > date(disc_date) OR disc_patient IS NULL))) and on_drugs is null\n" + + ") pre_art;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("preARTCohort"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Those in care, not started on ARVs"); + return cd; + + } + /** + * patients assessed for nutrition + */ + public CohortDefinition assessedForNutritionStatus() { + String sqlQuery = "select a.patient_id from (select t.patient_id, mid(max(concat(t.visit_date, t.nutritional_status)), 11) as nutritional_status\n" + + "from kenyaemr_etl.etl_patient_triage t\n" + + "where t.visit_date between date(:startDate) and date(:endDate)\n" + + "group by patient_id\n" + + "having nutritional_status is not null)a;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("nutritionalStatus"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients assessed for nutrition"); + return cd; + } + + /** + * patients on ART assessed for nutrition + * @return + */ + public CohortDefinition assessedForNutritionInHIV() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("txcurr",ReportUtils.map(currentlyOnArt(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("assessedForNutritionStatus",ReportUtils.map(assessedForNutritionStatus(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(txcurr AND assessedForNutritionStatus"); + return cd; + } + /** + * patients in HIV program assessed for nutrition and found malnourished + */ + public CohortDefinition malnourished() { + String sqlQuery = "select a.patient_id\n" + + "from (select t.patient_id, mid(max(concat(t.visit_date, t.nutritional_status)), 11) as nutritional_status\n" + + " from kenyaemr_etl.etl_patient_triage t\n" + + " where t.visit_date between date(:startDate) and date(:endDate)\n" + + " group by patient_id\n" + + " having nutritional_status in (163302, 163303)) a;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("malnourished"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Malnourished patients"); + return cd; + } + public CohortDefinition malnourishedInHIV() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("txcurr",ReportUtils.map(currentlyOnArt(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("malnourished",ReportUtils.map(malnourished(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(txcurr AND malnourished"); + return cd; + } + /** + * started on ipt + * looks for patients started on ipt during a given period + */ + public CohortDefinition startedOnIPT() { + String sqlQuery = "select patient_id \n" + + "from kenyaemr_etl.etl_ipt_initiation \n" + + "where visit_date between date(:startDate) and date(:endDate) and voided=0 " + + " ;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("startedOnIPT"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients started on TPT"); + return cd; + + } + + /** + * those started on ipt 12 months ago and have successfully completed + */ + public CohortDefinition completedIPT12Months() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select patient_id \n" + + "from kenyaemr_etl.etl_patient_program \n" + + "where program='TPT' and date_completed between date(:startDate) and date(:endDate) and date_enrolled between DATE_SUB(date(:startDate), INTERVAL 1 YEAR) and DATE_SUB(date(:endDate), INTERVAL 1 YEAR) and outcome=1267 " + + ";"; + cd.setName("completedIPT12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("TPT 12 months cohort who have completed"); + + return cd; + } + + /** + * newly enrolled tb patients + * @return + */ + public CohortDefinition tbEnrollment() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id " + + " from kenyaemr_etl.etl_tb_enrollment e " + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id " + + " where date(e.visit_date) between :startDate and :endDate " + + ";"; + cd.setName("newTBEnrollment"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB Enrollment"); + + return cd; + } + + /** + * new tb cases who are known positive + * @return + */ + public CohortDefinition tbNewKnownPositive() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id \n" + + "from kenyaemr_etl.etl_tb_enrollment e \n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + "inner join kenyaemr_etl.etl_hiv_enrollment he on he.patient_id=e.patient_id and he.visit_date > e.visit_date\n" + + "where date(e.visit_date) between :startDate and :endDate " + + ";"; + cd.setName("newTBKnownPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB HIV Known Positive"); + + return cd; + } + + /** + * new tb cases who took hiv test + * @return + */ + public CohortDefinition tbTestedForHIV() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id \n" + + "from kenyaemr_etl.etl_tb_enrollment e \n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + "inner join kenyaemr_etl.etl_hts_test h on h.patient_id=e.patient_id and h.visit_date between :startDate and :endDate\n" + + "where date(e.visit_date) between :startDate and :endDate " + + ";"; + cd.setName("newTBKnownPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB HIV Known Positive"); + + return cd; + } + + /** + * new tb cases who tested hiv positive + * @return + */ + public CohortDefinition tbNewTestedHIVPositive() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id \n" + + "from kenyaemr_etl.etl_tb_enrollment e \n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id \n" + + "inner join kenyaemr_etl.etl_hts_test h on h.patient_id=e.patient_id and h.visit_date between :startDate and :endDate and h.final_test_result=\"Positive\"\n" + + "where date(e.visit_date) between :startDate and :endDate " + + ";"; + cd.setName("newTBTestedHIVPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB cases tested HIV Positive"); + + return cd; + } + + /** + * new tb cases already on HAART at diagnosis + * @return + */ + public CohortDefinition tbNewAlreadyOnHAART() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_tb_enrollment e\n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id\n" + + "inner join kenyaemr_etl.etl_drug_event d on d.patient_id=e.patient_id and d.date_started < e.visit_date\n" + + "where d.program = 'HIV' and date(e.visit_date) between :startDate and :endDate ;"; + cd.setName("tbNewAlreadyOnHAART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB cases already on HAART"); + + return cd; + } + + /** + * TB newly diagnosed started on HAART within a period + * @return + */ + public CohortDefinition tbNewStartingHAART() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_tb_enrollment e\n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id\n" + + "inner join kenyaemr_etl.etl_drug_event d on d.patient_id=e.patient_id and d.date_started between :startDate and :endDate\n" + + "where d.program = 'HIV' and date(e.visit_date) between :startDate and :endDate;"; + cd.setName("tbNewStartingHAART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB cases started on HAART"); + + return cd; + } + + /** + * total of tb patients receiving HAART + * @return + */ + public CohortDefinition tbTotalOnHAART() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_tb_enrollment e\n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=e.patient_id\n" + + "inner join kenyaemr_etl.etl_drug_event d on d.patient_id=e.patient_id and d.date_started <= :endDate\n" + + "where d.program = 'HIV' and date(e.visit_date) between :startDate and :endDate;"; + cd.setName("tbNewTotalOnHAART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("New TB cases on HAART"); + + return cd; + } + + public CohortDefinition screenedForCaCx() { + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id \n" + + "from kenyaemr_etl.etl_patient_hiv_followup f \n" + + "join kenyaemr_etl.etl_patient_demographics p on p.patient_id=f.patient_id \n" + + "where date(f.visit_date) between date(:startDate) and date(:endDate) and f.cacx_screening in(703, 664, 1118) " + + ";"; + cd.setName("screenedforCaCx"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients screened for CaCx"); + + return cd; + } + + //Updated PMTCT + //First ANC visit HV02-01 + public CohortDefinition firstANCVisitMchmsAntenatal(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select d.patient_id from\n" + + " (select e.patient_id, max(e.visit_date) as latest_enrollment_date,av.visit_date as 1st_anc_visit from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join\n" + + " (select av.patient_id,av.visit_date as visit_date from kenyaemr_etl.etl_mch_antenatal_visit av where av.anc_visit_number = 1\n" + + " and av.visit_date between date(:startDate) and date(:endDate)) av on e.patient_id = av.patient_id\n" + + " group by e.patient_id\n" + + " having 1st_anc_visit between date(:startDate) and date(:endDate))d;"; + + cd.setName("First ANC Visit"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested For Hiv Antenatal"); + + return cd; + } + + // Delivery for HIV Positive mothers HV02-02 + public CohortDefinition deliveryFromHIVPositiveMothers(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select distinct ld.patient_id\n" + + " from kenyaemr_etl.etl_mchs_delivery ld\n" + + " left outer join kenyaemr_etl.etl_mch_enrollment e on e.patient_id= ld.patient_id\n" + + " left outer join kenyaemr_etl.etl_mch_antenatal_visit v on v.patient_id= ld.patient_id\n" + + " where (date(ld.visit_date) between date(:startDate) and date(:endDate))\n" + + " and (ld.final_test_result=\"Positive\" or e.hiv_status = 703 or v.final_test_result =\"Positive\") ;"; + + cd.setName("Delivery from HIV Positive Mothers"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Delivery from HIV Positive Mothers"); + + return cd; + } + // Known Positive at 1st ANC HV02-03 + public CohortDefinition knownPositiveAtFirstANC(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select v.patient_id from kenyaemr_etl.etl_mch_antenatal_visit v\n" + + " inner join (select mch.patient_id, max(mch.visit_date) as latest_mch_enrolment_date, mch.hiv_status as hiv_status_at_enrolment\n" + + " from kenyaemr_etl.etl_mch_enrollment mch group by mch.patient_id )mch on mch.patient_id = v.patient_id\n" + + " left join (select e.patient_id, max(e.visit_date) as latest_hiv_enrollment_date\n" + + " from kenyaemr_etl.etl_hiv_enrollment e where e.visit_date < date(:endDate)\n" + + " group by e.patient_id)e on v.patient_id = e.patient_id\n" + + " left join (select t.patient_id, max(t.visit_date) as latest_hiv_test_date,mid(max(concat(t.visit_date,t.final_test_result)),11) as test_result\n" + + " from kenyaemr_etl.etl_hts_test t where t.visit_date < date(:endDate)\n" + + " group by t.patient_id)t on v.patient_id = t.patient_id\n" + + "where v.visit_date between date(:startDate) and date(:endDate) and v.anc_visit_number = 1\n" + + " and ((mch.latest_mch_enrolment_date > e.latest_hiv_enrollment_date or hiv_status_at_enrolment = 703 or\n" + + " (mch.latest_mch_enrolment_date > t.latest_hiv_test_date and t.test_result = 'Positive')))\n" + + "group by v.patient_id"; + + cd.setName("Known Positive at First ANC"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Known Positive at First ANC"); + + return cd; + } + /** + * Clients withInitial test at ANC 1 HV02-04 * + * Composed using negativePMTCTANC1 OR positivePMTCTANC1 + * + * @return + */ + public CohortDefinition initialHIVTestInMchmsAntenatal() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("negativePMTCTANC1", + ReportUtils.map(datimCohortLibrary.negativePMTCTANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("positivePMTCTANC1", + ReportUtils.map(datimCohortLibrary.positivePMTCTANC1(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(negativePMTCTANC1 OR positivePMTCTANC1"); + return cd; + } + + // Initial test at Labour and Delivery HV02-05 + public CohortDefinition testedForHivInMchmsDelivery(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select ld.patient_id\n" + + "from kenyaemr_etl.etl_mchs_delivery ld\n" + + " left outer join (select a.patient_id, a.visit_date\n" + + " from kenyaemr_etl.etl_mch_antenatal_visit a\n" + + " where a.final_test_result is not null\n" + + " and date(a.visit_date) <= date(:endDate)\n" + + " group by a.patient_id\n" + + " having max(date(a.visit_date))) a\n" + + " on ld.patient_id = a.patient_id\n" + + " left join (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 160538\n" + + " and date(t.visit_date) <= date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) is not null) t\n" + + " on ld.patient_id = t.patient_id\n" + + "where date(ld.visit_date) between date(:startDate) and date(:endDate)\n" + + " and ld.final_test_result in ('Positive', 'Negative', 'Inconclusive')\n" + + " and a.patient_id is null and (t.patient_id is null or date(ld.visit_date) < date(t.visit_date));"; + + cd.setName("Initial Test at Labour and Delivery"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial Test at Labour and Delivery"); + + return cd; + } + //Initial Test at PNC <=6 Weeks HV02-06 + public CohortDefinition initialTestAtPNCUpto6Weeks(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select p.patient_id\n" + + "from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " left outer join (select a.patient_id, a.visit_date\n" + + " from kenyaemr_etl.etl_mch_antenatal_visit a\n" + + " where a.final_test_result is not null\n" + + " and date(a.visit_date) <= date(:endDate)\n" + + " group by a.patient_id\n" + + " having max(date(a.visit_date))) a\n" + + " on p.patient_id = a.patient_id\n" + + " left outer join (select ld.patient_id, ld.visit_date\n" + + " from kenyaemr_etl.etl_mchs_delivery ld\n" + + " where ld.final_test_result is not null\n" + + " and date(ld.visit_date) <= date(:endDate)\n" + + " group by ld.patient_id\n" + + " having max(date(ld.visit_date))) ld\n" + + " on p.patient_id = ld.patient_id\n" + + " left join (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 160538\n" + + " and date(t.visit_date) <= date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) is not null) t\n" + + " on p.patient_id = t.patient_id\n" + + "where date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " and p.final_test_result in ('Positive', 'Negative','Inconclusive')\n" + + " and timestampdiff(WEEK,date(p.delivery_date),date(p.visit_date)) between 0 and 6\n" + + " and (a.patient_id is null and ld.patient_id is null and (date(p.visit_date) < date(t.visit_date) or t.patient_id is null));"; + + cd.setName("Initial Test at PNC <=6 Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial Test at PNC <=6 Weeks"); + + return cd; + } + /** + * HIV Status Total HV02-07 --Computed + * Composed using knownPositiveAtFirstANC OR initialHIVTestInMchmsAntenatal OR testedForHivInMchmsDelivery OR initialTestAtPNCUpto6Weeks + * + * @return + */ + public CohortDefinition testedForHivInMchmsTotal() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("knownPositiveAtFirstANC", + ReportUtils.map(knownPositiveAtFirstANC(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("initialHIVTestInMchmsAntenatal", + ReportUtils.map(initialHIVTestInMchmsAntenatal(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedForHivInMchmsDelivery", + ReportUtils.map(testedForHivInMchmsDelivery(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedHivPositiveInPNCWithin6Weeks", + ReportUtils.map(testedHivPositiveInPNCWithin6Weeks(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(knownPositiveAtFirstANC OR initialHIVTestInMchmsAntenatal OR testedForHivInMchmsDelivery OR testedHivPositiveInPNCWithin6Weeks "); + return cd; + } + //Retesting PNC <=6 weeks HV02-08 + public CohortDefinition pncRetestUpto6Weeks(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select p.patient_id\n" + + "from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " left join (select a.patient_id, a.visit_date\n" + + " from kenyaemr_etl.etl_mch_antenatal_visit a\n" + + " where a.final_test_result is not null\n" + + " and date(a.visit_date) <= date(:endDate)\n" + + " group by a.patient_id\n" + + " having max(date(a.visit_date))) a\n" + + " on p.patient_id = a.patient_id\n" + + " left outer join (select ld.patient_id, ld.visit_date\n" + + " from kenyaemr_etl.etl_mchs_delivery ld\n" + + " where ld.final_test_result is not null\n" + + " and date(ld.visit_date) <= date(:endDate)\n" + + " group by ld.patient_id\n" + + " having max(date(ld.visit_date))) ld\n" + + " on p.patient_id = ld.patient_id\n" + + " left join (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 160538\n" + + " and date(t.visit_date) <= date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) is not null) t\n" + + " on p.patient_id = t.patient_id\n" + + "where date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " and p.final_test_result in ('Positive', 'Negative','Inconclusive')\n" + + " and timestampdiff(WEEK,date(p.delivery_date),date(p.visit_date)) between 0 and 6\n" + + " and (a.patient_id is not null or t.patient_id is not null or ld.patient_id is not null);"; + + cd.setName("pncRetestUpto6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("PNC Retest within 6 weeks"); + + return cd; + } + //Tested PNC >6 weeks and <= 6 months HV02-09 + public CohortDefinition pncTestBtwn6WeeksAnd6Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left join (select a.patient_id, a.visit_date, a.delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit a\n" + + " where a.final_test_result is not null\n" + + " and date(a.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by a.patient_id\n" + + " having max(date(a.visit_date))) p\n" + + " on e.patient_id = p.patient_id\n" + + " left join (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 160538\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(date(t.visit_date), t.final_test_result)), 11) in ('Positive', 'Negative')) t\n" + + " on e.patient_id = t.patient_id\n" + + "where\n" + + " (timestampdiff(WEEK, date(p.delivery_date), date(p.visit_date)) > 6 and\n" + + " timestampdiff(MONTH, date(p.delivery_date), date(p.visit_date)) <= 6)\n" + + " or (timestampdiff(WEEK, date(p.delivery_date), date(t.visit_date)) > 6 and\n" + + " timestampdiff(MONTH, date(p.delivery_date), date(t.visit_date)) <= 6);"; + + cd.setName("pncTest6WeeksUpto6Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("PNC Test between 6 weeks and 6 Months"); + + return cd; + } + //Known Positive before 1st ANC HV02-10 + /*public CohortDefinition knownPositiveAtFirstANC(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = " select distinct e.patient_id " + + " from kenyaemr_etl.etl_mch_enrollment e " + + " join kenyaemr_etl.etl_mch_antenatal_visit anc on anc.patient_id=e.patient_id " + + " where (e.visit_date between date(:startDate) and date(:endDate)) " + + " and hiv_status=703 and e.visit_date>hiv_test_date;"; + + cd.setName("knownHIVPositiveBeforeFirstAnc"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested Hiv Positive Before First ANC visit"); + + return cd; + }*/ + //Tested HIV Positive at ANC HV02-11 + public CohortDefinition testedHivPositiveInMchmsAntenatal(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select distinct v.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v\n" + + " left outer join kenyaemr_etl.etl_mch_enrollment e on e.patient_id=v.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate) and\n" + + " (e.hiv_status !=703) and\n" + + " v.final_test_result =\"POSITIVE\";"; + + cd.setName("Tested Hiv Postive at Antenatal"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested Hiv Postive at Antenatal"); + + return cd; + } + +//Tested HIV Positive during Labour and Delivery HV02-12 + + public CohortDefinition positiveHIVResultsAtLabourAndDelivery(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left outer join (select ld.patient_id, ld.visit_date\n" + + " from kenyaemr_etl.etl_mchs_delivery ld\n" + + " where ld.final_test_result = 'Positive'\n" + + " and date(ld.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by ld.patient_id\n" + + " having max(date(ld.visit_date))) ld\n" + + " on e.patient_id = ld.patient_id\n" + + " left join (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 160456\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) = 'Positive') t\n" + + " on e.patient_id = t.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and (ld.patient_id is not null or t.patient_id is not null);"; + + cd.setName("HIV Positive results during Labour and Delivery"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HIV Positive results during Labour and Delivery"); + + return cd; + } + // HIV positive results PNC <=6 weeks) HV02-13 + public CohortDefinition testedHivPositiveInPNCWithin6Weeks(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery ="select p.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left outer join (select p.patient_id, p.visit_date, p.delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where p.final_test_result = 'Positive' and p.patient_given_result = 'Yes'\n" + + " and date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by p.patient_id\n" + + " having max(date(p.visit_date))) p\n" + + " on p.patient_id = e.patient_id\n" + + " left join (select t.patient_id, t.visit_date,t.final_test_result\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 1623\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) = 'Positive'\n" + + " and mid(max(concat(t.visit_date, t.patient_given_result)), 11) = 'Yes') t\n" + + " on p.patient_id = t.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and (timestampdiff(WEEK,date(p.delivery_date),date(p.visit_date)) between 0 and 6\n" + + " or timestampdiff(WEEK,date(p.delivery_date),date(t.visit_date)) between 0 and 6);"; + + cd.setName("testedHivPositiveInPNCWithin6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested Positive at PNC within 6 weeks"); + + return cd; + } + //Total HIV positive Mothers HV02-14 + public CohortDefinition totalHivPositiveMothersInMchms(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("knownPositiveAtFirstANC", + ReportUtils.map(knownPositiveAtFirstANC(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("initialHIVTestInMchmsAntenatal", + ReportUtils.map(initialHIVTestInMchmsAntenatal(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("testedForHivInMchmsDelivery", + ReportUtils.map(testedForHivInMchmsDelivery(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("initialTestAtPNCUpto6Weeks", + ReportUtils.map(initialTestAtPNCUpto6Weeks(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(knownPositiveAtFirstANC OR initialHIVTestInMchmsAntenatal OR testedForHivInMchmsDelivery OR initialTestAtPNCUpto6Weeks "); + return cd; + } + // PNC >6 weeks and <=6 months HV02-15 + public CohortDefinition totalHivPositivePNC6WeeksTo6monthsInMchms(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select p.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left outer join (select p.patient_id, p.visit_date, p.delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where p.final_test_result = 'Positive' and p.patient_given_result = 'Yes'\n" + + " and date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by p.patient_id\n" + + " having max(date(p.visit_date))) p\n" + + " on p.patient_id = e.patient_id\n" + + " left join (select t.patient_id, t.visit_date,t.final_test_result\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " where t.hts_entry_point = 1623\n" + + " and date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by t.patient_id\n" + + " having max(date(t.visit_date))\n" + + " and mid(max(concat(t.visit_date, t.final_test_result)), 11) = 'Positive'\n" + + " and mid(max(concat(t.visit_date, t.patient_given_result)), 11) = 'Yes') t\n" + + " on p.patient_id = t.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and (timestampdiff(WEEK, date(p.delivery_date), date(p.visit_date)) > 6 and\n" + + " timestampdiff(MONTH, date(p.delivery_date), date(p.visit_date)) <= 6)\n" + + " or (timestampdiff(WEEK, date(p.delivery_date), date(t.visit_date)) > 6 and\n" + + " timestampdiff(MONTH, date(p.delivery_date), date(t.visit_date)) <= 6);"; + + cd.setName("totalHivPositivePNC6WeeksTo6monthsInMchms"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Mothers tested Hiv Positive in PNC Between 7 weeks and 6 months"); + + return cd; + } + //On HAART at 1st ANC HV02-16 + public CohortDefinition totalOnHAARTAtFirstANC(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + + " left join (select patient_id,\n" + + " min(date_started) as date_started_art\n" + + " from kenyaemr_etl.etl_drug_event d\n" + + " where program = 'HIV'\n" + + " and d.date_started <= date(:endDate)\n" + + " GROUP BY patient_id) d on v.patient_id = d.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and v.anc_visit_number = 1\n" + + " and (date(e.ti_date_started_art) < date(v.visit_date) or\n" + + " (d.date_started_art < date(v.visit_date)));"; + + cd.setName("totalOnHAARTAtFirstANC"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("On HAART At first ANC"); + + return cd; + } + + // Given HAART during ANC + public CohortDefinition givenHAARTAtANC(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select v.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v\n" + + "where v.haart_given = 1\n" + + " and date(v.visit_date) between date(:startDate) and date(:endDate);"; + cd.setName("givenHAARTAtANC"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Given HAART At ANC"); + + return cd; + } + + /** + * Started HAART at during ANC + * @return + */ + public CohortDefinition startedHAARTAtANC() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("givenHAARTAtANC",ReportUtils.map(givenHAARTAtANC(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("totalOnHAARTAtFirstANC",ReportUtils.map(totalOnHAARTAtFirstANC(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("givenHAARTAtANC AND NOT totalOnHAARTAtFirstANC"); + return cd; + } + + //Start HAART During Labour and Delivery HV02-18 + public CohortDefinition totalStartedHAARTAtLabourAndDelivery(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct ld.patient_id\n" + + "from kenyaemr_etl.etl_mchs_delivery ld\n" + + "inner join kenyaemr_etl.etl_drug_event d on d.patient_id=ld.patient_id\n" + + "where d.program = 'HIV' and date(ld.visit_date) between date(:startDate) and date(:endDate)\n" + + "and d.date_started >= ld.visit_date;"; + + cd.setName("totalStartedHAARTAtLabourAndDelivery"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Started HAART At L&D"); + + return cd; + } + + //Started HAART upto 6 weeks HV02-19 + public CohortDefinition totalStartedHAARTAtPNCUpto6Weeks(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join (select p.patient_id, p.visit_date, p.delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where p.mother_haart_given = 1065\n" + + " and date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by p.patient_id\n" + + " having max(date(p.visit_date))) p\n" + + " on p.patient_id = e.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(WEEK,date(p.delivery_date),date(p.visit_date)) between 0 and 6;"; + + cd.setName("totalStartedHAARTAtPNCUpto6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Started HAART At PNC within 6 weeks"); + + return cd; + } + + //Total maternal HAART HV02-20 + public CohortDefinition totalMaternalHAART(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = ";"; + + cd.setName("totalMaternalHAART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total maternal HAART"); + + return cd; + } + //Start HAART_PNC >6 wks to 6 mths HV02-21 + public CohortDefinition totalStartedOnHAARTBtw7WeeksAnd6Months(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join (select p.patient_id, p.visit_date, p.delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where p.mother_haart_given = 1065\n" + + " and date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by p.patient_id\n" + + " having max(date(p.visit_date))) p\n" + + " on p.patient_id = e.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + "and (timestampdiff(WEEK, date(p.delivery_date), date(p.visit_date)) > 6 and\n" + + " timestampdiff(MONTH, date(p.delivery_date), date(p.visit_date)) <= 6);"; + + cd.setName("totalStartedOnHAARTBtw7WeeksAnd6Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total started on HAART between 7 weeks and 6 months"); + + return cd; + } + //On maternal HAART_12 mths HV02-22 + public CohortDefinition onHAARTUpto12Months(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct mch.patient_id\n" + + " from kenyaemr_etl.etl_mch_enrollment mch\n" + + " inner join kenyaemr_etl.etl_drug_event d on d.patient_id=mch.patient_id and d.program = 'HIV'\n" + + " where d.date_started between date_sub(date(:startDate), INTERVAL 12 MONTH) and date_sub(date(:endDate), INTERVAL 12 MONTH);"; + cd.setName("onHAARTUpto12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total on HAART upto 12 months"); + + return cd; + } + + //MCH Net Cohort_12 months HV02-23 + public CohortDefinition netCohortAt12Months(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct e.patient_id\n" + + " from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join kenyaemr_etl.etl_drug_event d on d.patient_id=e.patient_id and d.program = 'HIV'\n" + + " left join (select disc.patient_id, max(disc.visit_date) latest_visit from kenyaemr_etl.etl_patient_program_discontinuation disc where disc.program_name='HIV') disc on e.patient_id = disc.patient_id\n" + + " where (disc.patient_id is null or disc.latest_visit > date(:endDate)) and d.date_started between date_sub(date(:startDate), INTERVAL 12 MONTH) and date_sub(date(:endDate), INTERVAL 12 MONTH);\n" + + "\n"; + + cd.setName("netCohortAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Net Cohort at 12 months"); + + return cd; + } + + //Syphilis Screened at ANC HV02-24 + + public CohortDefinition syphilisScreenedAtANC(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select v.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v\n" + + " inner join kenyaemr_etl.etl_mch_enrollment e on v.patient_id = e.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and (v.syphilis_test_status in (1229, 1228, 1304) or\n" + + " (e.visit_date between date(:startDate) and date(:endDate) and e.serology in (1229, 1228, 1304)));"; + + cd.setName("syphilisScreenedAt1stANC"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Screened at First ANC"); + + return cd; + } + + //Syphilis Screened Positive HV02-25 + public CohortDefinition syphilisScreenedPositive(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join kenyaemr_etl.etl_mch_antenatal_visit v on v.patient_id = e.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and v.syphilis_test_status = 1228;"; + + cd.setName("syphilisScreenedPositive"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Syphilis Screened Positive"); + + return cd; + } + + //Syphilis Treated HV02-26 + public CohortDefinition treatedForSyphilis(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join kenyaemr_etl.etl_mch_antenatal_visit v on v.patient_id= e.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and v.syphilis_treated_status =1065;"; + + cd.setName("treatedForSyphilis"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Treated for Syphilis"); + + return cd; + } + + //HIV+ On Modern FP at 6 weeks HV02-27 + public CohortDefinition HIVPositiveOnModernFPUpto6Weeks(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct p.patient_id\n" + + "from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + "inner join kenyaemr_etl.etl_mch_enrollment e on e.patient_id = p.patient_id\n" + + "inner join kenyaemr_etl.etl_mchs_delivery ld on ld.patient_id= p.patient_id\n" + + "where date(p.visit_date) between date(:startDate) and date(:endDate) and\n" + + "(ld.final_test_result=\"Positive\" or e.hiv_status = 703 or p.final_test_result =\"Positive\") and\n" + + "(round(DATEDIFF(ld.date_of_delivery,:endDate)/7) <=6) and\n" + + "p.family_planning_status=965;"; + + cd.setName("HIVPositiveOnModernFPUpto6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HIV Positive on Modern FP at 6 weeks"); + + return cd; + } + + //HIV+ PNC Visits at 6 weeks HV02-28 + public CohortDefinition HIVPositivePNCVisitsAt6Weeks(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct p.patient_id\n" + + "from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " inner join kenyaemr_etl.etl_mch_enrollment e on e.patient_id = p.patient_id\n" + + " left outer join kenyaemr_etl.etl_mch_antenatal_visit v on v.patient_id=p.patient_id\n" + + " left outer join kenyaemr_etl.etl_mchs_delivery ld on ld.patient_id= p.patient_id\n" + + "where date(p.visit_date) between date(:startDate) and date(:endDate) and\n" + + " (ld.final_test_result=\"Positive\" or e.hiv_status = 703 or v.final_test_result =\"Positive\") and\n" + + " (round(DATEDIFF(ld.date_of_delivery,:endDate)/7) <=6);"; + + cd.setName("HIVPositivePNCVisitsAt6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HIV Positive PNC Visits at 6 weeks"); + + return cd; + } + + //Known partner HIV Status 1st Contact HV02-29 + public CohortDefinition knownHIVStatusAt1stContact(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " inner join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and v.anc_visit_number = 1\n" + + " and coalesce(v.partner_hiv_status,e.partner_hiv_status) in (703, 664);"; + cd.setName("knownHIVStatusAt1stContact"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Known partner HIV status at First Contact"); + + return cd; + } + + //Initial test at ANC Male HV02-30 + public CohortDefinition initialTestAtANCForMale(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct anc.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit anc\n" + + "where date(anc.visit_date) between date(:startDate) and date(:endDate)\n" + + " and anc.partner_hiv_tested =1065;"; + cd.setName("initialTestAtANCForMale"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial Test at ANC for Males"); + + return cd; + } + + //Initial test at Delivery Male HV02-30 + public CohortDefinition initialTestAtDeliveryForMale(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct ld.patient_id\n" + + "from kenyaemr_etl.etl_mchs_delivery ld\n" + + "where date(ld.visit_date) between date(:startDate) and date(:endDate)\n" + + "and ld.partner_hiv_tested =1065;"; + cd.setName("initialTestAtDeliveryForMale"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial Test at Delivery for Males"); + + return cd; + } + + //Initial test at PNC Male HV02-31 + public CohortDefinition initialTestAtPNCForMale(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct pnc.patient_id\n" + + "from kenyaemr_etl.etl_mch_postnatal_visit pnc\n" + + "where date(pnc.visit_date) between date(:startDate) and date(:endDate)\n" + + "and pnc.partner_hiv_tested =1065;"; + + cd.setName("initialTestAtPNCForMale"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial Test at PNC for Males"); + + return cd; + } + //Total Known Status Male HV02-32 + /* public CohortDefinition totalKnownHIVStatusMale(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = ";"; + + cd.setName("totalKnownHIVStatusMale"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total males with known HIV Status"); + + return cd; + }*/ + + //1st ANC KP adolescents (10-19) HV02-33 + public CohortDefinition firstANCKPAdolescents(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select c.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit c\n" + + " left join (select e.patient_id, max(e.visit_date) as latest_mch_enrollment\n" + + " from kenyaemr_etl.etl_mch_enrollment e\n" + + " where e.visit_date <= date(:endDate)\n" + + " and e.hiv_status = 703\n" + + " group by e.patient_id) e on c.patient_id = e.patient_id\n" + + " left join (select h.patient_id, max(h.visit_date) as latest_hiv_enrollment\n" + + " from kenyaemr_etl.etl_hiv_enrollment h\n" + + " where h.visit_date <= date(:endDate)\n" + + " group by h.patient_id) h\n" + + " on c.patient_id = h.patient_id\n" + + "where c.anc_visit_number = 1\n" + + " and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + + " and (date(c.visit_date) > date(e.latest_mch_enrollment)\n" + + " or date(c.visit_date) > h.latest_hiv_enrollment)\n" + + " and (e.patient_id is not null\n" + + " or h.patient_id is not null);"; + + cd.setName("firstANCKPAdolescents"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("1st ANC KP Adolescents"); + + return cd; + } + + public CohortDefinition firstHIVTestAtANCOrDelivery(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select t.patient_id from kenyaemr_etl.etl_hts_test t where date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + "and t.ever_tested_for_hiv = 'No' and t.hts_entry_point in (160538,160456);"; + cd.setName("firstHIVTestAtANCOrDelivery"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested at ANC OR l&d for the first time"); + + return cd; + } + public CohortDefinition firstHIVTestAtPNCWithin6Weeks(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left join\n" + + " (select t.patient_id, t.visit_date\n" + + " from kenyaemr_etl.etl_hts_test t\n" + + " left join (select pn.patient_id,\n" + + " max(pn.visit_date) as latest_pn_visit,\n" + + " mid(max(concat(pn.visit_date, pn.delivery_date)), 11) as delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit pn\n" + + " where date(pn.visit_date) <= date(:endDate)) pn on t.patient_id = pn.patient_id\n" + + " where date(t.visit_date) between date(:startDate) and date(:endDate)\n" + + " and t.ever_tested_for_hiv = 'No'\n" + + " and t.hts_entry_point = 1623\n" + + " and timestampdiff(WEEK, pn.delivery_date, t.visit_date) <= 6) hts on e.patient_id = hts.patient_id\n" + + " left join (select p.patient_id\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " and p.final_test_result is not null\n" + + " and p.final_test_result != ''\n" + + " and timestampdiff(WEEK, date(p.delivery_date), date(p.visit_date)) <= 6) p\n" + + " on e.patient_id = p.patient_id\n" + + "where hts.patient_id is not null\n" + + " or p.patient_id is not null;"; + cd.setName("firstHIVTestAtPNCWithin6Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Tested at PNC for the first time within 6 weeks"); + + return cd; + } + public CohortDefinition adolescentsHIVPositive() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("firstHIVTestAtANCOrDelivery",ReportUtils.map(firstHIVTestAtANCOrDelivery(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("firstHIVTestAtPNCWithin6Weeks",ReportUtils.map(firstHIVTestAtPNCWithin6Weeks(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("firstHIVTestAtANCOrDelivery AND firstHIVTestAtPNCWithin6Weeks"); + return cd; + } + //Started HAART adolescents_Total HV02-35 + public CohortDefinition adolescentsStartedOnHAART(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " left join (select de.patient_id\n" + + " from kenyaemr_etl.etl_drug_event de\n" + + " inner join (select pn.patient_id,\n" + + " mid(max(concat(pn.visit_date, pn.visit_timing_mother)), 11) as mother_visit_timing,\n" + + " max(pn.visit_date) as latest_pn_visit,\n" + + " mid(max(concat(pn.visit_date, pn.delivery_date)), 11) as delivery_date\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit pn\n" + + " where date(pn.visit_date) <= date(:endDate)) pn\n" + + " on de.patient_id = pn.patient_id\n" + + " where date(de.visit_date) between date(:startDate) and date(:endDate)\n" + + " and de.program = 'HIV'\n" + + " and (timestampdiff(WEEK, date(pn.delivery_date), date(de.date_started)) <= 6)) de\n" + + " on e.patient_id = de.patient_id\n" + + " left join (select c.patient_id\n" + + " from kenyaemr_etl.etl_mch_antenatal_visit c\n" + + " where date(c.visit_date) between date(:startDate) and date(:endDate)\n" + + " and date(c.date_given_haart) between date(:startDate) and date(:endDate)) c\n" + + " on e.patient_id = c.patient_id\n" + + " left join (select d.patient_id, d.visit_date\n" + + " from kenyaemr_etl.etl_mchs_delivery d\n" + + " where date(d.visit_date) between date(:startDate) and date(:endDate)\n" + + " and d.mother_started_haart_at_maternity = 1065) d\n" + + " on e.patient_id = d.patient_id\n" + + " left join (select p.patient_id\n" + + " from kenyaemr_etl.etl_mch_postnatal_visit p\n" + + " where date(p.visit_date) between date(:startDate) and date(:endDate)\n" + + " and p.mother_haart_given = 1065\n" + + " and (timestampdiff(WEEK, date(p.delivery_date), date(p.visit_date)) <= 6 or\n" + + " p.visit_timing_mother in (1721, 1722))) p on e.patient_id = p.patient_id\n" + + "where de.patient_id is not null\n" + + " or c.patient_id is not null\n" + + " or d.patient_id is not null\n" + + " or p.patient_id is not null;"; + cd.setName("adolescentsStartedOnHAART"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Adolescents started on HAART"); + + return cd; + } + + //Known Exposure at Penta 1 HV02-36 + public CohortDefinition knownExposureAtPenta1(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct he.patient_id\n" + + "from kenyaemr_etl.etl_hei_enrollment he\n" + + " inner join kenyaemr_etl.etl_immunization hi on hi.patient_id=he.patient_id\n" + + "where date(hi.visit_date) between (:startDate) and (:endDate)\n" + + " and he.child_exposed != 1067 AND\n" + + " hi.PCV_10_1 = \"Yes\" ;"; + + cd.setName("knownExposureAtPenta1"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Known HIV Exposure at Penta 1"); + + return cd; + } + + //Total given Penta 1 HV02-37 + public CohortDefinition totalGivenPenta1(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct he.patient_id\n" + + " from kenyaemr_etl.etl_hei_enrollment he\n" + + " inner join kenyaemr_etl.etl_immunization hi on hi.patient_id=he.patient_id\n" + + " where date(hi.visit_date) between (:startDate) and (:endDate)\n" + + " and hi.PCV_10_1 = \"Yes\" ;"; + + cd.setName("totalGivenPenta1"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total Infants given Penta 1"); + + return cd; + } + + //Infant ARV Prophylaxis ANC HV02-39 + //We want to pick the first anc given prophylaxis + public CohortDefinition infantArvProphylaxisANC(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select en.patient_id\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v\n" + + " inner join kenyaemr_etl.etl_mch_enrollment en on en.patient_id = v.patient_id\n" + + "where (v.baby_nvp_dispensed = 80586\n" + + " or v.baby_azt_dispensed = 160123)\n" + + " and date(v.visit_date) between date(:startDate) and date(:endDate);"; + + cd.setName("infantArvProphylaxisANC"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Infant ARV Prophylaxis at ANC"); + + return cd; + } + + //We want to pick the first ld given prophylaxis + public CohortDefinition infantArvProphylaxisLabourAndDeliverySql(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select distinct en.patient_id from kenyaemr_etl.etl_mchs_delivery ld\n" + + " inner join kenyaemr_etl.etl_mch_enrollment en on en.patient_id = ld.patient_id\n" + + "where ld.baby_nvp_dispensed = 1 or ld.baby_azt_dispensed = 1\n" + + "group by ld.patient_id\n" + + "having min(date(ld.visit_date)) between date(:startDate) and date(:endDate);"; + cd.setName("infantArvProphylaxisLabourAndDelivery"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Infant ARV Prophylaxis during Labour and Delivery"); + + return cd; + } + //Infant ARV Prophylaxis L&D HV02-40 + //Exludes those given at ANC + public CohortDefinition infantArvProphylaxisLabourAndDelivery(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("infantArvProphylaxisLabourAndDeliverySql",ReportUtils.map(infantArvProphylaxisLabourAndDeliverySql(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("infantArvProphylaxisANC",ReportUtils.map(infantArvProphylaxisANC(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("infantArvProphylaxisLabourAndDeliverySql AND NOT infantArvProphylaxisANC"); + return cd; + } + + public CohortDefinition infantARVProphylaxisGivenWithin8WeeksSql(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select en.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment en\n" + + " inner join kenyaemr_etl.etl_mch_postnatal_visit p on en.patient_id = p.patient_id\n" + + "where (p.baby_nvp_dispensed = 80586 or p.baby_azt_dispensed = 160123)\n" + + " and TIMESTAMPDIFF(WEEK, date(p.delivery_date), date(p.visit_date)) <=\n" + + " 8 and date(p.visit_date) between date(:startDate) and date(:endDate);"; + + cd.setName("totalARVProphylaxis"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total ARV Prophylaxis"); + + return cd; + } + //Infant ARV Prophylaxis <8weeks PNC HV02-41. Exludes those given at L&D and ANC + //We want to pick the first pnc less than 8 weeks given prophylaxis + public CohortDefinition infantArvProphylaxisPNCLessThan8Weeks(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("infantARVProphylaxisGivenWithin8WeeksSql",ReportUtils.map(infantARVProphylaxisGivenWithin8WeeksSql(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("infantArvProphylaxisLabourAndDelivery",ReportUtils.map(infantArvProphylaxisLabourAndDelivery(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("infantARVProphylaxisGivenWithin8WeeksSql AND NOT infantArvProphylaxisLabourAndDelivery"); + return cd; + } + /** + * Total Infant ARV prophylaxis: At ANC+L&D+PNC upto 8 weeks + * @return + */ + public CohortDefinition totalInfantARVProphylaxis() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("infantArvProphylaxisANC",ReportUtils.map(infantArvProphylaxisANC(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("infantArvProphylaxisLabourAndDelivery",ReportUtils.map(infantArvProphylaxisLabourAndDelivery(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("infantArvProphylaxisPNCLessThan8Weeks",ReportUtils.map(infantArvProphylaxisPNCLessThan8Weeks(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("infantArvProphylaxisANC OR infantArvProphylaxisLabourAndDelivery OR infantArvProphylaxisPNCLessThan8Weeks"); + return cd; + } + + /** + * 12 Month cohort + * @return + */ + public CohortDefinition twelveMonthCohort(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select d.patient_id\n" + + "from kenyaemr_etl.etl_patient_demographics d\n" + + "where d.dob between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 12 MONTH)\n" + + " and date_sub(date(:endDate), interval 12 MONTH);"; + cd.setName("twelveMonthCohort"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Twelve month cohort"); + return cd; +} + + /** + * 24 month cohort + * @return + */ + public CohortDefinition twentyFourMonthCohort(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select d.patient_id\n" + + "from kenyaemr_etl.etl_patient_demographics d\n" + + " inner join kenyaemr_etl.etl_hei_enrollment e on d.patient_id = e.patient_id\n" + + "where d.dob between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + + " interval 24 MONTH)\n" + + " and date_sub(date(:endDate), interval 24 MONTH) and timestampdiff(month, (d.dob), date(e.visit_date)) between 0 and 18;"; + cd.setName("twentyFourMonthCohort"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("24 month cohort"); + return cd; + } + public CohortDefinition heiDDSCTXStartWithin2Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "SELECT en.patient_id\n" + + "FROM kenyaemr_etl.etl_hei_enrollment en\n" + + " inner join kenyaemr_etl.etl_patient_demographics pd on en.patient_id = pd.patient_id\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit hf on hf.patient_id = en.patient_id\n" + + "where TIMESTAMPDIFF(MONTH, pd.DOB, hf.visit_date) <= 2\n" + + " and hf.ctx_given = 105281;"; + cd.setName("heiDDSCTSStartLessThan2Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HEI DDS/CTS Start <=2 Months"); + + return cd; + } + //HEI CTX/DDS Start <2 months HV02-42 + public CohortDefinition heiDDSCTXStartLessThan2Months() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("heiDDSCTXStartWithin2Months",ReportUtils.map(heiDDSCTXStartWithin2Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND heiDDSCTXStartWithin2Months"); + return cd; + } + + //Initial PCR <8 weeks HV02-43 + public CohortDefinition initialPCRLessThan8Weeks(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id \n" + + " from kenyaemr_etl.etl_hei_follow_up_visit hv \n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=hv.patient_id \n" + + " where hv.dna_pcr_result is not null and \n" + + " (hv.visit_date between date(:startDate) and date(:endDate)) and timestampdiff(week,p.dob,date(:endDate))<= 8; "; + cd.setName("initialPCRLessThan8Weeks"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial PCR <8 weeks"); + + return cd; + } + + //Initial PCR >8weeks - 12 months HV02-44 + public CohortDefinition initialPCROver8WeeksTo12Months(){ + + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + "from kenyaemr_etl.etl_hei_follow_up_visit hv\n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id = hv.patient_id\n" + + "where hv.dna_pcr_result is not null\n" + + " and (hv.visit_date between date(:startDate) and date(:endDate))\n" + + " and timestampdiff(WEEK, p.dob, date(:endDate)) > 8\n" + + " and timestampdiff(month, p.dob, date(:endDate)) <= 12; "; + cd.setName("initialPCROver8WeeksTo12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Initial PCR >8 weeks to 12 Months"); + + return cd; + } + + //Initial PCR Test <12 mths Total HV02-45 + public CohortDefinition totalInitialPCRTestLessThan12Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + " from kenyaemr_etl.etl_hei_follow_up_visit hv \n" + + " join kenyaemr_etl.etl_patient_demographics p on p.patient_id=hv.patient_id \n" + + " where hv.dna_pcr_result is not null and\n" + + " (hv.visit_date between date(:startDate) and date(:endDate)) and timestampdiff(month,p.dob,date(:endDate)) <= 12;"; + cd.setName("totalInitialPCRTestLessThan12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total Initial PCR <12 Months"); + + return cd; + } + + public CohortDefinition totalInfectedHEI(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + "from kenyaemr_etl.etl_hei_follow_up_visit hv\n" + + "where hv.dna_pcr_result = 703 and date(hv.visit_date) <= date(:endDate);"; + cd.setName("totalInfectedHEI"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total infected HEIs"); + return cd; + } + //Infected 24 months HV02-46 + public CohortDefinition totalInfected24Months() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("totalInfectedHEI",ReportUtils.map(totalInfectedHEI(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND totalInfectedHEI"); + return cd; + } + + public CohortDefinition totalUninfectedHEIs(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + "from kenyaemr_etl.etl_hei_follow_up_visit hv\n" + + "where dna_pcr_result = 664\n" + + " and dna_pcr_contextual_status = 162082 and date(hv.visit_date) <= date(:endDate);"; + cd.setName("totalUninfectedHEIs"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Total uninfected HEIs"); + return cd; + } + //Uninfected 24 months HV02-47 + public CohortDefinition totalUninfectedIn24Months() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("totalUninfectedHEIs",ReportUtils.map(totalUninfectedHEIs(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND totalUninfectedHEIs"); + return cd; + } + + //Unknown Outcome 24 mths HV02-48 + public CohortDefinition unknownOutcomesIn24Months(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("exitedHEI",ReportUtils.map(exitedHEI(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("unknownStatusHEI",ReportUtils.map(unknownStatusHEI(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND exitedHEI AND unknownStatusHEI"); + return cd; + } + + //Net Cohort HEI 24 months HV02-49 + public CohortDefinition netCohortHeiIn24Months() { + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("heiTransferredOut",ReportUtils.map(heiTransferredOut(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND NOT heiTransferredOut"); + return cd; + } + public CohortDefinition exitedHEI(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select d.patient_id\n" + + "from kenyaemr_etl.etl_patient_program_discontinuation d\n" + + "where program_name = 'MCH Child HEI'\n" + + " and d.discontinuation_reason in (5240, 159492, 160034)\n" + + " and date(coalesce(d.effective_discontinuation_date, d.visit_date)) <= date(:endDate);"; + cd.setName("exitedHEI"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Exited HEI"); + + return cd; + } + public CohortDefinition unknownStatusHEI(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + "from kenyaemr_etl.etl_hei_follow_up_visit hv\n" + + "where date(hv.visit_date) <= date(:endDate)\n" + + "group by hv.patient_id\n" + + "having group_concat(hv.dna_pcr_result) is null;"; + cd.setName("unknownStatusHEI"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Unknown status HEI"); + + return cd; + } + public CohortDefinition heiTransferredOut(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select d.patient_id\n" + + "from kenyaemr_etl.etl_patient_program_discontinuation d\n" + + "where program_name in ('MCH Child HEI', 'MCH Child')\n" + + " and d.discontinuation_reason = 159492\n" + + " and date(coalesce(d.effective_discontinuation_date, d.visit_date)) <= date(:endDate);"; + cd.setName("heiTransferredOut"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HEIs transferred out"); + + return cd; + } + /** + * Hei followup at 24 months with mother as primary care giver + * @return + */ + public CohortDefinition motherBabyPairs(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select hv.patient_id\n" + + "from kenyaemr_etl.etl_hei_follow_up_visit hv\n" + + "where hv.primary_caregiver = 970\n" + + " and hv.visit_date between date(:startDate) and date(:endDate);"; + cd.setName("motherBabyPairsIn24Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Mother-baby pairs in 24 Months"); + return cd; + } + //Mother-baby pairs 24 months HV02-50 + public CohortDefinition motherBabyPairsIn24Months(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("motherBabyPairs",ReportUtils.map(motherBabyPairs(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND motherBabyPairs"); + return cd; + } + + public CohortDefinition heiWithLivingMotherAtEnrollment(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select he.patient_id\n" + + " from kenyaemr_etl.etl_hei_enrollment he\n" + + " where he.mother_alive = 1;"; + cd.setName("heiWithLivingMotherAtEnrollment"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("HEI with living mother at registration"); + return cd; + } + //Pair net cohort 24 months HV02-51 + public CohortDefinition pairNetCohortIn24Months(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("heiWithLivingMotherAtEnrollment",ReportUtils.map(heiWithLivingMotherAtEnrollment(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("heiTransferredOut",ReportUtils.map(heiTransferredOut(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("(twentyFourMonthCohort AND heiWithLivingMotherAtEnrollment) AND NOT heiTransferredOut"); + return cd; + } + public CohortDefinition exclusiveBFAt6Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id from (Select e.patient_id, f.infant_feeding, group_concat(f.infant_feeding) as feeding, d.dob\n" + + "from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 6\n" + + "group by e.patient_id\n" + + "having find_in_set(6046, feeding) = 0\n" + + " and find_in_set(1595, feeding) = 0\n" + + " and find_in_set(5632, feeding) = 0\n" + + " and find_in_set(164478, feeding) = 0\n" + + " and find_in_set(5526, feeding) = 1)f;"; + cd.setName("exclusiveBFAt6Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Exclusive Breastfeeding at 6 months"); + return cd; + } + //EBF (at 6 months) HV02-52 + public CohortDefinition exclusiveBFAt6Months12MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("exclusiveBFAt6Months",ReportUtils.map(exclusiveBFAt6Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND exclusiveBFAt6Months"); + return cd; + } + + //ERF (at 6 months) HV02-53 + public CohortDefinition exclusiveRFAt6Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id from (Select e.patient_id, f.infant_feeding, group_concat(f.infant_feeding) as feeding, d.dob\n" + + "from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + "where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 6\n" + + "group by e.patient_id\n" + + "having find_in_set(6046, feeding) = 0\n" + + " and find_in_set(1595, feeding) = 1\n" + + " and find_in_set(5632, feeding) = 0\n" + + " and find_in_set(164478, feeding) = 0\n" + + " and find_in_set(5526, feeding) = 0)f;"; + cd.setName("exclusiveRFAt6Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Exclusive Replacement feeding at 6 months"); + return cd; + } + public CohortDefinition exclusiveRFAt6Months12MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("exclusiveRFAt6Months",ReportUtils.map(exclusiveRFAt6Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND exclusiveRFAt6Months"); + return cd; + } + public CohortDefinition mixedFeedingAt6Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from (Select e.patient_id, f.infant_feeding, group_concat(f.infant_feeding) as feeding, d.dob\n" + + " from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + " where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 6\n" + + " group by e.patient_id\n" + + " having find_in_set(6046, feeding) = 1\n" + + ") f;"; + cd.setName("mixedFeedingAt6Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Mixed feeding at 6 months"); + return cd; + } + //MF (at 6 months) HV02-54 + public CohortDefinition mixedFeedingAt6Months12MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("mixedFeedingAt6Months",ReportUtils.map(mixedFeedingAt6Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND mixedFeedingAt6Months"); + return cd; + } + public CohortDefinition breastFeedingAt12Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from (Select e.patient_id, group_concat(f.infant_feeding) as feeding, d.dob\n" + + " from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + " where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 12\n" + + " group by e.patient_id\n" + + " having (find_in_set(6046, feeding) = 1\n" + + " or find_in_set(5632, feeding) = 1\n" + + " or find_in_set(5526, feeding) = 1)\n" + + " and find_in_set(1595, feeding) = 0\n" + + " and find_in_set(164478, feeding) = 0) f;"; + cd.setName("breastFeedingAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Breast feeding at 12 months"); + + return cd; + } + //BF (12 months) HV02-55 + public CohortDefinition breastFeedingAt12Months12MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("breastFeedingAt12Months",ReportUtils.map(breastFeedingAt12Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND breastFeedingAt12Months"); + return cd; + } + + //Not BF (12 months) HV02-56 + public CohortDefinition notBreastFeedingAt12Months12MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twelveMonthCohort",ReportUtils.map(twelveMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("notBreastFeedingAt12Months",ReportUtils.map(notBreastFeedingAt12Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twelveMonthCohort AND notBreastFeedingAt12Months"); + return cd; + } + public CohortDefinition notBreastFeedingAt12Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from (Select e.patient_id, group_concat(f.infant_feeding) as feeding, d.dob\n" + + " from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + " where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 12\n" + + " group by e.patient_id\n" + + " having (find_in_set(1595, feeding) = 1\n" + + " or find_in_set(164478, feeding) = 1)\n" + + " and find_in_set(6046, feeding) = 0\n" + + " and find_in_set(5632, feeding) = 0\n" + + " and find_in_set(5526, feeding) = 0) f;"; + cd.setName("notBreastFeedingAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Not Breast feeding at 12 months"); + + return cd; + } + + public CohortDefinition breastFeedingAt18Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from (Select e.patient_id, group_concat(f.infant_feeding) as feeding, d.dob\n" + + " from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + " where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 18\n" + + " group by e.patient_id\n" + + " having (find_in_set(6046, feeding) = 1\n" + + " or find_in_set(5632, feeding) = 1\n" + + " or find_in_set(5526, feeding) = 1)\n" + + " and find_in_set(1595, feeding) = 0\n" + + " and find_in_set(164478, feeding) = 0) f;"; + cd.setName("breastFeedingAt18Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Breast feeding at 18 months"); + + return cd; + } + //BF (18 months) HV02-57 + public CohortDefinition breastFeedingAt18Months24MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("breastFeedingAt18Months",ReportUtils.map(breastFeedingAt18Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND breastFeedingAt18Months"); + return cd; + } + public CohortDefinition notBreastFeedingAt18Months(){ + SqlCohortDefinition cd = new SqlCohortDefinition(); + String sqlQuery = "select f.patient_id\n" + + "from (Select e.patient_id, group_concat(f.infant_feeding) as feeding, d.dob\n" + + " from kenyaemr_etl.etl_hei_enrollment e\n" + + " inner join kenyaemr_etl.etl_hei_follow_up_visit f on e.patient_id = f.patient_id\n" + + " inner join kenyaemr_etl.etl_patient_demographics d on d.patient_id = e.patient_id\n" + + " where date(e.visit_date) <= date(:endDate)\n" + + " and timestampdiff(month, d.dob, date(f.visit_date)) <= 18\n" + + " group by e.patient_id\n" + + " having (find_in_set(1595, feeding) = 1\n" + + " or find_in_set(164478, feeding) = 1)\n" + + " and find_in_set(6046, feeding) = 0\n" + + " and find_in_set(5632, feeding) = 0\n" + + " and find_in_set(5526, feeding) = 0) f;"; + cd.setName("notBreastFeedingAt12Months"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Not Breast feeding at 12 months"); + + return cd; + } + + //Not BF (18 months) HV02-58 + public CohortDefinition notBreastFeedingAt18Months24MonthCohort(){ + CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.addSearch("twentyFourMonthCohort",ReportUtils.map(twentyFourMonthCohort(), "startDate=${startDate},endDate=${endDate}")); + cd.addSearch("notBreastFeedingAt18Months",ReportUtils.map(notBreastFeedingAt18Months(), "startDate=${startDate},endDate=${endDate}")); + cd.setCompositionString("twentyFourMonthCohort AND notBreastFeedingAt18Months"); + return cd; + } + /** + * VMMC + * HV04-13 + *Number of males circumcised with moderate Adverse Events during procedutre + * @return + */ + public CohortDefinition circumcisedWithModerateAEDuringProcedure() { + String sqlQuery = "select e.patient_id from kenyaemr_etl.etl_vmmc_enrolment e\n" + + " inner join kenyaemr_etl.etl_vmmc_circumcision_procedure c on e.patient_id = c.patient_id\n" + + " inner join kenyaemr_etl.etl_adverse_events a on e.patient_id = a.patient_id and a.form ='vmmc-procedure'\n" + + "where c.visit_date between date(:startDate) and date(:endDate) and a.severity = 1499;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("VMMC_MODERATE_AE_DURING"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Number of males circumcised with moderate AE during procedure"); + return cd; + } + /** + * VMMC + * HV04-14 + *Number of males circumcised with severe Adverse Events during procedutre + * @return + */ + public CohortDefinition circumcisedWithSevereAEDuringProcedure() { + String sqlQuery = "select e.patient_id from kenyaemr_etl.etl_vmmc_enrolment e\n" + + " inner join kenyaemr_etl.etl_vmmc_circumcision_procedure c on e.patient_id = c.patient_id\n" + + " inner join kenyaemr_etl.etl_adverse_events a on e.patient_id = a.patient_id and a.form ='vmmc-procedure'\n" + + "where c.visit_date between date(:startDate) and date(:endDate) and a.severity = 1500;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("VMMC_SEVERE_AE_DURING"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Number of males circumcised with severe AE during procedure"); + return cd; + } + /** + * VMMC + * HV04-15 + *Number of males circumcised with moderate Adverse Events post procedutre + * @return + */ + public CohortDefinition circumcisedWithModerateAEPostProcedure() { + String sqlQuery = "select e.patient_id from kenyaemr_etl.etl_vmmc_enrolment e\n" + + " inner join kenyaemr_etl.etl_vmmc_circumcision_procedure c on e.patient_id = c.patient_id\n" + + " inner join kenyaemr_etl.etl_adverse_events a on e.patient_id = a.patient_id and a.form ='vmmc-followup'\n" + + "where c.visit_date between date(:startDate) and date(:endDate) and a.severity = 1499;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("VMMC_MODERATE_AE_POST"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Number of males circumcised with moderate AE post procedure"); + return cd; + } + /** + * VMMC + * HV04-16 + *Number of males circumcised with severe Adverse Events post procedure + * @return + */ + public CohortDefinition circumcisedWithSevereAEPostProcedure() { + String sqlQuery = "select e.patient_id from kenyaemr_etl.etl_vmmc_enrolment e\n" + + " inner join kenyaemr_etl.etl_vmmc_circumcision_procedure c on e.patient_id = c.patient_id\n" + + " inner join kenyaemr_etl.etl_adverse_events a on e.patient_id = a.patient_id and a.form ='vmmc-followup'\n" + + "where c.visit_date between date(:startDate) and date(:endDate) and a.severity = 1500;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("VMMC_SEVERE_AE_POST"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Number of males circumcised with severe AE post procedure"); + return cd; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardIndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardIndicatorLibrary.java new file mode 100644 index 0000000000..a25f011603 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/moh731Old/ETLOldMoh731GreenCardIndicatorLibrary.java @@ -0,0 +1,1324 @@ +/** + * 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.library.ETLReports.moh731Old; + +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.RevisedDatim.DatimCohortLibrary; +import org.openmrs.module.reporting.indicator.CohortIndicator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.openmrs.module.kenyacore.report.ReportUtils.map; +import static org.openmrs.module.kenyaemr.reporting.EmrReportingUtils.cohortIndicator; + +/** + * Created by dev on 1/14/17. + */ + +/** + * Library of HIV related indicator definitions. All indicators require parameters ${startDate} and ${endDate} + */ +@Component +public class ETLOldMoh731GreenCardIndicatorLibrary { + @Autowired + private ETLOldMoh731GreenCardCohortLibrary moh731Cohorts; + @Autowired + private DatimCohortLibrary datimCohorts; + + // Green card additions + + /** + * HIV counseling and testing + * covers indicators HV01-01 - HV01-10 + * + * @return indicator + */ + public CohortIndicator htsNumberTested() { + return cohortIndicator("Individuals tested", map(moh731Cohorts.htsNumberTested(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV counseling and testing at health facility + * covers indicators HV01-11 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedAtFacility() { + return cohortIndicator("Individuals tested at the facility", map(moh731Cohorts.htsNumberTestedAtFacility(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV counseling and testing at community + * covers indicators HV01-12 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedAtCommunity() { + return cohortIndicator("Individuals tested at the community", map(moh731Cohorts.htsNumberTestedAtCommunity(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * New tests + * covers indicators HV01-13 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedNew() { + return cohortIndicator("New tests", map(moh731Cohorts.htsNumberTestedNew(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Repeat tests + * covers indicators HV01-14 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedRepeat() { + return cohortIndicator("Repeat tests", map(moh731Cohorts.htsNumberTestedRepeat(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: couples + * covers indicators HV01-15 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedAsCouple() { + return cohortIndicator("Couple testing", map(moh731Cohorts.htsNumberTestedAsCouple(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: Key population + * covers indicators HV01-16 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedKeyPopulation() { + return cohortIndicator("Key population testing", map(moh731Cohorts.htsNumberTestedKeyPopulation(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: Positive results + * covers indicators HV01-17 - HV01-26 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedPositive() { + return cohortIndicator("HIV Positive tests", map(moh731Cohorts.htsNumberTestedPositive(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: Negative total + * covers indicators HV01-27 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedNegative() { + return cohortIndicator("HIV Negative tests", map(moh731Cohorts.htsNumberTestedNegative(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: Discordant couples + * covers indicators HV01-28 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedDiscordant() { + return cohortIndicator("Discordant couples", map(moh731Cohorts.htsNumberTestedDiscordant(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: Negative total + * covers indicators HV01-29 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedKeypopPositive() { + return cohortIndicator("Key Pop - positives", map(moh731Cohorts.htsNumberTestedKeypopPositive(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: turned positive within last 3 months and linked to care during reporting period + * covers indicators HV01-30 - HV01-35 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedPositiveAndLinked() { + return cohortIndicator("Positive and linked to care", map(moh731Cohorts.htsNumberTestedPositiveAndLinked(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV couseling and testing: number tested positive in last 3 months + * covers indicators HV01-36 + * + * @return indicator + */ + public CohortIndicator htsNumberTestedPositiveThreeMonthsAgo() { + return cohortIndicator("tested Positive 3 months ago", map(moh731Cohorts.htsNumberTestedPositiveThreeMonthsAgo(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Assessed for HIV risk + * @return + */ + public CohortIndicator numberAssessedForHIVRisk() { + return cohortIndicator("Assessed for HIV risk", map(moh731Cohorts.numberAssessedForHIVRisk(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who did First ANC visit during that period {@link org.openmrs.module.kenyaemr.PregnancyStage} + * First ANC visit HV02-01 + * + * @return the indicator + */ + public CohortIndicator firstANCVisitMchmsAntenatal() { + return cohortIndicator(null, + map(moh731Cohorts.firstANCVisitMchmsAntenatal(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the DELIVERY {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Delivery for HIV Positive mothers HV02-02 + * + * @return the indicator + */ + public CohortIndicator deliveryFromHIVPositiveMothers() { + return cohortIndicator(null, + map(moh731Cohorts.deliveryFromHIVPositiveMothers(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who are known positive at First ANC {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Known Positive at 1st ANC HV02-03 + * + * @return the indicator + */ + public CohortIndicator knownPositiveAtFirstANC() { + return cohortIndicator(null, + map(moh731Cohorts.knownPositiveAtFirstANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the ANTENATAL {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Initial test at ANC HV02-04 + * + * @return the indicator + */ + public CohortIndicator initialHIVTestInMchmsAntenatal() { + return cohortIndicator(null, + map(moh731Cohorts.initialHIVTestInMchmsAntenatal(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the DELIVERY {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Initial test at labour and delivery HV02-05 + * + * @return the indicator + */ + public CohortIndicator testedForHivInMchmsDelivery() { + return cohortIndicator(null, + map(moh731Cohorts.testedForHivInMchmsDelivery(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the POSTNATAL {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Initial Test at PNC<=6 weeks HV02-06 + * + * @return the indicator + */ + public CohortIndicator initialTestAtPNCUpto6Weeks() { + return cohortIndicator(null, + map(moh731Cohorts.initialTestAtPNCUpto6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during any {@link org.openmrs.module.kenyaemr.PregnancyStage} after enrollment + * Known HIV Status total HV02-07 + * + * @return the indicator + */ + public CohortIndicator testedForHivInMchms() { + return cohortIndicator(null, + map(moh731Cohorts.testedForHivInMchmsTotal(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during any {@link org.openmrs.module.kenyaemr.PregnancyStage} after enrollment + * Retesting_PNC <=6 weeks HV02-08 + * + * @return the indicator + */ + public CohortIndicator pncRetestUpto6Weeks() { + return cohortIndicator(null, + map(moh731Cohorts.pncRetestUpto6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during any {@link org.openmrs.module.kenyaemr.PregnancyStage} after enrollment + * Tested_PNC>6 Weeks to 6 months HV02-09 + * + * @return the indicator + */ + public CohortIndicator pncTestBtwn6WeeksAnd6Months() { + return cohortIndicator(null, + map(moh731Cohorts.pncTestBtwn6WeeksAnd6Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested HIV +ve before MCHMS + * Known HIV Positive at 1st ANC HV02-10 + * + * @return the indicator + */ + public CohortIndicator knownHivPositiveAtFirstANC() { + + return cohortIndicator(null, + map(moh731Cohorts.knownPositiveAtFirstANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested HIV Positive in MCHMS during the ANTENATAL {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Positive results ANC HV02-11 + * + * @return the indicator + */ + public CohortIndicator testedHivPositiveInMchmsAntenatal() { + return cohortIndicator(null, + map(moh731Cohorts.testedHivPositiveInMchmsAntenatal(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the DELIVERY {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Delivery for HIV Positive mothers HV02-12 + * + * @return the indicator + */ + public CohortIndicator testedHivPositiveInMchmsDelivery() { + return cohortIndicator(null, + map(moh731Cohorts.positiveHIVResultsAtLabourAndDelivery(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested for HIV in MCHMS during the DELIVERY {@link org.openmrs.module.kenyaemr.PregnancyStage} + * Positive Results PNC <=6 weeks HV02-13 + * + * @return the indicator + */ + public CohortIndicator testedHivPositiveInPNCWithin6Weeks() { + return cohortIndicator(null, + map(moh731Cohorts.testedHivPositiveInPNCWithin6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of patients who tested HIV Positive in MCHMS during any {@link org.openmrs.module.kenyaemr.PregnancyStage} after enrollment + * Mothers positive total HV02-14 + * + * @return the indicator + */ + public CohortIndicator totalHivPositiveInMchms() { + return cohortIndicator(null, + map(moh731Cohorts.totalHivPositiveMothersInMchms(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of infant patients who took pcr test aged between 7 weeks and 6 months and confirmed Positive + * Positive PNC >6 Weeks to 6 months HV02-15 + * + * @return the indicator + */ + public CohortIndicator pncHIVPositiveBetween7weeksAnd6Months() { + return cohortIndicator("PNC HIV Positive between 7 weeks and 6 months", + map(moh731Cohorts.totalHivPositivePNC6WeeksTo6monthsInMchms(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients on HAART At First ANC + * On HAART At First ANC HV02-16 + * + * @return the indicator + */ + public CohortIndicator onHAARTAtFirstANC() { + return cohortIndicator("On HAART At first ANC", + map(moh731Cohorts.totalOnHAARTAtFirstANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started HAART At ANC + * Start HAART ANC HV02-17 + * + * @return the indicator + */ + public CohortIndicator startHAARTANC() { + return cohortIndicator("Started HAART At ANC", + map(moh731Cohorts.startedHAARTAtANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started HAART during Labour and delivery + * Start HAART L&D HV02-18 + * + * @return the indicator + */ + public CohortIndicator startedHAARTLabourAndDelivery() { + return cohortIndicator("Started HAART during labour and delivery", + map(moh731Cohorts.totalStartedHAARTAtLabourAndDelivery(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started HAART during first 6 weeks of PNC + * Start HAART PNC <=6 weeks HV02-19 + * + * @return the indicator + */ + public CohortIndicator startedHAARTPNCUpto6Weeks() { + return cohortIndicator("Started HAART within 6 weeks of PNC", + map(moh731Cohorts.totalStartedHAARTAtPNCUpto6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started on maternal HAART + * Total maternal HAART HV02-20 + * + * @return the indicator + * + public CohortIndicator totalMaternalHAART() { + return cohortIndicator("Total maternal HAART", + map(moh731Cohorts.totalMaternalHAART(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started HAART between 7 weeks and 6 months + * Start HAART_PNC>6 weeks to 6 months HV02-21 + * * @return the indicator + */ + public CohortIndicator onHAARTFrom7WeeksTo6Months() { + return cohortIndicator("Started HAART between 7 weeks and 6 months", + map(moh731Cohorts.totalStartedOnHAARTBtw7WeeksAnd6Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients started HAART during first 6 weeks of PNC + * On maternal HAART_12 Months HV02-22 + * + * @return the indicator + */ + public CohortIndicator onHAARTUpto12Months() { + return cohortIndicator("On Maternal HAART upto 12 months", + map(moh731Cohorts.onHAARTUpto12Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Net cohort at 12 months + * Net cohort_12 months HV02-23 + * + * @return the indicator + */ + public CohortIndicator netCohortAt12Months() { + return cohortIndicator("Net cohort at 12 months", + map(moh731Cohorts.netCohortAt12Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients screened for syphilis at 1st ANC + * Syphilis screened 1st ANC HV02-24 + * + * @return the indicator + */ + public CohortIndicator syphilisScreenedAtANC() { + return cohortIndicator("Screened for Syphilis at ANC", + map(moh731Cohorts.syphilisScreenedAtANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients screened positive for syphilis + * Syphilis screened positive HV02-25 + * + * @return the indicator + */ + public CohortIndicator syphilisScreenedPositive() { + return cohortIndicator("Syphilis Screened Positive", + map(moh731Cohorts.syphilisScreenedPositive(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Patients Treated for syphilis + * Syphilis treated HV02-26 + * + * @return the indicator + */ + public CohortIndicator syphilisTreated() { + return cohortIndicator("Treated for syphilis", + map(moh731Cohorts.treatedForSyphilis(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of HIV+ Patients on modern FP at 6 weeks + * HIV+ On modern FP at 6 weeks HV02-27 + * + * @return the indicator + */ + public CohortIndicator HIVPositiveOnModernFPUpto6Weeks() { + return cohortIndicator("HIVPositiveOnModernFPUpto6Weeks", + map(moh731Cohorts.HIVPositiveOnModernFPUpto6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of HIV+ Patients with PNC visits at 6 weeks + * HIV+ PNC Visits at 6 weeks HV02-28 + * + * @return the indicator + */ + public CohortIndicator HIVPositivePNCVisitsAt6Weeks() { + return cohortIndicator("HIVPositivePNCVisitsAt6Weeks", + map(moh731Cohorts.HIVPositivePNCVisitsAt6Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Known HIV status for partners at First contacts + * Known HIV status for partners 1st contact HV02-29 + * + * @return the indicator + */ + public CohortIndicator knownHIVStatusAt1stContact() { + return cohortIndicator("knownHIVPositive1stContact", + map(moh731Cohorts.knownHIVStatusAt1stContact(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Male contacts tested at ANC + * Initial test at ANC male HV02-30 + * + * @return the indicator + */ + public CohortIndicator initialTestAtANCForMale() { + return cohortIndicator("initialTestAtANCForMale", + map(moh731Cohorts.initialTestAtANCForMale(), "startDate=${startDate},endDate=${endDate}") + ); + } + /** + * Number of Male contacts tested at L&D + * Initial test at L&D male HV02-30 + * + * @return the indicator + */ + public CohortIndicator initialTestAtDeliveryForMale() { + return cohortIndicator("initialTestAtDeliveryForMale", + map(moh731Cohorts.initialTestAtDeliveryForMale(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Male contacts tested at PNC + * Initial test at PNC Male HV02-31 + * + * @return the indicator + */ + public CohortIndicator initialTestAtPNCForMale() { + return cohortIndicator("initialTestAtPNCForMale", + map(moh731Cohorts.initialTestAtPNCForMale(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Male contacts with known HIV status + * Total known status male HV02-32 + * + * @return the indicator + * + public CohortIndicator totalKnownHIVStatusMale() { + return cohortIndicator("totalKnownHIVStatusMale", + map(moh731Cohorts.totalKnownHIVStatusMale(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of 1st ANC KP Adolescents + * 1st ANC KP Adolescents HV02-33 + * + * @return the indicator + */ + public CohortIndicator firstANCKPAdolescents() { + return cohortIndicator("firstANCKPAdolescents", + map(moh731Cohorts.firstANCKPAdolescents(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Adolescents with HIV Positive results + * Positive result adolescents_Total HV02-34 + * + * @return the indicator + */ + public CohortIndicator adolescentsHIVPositive() { + return cohortIndicator("adolescentsHIVPositive", + map(moh731Cohorts.adolescentsHIVPositive(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of Adolescents started on HAART + * Started HAART adolescents_Total HV02-35 + * + * @return the indicator + */ + public CohortIndicator adolescentsStartedOnHAART() { + return cohortIndicator("adolescentsStartedOnHAART", + map(moh731Cohorts.adolescentsStartedOnHAART(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of known exposed infants at penta 1 + * Known exposure at penta 1 HV02-36 + * + * @return the indicator + */ + public CohortIndicator knownExposureAtPenta1() { + return cohortIndicator("knownExposureAtPenta1", + map(moh731Cohorts.knownExposureAtPenta1(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Number of infants given penta 1 + * Total given penta 1 HV02-37 + * + * @return the indicator + */ + public CohortIndicator totalGivenPenta1() { + return cohortIndicator("totalGivenPenta1", + map(moh731Cohorts.totalGivenPenta1(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Infant ARV Prophylaxis at ANC + * Infant ARV Prophylaxis ANC HV02-38 + * + * @return the indicator + */ + public CohortIndicator infantArvProphylaxisANC() { + return cohortIndicator("infantArvProphylaxisANC", + map(moh731Cohorts.infantArvProphylaxisANC(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Infant ARV Prophylaxis during Labour and Delivery + * Infant ARV prophylaxis L&D HV02-39 + * + * @return the indicator + */ + public CohortIndicator infantArvProphylaxisLabourAndDelivery() { + return cohortIndicator("infantArvProphylaxisLabourAndDelivery", + map(moh731Cohorts.infantArvProphylaxisLabourAndDelivery(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Infant ARV Prophylaxis PNC < 8 weeks + * Infant ARV Prophylaxis <8 weeks PNC HV02-40 + * + * @return the indicator + */ + public CohortIndicator infantArvProphylaxisPNCLessThan8Weeks() { + return cohortIndicator("infantArvProphylaxisPNCLessThan8Weeks", + map(moh731Cohorts.infantArvProphylaxisPNCLessThan8Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total Infant ARV Prophylaxis + * Total ARV Prophylaxis total HV02-41 + * + * @return the indicator + * + public CohortIndicator totalARVProphylaxis() { + return cohortIndicator("totalARVProphylaxis", + map(moh731Cohorts.totalARVProphylaxis(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total HEI DDS/CTX Start less than 2 months + * HEI CTX/DDS Start <2 months HV02-42 + * + * @return the indicator + */ + public CohortIndicator heiDDSCTXStartLessThan2Months() { + return cohortIndicator("heiDDSCTXStartLessThan2Months", + map(moh731Cohorts.heiDDSCTXStartLessThan2Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total Initial PCR < 8 Weeks + * Initial PCR <8 Weeks HV02-43 + * + * @return the indicator + */ + public CohortIndicator initialPCRLessThan8Weeks() { + return cohortIndicator("initialPCRLessThan8Weeks", + map(moh731Cohorts.initialPCRLessThan8Weeks(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total Initial PCR > 8 Weeks to 12 months + * Initial PCR >8 Weeks - 12 months HV02-44 + * + * @return the indicator + */ + public CohortIndicator initialPCROver8WeeksTo12Months() { + return cohortIndicator("initialPCROver8WeeksTo12Months", + map(moh731Cohorts.initialPCROver8WeeksTo12Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total Initial PCR <12 months + * Initial PCR Test <12 months Total HV02-45 + * + * @return the indicator + */ + public CohortIndicator totalInitialPCRTestLessThan12Months() { + return cohortIndicator("totalInitialPCRTestLessThan12Months", + map(moh731Cohorts.totalInitialPCRTestLessThan12Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total Infected in 24 months + * Infected 24 months HV02-46 + * + * @return the indicator + */ + public CohortIndicator infectedIn24Months() { + return cohortIndicator("totalInfected24Months", + map(moh731Cohorts.totalInfected24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total uninfected in 24 months + * Uninfected 24 months HV02-47 + * + * @return the indicator + */ + public CohortIndicator uninfectedIn24Months() { + return cohortIndicator("totalUninfectedIn24Months", + map(moh731Cohorts.totalUninfectedIn24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Total unknown outcomes in 24 months + * Unknown Outcome 24 months HV02-48 + * + * @return the indicator + */ + public CohortIndicator unknownOutcomesIn24Months() { + return cohortIndicator("unknownOutcomesIn24Months", + map(moh731Cohorts.unknownOutcomesIn24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Net cohort HEI in 24 months + * Net cohort HEI 24 months HV02-49 + * + * @return the indicator + */ + public CohortIndicator netCohortHeiIn24Months() { + return cohortIndicator("netCohortHeiIn24Months", + map(moh731Cohorts.netCohortHeiIn24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Mother-baby pairs in 24 months + * Mother-baby pairs 24 months HV02-50 + * + * @return the indicator + */ + public CohortIndicator motherBabyPairsIn24Months() { + return cohortIndicator("motherBabyPairsIn24Months", + map(moh731Cohorts.motherBabyPairsIn24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Pair Net cohorts at 24 months + * Pair net cohort 24 months HV02-51 + * + * @return the indicator + */ + public CohortIndicator pairNetCohortIn24Months() { + return cohortIndicator("pairNetCohortIn24Months", + map(moh731Cohorts.pairNetCohortIn24Months(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Exclusive Breastfeeding at 6 months + * EBF(at 6 months) HV02-52 + * + * @return the indicator + */ + public CohortIndicator exclusiveBFAt6Months12MonthCohort() { + return cohortIndicator("exclusiveBFAt6Months", + map(moh731Cohorts.exclusiveBFAt6Months12MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Exclusive Replacement feeding at 6 months + * ERF(at 6 months) HV02-53 + * + * @return the indicator + */ + public CohortIndicator exclusiveRFAt6Months12MonthCohort() { + return cohortIndicator("exclusiveRFAt6Months", + map(moh731Cohorts.exclusiveRFAt6Months12MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Mixed feeding at 6 months + * MF(at 6 months) HV02-54 + * + * @return the indicator + */ + public CohortIndicator mixedFeedingAt6Months12MonthCohort() { + return cohortIndicator("mixedFeedingAt6Months", + map(moh731Cohorts.mixedFeedingAt6Months12MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Breastfeeding at 12 months + * BF(12 months) HV02-55 + * + * @return the indicator + */ + public CohortIndicator breastFeedingAt12Months12MonthCohort() { + return cohortIndicator("breastFeedingAt12Months", + map(moh731Cohorts.breastFeedingAt12Months12MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Not Breastfeeding in 12 months + * Not BF (12 Months) HV02-56 + * + * @return the indicator + */ + public CohortIndicator notBreastFeedingAt12Months12MonthCohort() { + return cohortIndicator("notBreastFeedingAt12Months", + map(moh731Cohorts.notBreastFeedingAt12Months12MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Breastfeeding at 18 months + * BF (18 Months) HV02-57 + * + * @return the indicator + */ + public CohortIndicator breastFeedingAt18Months24MonthCohort() { + return cohortIndicator("breastFeedingAt18Months", + map(moh731Cohorts.breastFeedingAt18Months24MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Not Breastfeeding at 18 months + * Not BF(18 Months) HV02-58 + * + * @return the indicator + */ + public CohortIndicator notBreastFeedingAt18Months24MonthCohort() { + return cohortIndicator("notBreastFeedingAt18Months", + map(moh731Cohorts.notBreastFeedingAt18Months24MonthCohort(), "startDate=${startDate},endDate=${endDate}") + ); + } + + /** + * Pre-art + * covers indicators HV03-013 to HV03-015 + * + * @return indicator + */ + public CohortIndicator preArtCohort() { + return cohortIndicator("pre-art cohort", map(moh731Cohorts.preArtCohort(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * patients in HIV program assessed for nutrition + * + * @return indicator + */ + public CohortIndicator assessedForNutritionInHIV() { + return cohortIndicator("Started on IPT", map(moh731Cohorts.assessedForNutritionInHIV(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * patients in HIV program who are malnourished + * + * @return indicator + */ + public CohortIndicator malnourishedInHIV() { + return cohortIndicator("Started on IPT", map(moh731Cohorts.malnourishedInHIV(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * patients started on ipt + * + * @return indicator + */ + public CohortIndicator startedOnIPT() { + return cohortIndicator("Started on IPT", map(moh731Cohorts.startedOnIPT(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * patients who started ipt 12 months ago and have completed + */ + public CohortIndicator ipt12MonthsCohort() { + return cohortIndicator("IPT 12 months cohort", map(moh731Cohorts.completedIPT12Months(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * 3.10 HIV in TB clinic + */ + // tb new cases + public CohortIndicator tbEnrollment() { + return cohortIndicator("New TB cases", map(moh731Cohorts.tbEnrollment(), "startDate=${startDate},endDate=${endDate}")); + } + + // New TB cases known positive + public CohortIndicator tbNewKnownPositive() { + return cohortIndicator("New TB cases with KP status", map(moh731Cohorts.tbNewKnownPositive(), "startDate=${startDate},endDate=${endDate}")); + } + + // New TB cases tested positive + public CohortIndicator tbTestedForHIV() { + return cohortIndicator("New TB cases tested for HIV", map(moh731Cohorts.tbTestedForHIV(), "startDate=${startDate},endDate=${endDate}")); + } + + // new TB cases tested HIV positive + public CohortIndicator tbNewTestedHIVPositive() { + return cohortIndicator("New TB cases tested HIV Positive", map(moh731Cohorts.tbNewTestedHIVPositive(), "startDate=${startDate},endDate=${endDate}")); + } + + // new TB cases already on HAART + public CohortIndicator tbNewAlreadyOnHAART() { + return cohortIndicator("New TB cases already on HAART", map(moh731Cohorts.tbNewAlreadyOnHAART(), "startDate=${startDate},endDate=${endDate}")); + } + + // new TB cases started on HAART + public CohortIndicator tbNewStartingHAART() { + return cohortIndicator("New TB cases starting on HAART", map(moh731Cohorts.tbNewStartingHAART(), "startDate=${startDate},endDate=${endDate}")); + } + + // total TB on HAART + public CohortIndicator tbTotalOnHAART() { + return cohortIndicator("Total TB cases on HAART", map(moh731Cohorts.tbTotalOnHAART(), "startDate=${startDate},endDate=${endDate}")); + } + + // screened for cacx + public CohortIndicator screenedforCaCx() { + return cohortIndicator("Screened for Cacx", map(moh731Cohorts.screenedForCaCx(), "startDate=${startDate},endDate=${endDate}")); + } + + + + + /** + * 1.1 - 1.4 HIV Care and treatment + *

+ * Number of patients currently in care (includes transfers) + * + * @return the indicator + */ + public CohortIndicator currentlyInCare() { + return cohortIndicator("Currently in care (includes transfers)", ReportUtils.map(moh731Cohorts.currentlyInCare(), "startDate=${startDate},endDate=${endDate}")); + } + + public CohortIndicator newHivEnrollment() { + return cohortIndicator("New Enrollment in care (excludes transfers)", ReportUtils.map(moh731Cohorts.hivEnrollment(), "startDate=${startDate},endDate=${endDate}")); + } + + public CohortIndicator hivEnrolledKPs() { + return cohortIndicator("KPs newly Enrolled in care (excludes transfers)", ReportUtils.map(moh731Cohorts.hivEnrolledKPs(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who are currently on ART + * + * @return the indicator + */ + public CohortIndicator currentlyOnArt() { + return cohortIndicator("Currently on ART", ReportUtils.map(moh731Cohorts.currentlyOnArt(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * KPs currently on ART + * @return + */ + public CohortIndicator kpsCurrentlyOnArtOnART() { + return cohortIndicator("Currently on ART", ReportUtils.map(moh731Cohorts.kpsCurrentlyOnArtOnART(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * Number of patients who are ART revisits + * + * @return the indicator + */ + public CohortIndicator revisitsArt() { + return cohortIndicator("Revisits ART", ReportUtils.map(moh731Cohorts.revisitsArt(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * KPs started on ART + * @return + */ + public CohortIndicator kpsStartedOnART() { + return cohortIndicator("KPs started on ART", ReportUtils.map(moh731Cohorts.kpsStartedOnART(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who were started on Art + * + * @return the indicator + */ + public CohortIndicator startedOnArt() { + return cohortIndicator("Started on ART", ReportUtils.map(moh731Cohorts.startedOnART(), "startDate=${startDate},endDate=${endDate}")); + } + + + /** + * Cumulative number of patients on ART + * + * @return the indicator + */ + public CohortIndicator cumulativeOnArt() { + return cohortIndicator("Cumulative ever on ART", ReportUtils.map(moh731Cohorts.cummulativeOnArt(), "endDate=${endDate}")); + } + + /** + * Number of patients in the ART 12 month cohort + * + * @return the indicator + */ + public CohortIndicator art12MonthNetCohort() { + return cohortIndicator("ART 12 Month Net Cohort", ReportUtils.map(moh731Cohorts.art12MonthNetCohort(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients in the 12 month cohort who are on their original first-line regimen + * + * @return the indicator + */ + public CohortIndicator onOriginalFirstLineAt12Months() { + return cohortIndicator("On original 1st line at 12 months", ReportUtils.map(moh731Cohorts.onOriginalFirstLineAt12Months(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients in the 12 month cohort who are on an alternate first-line regimen + * + * @return the indicator + */ + public CohortIndicator onAlternateFirstLineAt12Months() { + return cohortIndicator("On alternate 1st line at 12 months", ReportUtils.map(moh731Cohorts.onAlternateFirstLineAt12Months(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients in the 12 month cohort who are on a second-line regimen + * + * @return the indicator + */ + public CohortIndicator onSecondLineAt12Months() { + return cohortIndicator("On 2nd line at 12 months", ReportUtils.map(moh731Cohorts.onSecondLineAt12Months(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients in the 12 month cohort who are on ART + * + * @return the indicator + */ + public CohortIndicator onTherapyAt12Months() { + return cohortIndicator("On therapy at 12 months", ReportUtils.map(moh731Cohorts.onTherapyAt12Months(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * Number of patients with suppressed vl last 12 months * + * @return the indicator + */ + public CohortIndicator patientsWithSuppressedVlLast12Months() { + return cohortIndicator("Patients with suppressed vl last 12 months", ReportUtils.map(moh731Cohorts.patientsWithSuppressedVlLast12Months(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * Number of patients with vl results last 12 months * + * @return the indicator + */ + public CohortIndicator patientsWithVLResultsLast12Months() { + return cohortIndicator("Patients with vl results last 12 months", ReportUtils.map(moh731Cohorts.patientsWithVLResultsLast12Months(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * Cumulative number of patients screened for TB + * + * @return the indicator + */ + public CohortIndicator screenedForTb() { + return cohortIndicator("Screen for TB", ReportUtils.map(moh731Cohorts.tbScreening(), "startDate=${startDate},endDate=${endDate}")); + } + + public CohortIndicator presumedForTb() { + return cohortIndicator("Presumed for TB", ReportUtils.map(moh731Cohorts.presumedTb(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who were started on Art while pregnant + * + * @return the indicator + */ + public CohortIndicator startedArtWhilePregnant() { + return cohortIndicator("Started on ART Pregnant", ReportUtils.map(moh731Cohorts.startingARTPregnant(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who were started on Art while pregnant + * + * @return the indicator + */ + public CohortIndicator startedArtWhileTbPatient() { + return cohortIndicator("Started on ART - Tb Patient", ReportUtils.map(moh731Cohorts.startingARTWhileTbPatient(), "startDate=${startDate},endDate=${endDate}")); + } + + + /** + * Number of patients provided with condoms + * + * @return the indicator + */ + public CohortIndicator condomsProvided() { + return cohortIndicator("patients provided with condoms", map(moh731Cohorts.condomsProvided(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients provided with modern contraceptives + * + * @return the indicator + */ + public CohortIndicator modernContraceptivesProvided() { + return cohortIndicator("patients provided with modern contraceptives", map(moh731Cohorts.modernContraceptivesProvided(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of HIV care visits for females aged 18 and over + * + * @return the indicator + */ + public CohortIndicator hivCareVisitsFemale18() { + return cohortIndicator("HIV care visits for females aged 18 and over", map(moh731Cohorts.hivCareVisitsFemale18(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of scheduled HIV care visits + * + * @return the indicator + */ + public CohortIndicator hivCareVisitsScheduled() { + return cohortIndicator("Scheduled HIV care visits", map(moh731Cohorts.hivCareVisitsScheduled(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of unscheduled HIV care visits + * + * @return the indicator + */ + public CohortIndicator hivCareVisitsUnscheduled() { + return cohortIndicator("Unscheduled HIV care visits", map(moh731Cohorts.hivCareVisitsUnscheduled(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Total number of HIV care visits + * + * @return the indicator + */ + public CohortIndicator hivCareVisitsTotal() { + return cohortIndicator("HIV care visits", map(moh731Cohorts.hivCareVisitsTotal(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of patients who are on Cotrimoxazole prophylaxis + * + * @return the indicator + */ + public CohortIndicator onCotrimoxazoleProphylaxis() { + return cohortIndicator("patients on CTX prophylaxis", map(moh731Cohorts.inHivProgramAndOnCtxProphylaxis(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV exposed infants within 2 months + * + * @return indicator + */ + public CohortIndicator hivExposedInfantsWithin2Months() { + return cohortIndicator("Hiv Exposed Infants within 2 months", map(moh731Cohorts.hivExposedInfantsWithin2Months(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HIV exposed infants within 2 months and are eligible for ctx + * + * @return indicator + */ + public CohortIndicator hivExposedInfantsWithin2MonthsAndEligibleForCTX() { + return cohortIndicator("Hiv Exposed Infants within 2 months", map(moh731Cohorts.hivExposedInfantsWithin2MonthsAndEligibleForCTX(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised HV04-01 + * + * @return indicator + */ + public CohortIndicator numberCircumcised() { + return cohortIndicator("Number circumcised", map(datimCohorts.malesCircumcised(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised HIV Positive HV04-08 + * + * @return indicator + */ + public CohortIndicator numberCircumcisedHivPositive() { + return cohortIndicator("Number circumcised Hiv Positive", map(datimCohorts.malesCircumcisedTestedHIVPositive(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised Hiv Negative HV04-09 + * + * @return indicator + */ + public CohortIndicator numberCircumcisedHivNegative() { + return cohortIndicator("Number circumcised Hiv Negative", map(datimCohorts.malesCircumcisedTestedHIVNegative(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised Hiv Unknown HV04-10 + * + * @return indicator + */ + public CohortIndicator numberCircumcisedHivUnknown() { + return cohortIndicator("Number circumcised Hiv Unknown", map(datimCohorts.malesCircumcisedIndeterminateHIVResult(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised Surgically HV04-11 + * + * @return indicator + */ + public CohortIndicator numberCircumcisedSurgically() { + return cohortIndicator("Number circumcised surgically", map(datimCohorts.vmmcSurgical(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number circumcised using device method HV04-12 + * + * @return indicator + */ + public CohortIndicator numberCircumcisedUsingDevice() { + return cohortIndicator("Number circumcised using device method", map(datimCohorts.vmmcDevice(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number of males circumcised with moderate Adverse Events during procedure + * HV04-13 + * + * @return indicator + */ + public CohortIndicator circumcisedWithModerateAEDuringProcedure() { + return cohortIndicator("Number circumcised with moderate Adverse Events during procedutre", map(moh731Cohorts.circumcisedWithModerateAEDuringProcedure(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number of males circumcised with severe Adverse Events during procedure + * HV04-14 + * + * @return indicator + */ + public CohortIndicator circumcisedWithSevereAEDuringProcedure() { + return cohortIndicator("Number circumcised with sever Adverse Events during procedutre", map(moh731Cohorts.circumcisedWithSevereAEDuringProcedure(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number of males circumcised with moderate Adverse Events post procedure + * HV04-15 + * + * @return indicator + */ + public CohortIndicator circumcisedWithModerateAEPostProcedure() { + return cohortIndicator("Number circumcised with moderate Adverse Events post procedutre", map(moh731Cohorts.circumcisedWithModerateAEPostProcedure(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number of males circumcised with severe Adverse Events post procedure + * HV04-16 + * + * @return indicator + */ + public CohortIndicator circumcisedWithSevereAEPostProcedure() { + return cohortIndicator("Number circumcised with severe Adverse Events post procedutre", map(moh731Cohorts.circumcisedWithSevereAEPostProcedure(), "startDate=${startDate},endDate=${endDate}")); + } + /** + * VMMC + * Number of males circumcised followed up within 14 days of VMMC procedure + * HV04-17 + * + * @return indicator + */ + public CohortIndicator followedUpWithin14daysOfVMMCProcedure() { + return cohortIndicator("Number circumcised have a followup visit within 14 days post procedutre", map(datimCohorts.followedUpWithin14daysOfVMMCProcedure(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * HV02-42: Total Infant ARV prophylaxis + * @return + */ + public CohortIndicator totalInfantARVProphylaxis() { + return cohortIndicator("Total Infant ARV prophylaxis", map(moh731Cohorts.totalInfantARVProphylaxis(), "startDate=${startDate},endDate=${endDate}")); + } +} + + diff --git a/api/src/main/resources/content/kenyaemr.common.xml b/api/src/main/resources/content/kenyaemr.common.xml index 400b9bcac6..568ff847d2 100644 --- a/api/src/main/resources/content/kenyaemr.common.xml +++ b/api/src/main/resources/content/kenyaemr.common.xml @@ -57,9 +57,11 @@ + + @@ -587,7 +589,7 @@ - + @@ -596,6 +598,18 @@ + + + + + + + + + + + + @@ -623,7 +637,16 @@ - + + + + + + + + + + diff --git a/omod/src/main/webapp/resources/reports/moh731-KDoD-old.xls b/omod/src/main/webapp/resources/reports/moh731-KDoD-old.xls new file mode 100644 index 0000000000000000000000000000000000000000..0044faf97c185c22534b4b179e7bf4bd60d7e3d1 GIT binary patch literal 68096 zcmeIb2Y3}n)-75`2$T>Ak#mCpi6C*Jg2{*^5WyrTY!D!UjF7M-FgOg1GY&ZCgwx;z z&N<1(VLZk;4Ysk3$HoaK#tDyYy|t>ktGil98vc9l_rCAG$2l~uUA=49-m7-)3SHgj zwO2cQe8W9Gb_?HUv}h&%Y)lbtJn0GeJK)e6LOArFjg5^?@>2W(^5EzH5(NH$o~NMB zScj+L+!_b#JPAiKjuafJIMQ&m#gUGq9gg-m-~yrpj!YaKadg7b8Alf!U2$~7(H%z* z96fRL!qFQ?9~^ygSUCFO=#L`{#{e7yaSXzdjUxxgU>rkm48<`FM=p*$9K&%0afEP$ zaYS%Lal~-s<0!yUh@%L{Avi|h7>Q#Pj?p;A;24Wz9FFlgig8T9F%ick9FuWO!BK)^ zDvoJ5N^wlbF$2d;9J6p7ieom8IXLFxn1^FNj>B*qj^hX%N8&gN#{wKj<2VM#LL7^5 zl;K#6V+oFO9ITHDoR{HPj-wLCu{c)XsKT)lM>UQb9IJ2~hocrp9gcb&t8uKsaXgN- zIM(4f0mq3rPQr0Aj=$hok7EOl*^pF&oE9vv#<^DJz=Z?+bb-e>t{y-hD>*^tY*6_L zrAU3~js-c}-w9;ol^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$(qb>b5{-xS2U*YH*Mh|tRA;~U5zKM3nIX9C2lrJoJAG2~8xId%BH zA^+cLn==LG%o88!V%p;B$Fi6{$dQg`0X89p=BRv>ptguSiPa1ark?YBpSS;3=Qll9 zTrT!nd|k{`2_z-^zwF~ItnjBax#Dsv9&AwhuRPNafCrnI{;Qms2f#Dy0C*1luRQJK zdsiG=TLFz!q$mwjLGe1*nABH|2}l9$5^Ed(!a3>lns=jXjhc z#`C)ix6nocZ*Es~zr3T<4*LT##e;29&{>Z~O)tf_8_wt8HwDj0#vl6A15dT!?IwIa z75y@rIsWSM8SZ0eqo*H_iq4Q{zMvo|Zz8tGy$%-99_z|nS#FP;NPK@%I_`<*!nlr- zkMBVuAJ63DnM<>2kkcJs%IkwKe!UM*YV<|fDcGdN&0HO^J%!s}FXZJr;>gD{^YdwL z+TIm;SS}xwS06q=j8=s!3HSyek>@0gJa}e#JoA+x)QEO0OYVxp&W;mu@rg-ZOm$Na z{`G$Y0xibKhXa({};-~<}vv?tphFNzwx=&H+na({kLrY$FBeH zls^{rz=!zQoLMF8+q>f6{2vinzWOBt=S4U=;#iJ@k#rS~bR27Ow8ill4vb;Mr-|~> zGW?Yx^W%?Z&wU`6c_??rxH-i$XDysQb4o!Zlsj!g%>-c~IlF0kcE4G*mDTkN$JLgX ziM9}d5)o)sF^AREuBcmHUS3}(V-+ppC2BgOY-RaUYj#=nvU2yLe8~|57e5vb=HTrP z>NU=$`8Op{_~M$H6_Zz2F4e|Td=8F^Q2vsNqOwqKv@jCQjRu!Qa~DTK!Q8S)LAYpX zG!!i;tN@$;6Ts8=tq?U?hj`3QUT#oKlPsM3Os`y0TT@q4QEyFLyQI9z3I~G`OPh)4 hF2wlCii$$?0C;Z+S@Px(fV@KSW6{0GA+g2J{{tVUzLx+1 literal 0 HcmV?d00001 diff --git a/omod/src/main/webapp/resources/reports/moh731_retired.xls b/omod/src/main/webapp/resources/reports/moh731_old_y18.xls similarity index 100% rename from omod/src/main/webapp/resources/reports/moh731_retired.xls rename to omod/src/main/webapp/resources/reports/moh731_old_y18.xls