Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MEPTS - 1653 | PREP NEW Changes for March 2025 Release #1314

Open
wants to merge 8 commits into
base: 2.x_develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -6195,4 +6195,78 @@ public Concept getCD4SemiQuantitativeAtArtStartingConcept() {
.getGlobalProperty("eptsreports.cd4SemiQuantitativeAtArtStartingUuid");
return getConcept(uuid);
}

/**
* /** <b>concept_id = 165516</b>
*
* <p><b>Name:</b> TYPE OF PREP
*
* <p><b>Description:</b>
*
* @return {@link Concept}
*/
public Concept getTypeOfPrepConcept() {
String uuid =
Context.getAdministrationService().getGlobalProperty("eptsreports.typeOfPrepUuid");
return getConcept(uuid);
}

/**
* /** <b>concept_id = 165517</b>
*
* <p><b>Name:</b> ORAL - ON DEMAND
*
* <p><b>Description:</b>
*
* @return {@link Concept}
*/
public Concept getOralOnDemandConcept() {
String uuid =
Context.getAdministrationService().getGlobalProperty("eptsreports.oralOnDemandUuid");
return getConcept(uuid);
}

/**
* /** <b>concept_id = 165518</b>
*
* <p><b>Name:</b> ORAL- DIARY
*
* <p><b>Description:</b>
*
* @return {@link Concept}
*/
public Concept getOralDiaryConcept() {
String uuid = Context.getAdministrationService().getGlobalProperty("eptsreports.oralDiaryUuid");
return getConcept(uuid);
}

/**
* /** <b>concept_id = 21959</b>
*
* <p><b>Name:</b> INJECTABLE
*
* <p><b>Description:</b>
*
* @return {@link Concept}
*/
public Concept getInjectableConcept() {
String uuid =
Context.getAdministrationService().getGlobalProperty("eptsreports.injectableUuid");
return getConcept(uuid);
}

