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-1592 | RM DAH DIFF ICAP #1285

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@
getPatientsWhoHaveCd4Results(),
"startDate=${startDate-1m},endDate=${endDate},location=${location}"));

cd.addSearch(

Check warning on line 371 in api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java#L371

Added line #L371 was not covered by tests
"cd4ByAgeAndResult",
map(
getPatientsWithCD4BasedOnAgeAndCd4Results(),

Check warning on line 374 in api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java#L373-L374

Added lines #L373 - L374 were not covered by tests
"startDate=${startDate-1m},endDate=${endDate},location=${location}"));

cd.addSearch(
"tbLamResults",
mapStraightThrough(
Expand All @@ -381,7 +387,7 @@
getPatientsWhoStartedFollowupOnDAHComposition(),
"startDate=${endDate},endDate={endDate},location=${location}"));

cd.setCompositionString("onDAH AND haveCd4Results AND tbLamResults");
cd.setCompositionString("onDAH AND haveCd4Results AND cd4ByAgeAndResult AND tbLamResults");

Check warning on line 390 in api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java#L390

Added line #L390 was not covered by tests
return cd;
}

Expand Down Expand Up @@ -805,7 +811,7 @@
public CohortDefinition getPatientsWhoAreMarkedAsDeadDOnSixMonthsCohortAndAfterFollowupDate() {

SqlCohortDefinition sqlCohortDefinition = new SqlCohortDefinition();
sqlCohortDefinition.setName("");
sqlCohortDefinition.setName("Motivo de Saída” = “Óbito”");

Check warning on line 814 in api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/openmrs/module/eptsreports/reporting/library/cohorts/advancedhivillness/ResumoMensalDAHCohortQueries.java#L814

Added line #L814 was not covered by tests
sqlCohortDefinition.addParameter(new Parameter("startDate", "startDate", Date.class));
sqlCohortDefinition.addParameter(new Parameter("endDate", "endDate", Date.class));
sqlCohortDefinition.addParameter(new Parameter("reportEndDate", "reportEndDate", Date.class));
Expand All @@ -815,7 +821,6 @@
map.put("90", hivMetadata.getAdvancedHivIllnessEncounterType().getEncounterTypeId());
map.put("1708", hivMetadata.getExitFromArvTreatmentConcept().getConceptId());
map.put("1366", hivMetadata.getPatientHasDiedConcept().getConceptId());
map.put("165386", hivMetadata.getExitDateFromArvTreatmentConcept().getConceptId());

String query =
"SELECT p.patient_id "
Expand All @@ -829,24 +834,19 @@
+ " 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 = ${90} "
+ " AND e.encounter_datetime >= :startDate "
+ " AND e.encounter_datetime <= :endDate "
+ " AND e.encounter_datetime >= :startDate "
+ " AND e.encounter_datetime <= :endDate "
+ " AND e.location_id = :location "
+ " GROUP BY p.patient_id "
+ " ) last_dah ON last_dah.patient_id = p.patient_id "
+ "WHERE p.voided = 0 "
+ " AND e.voided = 0 "
+ " AND o.voided = 0 "
+ " AND e.encounter_type = ${90} "
+ " AND ( "
+ " (o.concept_id = ${1708} "
+ " AND o.value_coded = ${1366} "
+ " AND o.obs_datetime >= last_dah.last_date "
+ " AND o.obs_datetime <= :reportEndDate) "
+ " OR (o.concept_id = ${165386} "
+ " AND o.value_datetime >= last_dah.last_date "
+ " AND o.value_datetime <= :reportEndDate) "
+ " ) "
+ " AND o.concept_id = ${1708} "
+ " AND o.value_coded = ${1366} "
+ " AND o.obs_datetime >= last_dah.last_date "
+ " AND o.obs_datetime <= :reportEndDate "
+ " AND e.location_id = :location "
+ "GROUP BY p.patient_id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public DataSetDefinition constructResumoMensalDAHDataset() {
getPatientsWhoLeftFollowupOnDAHByDuringMonth(),
resumoMensalDAHDisaggregations.get0to7ColumnDisaggregations());

// INDICATOR 5 IS A DISAGREGATIONCALCULATION
dd.addColumn(
"TOTALI5",
"Indicador 5 Utentes em DAH até o fim do mês",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
import java.util.List;
import java.util.Properties;
import org.openmrs.Location;
import org.openmrs.module.eptsreports.reporting.library.cohorts.GenericCohortQueries;
import org.openmrs.module.eptsreports.reporting.library.datasets.DatimCodeDatasetDefinition;
import org.openmrs.module.eptsreports.reporting.library.datasets.LocationDataSetDefinition;
import org.openmrs.module.eptsreports.reporting.library.datasets.SismaCodeDatasetDefinition;
import org.openmrs.module.eptsreports.reporting.library.datasets.resumo.ResumoMensalDAHDatasetDefinition;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsDataExportManager;
import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils;
import org.openmrs.module.reporting.ReportingException;
import org.openmrs.module.reporting.evaluation.parameter.Parameter;
import org.openmrs.module.reporting.report.ReportDesign;
Expand All @@ -24,14 +22,11 @@
@Deprecated
public class SetupResumoMensalDAHReport extends EptsDataExportManager {

private GenericCohortQueries genericCohortQueries;
private ResumoMensalDAHDatasetDefinition resumoMensalDAHDatasetDefinition;

@Autowired
public SetupResumoMensalDAHReport(
GenericCohortQueries genericCohortQueries,
ResumoMensalDAHDatasetDefinition resumoMensalDAHDatasetDefinition) {
this.genericCohortQueries = genericCohortQueries;
this.resumoMensalDAHDatasetDefinition = resumoMensalDAHDatasetDefinition;
}

Expand Down Expand Up @@ -78,11 +73,6 @@ public ReportDefinition constructReportDefinition() {
rd.addDataSetDefinition("HF", mapStraightThrough(new LocationDataSetDefinition()));
rd.addDataSetDefinition("SM", mapStraightThrough(new SismaCodeDatasetDefinition()));

// Report Base Cohort
rd.setBaseCohortDefinition(
EptsReportUtils.map(
genericCohortQueries.getBaseCohort(), "endDate=${endDate},location=${location}"));

return rd;
}

Expand Down