From 86253573c9e0183183e8c4a02e3ce2e3f561e77a Mon Sep 17 00:00:00 2001 From: steliomo Date: Thu, 14 Nov 2019 16:30:57 +0200 Subject: [PATCH] REPORT-106: DSD Reports --- .../library/cohorts/DSDCohortQueries.java | 745 +++++++++++- .../cohorts/DsdElegibleCohortQuery.java | 266 ----- .../cohorts/Eri2MonthsCohortQueries.java | 269 ++--- .../library/cohorts/TXTBCohortQueries.java | 250 ++-- .../library/cohorts/TxNewCohortQueries.java | 35 +- .../library/datasets/Eri2MonthsDataset.java | 91 +- .../library/datasets/EriDSDDataset.java | 1064 +++++++---------- .../dimensions/EptsCommonDimension.java | 66 +- .../dimensions/Eri2MonthsDamision.java | 153 --- .../library/queries/DsdQueriesInterface.java | 199 ++- .../queries/Eri2MonthsQueriesInterface.java | 167 --- .../library/queries/PregnantQueries.java | 2 +- .../reporting/library/queries/TbQueries.java | 44 + .../eptsreports/reporting/utils/AgeRange.java | 4 + api/src/main/resources/IM_ER_Report.xls | Bin 101888 -> 122880 bytes .../cohorts/TxNewCohortDefinitionTest.java | 23 +- 16 files changed, 1596 insertions(+), 1782 deletions(-) delete mode 100644 api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DsdElegibleCohortQuery.java delete mode 100644 api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/Eri2MonthsDamision.java create mode 100644 api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TbQueries.java diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DSDCohortQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DSDCohortQueries.java index af68ae3418..aa40b8ba02 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DSDCohortQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DSDCohortQueries.java @@ -2,7 +2,10 @@ import java.util.Date; import org.openmrs.Location; +import org.openmrs.module.eptsreports.reporting.library.queries.BreastfeedingQueries; import org.openmrs.module.eptsreports.reporting.library.queries.DsdQueriesInterface; +import org.openmrs.module.eptsreports.reporting.library.queries.PregnantQueries; +import org.openmrs.module.eptsreports.reporting.library.queries.TbQueries; import org.openmrs.module.eptsreports.reporting.library.queries.TxCurrQueries; import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; @@ -17,63 +20,69 @@ public class DSDCohortQueries { @Autowired private GenericCohortQueries genericCohorts; - @DocumentedDefinition(value = "patientsActiveOnArtExcludingPregnantBreastfeedingAndTb") - public CohortDefinition getPatientsActiveOnArtExcludingPregnantBreastfeedingAndTb( - final String cohortName) { + @DocumentedDefinition(value = "patientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb") + public CohortDefinition findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb() { - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + final CompositionCohortDefinition dataSetDefinitio = new CompositionCohortDefinition(); - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); + dataSetDefinitio.setName("patientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb"); + dataSetDefinitio.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dataSetDefinitio.addParameter(new Parameter("endDate", "End Date", Date.class)); + dataSetDefinitio.addParameter(new Parameter("location", "location", Location.class)); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - dsd.addSearch( + dataSetDefinitio.addSearch( "IN-ART", EptsReportUtils.map( this.genericCohorts.generalSql( "IN-ART", TxCurrQueries.QUERY.findPatientsWhoAreCurrentlyEnrolledOnART), mappings)); - dsd.addSearch( - "PREGNANT-BRESTFEETING", + dataSetDefinitio.addSearch( + "PREGNANT", EptsReportUtils.map( this.genericCohorts.generalSql( - "PREGNANT-BRESTFEETING", - DsdQueriesInterface.QUERY - .findPregnantWomenRegisteredInTheLast9MonthsOrBrestfeetingWomenRegisteredInTheLast18Months), - mappings)); + "patientsWhoArePregnantInAPeriod", + PregnantQueries.findPatientsWhoArePregnantInAPeriod()), + "startDate=${endDate-9m},endDate=${endDate},location=${location}")); - dsd.addSearch( + dataSetDefinitio.addSearch( + "BREASTFEEDING", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreBreastfeeding", + BreastfeedingQueries.findPatientsWhoAreBreastfeeding()), + "startDate=${endDate-18m},endDate=${endDate},location=${location}")); + + dataSetDefinitio.addSearch( "TB", EptsReportUtils.map( this.genericCohorts.generalSql( - "TB", DsdQueriesInterface.QUERY.findPatientsBeingOnTuberculosisTreatmentEndPeriod), + "patientsWhoAreInTbTreatment", TbQueries.QUERY.findPatientsWhoAreInTbTreatment), mappings)); - dsd.setCompositionString("IN-ART NOT (PREGNANT-BRESTFEETING OR TB)"); + dataSetDefinitio.setCompositionString("IN-ART NOT (PREGNANT OR BREASTFEEDING OR TB)"); - return dsd; + return dataSetDefinitio; } @DocumentedDefinition(value = "patientsActiveInArtEligibleForDsd") - public CohortDefinition getPatientsActiveOnArtEligibleForDsd(final String cohortName) { + public CohortDefinition findPatientsActiveOnArtEligibleForDsd() { final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - dsd.setName(cohortName); + dsd.setName("patientsActiveOnArtEligibleForDsd"); dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); dsd.addParameter(new Parameter("location", "location", Location.class)); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; dsd.addSearch( "IN-ART", EptsReportUtils.map( - getPatientsActiveOnArtExcludingPregnantBreastfeedingAndTb(""), mappings)); + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); dsd.addSearch( "STABLE", @@ -100,27 +109,27 @@ public CohortDefinition getPatientsActiveOnArtEligibleForDsd(final String cohort .findPatientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months), mappings)); - dsd.setCompositionString("(IN-ART AND STABLE) NOT(ADVERSASE-REACTIONS OR SARCOMA-KAPOSI)"); + dsd.setCompositionString("(IN-ART AND STABLE) NOT (ADVERSASE-REACTIONS OR SARCOMA-KAPOSI)"); return dsd; } @DocumentedDefinition(value = "patientsWhoNotElegibleDSD") - public CohortDefinition getPatientsActiveOnArtNotEligibleForDsd(final String cohortName) { + public CohortDefinition findPatientsActiveOnArtNotEligibleForDsd() { final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - dsd.setName(cohortName); + dsd.setName("patientsWhoNotElegibleDSD"); dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); dsd.addParameter(new Parameter("location", "location", Location.class)); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; dsd.addSearch( "IN-ART", EptsReportUtils.map( - getPatientsActiveOnArtExcludingPregnantBreastfeedingAndTb(""), mappings)); + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); dsd.addSearch( "STABLE", @@ -148,63 +157,703 @@ public CohortDefinition getPatientsActiveOnArtNotEligibleForDsd(final String coh mappings)); dsd.setCompositionString( - "IN-ART NOT((STABLE AND IN-ART) NOT(ADVERSASE-REACTIONS OR SARCOMA-KAPOSI))"); + "IN-ART NOT ((STABLE AND IN-ART) NOT (ADVERSASE-REACTIONS OR SARCOMA-KAPOSI))"); return dsd; } - @DocumentedDefinition(value = "patientsActiveOnArtWhoInDt") - public CohortDefinition getPatientsActiveOnArtWhoInDt(final String cohortName) { + @DocumentedDefinition(value = "patientsWhoAreActiveOnArtAndInAtleastOneDSD") + public CohortDefinition findPatientsWhoAreActiveOnArtAndInAtleastOneDSD() { + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); + + definition.setName("patientsWhoAreActiveOnArtAndInAtleastOneDSD"); + definition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + definition.addParameter(new Parameter("endDate", "End Date", Date.class)); + definition.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + definition.addSearch( + "IART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + definition.addSearch( + "GAAC", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreCommunityAdherenceGroups", + DsdQueriesInterface.QUERY.findPatientsWhoAreCommunityAdherenceGroups), + mappings)); + + definition.addSearch( + "AF", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreFamilyAproach", + DsdQueriesInterface.QUERY.findPatientsWhoAreFamilyAproach), + mappings)); + + definition.addSearch( + "CA", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patietsWhoAreOnAdherenceClubs", + DsdQueriesInterface.QUERY.findPatietsWhoAreOnAdherenceClubs), + mappings)); + + definition.addSearch( + "DT", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreThreeMonthsDrugDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreThreeMonthsDrugDistribution), + mappings)); + + definition.addSearch( + "FR", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreFastTrack", DsdQueriesInterface.QUERY.findPatientsWhoAreFastTrack), + mappings)); + + definition.addSearch( + "DC", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreInCommunityDrugsDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreInCommunityDrugsDistribution), + mappings)); + + definition.addSearch( + "DS", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreSixMonthsDrugsDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreSixMonthsDrugsDistribution), + mappings)); + + definition.setCompositionString("IART AND (GAAC OR AF OR CA OR DT FR OR DC OR DS)"); + + return definition; + } + + @DocumentedDefinition(value = "patientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreStable") + public CohortDefinition findPatientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreStable() { + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); + + definition.setName("patientsWhoAreActiveOnArtAndInAtleastOneDSD"); + definition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + definition.addParameter(new Parameter("endDate", "End Date", Date.class)); + definition.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + definition.addSearch( + "IART-DSD", + EptsReportUtils.map(this.findPatientsWhoAreActiveOnArtAndInAtleastOneDSD(), mappings)); + + definition.addSearch( + "STABLE", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsInArtWhoAreStable", + DsdQueriesInterface.QUERY.findPatientsInArtWhoAreStable), + mappings)); + + definition.addSearch( + "SARCOMA-KAPOSI", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoHaveBeenNotifiedOfKaposiSarcoma", + DsdQueriesInterface.QUERY.findPatientsWhoHaveBeenNotifiedOfKaposiSarcoma), + mappings)); + + definition.addSearch( + "ADVERSASE-REACTIONS", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months", + DsdQueriesInterface.QUERY + .findPatientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months), + mappings)); + + definition.setCompositionString( + "(STABLE AND IART-DSD) NOT (ADVERSASE-REACTIONS OR SARCOMA-KAPOSI)"); + + return definition; + } + + @DocumentedDefinition(value = "patientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreUnstable") + public CohortDefinition findPatientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreUnstable() { + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); + + definition.setName("patientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreUnstable"); + definition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + definition.addParameter(new Parameter("endDate", "End Date", Date.class)); + definition.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + definition.addSearch( + "IART-DSD", + EptsReportUtils.map(this.findPatientsWhoAreActiveOnArtAndInAtleastOneDSD(), mappings)); + + definition.addSearch( + "STABLE", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsInArtWhoAreStable", + DsdQueriesInterface.QUERY.findPatientsInArtWhoAreStable), + mappings)); + + definition.addSearch( + "SARCOMA-KAPOSI", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoHaveBeenNotifiedOfKaposiSarcoma", + DsdQueriesInterface.QUERY.findPatientsWhoHaveBeenNotifiedOfKaposiSarcoma), + mappings)); + + definition.addSearch( + "ADVERSASE-REACTIONS", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months", + DsdQueriesInterface.QUERY + .findPatientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months), + mappings)); + + definition.setCompositionString( + "IART-DSD NOT ((STABLE AND IART-DSD) NOT (ADVERSASE-REACTIONS OR SARCOMA-KAPOSI))"); + + return definition; + } + + @DocumentedDefinition(value = "patientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution") + public CohortDefinition findPatientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution() { final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - dsd.setName(cohortName); + dsd.setName("patientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution"); dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); dsd.addParameter(new Parameter("location", "location", Location.class)); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; dsd.addSearch( "IN-ART", EptsReportUtils.map( - getPatientsActiveOnArtExcludingPregnantBreastfeedingAndTb(""), mappings)); + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); dsd.addSearch( - "QUARTERLY-DISPENSATION", + "DT", EptsReportUtils.map( this.genericCohorts.generalSql( - "QUARTERLY-DISPENSATION", - DsdQueriesInterface.QUERY.findPatientWhoAreMdcQuarterlyDispensation), + "patientsWhoAreThreeMonthsDrugDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreThreeMonthsDrugDistribution), mappings)); - dsd.setCompositionString("(IN-ART AND QUARTERLY-DISPENSATION)"); + dsd.setCompositionString("IN-ART AND DT"); return dsd; } - @DocumentedDefinition(value = "patientsActiveOnArtWhoInDt") - public CohortDefinition getPatientsActiveOnArtElegibleDsdWhoInDt(final String cohortName) { + @DocumentedDefinition( + value = "patientsWhoAreActiveOnArtAndEligibleToThreeMonthsDrugsDistribution") + public CohortDefinition findPatientsWhoAreActiveOnArtAndEligibleToThreeMonthsDrugsDistribution() { final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - dsd.setName(cohortName); + dsd.setName("patientsWhoAreActiveOnArtAndEligibleToThreeMonthsDrugsDistribution"); dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); dsd.addParameter(new Parameter("location", "location", Location.class)); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; dsd.addSearch( - "ELEGIBLE", EptsReportUtils.map(getPatientsActiveOnArtEligibleForDsd(""), mappings)); + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); dsd.addSearch( - "QUARTERLY-DISPENSATION", + "DT", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND DT"); + + return dsd; + } + + @DocumentedDefinition( + value = "patientsWhoAreActiveOnArtAndNotEligibleToThreeMonthsDrugsDistribution") + public CohortDefinition + findPatientsWhoAreActiveOnArtAndNotEligibleToThreeMonthsDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsWhoAreActiveOnArtAndNotEligibleToThreeMonthsDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "DT", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND DT"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInFastTrack") + public CohortDefinition findPatientsActiveOnArtInFastTrack() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInFastTrack"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "FR", EptsReportUtils.map( this.genericCohorts.generalSql( - "QUARTERLY-DISPENSATION", - DsdQueriesInterface.QUERY.findPatientWhoAreMdcQuarterlyDispensation), + "patientsWhoAreFastTrack", DsdQueriesInterface.QUERY.findPatientsWhoAreFastTrack), mappings)); - dsd.setCompositionString("(ELEGIBLE AND QUARTERLY-DISPENSATION)"); + dsd.setCompositionString("IN-ART AND FR"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToFastTrack") + public CohortDefinition findPatientsActiveOnArtEligibleToFastTrack() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToFastTrack"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch("FR", EptsReportUtils.map(this.findPatientsActiveOnArtInFastTrack(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND FR"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotElegibleToFastTrack") + public CohortDefinition findPatientsActiveOnArtNotElegibleToFastTrack() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotElegibleToFastTrack"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch("FR", EptsReportUtils.map(this.findPatientsActiveOnArtInFastTrack(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND FR"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInCommunityAdherennceGroups") + public CohortDefinition findPatientsActiveOnArtInCommunityAdherennceGroups() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInCommunityAdherennceGroups"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "GAAC", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreCommunityAdherenceGroups", + DsdQueriesInterface.QUERY.findPatientsWhoAreCommunityAdherenceGroups), + mappings)); + + dsd.setCompositionString("IN-ART AND GAAC"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToCommunityAdherennceGroups") + public CohortDefinition findPatientsActiveOnArtEligibleToCommunityAdherennceGroups() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToCommunityAdherennceGroups"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch( + "GAAC", + EptsReportUtils.map(this.findPatientsActiveOnArtInCommunityAdherennceGroups(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND GAAC"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotEligibleToCommunityAdherennceGroups") + public CohortDefinition findPatientsActiveOnArtNotEligibleToCommunityAdherennceGroups() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotEligibleToCommunityAdherennceGroups"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "GAAC", + EptsReportUtils.map(this.findPatientsActiveOnArtInCommunityAdherennceGroups(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND GAAC"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInFamilyApproach") + public CohortDefinition findPatientsActiveOnArtInFamilyApproach() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInFamilyApproach"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "AF", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreFamilyAproach", + DsdQueriesInterface.QUERY.findPatientsWhoAreFamilyAproach), + mappings)); + + dsd.setCompositionString("IN-ART AND AF"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToFamilyApproach") + public CohortDefinition findPatientsActiveOnArtEligibleToFamilyApproach() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToFamilyApproach"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch( + "AF", EptsReportUtils.map(this.findPatientsActiveOnArtInFamilyApproach(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND AF"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotEligibleToFamilyApproach") + public CohortDefinition findPatientsActiveOnArtNotEligibleToFamilyApproach() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotEligibleToFamilyApproach"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "AF", EptsReportUtils.map(this.findPatientsActiveOnArtInFamilyApproach(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND AF"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInAdherenceClubs") + public CohortDefinition findPatientsActiveOnArtInAdherenceClubs() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInAdherenceClubs"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "CA", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patietsWhoAreOnAdherenceClubs", + DsdQueriesInterface.QUERY.findPatietsWhoAreOnAdherenceClubs), + mappings)); + + dsd.setCompositionString("IN-ART AND CA"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToAdherenceClubs") + public CohortDefinition findPatientsActiveOnArtEligibleToAdherenceClubs() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToAdherenceClubs"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch( + "CA", EptsReportUtils.map(this.findPatientsActiveOnArtInAdherenceClubs(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND CA"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotEligibleToAdherenceClubs") + public CohortDefinition findPatientsActiveOnArtNotEligibleToAdherenceClubs() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotEligibleToAdherenceClubs"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "CA", EptsReportUtils.map(this.findPatientsActiveOnArtInAdherenceClubs(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND CA"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInSixMonthsDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtInSixMonthsDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInSixMonthsDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "DS", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreSixMonthsDrugsDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreSixMonthsDrugsDistribution), + mappings)); + + dsd.setCompositionString("IN-ART AND DS"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToSixMonthsDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtEligibleToSixMonthsDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToSixMonthsDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch( + "DS", + EptsReportUtils.map(this.findPatientsActiveOnArtInSixMonthsDrugsDistribution(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND DS"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "DS", + EptsReportUtils.map(this.findPatientsActiveOnArtInSixMonthsDrugsDistribution(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND DS"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtInCommunityDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtInCommunityDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtInCommunityDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "IN-ART", + EptsReportUtils.map( + this.findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), mappings)); + + dsd.addSearch( + "DC", + EptsReportUtils.map( + this.genericCohorts.generalSql( + "patientsWhoAreInCommunityDrugsDistribution", + DsdQueriesInterface.QUERY.findPatientsWhoAreInCommunityDrugsDistribution), + mappings)); + + dsd.setCompositionString("IN-ART AND DC"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtEligibleToCommunityDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtEligibleToCommunityDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtEligibleToCommunityDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "ELEGIBLE", EptsReportUtils.map(this.findPatientsActiveOnArtEligibleForDsd(), mappings)); + + dsd.addSearch( + "DC", + EptsReportUtils.map(this.findPatientsActiveOnArtInCommunityDrugsDistribution(), mappings)); + + dsd.setCompositionString("ELEGIBLE AND DC"); + + return dsd; + } + + @DocumentedDefinition(value = "patientsActiveOnArtNotEligibleToCommunityDrugsDistribution") + public CohortDefinition findPatientsActiveOnArtNotEligibleToCommunityDrugsDistribution() { + final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); + + dsd.setName("patientsActiveOnArtNotEligibleToCommunityDrugsDistribution"); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.addParameter(new Parameter("location", "location", Location.class)); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + dsd.addSearch( + "NOT-ELEGIBLE", + EptsReportUtils.map(this.findPatientsActiveOnArtNotEligibleForDsd(), mappings)); + + dsd.addSearch( + "DC", + EptsReportUtils.map(this.findPatientsActiveOnArtInCommunityDrugsDistribution(), mappings)); + + dsd.setCompositionString("NOT-ELEGIBLE AND DC"); return dsd; } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DsdElegibleCohortQuery.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DsdElegibleCohortQuery.java deleted file mode 100644 index 8f24113619..0000000000 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/DsdElegibleCohortQuery.java +++ /dev/null @@ -1,266 +0,0 @@ -package org.openmrs.module.eptsreports.reporting.library.cohorts; - -import java.util.Date; -import org.openmrs.Location; -import org.openmrs.module.eptsreports.reporting.library.queries.DsdQueriesInterface; -import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; -import org.openmrs.module.reporting.cohort.definition.CohortDefinition; -import org.openmrs.module.reporting.cohort.definition.CompositionCohortDefinition; -import org.openmrs.module.reporting.evaluation.parameter.Parameter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class DsdElegibleCohortQuery { - - @Autowired private GenericCohortQueries genericCohorts; - @Autowired private DSDCohortQueries dsdCohortQueries; - - public CohortDefinition getAdultActiveOnArtElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "ELEGIBLE", - EptsReportUtils.map(dsdCohortQueries.getPatientsActiveOnArtEligibleForDsd(""), mappings)); - - dsd.addSearch( - "ADULT", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "ADULT", DsdQueriesInterface.QUERY.findPatientsAge15Plus), - mappings)); - - dsd.setCompositionString("ELEGIBLE AND ADULT"); - - return dsd; - } - - public CohortDefinition getChild2To4ActiveOnArtElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "ELEGIBLE", - EptsReportUtils.map(dsdCohortQueries.getPatientsActiveOnArtEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD2TO4", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD2TO4", DsdQueriesInterface.QUERY.findPatientsAge2to4), - mappings)); - - dsd.setCompositionString("ELEGIBLE AND CHILD2TO4"); - - return dsd; - } - - public CohortDefinition getChild5To9ActiveOnArtElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "ELEGIBLE", - EptsReportUtils.map(dsdCohortQueries.getPatientsActiveOnArtEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD5TO9", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD5TO9", DsdQueriesInterface.QUERY.findPatientsAge5to9), - mappings)); - - dsd.setCompositionString("ELEGIBLE AND CHILD5TO9"); - - return dsd; - } - - public CohortDefinition getChild10To14ActiveOnArtElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "ELEGIBLE", - EptsReportUtils.map(dsdCohortQueries.getPatientsActiveOnArtEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD10T14", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD10T14", DsdQueriesInterface.QUERY.findPatientsAge10to14), - mappings)); - - dsd.setCompositionString("ELEGIBLE AND CHILD10T14"); - - return dsd; - } - - public CohortDefinition getAdultActiveOnArtNotElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "NOT-ELEGIBLE", - EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)); - - dsd.addSearch( - "ADULT", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "ADULT", DsdQueriesInterface.QUERY.findPatientsAge15Plus), - mappings)); - - dsd.setCompositionString("NOT-ELEGIBLE AND ADULT"); - - return dsd; - } - - public CohortDefinition getChildLessthan2ActiveOnArtNotElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "NOT-ELEGIBLE", - EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD2", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD2", DsdQueriesInterface.QUERY.findPatientsAgeLessThan2), - mappings)); - - dsd.setCompositionString("NOT-ELEGIBLE AND CHILD2"); - - return dsd; - } - - public CohortDefinition getChild2To4ActiveOnArtNotElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "NOT-ELEGIBLE", - EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD2TO4", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD2TO4", DsdQueriesInterface.QUERY.findPatientsAge2to4), - mappings)); - - dsd.setCompositionString("NOT-ELEGIBLE AND CHILD2TO4"); - - return dsd; - } - - public CohortDefinition getChild5To9ActiveOnNotArtElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "NOT-ELEGIBLE", - EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD5TO9", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD5TO9", DsdQueriesInterface.QUERY.findPatientsAge5to9), - mappings)); - - dsd.setCompositionString("NOT-ELEGIBLE AND CHILD5TO9"); - - return dsd; - } - - public CohortDefinition getChild10To14ActiveOnArtNotElegibleDsd(final String cohortName) { - - final CompositionCohortDefinition dsd = new CompositionCohortDefinition(); - - dsd.setName(cohortName); - dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); - dsd.addParameter(new Parameter("location", "location", Location.class)); - - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dsd.addSearch( - "NOT-ELEGIBLE", - EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)); - - dsd.addSearch( - "CHILD10T14", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "CHILD10T14", DsdQueriesInterface.QUERY.findPatientsAge10to14), - mappings)); - - dsd.setCompositionString("NOT-ELEGIBLE AND CHILD10T14"); - - return dsd; - } -} diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/Eri2MonthsCohortQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/Eri2MonthsCohortQueries.java index b287d17edd..579cd44400 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/Eri2MonthsCohortQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/Eri2MonthsCohortQueries.java @@ -15,8 +15,8 @@ import org.openmrs.Location; import org.openmrs.module.eptsreports.metadata.HivMetadata; import org.openmrs.module.eptsreports.reporting.library.queries.Eri2MonthsQueries; -import org.openmrs.module.eptsreports.reporting.library.queries.Eri2MonthsQueriesInterface; -import org.openmrs.module.eptsreports.reporting.library.queries.TxNewQueries; +import org.openmrs.module.eptsreports.reporting.library.queries.PregnantQueries; +import org.openmrs.module.eptsreports.reporting.utils.AgeRange; import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; import org.openmrs.module.reporting.cohort.definition.CompositionCohortDefinition; @@ -36,6 +36,10 @@ public class Eri2MonthsCohortQueries { @Autowired private GenericCohortQueries genericCohorts; + @Autowired private TxNewCohortQueries txNewCohortQueries; + + @Autowired private BreastFeedingCohortQueries breastFeedingCohortQueries; + /** * C * @@ -43,20 +47,20 @@ public class Eri2MonthsCohortQueries { */ public CohortDefinition getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days() { - SqlCohortDefinition cd = new SqlCohortDefinition(); + final SqlCohortDefinition cd = new SqlCohortDefinition(); cd.setName("Patients who picked up drugs in 33 days"); cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); cd.addParameter(new Parameter("endDate", "End Date", Date.class)); cd.addParameter(new Parameter("location", "Location", Location.class)); cd.setQuery( Eri2MonthsQueries.getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days( - hivMetadata.getARVPharmaciaEncounterType().getEncounterTypeId(), - hivMetadata.getAdultoSeguimentoEncounterType().getEncounterTypeId(), - hivMetadata.getARVPediatriaSeguimentoEncounterType().getEncounterTypeId(), - hivMetadata.getARVPlanConcept().getConceptId(), - hivMetadata.getStartDrugsConcept().getConceptId(), - hivMetadata.getHistoricalDrugStartDateConcept().getConceptId(), - hivMetadata.getARTProgram().getProgramId())); + this.hivMetadata.getARVPharmaciaEncounterType().getEncounterTypeId(), + this.hivMetadata.getAdultoSeguimentoEncounterType().getEncounterTypeId(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType().getEncounterTypeId(), + this.hivMetadata.getARVPlanConcept().getConceptId(), + this.hivMetadata.getStartDrugsConcept().getConceptId(), + this.hivMetadata.getHistoricalDrugStartDateConcept().getConceptId(), + this.hivMetadata.getARTProgram().getProgramId())); return cd; } @@ -66,7 +70,7 @@ public class Eri2MonthsCohortQueries { * @return CohortDefinition */ public CohortDefinition getAllPatientsWhoStartedArtAndPickedDrugsOnTheirNextVisit() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who picked up drugs during their second visit and had initiated ART"); cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); cd.addParameter(new Parameter("endDate", "End Date", Date.class)); @@ -74,12 +78,12 @@ public CohortDefinition getAllPatientsWhoStartedArtAndPickedDrugsOnTheirNextVisi cd.addSearch( "initiatedArt", EptsReportUtils.map( - eriCohortQueries.getAllPatientsWhoInitiatedArt(), + this.eriCohortQueries.getAllPatientsWhoInitiatedArt(), "cohortStartDate=${startDate},cohortEndDate=${endDate},location=${location}")); cd.addSearch( "pickedDrugs", EptsReportUtils.map( - getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days(), + this.getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days(), "startDate=${startDate},endDate=${endDate},location=${location}")); cd.setCompositionString("initiatedArt AND pickedDrugs"); return cd; @@ -91,7 +95,7 @@ public CohortDefinition getAllPatientsWhoStartedArtAndPickedDrugsOnTheirNextVisi * @return CohortDefinition */ public CohortDefinition getPatientsWhoDidNotPickDrugsOnTheirSecondVisit() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who did not pick up drugs during their second visit"); cd.addParameter(new Parameter("cohortStartDate", "Cohort Start Date", Date.class)); cd.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); @@ -100,24 +104,24 @@ public CohortDefinition getPatientsWhoDidNotPickDrugsOnTheirSecondVisit() { cd.addSearch( "initiatedArt", EptsReportUtils.map( - eriCohortQueries.getAllPatientsWhoInitiatedArt(), + this.eriCohortQueries.getAllPatientsWhoInitiatedArt(), "cohortStartDate=${cohortStartDate},cohortEndDate=${cohortEndDate},location=${location}")); cd.addSearch( "pickedDrugs", EptsReportUtils.map( - getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days(), + this.getAllPatientsWhoReturnedFor2ndConsultationOR2ndDrugsPickUpWithin33Days(), "startDate=${cohortStartDate},endDate=${cohortEndDate},location=${location}")); cd.addSearch( "dead", EptsReportUtils.map( - genericCohortQueries.getDeceasedPatients(), + this.genericCohortQueries.getDeceasedPatients(), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); cd.addSearch( "transfers", EptsReportUtils.map( - genericCohortQueries.getPatientsBasedOnPatientStates( - hivMetadata.getARTProgram().getProgramId(), - hivMetadata + this.genericCohortQueries.getPatientsBasedOnPatientStates( + this.hivMetadata.getARTProgram().getProgramId(), + this.hivMetadata .getTransferredOutToAnotherHealthFacilityWorkflowState() .getProgramWorkflowStateId()), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); @@ -137,7 +141,7 @@ public CohortDefinition getPatientsWhoDidNotPickDrugsOnTheirSecondVisit() { * @return CohortDefinition */ public CohortDefinition getPatientsWhoPickedUpDrugsOnTheirSecondVisit() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who picked up drugs during their second visit"); cd.addParameter(new Parameter("cohortStartDate", "Cohort Start Date", Date.class)); cd.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); @@ -146,19 +150,19 @@ public CohortDefinition getPatientsWhoPickedUpDrugsOnTheirSecondVisit() { cd.addSearch( "pickedDrugsAndStartedART", EptsReportUtils.map( - getAllPatientsWhoStartedArtAndPickedDrugsOnTheirNextVisit(), + this.getAllPatientsWhoStartedArtAndPickedDrugsOnTheirNextVisit(), "startDate=${cohortStartDate},endDate=${cohortEndDate},location=${location}")); cd.addSearch( "dead", EptsReportUtils.map( - genericCohortQueries.getDeceasedPatients(), + this.genericCohortQueries.getDeceasedPatients(), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); cd.addSearch( "transfers", EptsReportUtils.map( - genericCohortQueries.getPatientsBasedOnPatientStates( - hivMetadata.getARTProgram().getProgramId(), - hivMetadata + this.genericCohortQueries.getPatientsBasedOnPatientStates( + this.hivMetadata.getARTProgram().getProgramId(), + this.hivMetadata .getTransferredOutToAnotherHealthFacilityWorkflowState() .getProgramWorkflowStateId()), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); @@ -173,7 +177,7 @@ public CohortDefinition getPatientsWhoPickedUpDrugsOnTheirSecondVisit() { * @return CohortDefinition */ public CohortDefinition getPatientsWhoInitiatedArtAndDead() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who died during period"); cd.addParameter(new Parameter("cohortStartDate", "Cohort Start Date", Date.class)); cd.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); @@ -182,12 +186,12 @@ public CohortDefinition getPatientsWhoInitiatedArtAndDead() { cd.addSearch( "initiatedArtAndNotTransferIns", EptsReportUtils.map( - eriCohortQueries.getAllPatientsWhoInitiatedArt(), + this.eriCohortQueries.getAllPatientsWhoInitiatedArt(), "cohortStartDate=${cohortStartDate},cohortEndDate=${cohortEndDate},location=${location}")); cd.addSearch( "dead", EptsReportUtils.map( - genericCohortQueries.getDeceasedPatients(), + this.genericCohortQueries.getDeceasedPatients(), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); cd.setCompositionString("initiatedArtAndNotTransferIns AND dead"); return cd; @@ -200,7 +204,7 @@ public CohortDefinition getPatientsWhoInitiatedArtAndDead() { * @return CohortDefinition */ public CohortDefinition getPatientsWhoInitiatedArtButSuspendedTreatment() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who suspended treatment"); cd.addParameter(new Parameter("cohortStartDate", "Cohort Start Date", Date.class)); cd.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); @@ -209,14 +213,14 @@ public CohortDefinition getPatientsWhoInitiatedArtButSuspendedTreatment() { cd.addSearch( "initiatedArtAndNotTransferIns", EptsReportUtils.map( - eriCohortQueries.getAllPatientsWhoInitiatedArt(), + this.eriCohortQueries.getAllPatientsWhoInitiatedArt(), "cohortStartDate=${cohortStartDate},cohortEndDate=${cohortEndDate},location=${location}")); cd.addSearch( "suspendedTreatment", EptsReportUtils.map( - genericCohortQueries.getPatientsBasedOnPatientStates( - hivMetadata.getARTProgram().getProgramId(), - hivMetadata.getSuspendedTreatmentWorkflowState().getProgramWorkflowStateId()), + this.genericCohortQueries.getPatientsBasedOnPatientStates( + this.hivMetadata.getARTProgram().getProgramId(), + this.hivMetadata.getSuspendedTreatmentWorkflowState().getProgramWorkflowStateId()), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); cd.setCompositionString("initiatedArtAndNotTransferIns AND suspendedTreatment"); return cd; @@ -229,7 +233,7 @@ public CohortDefinition getPatientsWhoInitiatedArtButSuspendedTreatment() { * @return CohortDefinition */ public CohortDefinition getPatientsWhoInitiatedArtButTransferredOut() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("Patients who transferred out during period"); cd.addParameter(new Parameter("cohortStartDate", "Cohort Start Date", Date.class)); cd.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); @@ -239,14 +243,14 @@ public CohortDefinition getPatientsWhoInitiatedArtButTransferredOut() { cd.addSearch( "initiatedArtAndNotTransferIns", EptsReportUtils.map( - eriCohortQueries.getAllPatientsWhoInitiatedArt(), + this.eriCohortQueries.getAllPatientsWhoInitiatedArt(), "cohortStartDate=${cohortStartDate},cohortEndDate=${cohortEndDate},location=${location}")); cd.addSearch( "transferredOut", EptsReportUtils.map( - genericCohortQueries.getPatientsBasedOnPatientStates( - hivMetadata.getARTProgram().getProgramId(), - hivMetadata + this.genericCohortQueries.getPatientsBasedOnPatientStates( + this.hivMetadata.getARTProgram().getProgramId(), + this.hivMetadata .getTransferredOutToAnotherHealthFacilityWorkflowState() .getProgramWorkflowStateId()), "startDate=${cohortStartDate},endDate=${reportingEndDate},location=${location}")); @@ -254,47 +258,6 @@ public CohortDefinition getPatientsWhoInitiatedArtButTransferredOut() { return cd; } - public CohortDefinition getEri2MonthsCompositionCohort(final String cohortName) { - final CompositionCohortDefinition eri2MonthsCompositionCohort = - new CompositionCohortDefinition(); - - eri2MonthsCompositionCohort.setName(cohortName); - eri2MonthsCompositionCohort.addParameter(new Parameter("startDate", "Start Date", Date.class)); - eri2MonthsCompositionCohort.addParameter(new Parameter("endDate", "End Date", Date.class)); - eri2MonthsCompositionCohort.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - eri2MonthsCompositionCohort.addSearch( - "START-ART-2-MONTHS", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientEnrolledInART2Months", - Eri2MonthsQueriesInterface.QUERY.findPatientsWhoStartArtOneMonth), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod", - TxNewQueries.QUERY.findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN-AND-IN-ART-MASTER-CARD", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard", - TxNewQueries.QUERY - .findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard), - mappings)); - - eri2MonthsCompositionCohort.setCompositionString( - "START-ART-2-MONTHS NOT (TRANSFERED-IN OR TRANSFERED-IN-AND-IN-ART-MASTER-CARD)"); - return eri2MonthsCompositionCohort; - } - public CohortDefinition getEri2MonthsPregnatCompositionCohort(final String cohortName) { final CompositionCohortDefinition eri2MonthsCompositionCohort = new CompositionCohortDefinition(); @@ -309,26 +272,7 @@ public CohortDefinition getEri2MonthsPregnatCompositionCohort(final String cohor eri2MonthsCompositionCohort.addSearch( "START-ART-2-MONTHS", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientEnrolledInART2Months", - Eri2MonthsQueriesInterface.QUERY.findPatientsWhoStartArtOneMonth), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod", - TxNewQueries.QUERY.findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN-AND-IN-ART-MASTER-CARD", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard", - TxNewQueries.QUERY - .findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard), + this.txNewCohortQueries.getTxNewCompositionCohort("patientEnrolledInART2Months"), mappings)); eri2MonthsCompositionCohort.addSearch( @@ -336,12 +280,10 @@ public CohortDefinition getEri2MonthsPregnatCompositionCohort(final String cohor EptsReportUtils.map( this.genericCohorts.generalSql( "patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard), + PregnantQueries.findPatientsWhoArePregnantInAPeriod()), mappings)); - eri2MonthsCompositionCohort.setCompositionString( - "START-ART-2-MONTHS AND PREGNANT NOT (TRANSFERED-IN OR TRANSFERED-IN-AND-IN-ART-MASTER-CARD)"); + eri2MonthsCompositionCohort.setCompositionString("START-ART-2-MONTHS AND PREGNANT"); return eri2MonthsCompositionCohort; } @@ -360,39 +302,17 @@ public CohortDefinition getEri2MonthsBrestfeetingCompositionCohort(final String eri2MonthsCompositionCohort.addSearch( "START-ART-2-MONTHS", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientEnrolledInART2Months", - Eri2MonthsQueriesInterface.QUERY.findPatientsWhoStartArtOneMonth), + this.txNewCohortQueries.getTxNewCompositionCohort("patientEnrolledInART2Months"), mappings)); eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN", + "BREASTFEEDING", EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod", - TxNewQueries.QUERY.findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN-AND-IN-ART-MASTER-CARD", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard", - TxNewQueries.QUERY - .findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard), - mappings)); + this.breastFeedingCohortQueries + .findPatientsWhoAreBreastFeedingExcludingPregnantsInAPeriod(), + "cohortStartDate=${startDate},cohortEndDate=${endDate},location=${location}")); - eri2MonthsCompositionCohort.addSearch( - "BRESTFEETING", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard), - mappings)); - - eri2MonthsCompositionCohort.setCompositionString( - "START-ART-2-MONTHS AND BRESTFEETING NOT (TRANSFERED-IN OR TRANSFERED-IN-AND-IN-ART-MASTER-CARD)"); + eri2MonthsCompositionCohort.setCompositionString("START-ART-2-MONTHS AND BREASTFEEDING"); return eri2MonthsCompositionCohort; } @@ -411,55 +331,32 @@ public CohortDefinition getEri2MonthsAdultCompositionCohort(final String cohortN eri2MonthsCompositionCohort.addSearch( "START-ART-2-MONTHS", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientEnrolledInART2Months", - Eri2MonthsQueriesInterface.QUERY.findPatientsWhoStartArtOneMonth), + this.txNewCohortQueries.getTxNewCompositionCohort("patientEnrolledInART2Months"), mappings)); eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN", + "BREASTFEEDING", EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod", - TxNewQueries.QUERY.findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN-AND-IN-ART-MASTER-CARD", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard", - TxNewQueries.QUERY - .findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "BRESTFEETING", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard), - mappings)); + this.breastFeedingCohortQueries + .findPatientsWhoAreBreastFeedingExcludingPregnantsInAPeriod(), + "cohortStartDate=${startDate},cohortEndDate=${endDate},location=${location}")); eri2MonthsCompositionCohort.addSearch( "PREGNANT", EptsReportUtils.map( this.genericCohorts.generalSql( - "patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard), + "patientsWhoArePregnantInAPeriod", + PregnantQueries.findPatientsWhoArePregnantInAPeriod()), mappings)); eri2MonthsCompositionCohort.addSearch( "ADULT", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsThatAreAdult", Eri2MonthsQueriesInterface.QUERY.patientsThatAreAdult), + this.txNewCohortQueries.findPatientsWhoAreNewlyEnrolledOnArtByAgeRange(AgeRange.ADULT), mappings)); eri2MonthsCompositionCohort.setCompositionString( - "START-ART-2-MONTHS AND ADULT NOT (TRANSFERED-IN OR TRANSFERED-IN-AND-IN-ART-MASTER-CARD OR PREGNANT OR BRESTFEETING)"); + "(START-ART-2-MONTHS AND ADULT) NOT (PREGNANT OR BREASTFEEDING)"); return eri2MonthsCompositionCohort; } @@ -478,55 +375,33 @@ public CohortDefinition getEri2MonthsChildCompositionCohort(final String cohortN eri2MonthsCompositionCohort.addSearch( "START-ART-2-MONTHS", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientEnrolledInART2Months", - Eri2MonthsQueriesInterface.QUERY.findPatientsWhoStartArtOneMonth), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod", - TxNewQueries.QUERY.findPatientsWithAProgramStateMarkedAsTransferedInInAPeriod), - mappings)); - - eri2MonthsCompositionCohort.addSearch( - "TRANSFERED-IN-AND-IN-ART-MASTER-CARD", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard", - TxNewQueries.QUERY - .findPatientsWhoWhereMarkedAsTransferedInAndOnARTOnInAPeriodOnMasterCard), + this.txNewCohortQueries.getTxNewCompositionCohort("patientEnrolledInART2Months"), mappings)); eri2MonthsCompositionCohort.addSearch( - "BRESTFEETING", + "BREASTFEEDING", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard), - mappings)); + this.breastFeedingCohortQueries + .findPatientsWhoAreBreastFeedingExcludingPregnantsInAPeriod(), + "cohortStartDate=${startDate},cohortEndDate=${endDate},location=${location}")); eri2MonthsCompositionCohort.addSearch( "PREGNANT", EptsReportUtils.map( this.genericCohorts.generalSql( - "patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard", - Eri2MonthsQueriesInterface.QUERY - .patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard), + "patientsWhoArePregnantInAPeriod", + PregnantQueries.findPatientsWhoArePregnantInAPeriod()), mappings)); eri2MonthsCompositionCohort.addSearch( - "CHILD", + "CHILDREN", EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsThatAreChild", Eri2MonthsQueriesInterface.QUERY.patientsThatAreChild), + this.txNewCohortQueries.findPatientsWhoAreNewlyEnrolledOnArtByAgeRange( + AgeRange.CHILDREN), mappings)); eri2MonthsCompositionCohort.setCompositionString( - "START-ART-2-MONTHS AND CHILD NOT (TRANSFERED-IN OR TRANSFERED-IN-AND-IN-ART-MASTER-CARD OR PREGNANT OR BRESTFEETING)"); + "(START-ART-2-MONTHS AND CHILDREN) NOT (PREGNANT OR BREASTFEEDING)"); return eri2MonthsCompositionCohort; } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TXTBCohortQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TXTBCohortQueries.java index ad7f1ce091..f43950b515 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TXTBCohortQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TXTBCohortQueries.java @@ -28,21 +28,19 @@ public class TXTBCohortQueries { @Autowired private GenericCohortQueries genericCohortQueries; - @Autowired private HivCohortQueries hivCohortQueries; - - private String generalParameterMapping = + private final String generalParameterMapping = "startDate=${startDate},endDate=${endDate},location=${location}"; - private String codedObsParameterMapping = + private final String codedObsParameterMapping = "onOrAfter=${startDate},onOrBefore=${endDate},locationList=${location}"; - private Mapped map(CohortDefinition cd, String parameterMappings) { + private Mapped map(final CohortDefinition cd, final String parameterMappings) { return EptsReportUtils.map( cd, EptsReportUtils.removeMissingParameterMappingsFromCohortDefintion(cd, parameterMappings)); } - private void addGeneralParameters(CohortDefinition cd) { + private void addGeneralParameters(final CohortDefinition cd) { cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); cd.addParameter(new Parameter("endDate", "End Date", Date.class)); cd.addParameter(new Parameter("location", "Location", Location.class)); @@ -53,85 +51,85 @@ private void addGeneralParameters(CohortDefinition cd) { * TB. codes: DATAINICIO */ public CohortDefinition tbTreatmentStartDateWithinReportingDate() { - CohortDefinition definition = - genericCohortQueries.generalSql( + final CohortDefinition definition = + this.genericCohortQueries.generalSql( "startedTbTreatment", TXTBQueries.dateObs( - tbMetadata.getTBDrugTreatmentStartDate().getConceptId(), + this.tbMetadata.getTBDrugTreatmentStartDate().getConceptId(), Arrays.asList( - hivMetadata.getAdultoSeguimentoEncounterType().getId(), - hivMetadata.getARVPediatriaSeguimentoEncounterType().getId()), + this.hivMetadata.getAdultoSeguimentoEncounterType().getId(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType().getId()), true)); - addGeneralParameters(definition); + this.addGeneralParameters(definition); return definition; } /** PROGRAMA: PACIENTES INSCRITOS NO PROGRAMA DE TUBERCULOSE - NUM PERIODO */ public CohortDefinition getInTBProgram() { - CohortDefinition definition = - genericCohortQueries.generalSql( + final CohortDefinition definition = + this.genericCohortQueries.generalSql( "TBPROGRAMA", TXTBQueries.inTBProgramWithinReportingPeriodAtLocation( - tbMetadata.getTBProgram().getProgramId())); - addGeneralParameters(definition); + this.tbMetadata.getTBProgram().getProgramId())); + this.addGeneralParameters(definition); return definition; } /** PACIENTES COM RASTREIO DE TUBERCULOSE NEGATIVO codes: RASTREIOTBNEG */ public CohortDefinition codedNoTbScreening() { - CohortDefinition cd = - genericCohortQueries.hasCodedObs( - tbMetadata.getTbScreeningConcept(), + final CohortDefinition cd = + this.genericCohortQueries.hasCodedObs( + this.tbMetadata.getTbScreeningConcept(), TimeModifier.ANY, SetComparator.IN, Arrays.asList( - hivMetadata.getAdultoSeguimentoEncounterType(), - hivMetadata.getARVPediatriaSeguimentoEncounterType()), - Arrays.asList(commonMetadata.getNoConcept())); - addGeneralParameters(cd); + this.hivMetadata.getAdultoSeguimentoEncounterType(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType()), + Arrays.asList(this.commonMetadata.getNoConcept())); + this.addGeneralParameters(cd); return cd; } /** PACIENTES COM RASTREIO DE TUBERCULOSE POSITIVO codes: RASTREIOTBPOS */ public CohortDefinition codedYesTbScreening() { - CohortDefinition cd = - genericCohortQueries.hasCodedObs( - tbMetadata.getTbScreeningConcept(), + final CohortDefinition cd = + this.genericCohortQueries.hasCodedObs( + this.tbMetadata.getTbScreeningConcept(), TimeModifier.ANY, SetComparator.IN, Arrays.asList( - hivMetadata.getAdultoSeguimentoEncounterType(), - hivMetadata.getARVPediatriaSeguimentoEncounterType()), - Arrays.asList(commonMetadata.getYesConcept())); - addGeneralParameters(cd); + this.hivMetadata.getAdultoSeguimentoEncounterType(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType()), + Arrays.asList(this.commonMetadata.getYesConcept())); + this.addGeneralParameters(cd); return cd; } public CohortDefinition artList() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.addSearch( "started-by-end-reporting-period", EptsReportUtils.map( - genericCohortQueries.getStartedArtBeforeDate(false), + this.genericCohortQueries.getStartedArtBeforeDate(false), "onOrBefore=${endDate},location=${location}")); cd.setCompositionString("started-by-end-reporting-period"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition positiveInvestigationResult() { - CohortDefinition cd = - genericCohortQueries.hasCodedObs( - tbMetadata.getResearchResultConcept(), + final CohortDefinition cd = + this.genericCohortQueries.hasCodedObs( + this.tbMetadata.getResearchResultConcept(), TimeModifier.ANY, SetComparator.IN, Arrays.asList( - hivMetadata.getAdultoSeguimentoEncounterType(), - hivMetadata.getARVPediatriaSeguimentoEncounterType()), - Arrays.asList(tbMetadata.getPositiveConcept())); - addGeneralParameters(cd); + this.hivMetadata.getAdultoSeguimentoEncounterType(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType()), + Arrays.asList(this.tbMetadata.getPositiveConcept())); + this.addGeneralParameters(cd); return cd; } @@ -140,11 +138,11 @@ public CohortDefinition positiveInvestigationResult() { * during the reporting period consultations; ( response 703: POS or 664: NEG for question: 6277) */ public CohortDefinition positiveInvestigationResultComposition() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition P = positiveInvestigationResult(); - cd.addSearch("P", map(P, codedObsParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition P = this.positiveInvestigationResult(); + cd.addSearch("P", this.map(P, this.codedObsParameterMapping)); cd.setCompositionString("P"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } @@ -153,186 +151,200 @@ public CohortDefinition positiveInvestigationResultComposition() { * consultations; (response 1065: YES or 1066: NO for question 6257: SCREENING FOR TB) */ public CohortDefinition yesOrNoInvestigationResult() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition S = codedYesTbScreening(); - cd.addSearch("S", map(S, codedObsParameterMapping)); - CohortDefinition N = codedNoTbScreening(); - cd.addSearch("N", map(N, codedObsParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition S = this.codedYesTbScreening(); + cd.addSearch("S", this.map(S, this.codedObsParameterMapping)); + final CohortDefinition N = this.codedNoTbScreening(); + cd.addSearch("N", this.map(N, this.codedObsParameterMapping)); cd.setCompositionString("S OR N"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition txTbNumeratorA() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition i = - genericCohortQueries.generalSql( + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition i = + this.genericCohortQueries.generalSql( "onTbTreatment", TXTBQueries.dateObs( - tbMetadata.getTBDrugTreatmentStartDate().getConceptId(), + this.tbMetadata.getTBDrugTreatmentStartDate().getConceptId(), Arrays.asList( - hivMetadata.getAdultoSeguimentoEncounterType().getId(), - hivMetadata.getARVPediatriaSeguimentoEncounterType().getId()), + this.hivMetadata.getAdultoSeguimentoEncounterType().getId(), + this.hivMetadata.getARVPediatriaSeguimentoEncounterType().getId()), true)); - addGeneralParameters(i); - cd.addSearch("i", map(i, generalParameterMapping)); - CohortDefinition ii = getInTBProgram(); - cd.addSearch("ii", map(ii, generalParameterMapping)); - CohortDefinition artList = artList(); - cd.addSearch("artList", map(artList, generalParameterMapping)); + this.addGeneralParameters(i); + cd.addSearch("i", this.map(i, this.generalParameterMapping)); + final CohortDefinition ii = this.getInTBProgram(); + cd.addSearch("ii", this.map(ii, this.generalParameterMapping)); + final CohortDefinition artList = this.artList(); + cd.addSearch("artList", this.map(artList, this.generalParameterMapping)); cd.setCompositionString("(i OR ii) AND artList"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition txTbNumerator() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition A = txTbNumeratorA(); - cd.addSearch("A", map(A, generalParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition A = this.txTbNumeratorA(); + cd.addSearch("A", this.map(A, this.generalParameterMapping)); cd.addSearch( "started-tb-treatment-previous-period", EptsReportUtils.map( - tbTreatmentStartDateWithinReportingDate(), + this.tbTreatmentStartDateWithinReportingDate(), "startDate=${startDate-6m},endDate=${startDate-1d},location=${location}")); cd.setCompositionString("A NOT started-tb-treatment-previous-period"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition positiveScreening() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - cd.addSearch("A", EptsReportUtils.map(codedYesTbScreening(), codedObsParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + cd.addSearch( + "A", EptsReportUtils.map(this.codedYesTbScreening(), this.codedObsParameterMapping)); cd.addSearch( "B", - EptsReportUtils.map(positiveInvestigationResultComposition(), generalParameterMapping)); + EptsReportUtils.map( + this.positiveInvestigationResultComposition(), this.generalParameterMapping)); cd.addSearch( "C", - EptsReportUtils.map(tbTreatmentStartDateWithinReportingDate(), generalParameterMapping)); - cd.addSearch("D", EptsReportUtils.map(getInTBProgram(), generalParameterMapping)); + EptsReportUtils.map( + this.tbTreatmentStartDateWithinReportingDate(), this.generalParameterMapping)); + cd.addSearch("D", EptsReportUtils.map(this.getInTBProgram(), this.generalParameterMapping)); cd.setCompositionString("A OR B OR C OR D"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition newOnARTPositiveScreening() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); definition.setName("newOnARTPositiveScreening()"); definition.addSearch( - "denominator", EptsReportUtils.map(getDenominator(), generalParameterMapping)); - definition.addSearch("new-on-art", EptsReportUtils.map(getNewOnArt(), generalParameterMapping)); + "denominator", EptsReportUtils.map(this.getDenominator(), this.generalParameterMapping)); + definition.addSearch( + "new-on-art", EptsReportUtils.map(this.getNewOnArt(), this.generalParameterMapping)); definition.addSearch( - "positive-screening", EptsReportUtils.map(positiveScreening(), generalParameterMapping)); - addGeneralParameters(definition); + "positive-screening", + EptsReportUtils.map(this.positiveScreening(), this.generalParameterMapping)); + this.addGeneralParameters(definition); definition.setCompositionString("denominator AND new-on-art AND positive-screening"); return definition; } public CohortDefinition newOnARTNegativeScreening() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); definition.setName("newOnARTPositiveScreening()"); definition.addSearch( - "denominator", EptsReportUtils.map(getDenominator(), generalParameterMapping)); - definition.addSearch("new-on-art", EptsReportUtils.map(getNewOnArt(), generalParameterMapping)); + "denominator", EptsReportUtils.map(this.getDenominator(), this.generalParameterMapping)); definition.addSearch( - "positive-screening", EptsReportUtils.map(positiveScreening(), generalParameterMapping)); - addGeneralParameters(definition); + "new-on-art", EptsReportUtils.map(this.getNewOnArt(), this.generalParameterMapping)); + definition.addSearch( + "positive-screening", + EptsReportUtils.map(this.positiveScreening(), this.generalParameterMapping)); + this.addGeneralParameters(definition); definition.setCompositionString("(denominator AND new-on-art) NOT positive-screening"); return definition; } public CohortDefinition previouslyOnARTPositiveScreening() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); definition.setName("newOnARTPositiveScreening()"); definition.addSearch( - "denominator", EptsReportUtils.map(getDenominator(), generalParameterMapping)); - definition.addSearch("new-on-art", EptsReportUtils.map(getNewOnArt(), generalParameterMapping)); + "denominator", EptsReportUtils.map(this.getDenominator(), this.generalParameterMapping)); + definition.addSearch( + "new-on-art", EptsReportUtils.map(this.getNewOnArt(), this.generalParameterMapping)); definition.addSearch( - "positive-screening", EptsReportUtils.map(positiveScreening(), generalParameterMapping)); - addGeneralParameters(definition); + "positive-screening", + EptsReportUtils.map(this.positiveScreening(), this.generalParameterMapping)); + this.addGeneralParameters(definition); definition.setCompositionString("(denominator AND positive-screening) NOT new-on-art"); return definition; } public CohortDefinition previouslyOnARTNegativeScreening() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); definition.setName("previouslyOnARTNegativeScreening()"); definition.addSearch( - "denominator", EptsReportUtils.map(getDenominator(), generalParameterMapping)); - definition.addSearch("new-on-art", EptsReportUtils.map(getNewOnArt(), generalParameterMapping)); + "denominator", EptsReportUtils.map(this.getDenominator(), this.generalParameterMapping)); + definition.addSearch( + "new-on-art", EptsReportUtils.map(this.getNewOnArt(), this.generalParameterMapping)); definition.addSearch( - "positive-screening", EptsReportUtils.map(positiveScreening(), generalParameterMapping)); - addGeneralParameters(definition); + "positive-screening", + EptsReportUtils.map(this.positiveScreening(), this.generalParameterMapping)); + this.addGeneralParameters(definition); definition.setCompositionString("denominator NOT (new-on-art OR positive-screening)"); return definition; } public CohortDefinition patientsNewOnARTNumerator() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition NUM = txTbNumerator(); - cd.addSearch("NUM", map(NUM, generalParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition NUM = this.txTbNumerator(); + cd.addSearch("NUM", this.map(NUM, this.generalParameterMapping)); cd.addSearch( "started-during-reporting-period", EptsReportUtils.map( - genericCohortQueries.getStartedArtOnPeriod(false, true), + this.genericCohortQueries.getStartedArtOnPeriod(false, true), "onOrAfter=${startDate},onOrBefore=${endDate},location=${location}")); cd.setCompositionString("NUM AND started-during-reporting-period"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition patientsPreviouslyOnARTNumerator() { - CompositionCohortDefinition cd = new CompositionCohortDefinition(); - CohortDefinition NUM = txTbNumerator(); - cd.addSearch("NUM", map(NUM, generalParameterMapping)); + final CompositionCohortDefinition cd = new CompositionCohortDefinition(); + final CohortDefinition NUM = this.txTbNumerator(); + cd.addSearch("NUM", this.map(NUM, this.generalParameterMapping)); cd.addSearch( "started-before-start-reporting-period", EptsReportUtils.map( - genericCohortQueries.getStartedArtBeforeDate(false), + this.genericCohortQueries.getStartedArtBeforeDate(false), "onOrBefore=${startDate-1d},location=${location}")); cd.setCompositionString("NUM AND started-before-start-reporting-period"); - addGeneralParameters(cd); + this.addGeneralParameters(cd); return cd; } public CohortDefinition getDenominator() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); - addGeneralParameters(definition); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); + this.addGeneralParameters(definition); definition.setName("TxTB - Denominator"); definition.addSearch( "art-list", EptsReportUtils.map( - genericCohortQueries.getStartedArtBeforeDate(false), + this.genericCohortQueries.getStartedArtBeforeDate(false), "onOrBefore=${endDate},location=${location}")); definition.addSearch( - "tb-screening", EptsReportUtils.map(yesOrNoInvestigationResult(), generalParameterMapping)); + "tb-screening", + EptsReportUtils.map(this.yesOrNoInvestigationResult(), this.generalParameterMapping)); definition.addSearch( "tb-investigation", - EptsReportUtils.map(positiveInvestigationResultComposition(), generalParameterMapping)); + EptsReportUtils.map( + this.positiveInvestigationResultComposition(), this.generalParameterMapping)); definition.addSearch( "started-tb-treatment", - EptsReportUtils.map(tbTreatmentStartDateWithinReportingDate(), generalParameterMapping)); + EptsReportUtils.map( + this.tbTreatmentStartDateWithinReportingDate(), this.generalParameterMapping)); definition.addSearch( - "in-tb-program", EptsReportUtils.map(getInTBProgram(), generalParameterMapping)); + "in-tb-program", EptsReportUtils.map(this.getInTBProgram(), this.generalParameterMapping)); definition.addSearch( "started-tb-treatment-previous-period", EptsReportUtils.map( - tbTreatmentStartDateWithinReportingDate(), + this.tbTreatmentStartDateWithinReportingDate(), "startDate=${startDate-6m},endDate=${startDate-1d},location=${location}")); definition.addSearch( "in-tb-program-previous-period", EptsReportUtils.map( - getInTBProgram(), + this.getInTBProgram(), "startDate=${startDate-6m},endDate=${startDate-1d},location=${location}")); definition.addSearch( "transferred-out", EptsReportUtils.map( - genericCohortQueries.getPatientsBasedOnPatientStates( - hivMetadata.getARTProgram().getProgramId(), - hivMetadata + this.genericCohortQueries.getPatientsBasedOnPatientStates( + this.hivMetadata.getARTProgram().getProgramId(), + this.hivMetadata .getTransferredOutToAnotherHealthFacilityWorkflowState() .getProgramWorkflowStateId()), "startDate=${startDate},endDate=${endDate},location=${location}")); @@ -345,13 +357,13 @@ public CohortDefinition getDenominator() { } public CohortDefinition getNewOnArt() { - CompositionCohortDefinition definition = new CompositionCohortDefinition(); + final CompositionCohortDefinition definition = new CompositionCohortDefinition(); definition.setName("TxTB New on ART"); - addGeneralParameters(definition); + this.addGeneralParameters(definition); definition.addSearch( "started-on-period", EptsReportUtils.map( - genericCohortQueries.getStartedArtOnPeriod(false, true), + this.genericCohortQueries.getStartedArtOnPeriod(false, true), "onOrAfter=${startDate},onOrBefore=${endDate},location=${location}")); definition.setCompositionString("started-on-period"); return definition; diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TxNewCohortQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TxNewCohortQueries.java index 22f115d410..6cd6e91202 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TxNewCohortQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/TxNewCohortQueries.java @@ -231,20 +231,10 @@ public CohortDefinition findPatientsNewlyEnrolledByAgeInAPeriodExcludingBreastFe definition.addParameter(new Parameter("cohortEndDate", "Cohort End Date", Date.class)); definition.addParameter(new Parameter("location", "Location", Location.class)); - String query = TxNewQueries.QUERY.findPatientsWhoAreNewlyEnrolledOnArtByAge; - query = String.format(query, ageRange.getMin(), ageRange.getMax()); - - if (AgeRange.ADULT.equals(ageRange)) { - query = - query.replace( - "BETWEEN " + ageRange.getMin() + " AND " + ageRange.getMax(), - ">= " + ageRange.getMax()); - } - definition.addSearch( "IART", EptsReportUtils.map( - this.genericCohorts.generalSql("patientsWhoAreNewlyEnrolledOnArtByAge", query), + this.findPatientsWhoAreNewlyEnrolledOnArtByAgeRange(ageRange), "startDate=${cohortStartDate},endDate=${cohortEndDate},location=${location}")); definition.addSearch( @@ -266,4 +256,27 @@ public CohortDefinition findPatientsNewlyEnrolledByAgeInAPeriodExcludingBreastFe return definition; } + + public CohortDefinition findPatientsWhoAreNewlyEnrolledOnArtByAgeRange(final AgeRange ageRange) { + + final SqlCohortDefinition definition = new SqlCohortDefinition(); + definition.setName("patientsPregnantEnrolledOnART"); + definition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + definition.addParameter(new Parameter("endDate", "End Date", Date.class)); + definition.addParameter(new Parameter("location", "Location", Location.class)); + + String query = TxNewQueries.QUERY.findPatientsWhoAreNewlyEnrolledOnArtByAge; + query = String.format(query, ageRange.getMin(), ageRange.getMax()); + + if (AgeRange.ADULT.equals(ageRange)) { + query = + query.replace( + "BETWEEN " + ageRange.getMin() + " AND " + ageRange.getMax(), + ">= " + ageRange.getMax()); + } + + definition.setQuery(query); + + return definition; + } } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/Eri2MonthsDataset.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/Eri2MonthsDataset.java index fd4397fa51..91e83e1231 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/Eri2MonthsDataset.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/Eri2MonthsDataset.java @@ -16,6 +16,7 @@ import java.util.Arrays; import java.util.List; import org.openmrs.module.eptsreports.reporting.library.cohorts.Eri2MonthsCohortQueries; +import org.openmrs.module.eptsreports.reporting.library.cohorts.TxNewCohortQueries; import org.openmrs.module.eptsreports.reporting.library.dimensions.EptsCommonDimension; import org.openmrs.module.eptsreports.reporting.library.indicators.EptsGeneralIndicator; import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; @@ -33,110 +34,102 @@ public class Eri2MonthsDataset extends BaseDataSet { @Autowired private Eri2MonthsCohortQueries eri2MonthsCohortQueries; + @Autowired private TxNewCohortQueries txNewCohortQueries; + public DataSetDefinition constructEri2MonthsDatset() { - CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + final CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + final String cohortMappings = + "startDate=${endDate-2m+1d},endDate=${endDate-1m},location=${location}"; - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; dsd.setName("ERI-2months Data Set"); - dsd.addParameters(getParameters()); - // apply disaggregations + dsd.addParameters(this.getParameters()); + dsd.addDimension( - "state", EptsReportUtils.map(eptsCommonDimension.getEri2MonthsDimension2(), mappings)); + "state", EptsReportUtils.map(this.eptsCommonDimension.getEri2MonthsDimension2(), mappings)); - addRow( + this.addRow( dsd, "R21", "All Patients retained on ART 2 months after ART initiation", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( + this.eptsGeneralIndicator.getIndicator( "All patients", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsCompositionCohort("All patients"), - mappings)), + this.txNewCohortQueries.getTxNewCompositionCohort("Eri2Months"), + cohortMappings)), mappings), - get2MonthsRetentionColumns()); + this.get2MonthsRetentionColumns()); - addRow( + this.addRow( dsd, "R22", "Pregnant women retained on ART 2 months after ART initiation", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( + this.eptsGeneralIndicator.getIndicator( "Pregnant women", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsPregnatCompositionCohort("Pregnant"), - mappings)), + this.eri2MonthsCohortQueries.getEri2MonthsPregnatCompositionCohort("Pregnant"), + cohortMappings)), mappings), - get2MonthsRetentionColumns()); + this.get2MonthsRetentionColumns()); - addRow( - dsd, - "R23", - "Breastfeeding women retained on ART 2 months after ART initiation", - EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "Breastfeeding women", - EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsBrestfeetingCompositionCohort( - "BrestFeeting"), - mappings)), - mappings), - get2MonthsRetentionColumns()); - addRow( + this.addRow( dsd, "R23", "Breastfeeding women retained on ART 2 months after ART initiation", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( + this.eptsGeneralIndicator.getIndicator( "Breastfeeding women", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsBrestfeetingCompositionCohort( + this.eri2MonthsCohortQueries.getEri2MonthsBrestfeetingCompositionCohort( "BrestFeeting"), - mappings)), + cohortMappings)), mappings), - get2MonthsRetentionColumns()); + this.get2MonthsRetentionColumns()); - addRow( + this.addRow( dsd, "R24", "Children (0-14, excluding pregnant and breastfeeding women) retained on ART 2 months", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( + this.eptsGeneralIndicator.getIndicator( "Children", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsChildCompositionCohort("Children"), - mappings)), + this.eri2MonthsCohortQueries.getEri2MonthsChildCompositionCohort("Children"), + cohortMappings)), mappings), - get2MonthsRetentionColumns()); + this.get2MonthsRetentionColumns()); - addRow( + this.addRow( dsd, "R25", "Adults (15+, excluding pregnant and breastfeeding women) retained on ART 2 months", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( + this.eptsGeneralIndicator.getIndicator( "Adult", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsAdultCompositionCohort("Adult"), - mappings)), + this.eri2MonthsCohortQueries.getEri2MonthsAdultCompositionCohort("Adult"), + cohortMappings)), mappings), - get2MonthsRetentionColumns()); + this.get2MonthsRetentionColumns()); return dsd; } private List get2MonthsRetentionColumns() { - ColumnParameters artStart = + final ColumnParameters artStart = new ColumnParameters("initiated ART", "Initiated ART", "state=IART", "01"); - ColumnParameters didNotPickUpDrugs = + final ColumnParameters didNotPickUpDrugs = new ColumnParameters("did Not pick drugs", "Did Not pick up drugs", "state=DNPUD", "02"); - ColumnParameters pickedUpDrugs = + final ColumnParameters pickedUpDrugs = new ColumnParameters("picked drugs", "Picked up Drugs", "state=PUD", "03"); - ColumnParameters dead = new ColumnParameters("dead", "Dead", "state=DP", "04"); - ColumnParameters transfers = + final ColumnParameters dead = new ColumnParameters("dead", "Dead", "state=DP", "04"); + final ColumnParameters transfers = new ColumnParameters("transfers", "Transferred Out", "state=TOP", "05"); - ColumnParameters stopped = + final ColumnParameters stopped = new ColumnParameters("stopped", "Stopped treatment", "state=STP", "06"); return Arrays.asList(artStart, didNotPickUpDrugs, pickedUpDrugs, dead, transfers, stopped); } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/EriDSDDataset.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/EriDSDDataset.java index 6cee929616..c3662da886 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/EriDSDDataset.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/datasets/EriDSDDataset.java @@ -1,15 +1,15 @@ package org.openmrs.module.eptsreports.reporting.library.datasets; -import java.util.Arrays; -import java.util.List; import org.openmrs.module.eptsreports.reporting.library.cohorts.DSDCohortQueries; -import org.openmrs.module.eptsreports.reporting.library.cohorts.DsdElegibleCohortQuery; import org.openmrs.module.eptsreports.reporting.library.dimensions.AgeDimensionCohortInterface; import org.openmrs.module.eptsreports.reporting.library.dimensions.EptsCommonDimension; import org.openmrs.module.eptsreports.reporting.library.indicators.EptsGeneralIndicator; +import org.openmrs.module.eptsreports.reporting.utils.AgeRange; import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; 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.indicator.CohortIndicator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -18,7 +18,7 @@ public class EriDSDDataset extends BaseDataSet { @Autowired private DSDCohortQueries dsdCohortQueries; - @Autowired private DsdElegibleCohortQuery elegibleCohortQuery; + @Autowired private EptsGeneralIndicator eptsGeneralIndicator; @Autowired private EptsCommonDimension eptsCommonDimension; @@ -27,681 +27,511 @@ public class EriDSDDataset extends BaseDataSet { private AgeDimensionCohortInterface ageDimensionCohort; public DataSetDefinition constructEriDSDDataset() { - CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + final CohortIndicatorDataSetDefinition definition = new CohortIndicatorDataSetDefinition(); + + final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + + definition.setName("DSD Data Set"); + definition.addParameters(this.getParameters()); + + this.addAgeDimensions( + definition, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN, + AgeRange.ADULT); - String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; + this.dsdDenominator1(definition, mappings); - dsd.setName("DSD Data Set"); - dsd.addParameters(getParameters()); - dsd.addDimension( - "age", EptsReportUtils.map(eptsCommonDimension.getEri2DsdDimension2(), mappings)); - dsd.setName("Total"); + this.dsdNumerator1(definition, mappings); + this.dsdNumerator2(definition, mappings); + this.dsdNumerator3(definition, mappings); + this.dsdNumerator4(definition, mappings); + this.dsdNumerator5(definition, mappings); + this.dsdNumerator6(definition, mappings); + this.dsdNumerator7(definition, mappings); + this.dsdNumerator8(definition, mappings); - // DSD: Denominator: Number of active patients on ART - (Non-pregnant and Non-Breastfeeding not - // on TB treatment) - dsd.addColumn( - "D1T", - "DSD D1 Total", + return definition; + } + + private void dsdNumerator8( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN8T", + "DSDN8T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "DSD D1 Total", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInCommunityDrugsDistribution", EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtExcludingPregnantBreastfeedingAndTb(""), + this.dsdCohortQueries.findPatientsActiveOnArtInCommunityDrugsDistribution(), mappings)), mappings), ""); - dsd.addColumn( - "D2T", - "DSD D1 Sub Total", + + this.addColumns( + "DSDN8-E", + "DSDN8-E", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "DSD D2 Total", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleToSixMonthsDrugsDistribution", EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtEligibleForDsd(""), mappings)), + this.dsdCohortQueries + .findPatientsActiveOnArtEligibleToCommunityDrugsDistribution(), + mappings)), mappings), - ""); - dsd.addColumn( - "D1SNPNB", - "Adults (>=15)", + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN8-N", + "DSDN8-N", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "Adults (>=15)", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution", EptsReportUtils.map( - elegibleCohortQuery.getAdultActiveOnArtElegibleDsd(""), mappings)), + this.dsdCohortQueries + .findPatientsActiveOnArtNotEligibleToCommunityDrugsDistribution(), + mappings)), mappings), - ""); - dsd.addColumn( - "D1SNPNBC-01", - "2-4", + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void dsdNumerator7( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN7T", + "DSDN7T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "2-4", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInSixMonthsDrugsDistribution", EptsReportUtils.map( - elegibleCohortQuery.getChild2To4ActiveOnArtElegibleDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtInSixMonthsDrugsDistribution(), + mappings)), mappings), ""); - dsd.addColumn( - "D1SNPNBC-02", - "5-9", + + this.addColumns( + "DSDN7-E", + "DSDN7-E", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "5-9", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleToSixMonthsDrugsDistribution", EptsReportUtils.map( - elegibleCohortQuery.getChild5To9ActiveOnArtElegibleDsd(""), mappings)), + this.dsdCohortQueries + .findPatientsActiveOnArtEligibleToSixMonthsDrugsDistribution(), + mappings)), mappings), - ""); - dsd.addColumn( - "D1SNPNBC-03", - "10-14", + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN7-N", + "DSDN7-N", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "10-14", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution", EptsReportUtils.map( - elegibleCohortQuery.getChild10To14ActiveOnArtElegibleDsd(""), mappings)), + this.dsdCohortQueries + .findPatientsActiveOnArtNotEligibleToSixMonthsDrugsDistribution(), + mappings)), mappings), - ""); + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } - dsd.addColumn( - "D2TA", - "10-14", + private void dsdNumerator6( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN6T", + "DSDN6T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "D2TA Total", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInAdherenceClubs", EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtNotEligibleForDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtInAdherenceClubs(), mappings)), mappings), ""); - dsd.addColumn( - "D2NPNB", - "15+", + this.addColumns( + "DSDN6-E", + "DSDN6-E", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "15+", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleToFamilyApproach", EptsReportUtils.map( - elegibleCohortQuery.getAdultActiveOnArtNotElegibleDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtEligibleToAdherenceClubs(), + mappings)), mappings), - ""); + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN6-N", + "DSDN6-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleToFamilyApproach", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtNotEligibleToAdherenceClubs(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } - dsd.addColumn( - "D2NPNBC-D01", - "<2", + private void dsdNumerator5( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN5T", + "DSDN5T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "<2", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInFamilyApproach", EptsReportUtils.map( - elegibleCohortQuery.getChildLessthan2ActiveOnArtNotElegibleDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtInFamilyApproach(), mappings)), mappings), ""); - dsd.addColumn( - "D2NPNBC-01", - "2-4", + this.addColumns( + "DSDN5-E", + "DSDN5-E", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleToFamilyApproach", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtEligibleToFamilyApproach(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN5-N", + "DSDN5-N", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "2-4", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleToFamilyApproach", EptsReportUtils.map( - elegibleCohortQuery.getChild2To4ActiveOnArtNotElegibleDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtNotEligibleToFamilyApproach(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void dsdNumerator4( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN4T", + "DSDN4T Total", + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInCommunityAdherennceGroups", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtInCommunityAdherennceGroups(), + mappings)), mappings), ""); - dsd.addColumn( - "D2NPNBC-02", - "5-9", + + this.addColumns( + "DSDN4-E", + "DSDN4-E", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleToCommunityAdherennceGroups", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsActiveOnArtEligibleToCommunityAdherennceGroups(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN4-N", + "DSDN4-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleToCommunityAdherennceGroups", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsActiveOnArtNotEligibleToCommunityAdherennceGroups(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void dsdNumerator3( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN3T", + "DSDN3T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "5-9", + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtInFastTrack", EptsReportUtils.map( - elegibleCohortQuery.getChild5To9ActiveOnNotArtElegibleDsd(""), mappings)), + this.dsdCohortQueries.findPatientsActiveOnArtInFastTrack(), mappings)), mappings), ""); - dsd.addColumn( - "D2NPNBC-03", - "10-14", + + this.addColumns( + "DSDN3-E", + "DSDN3-E", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtAndEligibleToFastTrack", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtEligibleToFastTrack(), mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN3-N", + "DSDN3-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotElegibleToDsdWhoInFastFlow", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtNotElegibleToFastTrack(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void dsdNumerator2( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN2T", + "DSDN2T Total", EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "10-14", + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution", EptsReportUtils.map( - elegibleCohortQuery.getChild10To14ActiveOnArtNotElegibleDsd(""), mappings)), + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtAndInThreeMonthsDrugsDistribution(), + mappings)), mappings), ""); - // DSD: Numerator: Number of active on ART whose next ART pick-up is schedule for 83-97 days - // after the date of their last ART drug pick-up (DT) - (Non-pregnant and Non-Breastfeeding not - // on TB treatment) - dsd.addColumn( - "N1T", - "N1T Total", + + this.addColumns( + "DSDN2-E", + "DSDN2-E", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "TOTAL", - EptsReportUtils.map(dsdCohortQueries.getPatientsActiveOnArtWhoInDt(""), mappings)), + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtAndEligibleToThreeMonthsDrugsDistribution", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtAndEligibleToThreeMonthsDrugsDistribution(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN2-N", + "DSDN2-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtAndNotEligibleToThreeMonthsDrugsDistribution", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtAndNotEligibleToThreeMonthsDrugsDistribution(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void dsdNumerator1( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDN1T", + "DSDN1T Total", + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtAndInAtleastOneDSD", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsWhoAreActiveOnArtAndInAtleastOneDSD(), + mappings)), mappings), ""); - dsd.addColumn( - "N1SST", - "N1SST Total", + this.addColumns( + "DSDN1-E", + "DSDN1-E", + definition, EptsReportUtils.map( - eptsGeneralIndicator.getIndicator( - "SUB TOTAL", + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreStable", EptsReportUtils.map( - dsdCohortQueries.getPatientsActiveOnArtElegibleDsdWhoInDt(""), mappings)), + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreStable(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDN1-N", + "DSDN1-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "findPatientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreUnstable", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtAndInAtleastOneDSDAndAreUnstable(), + mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + /** + * @param definition + * @param mappings + */ + private void dsdDenominator1( + final CohortIndicatorDataSetDefinition definition, final String mappings) { + definition.addColumn( + "DSDD1T", + "DSDD1", + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb", + EptsReportUtils.map( + this.dsdCohortQueries + .findPatientsWhoAreActiveOnArtExcludingPregnantBreastfeedingAndTb(), + mappings)), mappings), ""); - // addRow( - // dsd, - // "D1SNPNBC", - // "Non-pregnant and Non-Breastfeeding Adults", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "D1SNPNBC", - // EptsReportUtils.map( - // this.genericCohorts.generalSql("", - // DsdQueriesInterface.QUERY.findPatientsAge15Plus), - // mappings)), - // mappings), - // getChildrenColumn()); - - // dsd.addColumn( - // "D2T", - // "DSD D2 Total", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "DSD D2 Total", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreActiveAndUnstable(), mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "D2NPNB", - // "Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "D2NPNB", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingD2(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "D2NPNBC", - // "Non-pregnant and Non-Breastfeeding Children By age", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "D2NPNBC", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingD2(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "D2BNP", - // "Breastfeeding (exclude pregnant)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "D2BNP", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreBreastFeedingAndNotPregnant(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "D2PNB", - // "Pregnant (exclude breastfeeding)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "D2PNB", - // EptsReportUtils.map(eriDSDCohortQueries.getPatientsWhoArePregnant(), - // mappings)), - // mappings), - // ""); - // /*dsd.addColumn( - // "NT", - // "DSD N Total", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NT", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModel(), - // "endDate=${endDate},location=${location}")), - // mappings), - // ""); - // dsd.addColumn( - // "NSST", - // "DSD N Stable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NSST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelStable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // ""); - // dsd.addColumn( - // "NSNPNB", - // "Stable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NSNPNB", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelStable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "NSNPNBC", - // "Stable Non-pregnant and Non-Breastfeeding Children By age", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NSNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelStable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "NUST", - // "DSD N Unstable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NUST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelUnstable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // ""); - // dsd.addColumn( - // "NUNPNB", - // "Unstable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NUNPNB", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelUnstable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "NUNPNBC", - // "Unstable Non-pregnant and Non-Breastfeeding Children By age", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NUNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticipateInDsdModelUnstable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "NUBNP", - // "N Unstable Breastfeeding (exclude pregnant)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NUBNP", - // EptsReportUtils.map( - // eriDSDCohortQueries - // - // .getPatientsWhoAreBreastFeedingAndNotPregnantAndParticipateInDsdModelUnstable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // ""); - // dsd.addColumn( - // "NUPB", - // "N Unstable Pregnant (include breastfeeding)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "NUPB", - // EptsReportUtils.map( - // eriDSDCohortQueries - // - // .getPatientsWhoArePregnantAndNotBreastFeedingAndParticipateInDsdModelUnstable(), - // "endDate=${endDate},location=${location}")), - // mappings), - // "");*/ - // dsd.addColumn( - // "N1T", - // "DSD N1 Total", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1T", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreActiveWithNextPickupAs3Months(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N1SST", - // "DSD N1 Stable Subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1SST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN1Stable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N1SNPNBA", - // "N1 Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1SNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN1Stable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N1SNPNBC", - // "N1 Non-pregnant and Non-Breastfeeding Children (<15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1SNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN1Stable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N1UST", - // "DSD N1 Unstable Subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1UST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveWithNextPickupAs3MonthsAndUnstable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N1UNPNBA", - // "N1 Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1UNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN1Unstable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N1UNPNBC", - // "N1 Non-pregnant and Non-Breastfeeding Children (<15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1UNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN1Unstable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N1UBNP", - // "N1 Patients who are breastfeeding excluding pregnant patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1UBNP", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreBreastfeedingAndNotPregnantN1(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N1UPB", - // "N1: Pregnant: includes breastfeeding patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N1UPB", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoArePregnantAndNotBreastfeedingN1(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N2T", - // "DSD N2 Total", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2T", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWithNextConsultationScheduled175To190Days(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N2SST", - // "DSD N2 Stable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2SST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN2Stable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N2SNPNBA", - // "DSD N2 Stable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2SNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN2Stable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N2SNPNBC", - // " DSD N2 Stable Non-pregnant and Non-Breastfeeding Children (2-4, - // 5-9, 10-14)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2SNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN2Stable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N2UST", - // "DSD N2 Unstable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2UST", - // EptsReportUtils.map( - // eriDSDCohortQueries - // .getPatientsWithNextConsultationScheduled175To190DaysUnstable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N2UNPNBA", - // "DSD N2 Unstable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2UNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN2Unstable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N2UNPNBC", - // " DSD N2 Unstable Non-pregnant and Non-Breastfeeding Children (2-4, - // 5-9, 10-14)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2UNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN2Unstable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N2UBNP", - // "N2 Patients who are breastfeeding excluding pregnant patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2UBNP", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreBreastfeedingAndNotPregnantN2(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N2UPB", - // "N2: Pregnant: includes breastfeeding patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N2UPB", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoArePregnantAndBreastfeedingN2(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N3T", - // "DSD N3 Total", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3T", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticpatingInGaac(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N3SST", - // "DSD N3 Stable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3SST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN3Stable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N3SNPNBA", - // "DSD N3 Stable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3SNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN3Stable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N3SNPNBC", - // " DSD N3 Stable Non-pregnant and Non-Breastfeeding Children (2-4, - // 5-9, 10-14)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3SNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN3Stable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N3UST", - // "DSD N3 Unstable subtotal", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3UST", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreActiveAndParticpatingInGaacUnstable(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N3UNPNBA", - // "DSD N3 Unstable Non-pregnant and Non-Breastfeeding Adults (>=15)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3UNPNBA", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN3Unstable(), - // mappings)), - // mappings), - // "age=15+"); - // addRow( - // dsd, - // "N3UNPNBC", - // " DSD N3 Unstable Non-pregnant and Non-Breastfeeding Children (2-4, - // 5-9, 10-14)", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3UNPNBC", - // EptsReportUtils.map( - // - // eriDSDCohortQueries.getPatientsWhoAreNotPregnantAndNotBreastfeedingN3Unstable(), - // mappings)), - // mappings), - // getChildrenColumn()); - // dsd.addColumn( - // "N3UBNP", - // "N3 Patients who are breastfeeding excluding pregnant patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3UBNP", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoAreBreastfeedingAndNotPregnantN3(), - // mappings)), - // mappings), - // ""); - // dsd.addColumn( - // "N3UPB", - // "N3: Pregnant: includes breastfeeding patients", - // EptsReportUtils.map( - // eptsGeneralIndicator.getIndicator( - // "N3UPB", - // EptsReportUtils.map( - // eriDSDCohortQueries.getPatientsWhoArePregnantAndBreastfeedingN3(), - // mappings)), - // mappings), - // ""); - // - return dsd; + this.addColumns( + "DSDD1-E", + "DSDD1-E", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtEligibleForDsd", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtEligibleForDsd(), mappings)), + mappings), + AgeRange.ADULT, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + + this.addColumns( + "DSDD1-N", + "DSDD1-N", + definition, + EptsReportUtils.map( + this.eptsGeneralIndicator.getIndicator( + "patientsActiveOnArtNotEligibleForDsd", + EptsReportUtils.map( + this.dsdCohortQueries.findPatientsActiveOnArtNotEligibleForDsd(), mappings)), + mappings), + AgeRange.ADULT, + AgeRange.UNDER_TWO, + AgeRange.TWO_TO_FOUR, + AgeRange.FIVE_TO_NINE, + AgeRange.TEN_TO_FOURTEEN); + } + + private void addColumns( + final String name, + final String label, + final CohortIndicatorDataSetDefinition definition, + final Mapped indicator, + final AgeRange... ranges) { + + int position = 1; + + String baseName = name + position; + String baseLabel = label + "(" + position + ")"; + + definition.addColumn(baseName, baseLabel, indicator, ""); + position++; + + for (final AgeRange range : ranges) { + + baseName = name + position; + baseLabel = label + "(" + position + ")"; + + definition.addColumn(baseName, baseLabel, indicator, range.getName() + "=" + range.getName()); + position++; + } } - private List getChildrenColumn() { - ColumnParameters twoTo4 = new ColumnParameters("twoTo4", "2-4", "age=2-4", "01"); - ColumnParameters fiveTo9 = new ColumnParameters("fiveTo9", "5-9", "age=5-9", "02"); - ColumnParameters tenTo14 = new ColumnParameters("tenTo14", "10-14", "age=10-14", "03"); + private void addAgeDimensions( + final CohortIndicatorDataSetDefinition definition, final AgeRange... ranges) { - return Arrays.asList(twoTo4, fiveTo9, tenTo14); + for (final AgeRange range : ranges) { + definition.addDimension( + range.getName(), + EptsReportUtils.map( + this.eptsCommonDimension.findPatientsByRange(range.getName(), range), + "endDate=${endDate}")); + } } } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/EptsCommonDimension.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/EptsCommonDimension.java index 79a30cdc61..80fac8afdd 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/EptsCommonDimension.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/EptsCommonDimension.java @@ -14,11 +14,9 @@ import java.util.Date; import org.openmrs.Location; import org.openmrs.module.eptsreports.metadata.HivMetadata; -import org.openmrs.module.eptsreports.reporting.library.cohorts.BreastFeedingCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.Eri2MonthsCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.Eri4MonthsCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.EriCohortQueries; -import org.openmrs.module.eptsreports.reporting.library.cohorts.EriDSDCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.GenderCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.GenericCohortQueries; import org.openmrs.module.eptsreports.reporting.library.cohorts.TbPrevCohortQueries; @@ -51,14 +49,10 @@ public class EptsCommonDimension { @Autowired private Eri2MonthsCohortQueries eri2MonthsCohortQueries; - @Autowired private EriDSDCohortQueries eriDSDCohortQueries; - @Autowired private EriCohortQueries eriCohortQueries; @Autowired private TbPrevCohortQueries tbPrevCohortQueries; - @Autowired private BreastFeedingCohortQueries breastFeedingCohortQueries; - @Autowired private GenericCohortQueries genericCohorts; /** @@ -285,7 +279,8 @@ public CohortDefinitionDimension getEri2MonthsDimension2() { dimension.addCohortDefinition( "IART", EptsReportUtils.map( - eri2MonthsCohortQueries.getEri2MonthsCompositionCohort("IART"), mappings)); + this.txNewCohortQueries.getTxNewCompositionCohort("Eri2Months"), + "startDate=${endDate-2m+1d},endDate=${endDate-1m},location=${location}")); dimension.addCohortDefinition( "DNPUD", @@ -335,26 +330,6 @@ public CohortDefinitionDimension getEri2MonthsDimension2() { return dimension; } - public CohortDefinitionDimension getEri2DsdDimension2() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName("Get patients dimensions for Eri2Months"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "D1SNPNB", - EptsReportUtils.map( - this.genericCohorts.generalSql( - "patientsAge15Plus", DsdQueriesInterface.QUERY.findPatientsAge15Plus), - mappings)); - - return dimension; - } - public CohortDefinitionDimension getArtStatusDimension() { final CohortDefinitionDimension dim = new CohortDefinitionDimension(); dim.addParameter(new Parameter("onOrAfter", "onOrAfter", Date.class)); @@ -475,8 +450,41 @@ public CohortDefinitionDimension findPatientsByGenderAndRange( dimension.addCohortDefinition( name, EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "patientsWhoAreNewlyEnrolledOnArtByAgeAndGender", query), + this.genericCohortQueries.generalSql("findPatientsByGenderAndRage", query), + "endDate=${endDate}")); + + return dimension; + } + + public CohortDefinitionDimension findPatientsByRange(final String name, final AgeRange range) { + final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); + + dimension.setName(name); + dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); + + String query = DsdQueriesInterface.QUERY.findPatientsAgeRange; + query = String.format(query, range.getMin(), range.getMax()); + + switch (range) { + case UNDER_TWO: + query = + query.replace( + "BETWEEN " + range.getMin() + " AND " + range.getMax(), " < " + range.getMax()); + break; + + case ADULT: + query = + query.replace( + "BETWEEN " + range.getMin() + " AND " + range.getMax(), " >= " + range.getMax()); + + default: + break; + } + + dimension.addCohortDefinition( + name, + EptsReportUtils.map( + this.genericCohortQueries.generalSql("findPatientsByRange", query), "endDate=${endDate}")); return dimension; diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/Eri2MonthsDamision.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/Eri2MonthsDamision.java deleted file mode 100644 index e5e2f08b60..0000000000 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/dimensions/Eri2MonthsDamision.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.openmrs.module.eptsreports.reporting.library.dimensions; - -import java.util.Date; -import org.openmrs.Location; -import org.openmrs.module.eptsreports.reporting.library.cohorts.Eri2MonthsCohortQueries; -import org.openmrs.module.eptsreports.reporting.library.cohorts.GenericCohortQueries; -import org.openmrs.module.eptsreports.reporting.library.queries.Eri2MonthsQueriesInterface; -import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils; -import org.openmrs.module.reporting.evaluation.parameter.Parameter; -import org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class Eri2MonthsDamision { - - @Autowired private GenericCohortQueries genericCohortQueries; - - @Autowired private Eri2MonthsCohortQueries eri2MonthsCohortQueries; - - public CohortDefinitionDimension findPatientsWhoStartArtOneMonth() { - - final CohortDefinitionDimension dim = new CohortDefinitionDimension(); - dim.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dim.addParameter(new Parameter("endDate", "End Date", Date.class)); - dim.addParameter(new Parameter("location", "location", Location.class)); - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dim.addCohortDefinition( - "1All", - EptsReportUtils.map( - this.eri2MonthsCohortQueries.getEri2MonthsCompositionCohort("1All"), mappings)); - - return dim; - } - - public CohortDefinitionDimension - findPatientsStartedArtLastMonthWith2PickupsOrConsultationWithin33DaysExcludingDeadAndTransferedOutAndIn() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName( - "PatientsStartedArtLastMonthWith2PickupsOrConsultationWithin33DaysExcludingDeadAndTransferedOutAndIn"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "ERI2.R21-03", - EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "findPatientsStartedArtLastMonthWith2PickupsOrConsultationWithin33DaysExcludingDeadAndTransferedOutAndIn", - Eri2MonthsQueriesInterface.QUERY - .findPatientsStartedArtLastMonthWith2PickupsOrConsultationWithin33DaysExcludingDeadAndTransferedOutAndIn), - mappings)); - - return dimension; - } - - public CohortDefinitionDimension - findPatientsWhoStartedArtAtAPeriodAndDidNotHaveASecondPickupsOrClinicalConsultationWithin33DaysAfterArtInitiation() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName( - "findPatientsWhoStartedArtAtAPeriodAndDidNotHaveASecondPickupsOrClinicalConsultationWithin33DaysAfterArtInitiation"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "ERI2.R21-02", - EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "findPatientsWhoStartedArtAtAPeriodAndDidNotHaveASecondPickupsOrClinicalConsultationWithin33DaysAfterArtInitiation", - Eri2MonthsQueriesInterface.QUERY - .findPatientsWhoStartedArtAtAPeriodAndDidNotHaveASecondPickupsOrClinicalConsultationWithin33DaysAfterArtInitiation), - mappings)); - - return dimension; - } - - public CohortDefinitionDimension - findPatientsWhoStartedArtInAPeriodAndAreDeath33DaysAfterArtInitiation() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName("findPatientsWhoStartedArtInAPeriodAndAreDeath33DaysAfterArtInitiation"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "ERI2.R21-04", - EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "findPatientsWhoStartedArtInAPeriodAndAreDeath33DaysAfterArtInitiation", - Eri2MonthsQueriesInterface.QUERY - .findPatientsWhoStartedArtInAPeriodAndAreDeath33DaysAfterArtInitiation), - mappings)); - - return dimension; - } - - public CohortDefinitionDimension - findPatientsWhoStartedArtInAPeriodAndSuspendTratement33DaysAfterInitiation() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName("findPatientsWhoStartedArtInAPeriodAndSuspendTratement33DaysAfterInitiation"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "ERI2.R21-06", - EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "findPatientsWhoStartedArtInAPeriodAndSuspendTratement33DaysAfterInitiation", - Eri2MonthsQueriesInterface.QUERY - .findPatientsWhoStartedArtInAPeriodAndSuspendTratement33DaysAfterInitiation), - mappings)); - - return dimension; - } - - public CohortDefinitionDimension - findPatientsWhoStartedArtInAPeriodAndAreTrasferedOut33DaysAfterInitiation() { - final CohortDefinitionDimension dimension = new CohortDefinitionDimension(); - - dimension.setName("findPatientsWhoStartedArtInAPeriodAndAreTrasferedOut33DaysAfterInitiation"); - dimension.addParameter(new Parameter("startDate", "Start Date", Date.class)); - dimension.addParameter(new Parameter("endDate", "End Date", Date.class)); - dimension.addParameter(new Parameter("location", "location", Location.class)); - - final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}"; - - dimension.addCohortDefinition( - "ERI2.R21-03", - EptsReportUtils.map( - this.genericCohortQueries.generalSql( - "findPatientsWhoStartedArtInAPeriodAndAreTrasferedOut33DaysAfterInitiation", - Eri2MonthsQueriesInterface.QUERY - .findPatientsWhoStartedArtInAPeriodAndAreTrasferedOut33DaysAfterInitiation), - mappings)); - - return dimension; - } -} diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/DsdQueriesInterface.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/DsdQueriesInterface.java index 668129a752..c06f87c3c3 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/DsdQueriesInterface.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/DsdQueriesInterface.java @@ -3,47 +3,14 @@ public interface DsdQueriesInterface { class QUERY { - public static final String findPatientsBeingOnTuberculosisTreatmentEndPeriod = - "select inicio_tb.patient_id from " - + "(select patient_id,max(data_inicio_tb) data_inicio_tb from ( " - + "select p.patient_id,o.value_datetime data_inicio_tb from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=1113 and e.location_id=:location and o.value_datetime<=:endDate " - + "union " - + "select patient_id,date_enrolled data_inicio_tb from patient_program " - + "where program_id=5 and voided=0 and date_enrolled<=:endDate and location_id=:location) inicio1 group by patient_id) inicio_tb " - + "left join (" - + "select patient_id,max(data_fim_tb) data_fim_tb from ( " - + "select p.patient_id,o.value_datetime data_fim_tb from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=6120 and e.location_id=:location and o.value_datetime<=:endDate " - + "union " - + "select patient_id,date_completed data_fim_tb from patient_program " - + "where program_id=5 and voided=0 and location_id=:location and date_completed is not null and date_completed<=:endDate) fim1 group by patient_id) " - + "fim on inicio_tb.patient_id=fim.patient_id and data_fim_tb>data_inicio_tb " - + "where data_fim_tb is null " - + " union " - + "select max_tb.patient_id from ( " - + "select p.patient_id,max(o.obs_datetime) max_datatb from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=1268 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_tb " - + "inner join obs on obs.person_id=max_tb.patient_id and max_tb.max_datatb=obs.obs_datetime " - + "where obs.concept_id=1268 and obs.value_coded in (1256,1257) and obs.location_id=:location " - + "union " - + "select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23761 and o.value_coded=1065 and e.encounter_datetime between (:endDate - INTERVAL 6 MONTH + INTERVAL 1 DAY) and :endDate and e.location_id=:location group by p.patient_id"; - public static final String findPatientsWithAdverseDrugReactionsRequiringRegularMonitoringNotifiedInLast6Months = "Select p.patient_id From patient p " + "inner join encounter e on p.patient_id=e.patient_id " + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=2015 and e.encounter_type=6 and e.encounter_datetime between (:endDate - INTERVAL 6 MONTH) AND :endDate and e.location_id=:location and o.value_coded in (23748,6293,23749,29,23750,23751,6299,23752) group by p.patient_id "; + + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=2015 and e.encounter_type=6 and e.encounter_datetime " + + "between (:endDate - INTERVAL 6 MONTH) AND :endDate and e.location_id=:location and o.value_coded " + + "IN (23748,6293,23749,29,23750,23751,6299,23752) group by p.patient_id "; public static final String findPatientsWhoHaveBeenNotifiedOfKaposiSarcoma = "SELECT p.patient_id FROM patient p " @@ -51,63 +18,6 @@ class QUERY { + "INNER JOIN obs o ON e.encounter_id = o.encounter_id " + "WHERE o.concept_id=1406 AND o.value_coded = 507 AND encounter_type=6 AND p.voided = 0 AND e.voided = 0 AND o.voided = 0 AND e.location_id =:location AND e.encounter_datetime<=:endDate group by p.patient_id "; - public static final String - findPregnantWomenRegisteredInTheLast9MonthsOrBrestfeetingWomenRegisteredInTheLast18Months = - "select lactante_real.patient_id from( " - + "Select p.patient_id,o.value_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=5599 and e.encounter_type in (5,6) and o.value_datetime between (:endDate - INTERVAL 18 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id, e.encounter_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6332 and value_coded=1065 and e.encounter_type in (6,53) and e.encounter_datetime between (:endDate - INTERVAL 18 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id, e.encounter_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6334 and value_coded=6332 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 18 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "select pg.patient_id,ps.start_date data_parto from patient p " - + "inner join patient_program pg on p.patient_id=pg.patient_id " - + "inner join patient_state ps on pg.patient_program_id=ps.patient_program_id " - + "where pg.voided=0 and ps.voided=0 and p.voided=0 and pg.program_id=8 and ps.state=27 and ps.end_date is null and ps.start_date between (:endDate - INTERVAL 18 MONTH ) AND :endDate and location_id=:location) lactante_real " - + "inner join person on lactante_real.patient_id=person.person_id where person.gender='F' " - + "union " - + "select patient_id from ( " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1982 and value_coded in (44,1465) and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1279 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1600 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6334 and value_coded=6331 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "select pp.patient_id from patient_program pp where pp.program_id=8 and pp.voided=0 and pp.date_enrolled between (:endDate - INTERVAL 9 MONTH ) AND :endDate and pp.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=5272 and o.value_coded=1065 and e.encounter_type=53 and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=1465 and e.encounter_type=6 and e.encounter_datetime between (:endDate - INTERVAL 9 MONTH ) AND :endDate and e.location_id=:location) gravida " - + "inner join person p on p.person_id=gravida.patient_id where p.gender='F'"; - public static final String findPatientsInArtWhoAreStable = "select patient_id from(select inicio.patient_id, inicio.data_inicio, timestampdiff(year,per.birthdate,:endDate) idade, timestampdiff(month,inicio.data_inicio,:endDate) idadeEmTarv, cd4Absoluto.value_numeric cd4Abs, cd4Percentual.value_numeric cd4Per, cvmenor1000.patient_id pidcvmenor100 from ( " + "Select patient_id,min(data_inicio) data_inicio from (Select p.patient_id,min(e.encounter_datetime) data_inicio from patient p " @@ -156,7 +66,17 @@ class QUERY { + "where o.concept_id=730 and o.value_numeric>15 and o.location_id=:location) cd4Percentual on inicio.patient_id=cd4Percentual.patient_id) elegivel " + "where idade>=2 and ((idade<=9 and idadeEmTarv>=12) or (idade>=10 and idadeEmTarv>=6)) and ((pidcvmenor100 is not null ) or (pidcvmenor100 is null and idade>=5 and cd4Abs>200) or (pidcvmenor100 is null and idade<=4 and (cd4Abs>750 or cd4Per>15))) "; - public static final String findPatientWhoAreMdcQuarterlyDispensation = + public static final String findPatietsWhoAreOnAdherenceClubs = + "SELECT max_ca.patient_id FROM ( " + + "SELECT p.patient_id,max(o.obs_datetime) max_dataca FROM patient p " + + "INNER JOIN encounter e on p.patient_id=e.patient_id " + + "INNER JOIN obs o on o.encounter_id=e.encounter_id " + + "WHERE e.encounter_type=6 AND e.voided=0 AND o.voided=0 AND p.voided=0 " + + "AND o.concept_id=23726 and e.location_id=:location " + + "AND o.obs_datetime<=:endDate GROUP BY p.patient_id) max_ca INNER JOIN obs on obs.person_id=max_ca.patient_id and max_ca.max_dataca=obs.obs_datetime " + + "WHERE obs.concept_id=23726 AND obs.value_coded IN (1256,1257) AND obs.location_id=:location"; + + public static final String findPatientsWhoAreThreeMonthsDrugDistribution = "select patient_id from ( " + "select levantamento.patient_id from ( " + "Select p.patient_id,max(e.encounter_datetime) data_levantamento from patient p " @@ -187,7 +107,7 @@ class QUERY { + "inner join obs on obs.person_id=max_dts.patient_id and max_dts.max_datadts=obs.obs_datetime " + "where obs.concept_id=23730 and obs.value_coded=1267 and obs.location_id=:location) "; - public static final String findPatientWhoAreMdcFastFlow = + public static final String findPatientsWhoAreFastTrack = "select patient_id from( " + "select ultimaConsulta.patient_id from ( " + "Select p.patient_id,max(e.encounter_datetime) data_consulta from patient p " @@ -210,29 +130,82 @@ class QUERY { + "inner join obs on obs.person_id=max_fr.patient_id and max_fr.max_datafr=obs.obs_datetime " + "where obs.concept_id=23729 and obs.value_coded=1267 and obs.location_id=:location) "; - public static final String findPatientsAge15Plus = - "SELECT patient_id FROM patient " - + "INNER JOIN person ON patient_id = person_id WHERE patient.voided=0 AND person.voided=0 " - + "AND TIMESTAMPDIFF(year,birthdate,:endDate)>=15 AND birthdate IS NOT NULL"; + public static final String findPatientsWhoAreInCommunityDrugsDistribution = + "SELECT max_dc.patient_id from ( " + + "SELECT p.patient_id,max(o.obs_datetime) max_datadc from patient p " + + "INNER JOIN encounter e on p.patient_id=e.patient_id " + + "INNER JOIN obs o on o.encounter_id=e.encounter_id " + + "WHERE e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 " + + "and o.concept_id=23731 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_dc " + + "inner join obs on obs.person_id=max_dc.patient_id and max_dc.max_datadc=obs.obs_datetime " + + "where obs.concept_id=23731 and obs.value_coded in (1256,1257) and obs.location_id=:location"; - public static final String findPatientsAgeLessThan2 = - "SELECT patient_id FROM patient " - + "INNER JOIN person ON patient_id = person_id WHERE patient.voided=0 AND person.voided=0 " - + "AND TIMESTAMPDIFF(year,birthdate,:endDate) < 2 AND birthdate is not null"; + public static final String findPatientsWhoAreCommunityAdherenceGroups = + "select patient_id from( " + + "Select gm.member_id as patient_id from gaac g " + + "inner join gaac_member gm on g.gaac_id=gm.gaac_id " + + "where gm.start_date<=:endDate and gm.voided=0 and g.voided=0 and ((leaving is null) or (leaving=0) or (leaving=1 and gm.end_date>:endDate)) and location_id=:location " + + "union " + + "select max_gaac.patient_id from( " + + "select p.patient_id,max(o.obs_datetime) max_datagaac from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23724 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_gaac " + + "inner join obs on obs.person_id=max_gaac.patient_id and max_gaac.max_datagaac=obs.obs_datetime " + + "where obs.concept_id=23724 and obs.value_coded in (1256,1257) and obs.location_id=:location) gaac " + + "where patient_id not in( " + + "select max_gaac.patient_id from ( " + + "select p.patient_id,max(o.obs_datetime) max_datagaac from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23724 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id)max_gaac " + + "inner join obs on obs.person_id=max_gaac.patient_id and max_gaac.max_datagaac=obs.obs_datetime " + + "where obs.concept_id=23724 and obs.value_coded=1267 and obs.location_id=:location)"; - public static final String findPatientsAge2to4 = - "SELECT patient_id FROM patient " - + "INNER JOIN person ON patient_id = person_id WHERE patient.voided=0 AND person.voided=0 " - + "AND TIMESTAMPDIFF(year,birthdate,:endDate) between 2 and 4 and birthdate is not null"; + public static final String findPatientsWhoAreFamilyAproach = + "select max_af.patient_id from (" + + "select p.patient_id,max(o.obs_datetime) max_dataaf from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 " + + "and o.concept_id=23725 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_af " + + "inner join obs on obs.person_id=max_af.patient_id and max_af.max_dataaf=obs.obs_datetime " + + "where obs.concept_id=23725 and obs.value_coded in (1256,1257) and obs.location_id=:location"; - public static final String findPatientsAge5to9 = - "SELECT patient_id FROM patient " - + "INNER JOIN person ON patient_id = person_id WHERE patient.voided=0 AND person.voided=0 " - + "AND TIMESTAMPDIFF(year,birthdate,:endDate) between 5 and 9 and birthdate is not null"; + public static final String findPatientsWhoAreSixMonthsDrugsDistribution = + "select patient_id from( " + + "select levantamento.patient_id from( " + + "Select p.patient_id,max(e.encounter_datetime) data_levantamento from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "where p.voided=0 and e.voided=0 and e.encounter_type=18 and e.encounter_datetime<=:endDate and e.location_id=:location group by p.patient_id )levantamento " + + "inner join obs o on o.person_id=levantamento.patient_id " + + "where levantamento.data_levantamento=o.obs_datetime and o.concept_id=5096 and o.voided=0 and o.location_id=:location and datediff(o.value_datetime,levantamento.data_levantamento) between 175 and 190 " + + "union select max_tl.patient_id from ( " + + "select p.patient_id,max(o.obs_datetime) max_datatl from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23739 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_tl " + + "inner join obs on obs.person_id=max_tl.patient_id and max_tl.max_datatl=obs.obs_datetime " + + "where obs.concept_id=23739 and obs.value_coded=23888 and obs.location_id=:location union " + + "select max_dt.patient_id from( " + + "select p.patient_id,max(o.obs_datetime) max_datadt from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23888 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_dt " + + "inner join obs on obs.person_id=max_dt.patient_id and max_dt.max_datadt=obs.obs_datetime " + + "where obs.concept_id=23888 and obs.value_coded in (1256,1257) and obs.location_id=:location) dt " + + "where patient_id not in( " + + "select max_dts.patient_id from( " + + "select p.patient_id,max(o.obs_datetime) max_datadts from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23888 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_dts " + + "inner join obs on obs.person_id=max_dts.patient_id and max_dts.max_datadts=obs.obs_datetime " + + "where obs.concept_id=23888 and obs.value_coded=1267 and obs.location_id=:location)"; - public static final String findPatientsAge10to14 = + public static final String findPatientsAgeRange = "SELECT patient_id FROM patient " + "INNER JOIN person ON patient_id = person_id WHERE patient.voided=0 AND person.voided=0 " - + "AND TIMESTAMPDIFF(year,birthdate,:endDate) between 10 and 14 and birthdate is not null"; + + "AND TIMESTAMPDIFF(year,birthdate,:endDate) BETWEEN %d AND %d AND birthdate IS NOT NULL"; } } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/Eri2MonthsQueriesInterface.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/Eri2MonthsQueriesInterface.java index 0b4f30bc9b..c776580eee 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/Eri2MonthsQueriesInterface.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/Eri2MonthsQueriesInterface.java @@ -3,32 +3,6 @@ public interface Eri2MonthsQueriesInterface { class QUERY { - public static final String findPatientsWhoStartArtOneMonth = - "SELECT patients.patient_id FROM (" - + "SELECT patient_id, MIN(art_start_date) art_start_date FROM( " - + "Select p.patient_id,min(e.encounter_datetime) art_start_date from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.voided=0 and o.voided=0 and p.voided=0 and e.encounter_type in (18,6,9) and o.concept_id=1255 and o.value_coded=1256 and e.encounter_datetime<=:endDate and e.location_id=:location group by p.patient_id " - + "union " - + "Select p.patient_id,min(value_datetime) art_start_date from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type in (18,6,9,53) and o.concept_id=1190 and o.value_datetime is not null and o.value_datetime<=:endDate and e.location_id=:location group by p.patient_id " - + "union select pg.patient_id,min(date_enrolled) art_start_date from patient p inner join patient_program pg on p.patient_id=pg.patient_id " - + "where pg.voided=0 and p.voided=0 and program_id=2 and date_enrolled<=:endDate and location_id=:location group by pg.patient_id " - + "union " - + "SELECT e.patient_id, MIN(e.encounter_datetime) AS art_start_date FROM patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "WHERE p.voided=0 and e.encounter_type=18 AND e.voided=0 and e.encounter_datetime<=:endDate and e.location_id=:location GROUP BY p.patient_id " - + "union " - + "Select p.patient_id,min(value_datetime) art_start_date from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type=52 and o.concept_id=23866 and o.value_datetime is not null and o.value_datetime<=:endDate and e.location_id=:location group by p.patient_id) patients_started_art " - + "GROUP BY patients_started_art.patient_id " - + "HAVING MIN(patients_started_art.art_start_date) BETWEEN (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH)) patients GROUP BY patients.patient_id"; - public static final String findPatientsStartedArtLastMonthWith2PickupsOrConsultationWithin33DaysExcludingDeadAndTransferedOutAndIn = "SELECT patients_all.patient_id FROM( " @@ -318,146 +292,5 @@ class QUERY { + "inner join encounter e on p.patient_id=e.patient_id " + "inner join obs o on e.encounter_id=o.encounter_id " + "where e.voided=0 and o.voided=0 and p.voided=0 and e.encounter_type=53 and o.concept_id=6272 and o.value_coded=1706 and o.obs_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND :endDate and e.location_id=:location group by p.patient_id ) transferido ON transferido.patient_id = patients.patient_id GROUP BY patients.patient_id) patients_all GROUP BY patients_all.patient_id "; - - public static final String - patientsThatAreFemaleAndWereMarkedAsPregnantInTheInitialConsultationOrFollowUpConsultationAndMasterCard = - "select patient_id from ( " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1982 and value_coded in (44,1465) and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1279 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1600 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6334 and value_coded=6331 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "select pp.patient_id from patient_program pp where pp.program_id=8 and pp.voided=0 and pp.date_enrolled between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and pp.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=5272 and o.value_coded=1065 and e.encounter_type=53 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id inner join obs o on e.encounter_id=o.encounter_id where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=1465 and e.encounter_type=6 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + ") gravida inner join person p on p.person_id=gravida.patient_id where p.gender='F' "; - - public static final String - patientsThatAreFemaleAndWereMarkedAsBrestfeetingInTheInitialConsultationOrFollowUpConsultationAndMasterCard = - "select lactante_real.patient_id from ( " - + "Select p.patient_id,o.value_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=5599 and e.encounter_type in (5,6) and o.value_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id, e.encounter_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6332 and value_coded=1065 and e.encounter_type in (6,53) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id, e.encounter_datetime data_parto from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6334 and value_coded=6332 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "select pg.patient_id,ps.start_date data_parto from patient p " - + "inner join patient_program pg on p.patient_id=pg.patient_id " - + "inner join patient_state ps on pg.patient_program_id=ps.patient_program_id " - + "where pg.voided=0 and ps.voided=0 and p.voided=0 and pg.program_id=8 and ps.state=27 and ps.end_date is null and ps.start_date between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and location_id=:location) lactante_real " - + "inner join person on lactante_real.patient_id=person.person_id " - + "where person.gender='F' and lactante_real.patient_id not in ( " - + "select patient_id from ( " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1982 and value_coded in (44,1465) and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1279 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1600 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and concept_id=6334 and value_coded=6331 and e.encounter_type in (5,6) and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "select pp.patient_id from patient_program pp " - + "where pp.program_id=8 and pp.voided=0 and pp.date_enrolled between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and pp.location_id=:location " - + "union " - + "Select p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=5272 and o.value_coded=1065 and e.encounter_type=53 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + "union " - + "Select p.patient_id from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and o.concept_id=1465 and e.encounter_type=6 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location " - + ") gravida " - + "inner join person p on p.person_id=gravida.patient_id " - + "where p.gender='F') "; - - public static final String patientsThatAreAdult = - "select patient_id from ( " - + "select patient_id,min(data_inicio) data_inicio from( " - + "Select p.patient_id,min(e.encounter_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.voided=0 and o.voided=0 and p.voided=0 and e.encounter_type in (18,6,9) and o.concept_id=1255 and o.value_coded=1256 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id " - + "union " - + "Select p.patient_id,min(value_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type in (18,6,9,53) and o.concept_id=1190 and o.value_datetime is not null and o.value_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id " - + "union " - + "select pg.patient_id,min(date_enrolled) data_inicio from patient p " - + "inner join patient_program pg on p.patient_id=pg.patient_id " - + "where pg.voided=0 and p.voided=0 and program_id=2 and date_enrolled between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and location_id=:location group by pg.patient_id " - + "union " - + "SELECT e.patient_id, MIN(e.encounter_datetime) AS data_inicio FROM patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "WHERE p.voided=0 and e.encounter_type=18 AND e.voided=0 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location GROUP BY p.patient_id " - + "union Select p.patient_id,min(value_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type=52 and o.concept_id=23866 and o.value_datetime is not null and o.value_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id) inicio group by patient_id )inicio_real " - + "inner join person pe on inicio_real.patient_id=pe.person_id " - + "where timestampdiff(year,birthdate,data_inicio)>=15 and birthdate is not null "; - - public static final String patientsThatAreChild = - "select patient_id from ( " - + "select patient_id,min(data_inicio) data_inicio from ( " - + "Select p.patient_id,min(e.encounter_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on o.encounter_id=e.encounter_id " - + "where e.voided=0 and o.voided=0 and p.voided=0 and e.encounter_type in (18,6,9) and o.concept_id=1255 and o.value_coded=1256 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id " - + "union " - + "Select p.patient_id,min(value_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type in (18,6,9,53) and o.concept_id=1190 and o.value_datetime is not null and o.value_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id " - + "union " - + "select pg.patient_id,min(date_enrolled) data_inicio from patient p inner join patient_program pg on p.patient_id=pg.patient_id " - + "where pg.voided=0 and p.voided=0 and program_id=2 and date_enrolled between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and location_id=:location group by pg.patient_id " - + "union " - + "SELECT e.patient_id, MIN(e.encounter_datetime) AS data_inicio FROM patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "WHERE p.voided=0 and e.encounter_type=18 AND e.voided=0 and e.encounter_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location GROUP BY p.patient_id " - + "union " - + "Select p.patient_id,min(value_datetime) data_inicio from patient p " - + "inner join encounter e on p.patient_id=e.patient_id " - + "inner join obs o on e.encounter_id=o.encounter_id " - + "where p.voided=0 and e.voided=0 and o.voided=0 and e.encounter_type=52 and o.concept_id=23866 and o.value_datetime is not null and o.value_datetime between (:endDate - INTERVAL 2 MONTH + INTERVAL 1 DAY) AND (:endDate - INTERVAL 1 MONTH) and e.location_id=:location group by p.patient_id) inicio group by patient_id " - + ")inicio_real inner join person pe on inicio_real.patient_id=pe.person_id where timestampdiff(year,birthdate,data_inicio)<=14 and birthdate is not null"; } } diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/PregnantQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/PregnantQueries.java index 765500b7db..04b9f331de 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/PregnantQueries.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/PregnantQueries.java @@ -84,7 +84,7 @@ public static final String findPatientsWhoArePregnantInAPeriod() { + "SELECT p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id inner join obs o on e.encounter_id=o.encounter_id " + "WHERE p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1279 and e.encounter_type in (5,6) and e.encounter_datetime between :startDate " + "AND :endDate and e.location_id=:location UNION " - + "SELECT p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id inner join obs o on e.encounter_id=o.encounter_id " + + "SELECT p.patient_id from patient p inner join encounter e on p.patient_id=e.patient_id inner join obs o on e.encounter_id=o.encounter_id " + "WHERE p.voided=0 and e.voided=0 and o.voided=0 and concept_id=1600 and e.encounter_type in (5,6) " + "AND e.encounter_datetime BETWEEN :startDate AND :endDate AND e.location_id=:location UNION " + "SELECT p.patient_id FROM patient p inner join encounter e on p.patient_id=e.patient_id inner join obs o on e.encounter_id=o.encounter_id " diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TbQueries.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TbQueries.java new file mode 100644 index 0000000000..2278e8ba99 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/library/queries/TbQueries.java @@ -0,0 +1,44 @@ +/** */ +package org.openmrs.module.eptsreports.reporting.library.queries; + +/** @author Stélio Moiane */ +public interface TbQueries { + + class QUERY { + + public static final String findPatientsWhoAreInTbTreatment = + "select inicio_tb.patient_id from " + + "(select patient_id,max(data_inicio_tb) data_inicio_tb from ( " + + "select p.patient_id,o.value_datetime data_inicio_tb from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=1113 and e.location_id=:location and o.value_datetime<=:endDate " + + "union " + + "select patient_id,date_enrolled data_inicio_tb from patient_program " + + "where program_id=5 and voided=0 and date_enrolled<=:endDate and location_id=:location) inicio1 group by patient_id) inicio_tb " + + "left join (" + + "select patient_id,max(data_fim_tb) data_fim_tb from ( " + + "select p.patient_id,o.value_datetime data_fim_tb from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=6120 and e.location_id=:location and o.value_datetime<=:endDate " + + "union " + + "select patient_id,date_completed data_fim_tb from patient_program " + + "where program_id=5 and voided=0 and location_id=:location and date_completed is not null and date_completed<=:endDate) fim1 group by patient_id) " + + "fim on inicio_tb.patient_id=fim.patient_id and data_fim_tb>data_inicio_tb " + + "where data_fim_tb is null " + + " union " + + "select max_tb.patient_id from ( " + + "select p.patient_id,max(o.obs_datetime) max_datatb from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type in (6,9) and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=1268 and e.location_id=:location and o.obs_datetime<=:endDate group by p.patient_id) max_tb " + + "inner join obs on obs.person_id=max_tb.patient_id and max_tb.max_datatb=obs.obs_datetime " + + "where obs.concept_id=1268 and obs.value_coded in (1256,1257) and obs.location_id=:location " + + "union " + + "select p.patient_id from patient p " + + "inner join encounter e on p.patient_id=e.patient_id " + + "inner join obs o on o.encounter_id=e.encounter_id " + + "where e.encounter_type=6 and e.voided=0 and o.voided=0 and p.voided=0 and o.concept_id=23761 and o.value_coded=1065 and e.encounter_datetime between (:endDate - INTERVAL 6 MONTH + INTERVAL 1 DAY) and :endDate and e.location_id=:location group by p.patient_id"; + } +} diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/utils/AgeRange.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/utils/AgeRange.java index cefbf7a88c..2e2609312c 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/utils/AgeRange.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/utils/AgeRange.java @@ -9,6 +9,10 @@ public enum AgeRange { ONE_TO_FOUR("oneTo4", 1, 4), + UNDER_TWO("under2", 0, 2), + + TWO_TO_FOUR("twoTo4", 2, 4), + FIVE_TO_NINE("fiveTo9", 5, 9), TEN_TO_FOURTEEN("tenTo14", 10, 14), diff --git a/api/src/main/resources/IM_ER_Report.xls b/api/src/main/resources/IM_ER_Report.xls index 6da21858326a3fe8acaee3ffa740fcde78cd61c6..8ac52cb4e9e8c6840be29c1f2f18a4eca0384315 100644 GIT binary patch literal 122880 zcmeEv2Y405_x9X$dgvW42_--h(g+}(B=j0W2O*Ff2!tf0KoF47i}c>4N|7egRFoz* z6s3cRAYBkCA_)8}`QEd8@3wmquR@+D|L^fmCUf6+XU>^(W_EUVcK7ay&f>4kJi<-GJK?*@hCPL_;lDC7Gi`J%z5xFB`9I=;KT%H?v>CObt2L$X?)dJ3 zm@jC#8QZ*5z8Q!MJ$I{9HpRzvhbtd3X%u_mG~q939^VlBh~#6ZL##9+h_#M+3Vh;;w zF&=R!Vgh0!ViMvo#AL)2#8kvI#Nmh|5YrJyBEE(=3UM^z7{u2R$0BARMnX~|N}6GL z0@7ru1U5MMDIr{y{oRBzW)CN+4{w^?&!t3;m>*%yCpdX`+3FJ|^_MM6_xW z>d{|nX_*PO5$%n3p$wN{GSu8YQ$%hkZqkm`O z{OgLx^>)&@=E&zS?D2W?%loo6KQUJ(t$Osl!ywNsb3H`OYP&Ab@uCzqP=BWFG(JCcZq>O~Sc{gm!dtYAs$M@LEjeyLqPcZq$}G8@C(3nBofRLK zXl|Dn7o9-+C><-Qj)6F+(f4wQs!!WR4~R=hO-vaidl%c9AZCQ#?MC*|ciX24efh27 znT?;EF-hP1+={x2vDg(yt~884LvbXcvA-3L0;|BEs zE{~C;v9cvq5Fb|@brW&)qdHimBhWvqPhEJP^x8hM)a?IL8)sPcXP?uttv211I#%N4 z=6VtR)D|!D$!h#82g{^^X=i_Tn$_~w8OXHY5$`pp*a`L9Xle@ zK1cf~?HBzJX?iD=sgWt%*u@}RR!D?l*iB{{9y`9(yUBO^L? zh>VgBe$rSJD2)TjmXxH#gcM6k-^8TUID8ZNQIfRL9!a%S2DB7Opw+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R|W)SX0895!RfrV+dm9R9zdK1=%u)c)#BdkAR0|+~wuoDOy zNZ2641`{@fu%U#d6E=*n48k%A8%|gjVIv3|N!TdDMiX`-VPgmzOV~KV#uJuJ*aX6I z2+JibkFbe^okZ9q!X^_og|L$eJB6^Rgq=#*G{UA6HiNKy!e$ayKv*GR9>R(Un?=}c z!iotyjj%a{l@K>R?*CG0%H&L`{w!Y(9i4Ph4%b}?a>5Vn@E zb%b3?*ky!WPS_QMttaeC!mc9hYQnA|>{`OEBWwd<8wtCfup0=wk+4mK-9*@C!nP2$ zm9U!$yM?e@3A>H3+X=gausaF6i?F*1+eX+ugxyQneT3al*aL)ZC+tDO9wO{v!X6=P z2Vpx2+eO%J!X72;F~ar`_Bdfr5cVWtPZ9PsVb2iuEMa>IdycT@3EM~53xvH$*h_@H zOxP=gy-L_?gzYEnb;8~t>`lVnBJ6F#-XZK=!rmk7eZoE<>_fsnBJ5+rJ|XN=!ann3 z_FwnwW&d@*`v2kA{ZJ+vSDK99AeBo_YN+v9YJ56=gVZ3(cvcNx|K->Hbmsr}KE*wM z?6MlUe=-H%vASw0j|#{5V`8Rs>Ka0PztT;Z3DmAV2E(~Y_j zu>qp|MvBz*1zwbIi&X68c#2EAyT|5N6z98>GBPuIW@cuO%pH~6Gh@Wao|z*?=5;w? zcy&c_L797WS>E!M#8*ubQ+lPPC8zZ2kaW26voO;(u@$k2aiUup{}9`ehsO`JlFCM|m^4 zP;ZIx|Etutq%)uV3ahW~Bk8|vkMb9d|D&VY_@6EEjdec?qoBxGCv#Ok#zQf_>tidO z-~ThoTfZDP)V6-{*VkS{(fGef%2a{T29GfUkE}iY|3m*}{@>-TKNQK4`d^N diff --git a/api/src/test/java/org/openmrs/module/eptsreports/reporting/intergrated/library/cohorts/TxNewCohortDefinitionTest.java b/api/src/test/java/org/openmrs/module/eptsreports/reporting/intergrated/library/cohorts/TxNewCohortDefinitionTest.java index c51883ebd5..461f3de8cb 100644 --- a/api/src/test/java/org/openmrs/module/eptsreports/reporting/intergrated/library/cohorts/TxNewCohortDefinitionTest.java +++ b/api/src/test/java/org/openmrs/module/eptsreports/reporting/intergrated/library/cohorts/TxNewCohortDefinitionTest.java @@ -5,12 +5,11 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; -import org.junit.Ignore; +import org.junit.Test; import org.openmrs.Location; import org.openmrs.api.context.Context; import org.openmrs.module.eptsreports.reporting.intergrated.utils.DefinitionsFGHLiveTest; -import org.openmrs.module.eptsreports.reporting.library.cohorts.TxNewCohortQueries; -import org.openmrs.module.eptsreports.reporting.utils.AgeRange; +import org.openmrs.module.eptsreports.reporting.library.cohorts.DSDCohortQueries; import org.openmrs.module.reporting.cohort.EvaluatedCohort; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; import org.openmrs.module.reporting.common.DateUtil; @@ -21,27 +20,27 @@ /** @author Stélio Moiane */ public class TxNewCohortDefinitionTest extends DefinitionsFGHLiveTest { - @Autowired private TxNewCohortQueries txNewCohortQueries; + @Autowired private DSDCohortQueries txNewCohortQueries; - @Ignore + @Test public void shouldFindPatientsNewlyEnrolledInART() throws EvaluationException { final Location location = Context.getLocationService().getLocation(6); final Date startDate = DateUtil.getDateTime(2018, 4, 21); final Date endDate = DateUtil.getDateTime(2018, 5, 20); - final Date reportingEndDate = DateUtil.getDateTime(2018, 9, 20); + // final Date reportingEndDate = DateUtil.getDateTime(2018, 9, 20); final CohortDefinition txNewCompositionCohort = - this.txNewCohortQueries - .findPatientsNewlyEnrolledByAgeInAPeriodExcludingBreastFeedingAndPregnant( - AgeRange.ADULT); + this.txNewCohortQueries.findPatientsWhoAreActiveOnArtAndInAtleastOneDSD(); final Map parameters = new HashMap<>(); - parameters.put(new Parameter("cohortStartDate", "Start Date", Date.class), startDate); - parameters.put(new Parameter("cohortEndDate", "End Date", Date.class), endDate); - parameters.put(new Parameter("reportingEndDate", "End Date", Date.class), reportingEndDate); + parameters.put(new Parameter("startDate", "Start Date", Date.class), startDate); + parameters.put(new Parameter("endDate", "End Date", Date.class), endDate); parameters.put(new Parameter("location", "Location", Location.class), location); + // parameters.put(new Parameter("reportingEndDate", "End Date", + // Date.class), reportingEndDate); + final EvaluatedCohort evaluatedCohort = this.evaluateCohortDefinition(txNewCompositionCohort, parameters);