/**
* /** <b>concept_id = 165514</b>
*
* <p><b>Name:</b> VAGINAL RING
*
* <p><b>Description:</b>
*
* @return {@link Concept}
*/
public Concept getVaginalRingConcept() {
String uuid =
Context.getAdministrationService().getGlobalProperty("eptsreports.vaginalRingUuid");
return getConcept(uuid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1061,4 +1061,180 @@ public CohortDefinition getMalePatientsWhoAreSexWorker() {

return cd;
}

/**
* The system will include clients from the PrEP_CT numerator (PREP_CT_FR2) in the PrEP type
* disaggregation as follows:
*
* <ul>
* <li>Oral: Clents with the responses “Oral-Diario” or “Oral-Sob Demanda” registered for the
* field “Tipo de PrEP” on the “Ficha de Consulta Inicial PrEP” or “Ficha de Consulta de
* Seguimento PrEP” registered during the period.
* </ul>
*
* Note 1: Clients with no response (Blank) for the field “Tipo de PrEP” on the selected “Ficha de
* Consulta Inicial PrEP” or “Ficha de Consulta de Seguimento PrEP” registered during the period
* will not be included in this disaggregation, and therefore the total of the disaggregation may
* not be equal to the PrEP_CT total.
*
* <p>Note 2: The PrEP type registered on the most recent “Ficha de Consulta Inicial PrEP” or
* “Ficha de Consulta de Seguimento PrEP” falling during the reporting period should be considered
*
* @return {@link CohortDefinition}
*/
public CohortDefinition getPatientsWithLastPrepTypeEqualToOral() {
SqlCohortDefinition sqlCohortDefinition = new SqlCohortDefinition();
sqlCohortDefinition.setName("Oral Prep Type");
sqlCohortDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("endDate", "End Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("location", "Location", Location.class));

Map<String, Integer> map = new HashMap<>();
map.put("80", hivMetadata.getPrepInicialEncounterType().getEncounterTypeId());
map.put("81", hivMetadata.getPrepSeguimentoEncounterType().getEncounterTypeId());
map.put("165516", hivMetadata.getTypeOfPrepConcept().getConceptId());
map.put("165517", hivMetadata.getOralOnDemandConcept().getConceptId());
map.put("165518", hivMetadata.getOralDiaryConcept().getConceptId());
map.put("21959", hivMetadata.getInjectableConcept().getConceptId());
map.put("165514", hivMetadata.getVaginalRingConcept().getConceptId());

String query =
"SELECT p.patient_id "
+ "FROM patient p "
+ " INNER JOIN encounter e ON e.patient_id = p.patient_id "
+ " INNER JOIN obs o ON o.encounter_id = e.encounter_id "
+ " INNER JOIN ( "
+ PrepCtQueries.getPatientsWithLastPrepTypeDuringPeriod()
+ " ) prep_type ON p.patient_id = prep_type.patient_id "
+ "WHERE p.voided = 0 AND e.voided = 0 AND o.voided = 0 "
+ " AND e.location_id = :location "
+ " AND e.encounter_type IN (${81}, ${80}) "
+ " AND o.concept_id = ${165516} "
+ " AND o.value_coded IN (${165517}, ${165518}) "
+ " AND e.encounter_datetime = prep_type.max_date ";

StringSubstitutor stringSubstitutor = new StringSubstitutor(map);

String mappedQuery = stringSubstitutor.replace(query);

sqlCohortDefinition.setQuery(mappedQuery);

return sqlCohortDefinition;
}

/**
* The system will include clients from the PrEP_CT numerator (PREP_CT_FR2) in the PrEP type
* disaggregation as follows:
* <li>Injectable: Clients with the response “Injectável” registered for the field “Tipo de PrEP”
* on the “Ficha de Consulta Inicial PrEP” or “Ficha de Consulta de Seguimento PrEP”
* registered during the period.
*
* <p>Note 1: Clients with no response (Blank) for the field “Tipo de PrEP” on the selected
* “Ficha de Consulta Inicial PrEP” or “Ficha de Consulta de Seguimento PrEP” registered
* during the period will not be included in this disaggregation, and therefore the total of
* the disaggregation may not be equal to the PrEP_CT total.
*
* <p>Note 2: The PrEP type registered on the most recent “Ficha de Consulta Inicial PrEP” or
* “Ficha de Consulta de Seguimento PrEP” falling during the reporting period should be
* considered
*
* @return {@link CohortDefinition}
*/
public CohortDefinition getPatientsWithLastPrepTypeEqualToInjectable() {
SqlCohortDefinition sqlCohortDefinition = new SqlCohortDefinition();
sqlCohortDefinition.setName("Injectable Prep Type");
sqlCohortDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("endDate", "End Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("location", "Location", Location.class));

Map<String, Integer> map = new HashMap<>();
map.put("80", hivMetadata.getPrepInicialEncounterType().getEncounterTypeId());
map.put("81", hivMetadata.getPrepSeguimentoEncounterType().getEncounterTypeId());
map.put("165516", hivMetadata.getTypeOfPrepConcept().getConceptId());
map.put("165517", hivMetadata.getOralOnDemandConcept().getConceptId());
map.put("165518", hivMetadata.getOralDiaryConcept().getConceptId());
map.put("21959", hivMetadata.getInjectableConcept().getConceptId());
map.put("165514", hivMetadata.getVaginalRingConcept().getConceptId());

String query =
"SELECT p.patient_id "
+ "FROM patient p "
+ " INNER JOIN encounter e ON e.patient_id = p.patient_id "
+ " INNER JOIN obs o ON o.encounter_id = e.encounter_id "
+ " INNER JOIN ( "
+ PrepCtQueries.getPatientsWithLastPrepTypeDuringPeriod()
+ " ) prep_type ON p.patient_id = prep_type.patient_id "
+ "WHERE p.voided = 0 AND e.voided = 0 AND o.voided = 0 "
+ " AND e.location_id = :location "
+ " AND e.encounter_type IN (${81}, ${80}) "
+ " AND o.concept_id = ${165516} "
+ " AND o.value_coded = ${21959} "
+ " AND e.encounter_datetime = prep_type.max_date ";

StringSubstitutor stringSubstitutor = new StringSubstitutor(map);

String mappedQuery = stringSubstitutor.replace(query);

sqlCohortDefinition.setQuery(mappedQuery);

return sqlCohortDefinition;
}

/**
* The system will include clients from the PrEP_CT numerator (PREP_CT_FR2) in the PrEP type
* disaggregation as follows:
* <li>Other: Clients with the response “Anel” registered for the field “Tipo de PrEP” on the
* “Ficha de Consulta Inicial PrEP” or “Ficha de Consulta de Seguimento PrEP” registered
* during the period.
*
* <p>Note 1: Clients with no response (Blank) for the field “Tipo de PrEP” on the selected
* “Ficha de Consulta Inicial PrEP” or “Ficha de Consulta de Seguimento PrEP” registered
* during the period will not be included in this disaggregation, and therefore the total of
* the disaggregation may not be equal to the PrEP_CT total.
*
* <p>Note 2: The PrEP type registered on the most recent “Ficha de Consulta Inicial PrEP” or
* “Ficha de Consulta de Seguimento PrEP” falling during the reporting period should be
* considered
*
* @return {@link CohortDefinition}
*/
public CohortDefinition getPatientsWithLastPrepTypeEqualToVaginalRing() {
SqlCohortDefinition sqlCohortDefinition = new SqlCohortDefinition();
sqlCohortDefinition.setName("Vaginal Ring Prep Type");
sqlCohortDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("endDate", "End Date", Date.class));
sqlCohortDefinition.addParameter(new Parameter("location", "Location", Location.class));

Map<String, Integer> map = new HashMap<>();
map.put("80", hivMetadata.getPrepInicialEncounterType().getEncounterTypeId());
map.put("81", hivMetadata.getPrepSeguimentoEncounterType().getEncounterTypeId());
map.put("165516", hivMetadata.getTypeOfPrepConcept().getConceptId());
map.put("165517", hivMetadata.getOralOnDemandConcept().getConceptId());
map.put("165518", hivMetadata.getOralDiaryConcept().getConceptId());
map.put("21959", hivMetadata.getInjectableConcept().getConceptId());
map.put("165514", hivMetadata.getVaginalRingConcept().getConceptId());

String query =
"SELECT p.patient_id "
+ "FROM patient p "
+ " INNER JOIN encounter e ON e.patient_id = p.patient_id "
+ " INNER JOIN obs o ON o.encounter_id = e.encounter_id "
+ " INNER JOIN ( "
+ PrepCtQueries.getPatientsWithLastPrepTypeDuringPeriod()
+ " ) prep_type ON p.patient_id = prep_type.patient_id "
+ "WHERE p.voided = 0 AND e.voided = 0 AND o.voided = 0 "
+ " AND e.location_id = :location "
+ " AND e.encounter_type IN (${81}, ${80}) "
+ " AND o.concept_id = ${165516} "
+ " AND o.value_coded = ${165514} "
+ " AND e.encounter_datetime = prep_type.max_date ";

StringSubstitutor stringSubstitutor = new StringSubstitutor(map);

String mappedQuery = stringSubstitutor.replace(query);

sqlCohortDefinition.setQuery(mappedQuery);

return sqlCohortDefinition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public DataSetDefinition constructPrepCtDataset() {
"prepInterruption",
EptsReportUtils.map(
eptsCommonDimension.getClientsWithReasonForPrepInterruptionDisaggregation(), mappings));
dsd.addDimension(
"prepType", EptsReportUtils.map(eptsCommonDimension.getPrepTypeDimension(), mappings));

dsd.addColumn(
"TOTAL-CT",
Expand All @@ -80,7 +82,25 @@ public DataSetDefinition constructPrepCtDataset() {
eptsGeneralIndicator.getIndicator(
"Oral", EptsReportUtils.map(prepCtCohortQueries.getPREPCTNumerator(), mappings)),
mappings),
"");
"prepType=oral");

dsd.addColumn(
"INJECTIBLE-CT",
"Injectible",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Oral", EptsReportUtils.map(prepCtCohortQueries.getPREPCTNumerator(), mappings)),
mappings),
"prepType=injectible");

dsd.addColumn(
"OTHER-CT",
"Vaginal Ring",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Oral", EptsReportUtils.map(prepCtCohortQueries.getPREPCTNumerator(), mappings)),
mappings),
"prepType=vaginalRing");

dsd.addColumn(
"PID-CT",
Expand All @@ -102,16 +122,6 @@ public DataSetDefinition constructPrepCtDataset() {
mappings),
"KP=MSM");

dsd.addColumn(
"TG-CT",
"PREP CT: Transgender",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Transgender",
EptsReportUtils.map(prepCtCohortQueries.getPREPCTNumerator(), mappings)),
mappings),
"KP=TG");

