Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SESP-318: TXPVLS Supplemental new mer quartely indicator #521

Merged
merged 11 commits into from
Dec 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,112 @@ public class PvlsCohortQueries {

return definition;
}

@DocumentedDefinition(value = "findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominators")
public CohortDefinition findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominators() {
final SqlCohortDefinition definition = new SqlCohortDefinition();

definition.setName("findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominators");
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));

definition.setQuery(
TxPvlsQueriesInterface.QUERY
.findPregnantAdnBreastfeedingWomenSuplementalCoverageDenominators(
WomanState.BREASTFEEDING));

return definition;
}

@DocumentedDefinition(value = "findPregnantWomanForTxPvlsSupplementalCoverageDenominators")
public CohortDefinition findPregnantWomanForTxPvlsSupplementalCoverageDenominators() {
final SqlCohortDefinition definition = new SqlCohortDefinition();

definition.setName("findPregnantWomanForTxPvlsSupplementalCoverageDenominators");
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));

definition.setQuery(
TxPvlsQueriesInterface.QUERY
.findPregnantAdnBreastfeedingWomenSuplementalCoverageDenominators(WomanState.PREGNANT));

return definition;
}

@DocumentedDefinition(
value =
"findPregnantBreatsFeedingWhoHaveMoreThan3MonthsOnArtWithViralLoadRegisteredInTheLast12MonthsWithVlMoreThan1000Target")
public CohortDefinition
findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominatorsPatients() {
final CompositionCohortDefinition definition = new CompositionCohortDefinition();

definition.setName("findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominatorsPatients");
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(
"BREASTFEEDING",
EptsReportUtils.map(
this.findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominators(), mappings));

definition.setCompositionString("BREASTFEEDING");

return definition;
}

@DocumentedDefinition(
value = "findPregnantWomanForTxPvlsSupplementalCoverageDenominatorsPatients")
public CohortDefinition findPregnantWomanForTxPvlsSupplementalCoverageDenominatorsPatients() {
final CompositionCohortDefinition definition = new CompositionCohortDefinition();

definition.setName("findPregnantWomanForTxPvlsSupplementalCoverageDenominatorsPatients");
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(
"PREGNANT",
EptsReportUtils.map(
this.findPregnantWomanForTxPvlsSupplementalCoverageDenominators(), mappings));

definition.setCompositionString("PREGNANT");

return definition;
}

