diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/IsBreastFeedingCalculation.java b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/IsBreastFeedingCalculation.java new file mode 100644 index 0000000000..67d61a1118 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/IsBreastFeedingCalculation.java @@ -0,0 +1,61 @@ +/** + * 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.calculation.library; + +import org.openmrs.Concept; +import org.openmrs.Encounter; +import org.openmrs.EncounterType; +import org.openmrs.Obs; +import org.openmrs.calculation.patient.PatientCalculationContext; +import org.openmrs.calculation.result.CalculationResultMap; +import org.openmrs.module.kenyacore.calculation.*; +import org.openmrs.module.kenyaemr.Dictionary; +import org.openmrs.module.kenyaemr.calculation.EmrCalculationUtils; +import org.openmrs.module.kenyaemr.metadata.MchMetadata; +import org.openmrs.module.metadatadeploy.MetadataUtils; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +/** + * Calculates the recorded pregnancy status of patients + */ +public class IsBreastFeedingCalculation extends AbstractPatientCalculation { + /** + * Evaluates the calculation + * @should calculate null for deceased patients + * @should calculate null for patients with no recorded status + * @should calculate last recorded breastfeeding status for all patients + */ + @Override + public CalculationResultMap evaluate(Collection cohort, Map parameterValues, PatientCalculationContext context) { + + Set aliveAndFemale = Filters.female(Filters.alive(cohort, context), context); + + Concept ExclusiveBreastFeeding = Dictionary.getConcept(Dictionary.BREASTFED_EXCLUSIVELY); + Concept MixedBreastFeeding = Dictionary.getConcept(Dictionary.MIXED_FEEDING); + CalculationResultMap infantFeedingStatusObs = Calculations.lastObs(Dictionary.getConcept(Dictionary.INFANT_FEEDING_METHOD), aliveAndFemale, context); + CalculationResultMap ret = new CalculationResultMap(); + for (Integer ptId : cohort) { + boolean breastFeeding = false; + + Obs feedingStatusObs = EmrCalculationUtils.obsResultForPatient(infantFeedingStatusObs, ptId); + + if (feedingStatusObs != null && feedingStatusObs.getValueCoded().equals(ExclusiveBreastFeeding) || feedingStatusObs.getValueCoded().equals(MixedBreastFeeding) ) { + breastFeeding = true; + } + + ret.put(ptId, new BooleanResult(breastFeeding, this)); + } + + return ret; + } +} \ No newline at end of file diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/GreenCardVelocityCalculation.java b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/GreenCardVelocityCalculation.java index 2aa20288b4..9e495781f4 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/GreenCardVelocityCalculation.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/GreenCardVelocityCalculation.java @@ -14,6 +14,7 @@ import org.joda.time.DateTime; import org.joda.time.Days; import org.joda.time.Minutes; +import org.joda.time.Months; import org.openmrs.Concept; import org.openmrs.Encounter; import org.openmrs.Obs; @@ -23,11 +24,14 @@ import org.openmrs.calculation.result.CalculationResultMap; import org.openmrs.calculation.result.ListResult; import org.openmrs.calculation.result.SimpleResult; +import org.openmrs.module.kenyacore.calculation.CalculationUtils; import org.openmrs.module.kenyacore.calculation.Calculations; import org.openmrs.module.kenyacore.calculation.Filters; import org.openmrs.module.kenyaemr.Dictionary; import org.openmrs.module.kenyaemr.calculation.BaseEmrCalculation; import org.openmrs.module.kenyaemr.calculation.EmrCalculationUtils; +import org.openmrs.module.kenyaemr.calculation.library.IsBreastFeedingCalculation; +import org.openmrs.module.kenyaemr.calculation.library.IsPregnantCalculation; import org.openmrs.module.kenyaemr.metadata.HivMetadata; import org.openmrs.module.kenyaemr.metadata.TbMetadata; import org.openmrs.module.kenyaemr.util.EncounterBasedRegimenUtils; @@ -45,7 +49,7 @@ * Not started on tb drugs - due for tb enrollment * In IPT program * On ART - * + *Is not pregnant */ public class GreenCardVelocityCalculation extends BaseEmrCalculation { @@ -76,20 +80,24 @@ public CalculationResultMap evaluate(Collection cohort, Map pregnantWomen = CalculationUtils.patientsThatPass(calculate(new IsPregnantCalculation(), cohort, context)); + //find breastfeeding women + Set breastFeeding = CalculationUtils.patientsThatPass(calculate(new IsBreastFeedingCalculation(), cohort, context)); CalculationResultMap ret = new CalculationResultMap(); StringBuilder sb = new StringBuilder(); @@ -105,12 +113,18 @@ public CalculationResultMap evaluate(Collection cohort, Map cohort, Map cohort, Map= 0 && adherenceDiffDays <= 182) { + goodAdherence6Months = true; + } + } + } //Enrolled in tb program if (inTbProgram.contains(ptId)) { patientInTBProgram = true; @@ -221,7 +247,7 @@ else if (lastVLObsResult != null && (lastVLObsResult.getConcept() == LDLQuestion if (artStartObsDate != null) { try { artStartDate = DATE_FORMAT.parse(artStartObsDate); - artStartCurrDiff = daysBetween(currentDate,artStartDate); + artStartCurrDiff = monthsBetween(currentDate,artStartDate); if (artStartCurrDiff > 3) { hasBeenOnART = true; } @@ -232,16 +258,27 @@ else if (lastVLObsResult != null && (lastVLObsResult.getConcept() == LDLQuestion } } + if(pregnantWomen.contains(ptId)) { + isPregnant = true; + } + + if(breastFeeding.contains(ptId)) { + isBreastFeeding = true; + } + sb.append("inIPT:").append(inIptProgram).append(","); sb.append("inTB:").append(patientInTBProgram).append(","); - sb.append("dueTB:").append(patientDueForTBEnrollment).append(","); sb.append("onART:").append(patientOnART).append(","); sb.append("hasBeenOnART:").append(hasBeenOnART).append(","); sb.append("regimenName:").append(regimenName).append(","); sb.append("duration:").append(artStartCurrDiff).append(","); sb.append("vlResult:").append(vlResult).append(","); sb.append("ldlResult:").append(ldlResult).append(","); - sb.append("iptCompleted:").append(patientInIPT6Months); + sb.append("iptCompleted:").append(patientInIPT6Months).append(","); + sb.append("goodAdherence:").append(goodAdherence6Months).append(","); + sb.append("isPregnant:").append(isPregnant).append(","); + sb.append("isBreastFeeding:").append(isBreastFeeding); + // sb.append("dueTB:").append(patientDueForTBEnrollment).append(","); // sb.append("artStartDate:").append(artStartDate).append(","); ret.put(ptId, new SimpleResult(sb.toString(), this, context)); @@ -259,4 +296,9 @@ private int daysBetween(Date date1, Date date2) { DateTime d2 = new DateTime(date2.getTime()); return Math.abs(Days.daysBetween(d1, d2).getDays()); } + private int monthsBetween(Date d1, Date d2) { + DateTime dateTime1 = new DateTime(d1.getTime()); + DateTime dateTime2 = new DateTime(d2.getTime()); + return Math.abs(Months.monthsBetween(dateTime1, dateTime2).getMonths()); + } } \ No newline at end of file diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/art/EligibleForArtCalculation.java b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/art/EligibleForArtCalculation.java index 4abbbe9ea7..19b0eec2c5 100755 --- a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/art/EligibleForArtCalculation.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/art/EligibleForArtCalculation.java @@ -15,22 +15,11 @@ import org.openmrs.Program; import org.openmrs.calculation.patient.PatientCalculationContext; import org.openmrs.calculation.result.CalculationResultMap; -import org.openmrs.calculation.result.SimpleResult; import org.openmrs.module.kenyacore.calculation.AbstractPatientCalculation; import org.openmrs.module.kenyacore.calculation.BooleanResult; -import org.openmrs.module.kenyacore.calculation.CalculationUtils; -import org.openmrs.module.kenyacore.calculation.Calculations; import org.openmrs.module.kenyacore.calculation.Filters; import org.openmrs.module.kenyacore.calculation.PatientFlagCalculation; -import org.openmrs.module.kenyaemr.Dictionary; -import org.openmrs.module.kenyaemr.calculation.EmrCalculationUtils; -import org.openmrs.module.kenyaemr.calculation.library.IsPregnantCalculation; -import org.openmrs.module.kenyaemr.calculation.library.hiv.LastCd4CountCalculation; -import org.openmrs.module.kenyaemr.calculation.library.hiv.LastWhoStageCalculation; -import org.openmrs.module.kenyaemr.calculation.library.hiv.LostToFollowUpIncludingTransferOutCalculation; import org.openmrs.module.kenyaemr.metadata.HivMetadata; -import org.openmrs.module.kenyaemr.metadata.TbMetadata; -import org.openmrs.module.kenyaemr.util.EmrUtils; import org.openmrs.module.metadatadeploy.MetadataUtils; import org.openmrs.module.reporting.common.Age; diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/RevisedDatimReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/RevisedDatimReportBuilder.java index 067cbd1cb0..5a2c3b966c 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/RevisedDatimReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/hiv/RevisedDatimReportBuilder.java @@ -196,6 +196,17 @@ protected DataSetDefinition careAndTreatmentDataSet() { EmrReportingUtils.addRow(cohortDsd, "PMTCT_STAT", "Clients with Known HIV status at ANC", ReportUtils.map(datimIndicators.clientsWithKnownHIVStatusAtANC(), indParams), datimPMTCTANCAgeDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07","08","09","10","11")); //Number of clients with known HIV status at ANC EmrReportingUtils.addRow(cohortDsd, "PMTCT_STAT", "Clients with Unknown HIV status at ANC", ReportUtils.map(datimIndicators.clientsWithUnKnownHIVStatusAtANC(), indParams), datimPMTCTANCAgeDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07","08","09","10","11")); + //Numerator: Number of clients with known HIV status at ANC + cohortDsd.addColumn("PMTCT_STAT_Known_Status", "Clients with Known HIV status at ANC", ReportUtils.map(datimIndicators.clientsWithKnownHIVStatusAtANC(), indParams),""); +//Number of clients with unknown HIV status at ANC + EmrReportingUtils.addRow(cohortDsd, "PMTCT_STAT_Unknown_status", "Clients with Unknown HIV status at ANC", ReportUtils.map(datimIndicators.clientsWithUnKnownHIVStatusAtANC(), indParams), datimPMTCTANCAgeDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07","08","09","10")); + + //Recent Positive at entry: Before ANC 1 or at enrollment + EmrReportingUtils.addRow(cohortDsd, "PMTCT_STAT_RECENT_POSITIVE", "Clients with Positive HIV status before ANC ", ReportUtils.map(datimIndicators.clientsWithPositiveHivStatusBeforeAnc1(), indParams), datimPMTCTANCAgeDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07","08","09","10")); + + //Recent Positive at entry: Before ANC 1 or at enrollment + EmrReportingUtils.addRow(cohortDsd, "PMTCT_STAT_RECENT_NEGATIVE", "Clients with Negative HIV status before ANC ", ReportUtils.map(datimIndicators.clientsWithNegativeHivStatusBeforeAnc1(), indParams), datimPMTCTANCAgeDisaggregation, Arrays.asList("01", "02", "03", "04", "05", "06", "07","08","09","10")); + //Newly enrolled to ANC cohortDsd.addColumn( "PMTCT_STAT", "Denominator:Clients newly enrolled to ANC", ReportUtils.map(datimIndicators.clientsNewlyEnrolledToANC(), indParams), ""); @@ -411,6 +422,39 @@ protected DataSetDefinition careAndTreatmentDataSet() { /*TX_ML Number of ART patients with no clinical contact since their last expected contact*/ //EmrReportingUtils.addRow(cohortDsd, "TX_ML", "Number of ART patients with no clinical contact since their last expected contact", ReportUtils.map(datimIndicators.onARTMissedAppointment(),indParams), datimNewAgeDisaggregation, 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","24","25")); + /*TX_ML_DIED Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed)*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death", ReportUtils.map(datimIndicators.onARTMissedAppointmentDied(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_TB Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of TB*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of TB", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedTB(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_CANCER Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of Cancer*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of cancer", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedCancer(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_OTHER_INFECTIOUS_DISEASE Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of other infectious and parasitic disease*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of other infectious and parasitic disease", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedOtherInfectious(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_OTHER_DISEASE Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of other disease or condition*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of other disease or condition", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedOtherDisease(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_NATURAL Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of natural cause*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of natural cause", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedNatural(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_NONNATURAL Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of non-natural cause*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of non-natural cause", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedNonNatural(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_DIED_UNKNOWN Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of unknown cause*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to death as a result of unknown cause", ReportUtils.map(datimIndicators.onARTMissedAppointmentDiedUnknown(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_PREV_UNDOCUMENTED_TRF Number of ART patients with no clinical contact since their last expected contact due to Previously undocumented transfer*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact due to undocumented transfer", ReportUtils.map(datimIndicators.onARTMissedAppointmentTransferred(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_TRACED_UNLOCATED Number of ART patients with no clinical contact since their last expected contact due to un-traceability*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "ART patients with no clinical contact since their last expected contact and were untraceable", ReportUtils.map(datimIndicators.onARTMissedAppointmentUntraceable(),indParams), datimNewAgeDisaggregation, 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","24")); + + /*TX_ML_NO_TRACE_ATTEMPTED Number of ART patients with no clinical contact since their last expected contact with no tracing attempted*/ + EmrReportingUtils.addRow(cohortDsd, "TX_ML", "Number of ART patients with no clinical contact since their last expected contact cohort definitions, dataset definitions and ", ReportUtils.map(datimIndicators.onARTMissedAppointmentNotTraced(),indParams), datimNewAgeDisaggregation, 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","24")); + /*HTS_INDEX Number of individuals who were identified and tested using Index testing services and received their results*/ EmrReportingUtils.addRow(cohortDsd, "HTS_INDEX", "No.of individuals identified and tested & received results using Index testing services", ReportUtils.map(datimIndicators.testedThroughIndexServices(),indParams), datimNewAgeDisaggregation, 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","24","25")); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimCohortLibrary.java index 6464a0f83e..3128c508a6 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimCohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimCohortLibrary.java @@ -347,10 +347,10 @@ public CohortDefinition startingARTWhileTbPatient() { public CohortDefinition patientHIVPositiveResultsAtANC() { String sqlQuery = "select v.patient_id\n" + - "from kenyaemr_etl.etl_mch_antenatal_visit v where v.final_test_result =\"Positive\"\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v where v.visit_date between date(:startDate) and date(:endDate)\n" + "group by v.patient_id\n" + - "having\n" + - " mid(max(concat(v.visit_date,v.final_test_result)),1,10) between date(:startDate) and date(:endDate);"; + "having mid(min(concat(v.visit_date,final_test_result)),11)=\"Positive\"\n" + + " and mid(min(concat(v.visit_date,v.final_test_result)),1,10) between date(:startDate) and date(:endDate);"; SqlCohortDefinition cd = new SqlCohortDefinition(); cd.setName("testPositiveResultsANC"); cd.setQuery(sqlQuery); @@ -364,10 +364,10 @@ public CohortDefinition patientHIVPositiveResultsAtANC() { public CohortDefinition patientHIVNegativeResultsATANC() { String sqlQuery = "select v.patient_id\n" + - "from kenyaemr_etl.etl_mch_antenatal_visit v where v.final_test_result =\"Negative\"\n" + + "from kenyaemr_etl.etl_mch_antenatal_visit v where v.visit_date between date(:startDate) and date(:endDate)\n" + "group by v.patient_id\n" + - "having\n" + - " mid(max(concat(v.visit_date,v.final_test_result)),1,10) between date(:startDate) and date(:endDate);"; + "having mid(min(concat(v.visit_date,final_test_result)),11)=\"Negative\"\n" + + " and mid(min(concat(v.visit_date,v.final_test_result)),1,10) between date(:startDate) and date(:endDate);"; SqlCohortDefinition cd = new SqlCohortDefinition(); cd.setName("testNegativeResultsANC"); cd.setQuery(sqlQuery); @@ -381,10 +381,10 @@ public CohortDefinition knownStatusAtANC() { String sqlQuery = "select e.patient_id\n" + "from kenyaemr_etl.etl_mch_enrollment e\n" + - "join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + - "where (e.hiv_status = 703 ) OR (v.anc_visit_number = 1 AND v.final_test_result in (\"Negative\",\"Positive\"))\n" + - "and v.visit_date between date(:startDate) and date(:endDate)\n" + - "group by e.patient_id;"; + " join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + + "where e.hiv_status in (664, 703) or (anc_visit_number = 1 and final_test_result in (\"Positive\", \"Negative\"))\n" + + "group by e.patient_id\n" + + "having min(v.visit_date) between date(:startDate) and date(:endDate);"; SqlCohortDefinition cd = new SqlCohortDefinition(); cd.setName("knownHIVStatusAtANC"); @@ -413,14 +413,55 @@ public CohortDefinition unKnownStatusAtANC() { return cd; } -//TODO add mch_enrollment ==>max(mch_enrollment) + //Clients with positive HIV status before ANC-1 + public CohortDefinition positiveHivStatusBeforeAnc1() { + + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + + "where e.hiv_status =703\n" + + "group by e.patient_id\n" + + "having min(v.visit_date) between date(:startDate) and date(:endDate)\n" + + " and min(v.visit_date) > max(e.visit_date);"; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("PMTCT_STAT_RECENT_POSITIVE"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Clients with positive HIV status before ANC-1"); + return cd; + + } + + //Clients with negative HIV status before ANC-1 + public CohortDefinition negativeHivStatusBeforeAnc1() { + + String sqlQuery = "select e.patient_id\n" + + "from kenyaemr_etl.etl_mch_enrollment e\n" + + " join kenyaemr_etl.etl_mch_antenatal_visit v on e.patient_id = v.patient_id\n" + + " join kenyaemr_etl.etl_hts_test tst on tst.patient_id = e.patient_id\n" + + "where e.hiv_status =664\n" + + "group by e.patient_id\n" + + "having min(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("PMTCT_STAT_RECENT_NEGATIVE"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Clients with negative HIV status before ANC-1"); + return cd; + + } + //TODO add mch_enrollment ==>max(mch_enrollment) //TODO subquery to get last enrollment public CohortDefinition newANCClients() { String sqlQuery = "select en.latest_enr from (select mid(max(concat(e.visit_date,e.patient_id)),11 )latest_enr\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 e.date_of_discontinuation is null and v.visit_date between date(:startDate) and date(:endDate)\n" + + " where e.date_of_discontinuation is null and e.visit_date between date(:startDate) and date(:endDate)\n" + " group by e.patient_id) en;"; SqlCohortDefinition cd = new SqlCohortDefinition(); cd.setName("newANCClients"); @@ -2151,6 +2192,409 @@ public CohortDefinition onARTMissedAppointment() { } + /*Number of ART patients with no clinical contact since their last expected contact due to death */ + public CohortDefinition onARTMissedAppointmentDied() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED"); + 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 ART patients with no clinical contact since their last expected contact due to death"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death as a result of TB */ + public CohortDefinition onARTMissedAppointmentDiedTB() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 164500;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_TB"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of TB"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death as a result of as cancer */ + public CohortDefinition onARTMissedAppointmentDiedCancer() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 116030;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_CANCER"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of cancer"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death as result of other infectious disease */ + public CohortDefinition onARTMissedAppointmentDiedOtherInfectious() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 151522;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_OTHER_INFECTIOUS_DISEASE"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of other infectious disease"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death of as result of other disease/condition*/ + public CohortDefinition onARTMissedAppointmentDiedOtherDisease() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + " \n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 162574;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_OTHER_DISEASE"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of other disease/condition"); + return cd; + + } + /*Number of ART patients with no clinical contact since their last expected contact due to death as result of natural causes*/ + public CohortDefinition onARTMissedAppointmentDiedNatural() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 133481;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_NATURAL"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of natural causes"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death as result of non-natural causes*/ + public CohortDefinition onARTMissedAppointmentDiedNonNatural() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 1603;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_NONNATURAL"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of non-natural causes"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to death as result of unknown causes*/ + public CohortDefinition onARTMissedAppointmentDiedUnknown() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 160432\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267\n" + + " and dt.cause_of_death = 5622;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_DIED_UNKNOWN"); + 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 ART patients with no clinical contact since their last expected contact due to death as a result of unknown causes"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to undocumented transfer */ + public CohortDefinition onARTMissedAppointmentTransferred() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 1693\n" + + " and dt.is_final_trace = 1267 and dt.tracing_outcome = 1267;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_PREV_UNDOCUMENTED_TRF"); + 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 ART patients with no clinical contact since their last expected contact due to undocumented transfer"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact due to un-traceability*/ + public CohortDefinition onARTMissedAppointmentUntraceable() { + + 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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e inner join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id and dt.true_status = 5240 and dt.is_final_trace = 1267\n" + + " and dt.tracing_outcome = 1118 and dt.attempt_number >=3\n" + + " and dt.tracing_type in (1650,\"eb113c76-aef8-4890-a611-fe22ba003123\",161642);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_TRACED_UNLOCATED"); + 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 ART patients with no clinical contact since their last expected contact due to un-traceability"); + return cd; + + } + + /*Number of ART patients with no clinical contact since their last expected contact and no trace attempted*/ + public CohortDefinition onARTMissedAppointmentNotTraced() { + + String sqlQuery = "\n" + + "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" + + " left outer JOIN\n" + + " (select patient_id, visit_date from kenyaemr_etl.etl_patient_program_discontinuation\n" + + " where date(visit_date) <= curdate() and program_name='HIV'\n" + + " group by patient_id\n" + + " ) d on d.patient_id = fup.patient_id\n" + + "\n" + + " where fup.visit_date <= :endDate and (:endDate BETWEEN date_sub(:endDate , interval 6 MONTH) and :endDate)\n" + + " group by patient_id\n" + + " having (\n" + + " (((date(latest_tca) < :endDate) and (date(latest_vis_date) < date(latest_tca))) ) and ((date(latest_tca) > date(date_discontinued) and date(latest_vis_date) > date(date_discontinued)) or disc_patient is null )\n" + + " and timestampdiff(day, date(latest_tca),:endDate) > 28 and latest_tca between date_sub(date(:endDate),interval 6 MONTH) and date(:endDate))\n" + + " ) e left outer join kenyaemr_etl.etl_ccc_defaulter_tracing dt on dt.patient_id = e.patient_id where dt.patient_id is null;"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("TX_ML_NO_TRACE_ATTEMPTED"); + 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 ART patients with no clinical contact since their last expected contact and no tracing attempted"); + return cd; + + } + /*HTS_INDEX Number of individuals who were identified and tested using Index testing services and received their results */ public CohortDefinition contactIndexTesting() { diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimIndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimIndicatorLibrary.java index 73b0322d09..695850af5d 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimIndicatorLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/RevisedDatim/DatimIndicatorLibrary.java @@ -138,6 +138,22 @@ public CohortIndicator clientsWithKnownHIVStatusAtANC() { public CohortIndicator clientsWithUnKnownHIVStatusAtANC() { return cohortIndicator("Clients with Unknown HIV Status at ANC", ReportUtils.map(datimCohorts.unKnownStatusAtANC(), "startDate=${startDate},endDate=${endDate}")); } + + /** + * Number of clients with positive HIV status before ANC-1 + * @return the indicator + */ + public CohortIndicator clientsWithPositiveHivStatusBeforeAnc1() { + return cohortIndicator("Clients with positive HIV Status before ANC-1", ReportUtils.map(datimCohorts.positiveHivStatusBeforeAnc1(), "startDate=${startDate},endDate=${endDate}")); + } + + /** + * Number of clients with Negative HIV status before ANC-1 + * @return the indicator + */ + public CohortIndicator clientsWithNegativeHivStatusBeforeAnc1() { + return cohortIndicator("Clients with Negative HIV Status before ANC-1", ReportUtils.map(datimCohorts.negativeHivStatusBeforeAnc1(), "startDate=${startDate},endDate=${endDate}")); + } /** * Number of clients newly enrolled for ANC * @return the indicator @@ -665,6 +681,93 @@ public CohortIndicator onARTMissedAppointment() { "startDate=${startDate},endDate=${endDate}")); } + /** + * TX_ML_DIED Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) + */ + public CohortIndicator onARTMissedAppointmentDied() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death", ReportUtils.map(datimCohorts.onARTMissedAppointmentDied(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_TB Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of TB + */ + public CohortIndicator onARTMissedAppointmentDiedTB() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of TB", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedTB(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_CANCER Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of Cancer + */ + public CohortIndicator onARTMissedAppointmentDiedCancer() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of Cancer", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedCancer(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_OTHER_INFECTIOUS_DISEASE Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of other infectious disease + */ + public CohortIndicator onARTMissedAppointmentDiedOtherInfectious() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of other Infectious disease", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedOtherInfectious(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_OTHER_DISEASE Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of other disease/condition + */ + public CohortIndicator onARTMissedAppointmentDiedOtherDisease() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of other Infectious disease", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedOtherDisease(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_NATURAL Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of natural causes + */ + public CohortIndicator onARTMissedAppointmentDiedNatural() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of natural causes", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedNatural(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_NONNATURAL Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of non-natural causes + */ + public CohortIndicator onARTMissedAppointmentDiedNonNatural() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of non-natural causes", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedNonNatural(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_DIED_UNKNOWN Number of ART patients with no clinical contact since their last expected contact due to Death (confirmed) as a result of unknown causes + */ + public CohortIndicator onARTMissedAppointmentDiedUnknown() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to death as a result of unknown causes", ReportUtils.map(datimCohorts.onARTMissedAppointmentDiedUnknown(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_PREV_UNDOCUMENTED_TRF Number of ART patients with no clinical contact since their last expected contact due to Previously undocumented transfer + */ + public CohortIndicator onARTMissedAppointmentTransferred() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact due to undocumented transfer", ReportUtils.map(datimCohorts.onARTMissedAppointmentTransferred(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_TRACED_UNLOCATED Number of ART patients with no clinical contact since their last expected contact due to un-traceability + */ + public CohortIndicator onARTMissedAppointmentUntraceable() { + return cohortIndicator("ART patients with no clinical contact since their last expected contact and were untraceable", ReportUtils.map(datimCohorts.onARTMissedAppointmentUntraceable(), + "startDate=${startDate},endDate=${endDate}")); + } + + /** + * TX_ML_NO_TRACE_ATTEMPTED Number of ART patients with no clinical contact since their last expected contact with no tracing attempted + */ + public CohortIndicator onARTMissedAppointmentNotTraced() { + return cohortIndicator("Number of ART patients with no clinical contact since their last expected contact and no tracing attempted", ReportUtils.map(datimCohorts.onARTMissedAppointmentNotTraced(), + "startDate=${startDate},endDate=${endDate}")); + } /** * HTS_INDEX Number of individuals who were identified and tested using Index testing services and received their results */ diff --git a/api/src/main/resources/content/kenyaemr.hiv.xml b/api/src/main/resources/content/kenyaemr.hiv.xml index 5aa271b7cd..fc16d9a7d5 100755 --- a/api/src/main/resources/content/kenyaemr.hiv.xml +++ b/api/src/main/resources/content/kenyaemr.hiv.xml @@ -32,7 +32,7 @@ - + @@ -145,7 +145,7 @@ - + diff --git a/omod/src/main/webapp/resources/htmlforms/hiv/enhancedAdherenceScreening.html b/omod/src/main/webapp/resources/htmlforms/hiv/enhancedAdherenceScreening.html new file mode 100644 index 0000000000..5976f99bdf --- /dev/null +++ b/omod/src/main/webapp/resources/htmlforms/hiv/enhancedAdherenceScreening.html @@ -0,0 +1,479 @@ + + + + + + +
+ + + + + +
Date: Location:
+
+ +
+
+ + Visit details + + + + + + + + + +
Session Number: + + +              Pill count adherence % (from pill count): + +
+
+
+ +
+ + Morisky Medication Adherence Scale + + +              Morisky Medication Adherence Scale (MMAS - 4) + + + + + + + + + + + + + + + + +
1. Do you ever forget to take your medicine? Yes + No +
2. Are you careless at times about taking your medicine? Yes + No +
3. Sometimes if you feel worse when you take the medicine, do you stop taking it? Yes + No +
4. When you feel better do you sometimes stop taking your medicine? Yes + No +
+


+ + + + + + + + + + + + + + + + + + +
Morisky Medication Adherence Scale (MMAS - 8)
5. Did you take the medicine yesterday? Yes + No +
6. When you feel like your symptoms are under control, do you sometimes stop taking your medicine? Yes + No +
7. Do you ever feel under pressure about sticking to your treatment plan? Yes + No +
8. How often do you have difficulty remembering to take all your medications? +
+
+
+ + Morisky Medication Adherence Score + + + + + + +
Adherence rating + +
+
+ + +
+ + Viral Load + + + + + + + + + + + + + + + + + + + + + + +
Understanding Viral Load (High/Suppressed):
+ 1. Has patient received viral load result? + +

+
+ 2. Was the Viral load result suppressed (less than 1000) or unsuppressed (greater than 1000) ? + +

+
3. How does the patient feel concerning the result?
4. What does the patient think caused the high viral load?
5. Way forward:

+ +
+
+
+ + Barriers to adherence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Access for possible barriers to adherence

Cognitive Barriers
1. How does the patient feel concerning the result?
Behavioural Barriers
1. Let the patient explan how they take their drugs, and at what time and how they store them
2. How does treatment fit the patient daily routines? What reminder tools are used?
3. What does the patient do in case of visits and travels?
4. What does the patient do incase of Side Effects?
5. What are the most difficult situations for the patient to take drugs?
Emotional Barriers
1. How does the patient feel about taking drugs everyday?
2. Motivation. What are the patient ambitions in life? What are the 3 most important things they still want to achieve?
Socio-Economic Barriers
+ 1. Does the patient have any people in their life who they can talk to about HIV status and ART?

2. Discuss how the patient can enlist the support of their family, friends and/or co-workers, a treatment buddy, community or support group?
3. Review the patient's and family's sources of income and how well they cover their needs.
4. Does the patient have any challenges getting the clinic on regular basis?

5. Is the patient worried about people finding out about their HIV status accidentally?

6. Does the patient feel like people treat them differently when they know their HIV status?

7. Does stigma making it difficult for them to take their medications on time, or for them to attend clinical appointments?

8. Find out if the patient has tried faith healing, or if they have ever stopped taking their medicine because of religious belief
+
+ +
+ + Review + + + + + + + + + + + + + + + +
Review Adherence Plan from previous session
1. Does patient think adherence has improved since last session? + +
2. Have any dosses been missed? + + +
3. Review barriers to adherence from previous session and if strategies identified have been
taken up, identify other gaps and issue emerging
+
+
+ + Referrals + + + + + + + + + + + + + + + + + + + + + + + + + +
Referrals and Networks
+ 1. Has the patient been referred to other services? (Nutrition, psychosocial support services,
substance use treatment, etc)


2. Did he/she attend the appointments?

3. What was the experience? Do the referrals need to be re-organized?
4. Will the patient benefit from a home visit?

5. Adherence plan
+
+
+ + Appointment + + + + + + +
Follow up Date:         + +
+
+ +
+
+ + +
\ No newline at end of file diff --git a/omod/src/main/webapp/resources/htmlforms/hiv/hivGreenCard.html b/omod/src/main/webapp/resources/htmlforms/hiv/hivGreenCard.html index 2c6b5dd49d..d616e7663d 100644 --- a/omod/src/main/webapp/resources/htmlforms/hiv/hivGreenCard.html +++ b/omod/src/main/webapp/resources/htmlforms/hiv/hivGreenCard.html @@ -83,15 +83,19 @@ var GREENCARD_VELOCITY = ""; var PATIENT_ON_IPT = GREENCARD_VELOCITY.split(",")[0].split(":")[1]; var PATIENT_ON_TB = GREENCARD_VELOCITY.split(",")[1].split(":")[1]; - var PATIENT_DUE_TB_ENROLLMENT = GREENCARD_VELOCITY.split(",")[2].split(":")[1]; - var PATIENT_ON_ART = GREENCARD_VELOCITY.split(",")[3].split(":")[1]; - var PATIENT_HAS_BEEN_ON_ART = GREENCARD_VELOCITY.split(",")[4].split(":")[1]; - var REGIMEN_NAME = GREENCARD_VELOCITY.split(",")[5].split(":")[1]; - var REGIMEN_DURATION = GREENCARD_VELOCITY.split(",")[6].split(":")[1]; - var VL_RESULT = GREENCARD_VELOCITY.split(",")[7].split(":")[1]; - var LDL_RESULT = GREENCARD_VELOCITY.split(",")[8].split(":")[1]; - var IPT_COMPLETED = GREENCARD_VELOCITY.split(",")[9].split(":")[1]; - // var ART_START_DATE = GREENCARD_VELOCITY.split(",")[5].split(":")[1]; + var PATIENT_ON_ART = GREENCARD_VELOCITY.split(",")[2].split(":")[1]; + var PATIENT_HAS_BEEN_ON_ART = GREENCARD_VELOCITY.split(",")[3].split(":")[1]; + var REGIMEN_NAME = GREENCARD_VELOCITY.split(",")[4].split(":")[1]; + var REGIMEN_DURATION = GREENCARD_VELOCITY.split(",")[5].split(":")[1]; + var VL_RESULT = GREENCARD_VELOCITY.split(",")[6].split(":")[1]; + var LDL_RESULT = GREENCARD_VELOCITY.split(",")[7].split(":")[1]; + var IPT_COMPLETED = GREENCARD_VELOCITY.split(",")[8].split(":")[1]; + var GOOD_ADHERENCE = GREENCARD_VELOCITY.split(",")[9].split(":")[1]; + var PATIENT_PREGNANT = GREENCARD_VELOCITY.split(",")[10].split(":")[1]; + var PATIENT_BREASTFEEDING = GREENCARD_VELOCITY.split(",")[11].split(":")[1]; + + console.log("PATIENT_PREGNANT ==>"+PATIENT_PREGNANT); + console.log("PATIENT_BREASTFEEDING ==>"+PATIENT_BREASTFEEDING); var pAge = parseInt(''); var pgender = ""; @@ -627,14 +631,31 @@ //4. Active OIs //5. Missed appointment last 6 months - - //5. Completed 6 months IPT + if(PATIENT_ON_ART =="true" && GOOD_ADHERENCE == 'true') { + jq('#good-adherence:text').val("YES"); + }else if(PATIENT_ON_ART =="true" && GOOD_ADHERENCE == 'false'){ + jq('#good-adherence:text').val("NO"); + }else { + jq('#good-adherence:text').val("N/A"); + } + //6. Completed 6 months IPT if(IPT_COMPLETED == 'true') { jq('#ipt-completion:text').val("YES"); }else{ jq('#ipt-completion:text').val("NO"); } - + //7. pregnant + if(PATIENT_PREGNANT == 'true') { + jq('#pregnant:text').val("YES"); + }else{ + jq('#pregnant:text').val("NO"); + } + //7. breast feeding + if(PATIENT_BREASTFEEDING == 'true') { + jq('#breast-feeding:text').val("YES"); + }else{ + jq('#breast-feeding:text').val("NO"); + } } function onLmpChange() { jq('#pregnancyOption :input').prop('disabled', false); @@ -727,10 +748,13 @@ var cnsFindingsSelected = jq('.cns-findings'); var gusFindingsSelected = jq('.gus-findings'); var stabilityAssessment = jq(".stability-details"); + if (getValue('person-present.value') == SELF ) { jq('.patient-details :input').prop('disabled', false); jq('#greencard').smartWizard('enableFinish', false); jq(".stability-details").show(); + jq("#difcom").show(); + jq(".phdp").show(); } else { complaintSelected(); knownAllergiesSelected(); @@ -742,12 +766,14 @@ jq("#tbl-ctx-adherence").hide(); jq("#tbl-dap-adherence").hide(); jq(".stability-details").hide(); + jq("#difcom").hide(); + jq(".phdp").hide(); jq("#refill-label").hide(); jq("#refill-date").hide(); jq('.patient-details :input').prop('disabled', true); jq('#greencard').smartWizard('goToStep', 4); jq('#greencard').smartWizard('enableFinish', true); - clearHiddenSections([popType, keyPop, whoAdult, whoChild, nutStatus, complaintsToday, onAntTb, onIPTDrugs, everOnIPTDrugs, tbScreeningAnswers, + clearRadios([popType, keyPop, whoAdult, whoChild, nutStatus, complaintsToday, onAntTb, onIPTDrugs, everOnIPTDrugs, tbScreeningAnswers, workupAnswers, iptStatus, tBtestsOrdered, tBtestResults, startantiTb, tbRegimen, allergiesSelected, chronicIllnessSelected, adverseReactionsSelected, adultVaccSelected, childVaccSelected, otherVaccSelected, hasMenses, pregOption, preIntention, familyPlanning, onfamilyPlanning, notOnfamilyPlanning, generalExamSelected, systemsFindingsSelected, skinFindingsSelected, eyeFindingsSelected, entFindingsSelected, chestFindingsSelected, cvsFindingsSelected, abdomenFindingsSelected, cnsFindingsSelected, gusFindingsSelected, stabilityAssessment]); @@ -894,15 +920,9 @@ var val = getValue('chronic-illness.value'); var illness = jq('.illness-chronic select').val(''); var onset = jq('.onset-date-chronic-illness input').val(''); - var drug = jq('.drug-chronic-illness input').val(''); - var dose = jq('.dose-chronic-illness input').val(''); - var units = jq('.units-chronic-illness input').val(''); - var frequency = jq('.frequency-chronic-illness select').val(''); - var duration = jq('.duration-chronic-illness input').val(''); - var durationUnits = jq('.duration-units-illness select').val(''); if (val == "false" || val == 1066){ jq("#tbl-chronic-illness").hide(); - clearHiddenSections([illness, onset, drug, dose, units, frequency, duration, durationUnits]); + clearHiddenSections([illness, onset]); getField('chronic.error').html('Please specify the chronic illness.').hide(); }else { jq("#tbl-chronic-illness").show(); @@ -1578,6 +1598,7 @@ parentObj[i].find('select').each(function() { this.selectedIndex =0; }); + } } //Smart wizard validations @@ -1862,22 +1883,18 @@ } else { getField('fplanning.error').html('Please specify if patient is using family planning methods.').hide(); } - //Validate fp options chooses atleast one option if on fp + //Validate fp options chooses atleast one option if on fp or if wants fp if (isPregnant == 1066 && onfpMethodChecked == 965 && fpMethodsChecked.length == 0) { jq('#fp-details').show(); jq('#greencard').smartWizard('setError', {stepnum: 2, iserror: true}); getField('fp-error.error').html('Please add at least one family planning method.').show(); return false; - } else { - getField('fp-error.error').html('Please add at least one family planning method.').hide(); - } - //Validate fp options chooses atleast one option if on fp - if (isPregnant == 1066 && onfpMethodChecked == 1360 && fpMethodsChecked.length == 0) { - jq('#fp-details').show(); - jq('#greencard').smartWizard('setError', {stepnum: 2, iserror: true}); - getField('fp-error.error').html('Please add at least one family planning method.').show(); - return false; - } else { + } else if (isPregnant == 1066 && onfpMethodChecked == 1360 && fpMethodsChecked.length == 0) { + jq('#fp-details').show(); + jq('#greencard').smartWizard('setError', {stepnum: 2, iserror: true}); + getField('fp-error.error').html('Please add at least one family planning method.').show(); + return false; + }else{ getField('fp-error.error').html('Please add at least one family planning method.').hide(); } //Validate not-on-fp options chooses atleast one option if not on fp @@ -2860,12 +2877,6 @@

Presenting complaints

Illness Onset Date - Drug - Dose - Units - Frequency - Duration - Duration units @@ -3188,11 +3182,7 @@

Presenting complaints


-
- + answerLabel="Vasectomy(Partner)" style="checkbox" id="fp-error"/>
@@ -3211,11 +3201,8 @@

Presenting complaints


+ answerLabel="Vasectomy" style="checkbox" id="fp-error"/>
- @@ -3641,6 +3628,7 @@

Patient management

+
PHDP Services @@ -3706,6 +3694,7 @@

Patient management

+
Stability assessment @@ -3743,7 +3732,7 @@

Patient management

- Duration of current regimen (Days):    + Duration of current regimen (Months):    @@ -3757,17 +3746,30 @@

Patient management

- - - Missed appointment in last 6 months : - + + + Good adherence in the last 6 months : + - - + + Completed 6 months IPT:          - - + + + + + + Pregnant : + + + + + Breast feeding:          + + + + diff --git a/omod/src/main/webapp/resources/reports/Datim_Template.xls b/omod/src/main/webapp/resources/reports/Datim_Template.xls index 29aab9850e..3eca4fadcc 100644 Binary files a/omod/src/main/webapp/resources/reports/Datim_Template.xls and b/omod/src/main/webapp/resources/reports/Datim_Template.xls differ