dsd.addColumn(
"SW-CT",
"PREP CT: Female sex workers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public DataSetDefinition constructPrepNewDataset() {
"maternity",
EptsReportUtils.map(
eptsCommonDimension.getPregnantAndBreastfeedingPatientsBasedOnPrepNew(), mappings));
dsd.addDimension(
"prepType", EptsReportUtils.map(eptsCommonDimension.getPrepTypeDimension(), mappings));

dsd.addColumn(
"Pregnant",
Expand Down Expand Up @@ -91,7 +93,29 @@ public DataSetDefinition constructPrepNewDataset() {
EptsReportUtils.map(
prepNewCohortQueries.getClientsWhoNewlyInitiatedPrep(), mappings)),
mappings),
"");
"prepType=oral");

dsd.addColumn(
"INJECTABLE",
"Injectable",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Injectable",
EptsReportUtils.map(
prepNewCohortQueries.getClientsWhoNewlyInitiatedPrep(), mappings)),
mappings),
"prepType=injectible");

dsd.addColumn(
"OTHER",
"Vaginal Ring",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Vaginal Ring",
EptsReportUtils.map(
prepNewCohortQueries.getClientsWhoNewlyInitiatedPrep(), mappings)),
mappings),
"prepType=vaginalRing");

dsd.addColumn(
"TOTAL",
Expand Down Expand Up @@ -126,17 +150,6 @@ public DataSetDefinition constructPrepNewDataset() {
mappings),
"KP=MSM");

dsd.addColumn(
"TG-NEW",
"PREP NEW: Transgender",
EptsReportUtils.map(
eptsGeneralIndicator.getIndicator(
"Transgender",
EptsReportUtils.map(
prepNewCohortQueries.getClientsWhoNewlyInitiatedPrep(), mappings)),
mappings),
"KP=TG");

dsd.addColumn(
"SW-NEW",
"PREP NEW: Female sex workers",
Expand Down
Loading