@DocumentedDefinition(
value = "findPregnantAndBreastfeedingWomenForTxPvlsSupplementalCoverageDenominatorsPatients")
public CohortDefinition
findPregnantAndBreastfeedingWomenForTxPvlsSupplementalCoverageDenominatorsPatients() {
final CompositionCohortDefinition definition = new CompositionCohortDefinition();

definition.setName(
"findPregnantAndBreastfeedingWomenForTxPvlsSupplementalCoverageDenominatorsPatients");
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(
"PREGNANT",
EptsReportUtils.map(
this.findPregnantWomanForTxPvlsSupplementalCoverageDenominators(), mappings));

definition.addSearch(
"BREASTFEEDING",
EptsReportUtils.map(
this.findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominators(), mappings));

definition.setCompositionString("PREGNANT OR BREASTFEEDING");

return definition;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/

package org.openmrs.module.eptsreports.reporting.library.datasets;

import org.openmrs.module.eptsreports.reporting.library.cohorts.PvlsCohortQueries;
import org.openmrs.module.eptsreports.reporting.library.indicators.EptsGeneralIndicator;
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.indicator.CohortIndicator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TxPvlsSuplementalDataSet extends BaseDataSet {

@Autowired private PvlsCohortQueries pvlsCohortQueries;

@Autowired private EptsGeneralIndicator eptsGeneralIndicator;

@Autowired
public DataSetDefinition constructTxPvlsSupplementalDataset() {

final CohortIndicatorDataSetDefinition dataSetDefinition =
new CohortIndicatorDataSetDefinition();

dataSetDefinition.setName("TxPvls Suplemental Data Set");
dataSetDefinition.addParameters(this.getParameters());

final String mappings = "startDate=${startDate},endDate=${endDate},location=${location}";

final CohortIndicator denominator =
this.eptsGeneralIndicator.getIndicator(
"total-denominator",
EptsReportUtils.map(
this.pvlsCohortQueries
.findPregnantAndBreastfeedingWomenForTxPvlsSupplementalCoverageDenominatorsPatients(),
mappings));

final CohortIndicator pregnantDenominator =
this.eptsGeneralIndicator.getIndicator(
"pregnant-denominator",
EptsReportUtils.map(
this.pvlsCohortQueries
.findPregnantWomanForTxPvlsSupplementalCoverageDenominatorsPatients(),
mappings));

final CohortIndicator breastFeedingDenominator =
this.eptsGeneralIndicator.getIndicator(
"breastfeeding-denominator",
EptsReportUtils.map(
this.pvlsCohortQueries
.findBreastfeedingWomanForTxPvlsSupplementalCoverageDenominatorsPatients(),
mappings));

dataSetDefinition.addColumn(
"TXPVLS-SUPLEMENTAL-TOTAL",
"TXPVLS-SUPLEMENTAL: Eligible for a VL test and on ART for 90 days (Total Denominator)",
EptsReportUtils.map(denominator, mappings),
"");

dataSetDefinition.addColumn(
"TXPVLS-SUPLEMENTAL-PREGNANT",
"TXPVLS-SUPLEMENTAL: Eligible for a VL test and on ART for 90 days (Pregnant Women)",
EptsReportUtils.map(pregnantDenominator, mappings),
"");

dataSetDefinition.addColumn(
"TXPVLS-SUPLEMENTAL-BREASTFEEDING",
"TXPVLS-SUPLEMENTAL: Eligible for a VL test and on ART for 90 days (Breastfeeding Women)",
EptsReportUtils.map(breastFeedingDenominator, mappings),
"");

return dataSetDefinition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class QUERY {
FIND_WOMAN_STATE_WHO_HAVE_MORE_THAN_3MONTHS_ON_ART_WITH_VIRALLOAD_REGISTERED_IN_THELAST12MONTHS =
"PVLS/FIND_WOMAN_STATE_WHO_HAVE_MORE_THAN_3MONTHS_ON_ART_WITH_VIRALLOAD_REGISTERED_IN_THELAST12MONTHS.sql";

private static final String
FIND_PREGNANT_AND_BREASTFEEDING_WOMEN_SUPLEMENTAL_COVERAGE_DENOMINATORS =
"TX_PVLS_SUPLEMENTAL/PREGNANT_AND_BREASTFEEDING_WOMEN.sql";

public enum WomanState {
PREGNANT,
BREASTFEEDING;
Expand Down Expand Up @@ -187,5 +191,24 @@ public enum WomanState {
}
return query;
}

public static final String findPregnantAdnBreastfeedingWomenSuplementalCoverageDenominators(
WomanState womanState) {

String query =
EptsQuerysUtils.loadQuery(
FIND_PREGNANT_AND_BREASTFEEDING_WOMEN_SUPLEMENTAL_COVERAGE_DENOMINATORS);

switch (womanState) {
case PREGNANT:
query = String.format(query, 1);
break;

case BREASTFEEDING:
query = String.format(query, 2);
break;
}
return query;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.openmrs.module.eptsreports.reporting.library.datasets.TxMlDataset;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxNewDataset;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxPvlsDataset;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxPvlsSuplementalDataSet;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxRttDataset;
import org.openmrs.module.eptsreports.reporting.library.queries.BaseQueries;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsDataExportManager;
Expand Down Expand Up @@ -62,6 +63,8 @@ public class SetupMERQuarterly extends EptsDataExportManager {

@Autowired private PMTCTHEIDataSet pmtctheiDataSet;

@Autowired private TxPvlsSuplementalDataSet txPvlsSuplementalDataSet;

@Autowired protected GenericCohortQueries genericCohortQueries;
@Autowired private DatimCodeDataSet datimCodeDataSet;

Expand Down Expand Up @@ -129,6 +132,11 @@ public ReportDefinition constructReportDefinition() {
reportDefinition.addDataSetDefinition(
"PMTCT_HEI", Mapped.mapStraightThrough(this.pmtctheiDataSet.constructPMTCTHEIDataset()));

reportDefinition.addDataSetDefinition(
"T-S",
Mapped.mapStraightThrough(
this.txPvlsSuplementalDataSet.constructTxPvlsSupplementalDataset()));

reportDefinition.addDataSetDefinition(
"D",
Mapped.mapStraightThrough(this.datimCodeDataSet.constructDataset(this.getParameters())));
Expand Down
Empty file.
Empty file.
Binary file modified api/src/main/resources/PEPFAR_MER_2.8_Quarterly.xls
Binary file not shown.
Loading