From 8b639aa5190f4fa65c540a6d20b11c3c779054fb Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Thu, 5 Feb 2026 20:12:35 +0530 Subject: [PATCH 1/8] Fix MSPP visit reports --- .../commonreports/CommonReportsConstants.java | 4 +- ...ohortCrossTabDataSetCsvReportRenderer.java | 38 +++++++++---------- .../reports/MSPPVaccinationReportManager.java | 4 +- api/src/main/resources/messages.properties | 2 +- .../DisbursementReportManagerTest.java | 14 ++++--- .../MSPPAntenatalReportManagerTest.java | 1 - .../MSPPFamilyPlanningReportManagerTest.java | 2 +- .../MSPPVaccinationReportManagerTest.java | 2 +- ...tpatientConsultationReportManagerTest.java | 13 ++++--- .../configuration/jsonkeyvalues/config.json | 2 +- 10 files changed, 43 insertions(+), 39 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/commonreports/CommonReportsConstants.java b/api/src/main/java/org/openmrs/module/commonreports/CommonReportsConstants.java index 97b46289..65208615 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/CommonReportsConstants.java +++ b/api/src/main/java/org/openmrs/module/commonreports/CommonReportsConstants.java @@ -36,9 +36,9 @@ public class CommonReportsConstants { public static final String COMPONENT_REPORTMANAGER_LAB = MODULE_ARTIFACT_ID + ".lab"; public static final String COMPONENT_REPORTMANAGER_VACCINATION = MODULE_ARTIFACT_ID + ".vaccination"; - + public static final String COMPONENT_REPORTMANAGER_FAMILY_PLANNING = MODULE_ARTIFACT_ID + ".familyPlanning"; - + /* * URIs URLs */ diff --git a/api/src/main/java/org/openmrs/module/commonreports/renderer/CohortCrossTabDataSetCsvReportRenderer.java b/api/src/main/java/org/openmrs/module/commonreports/renderer/CohortCrossTabDataSetCsvReportRenderer.java index 1df4f7ba..2d70f9b3 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/renderer/CohortCrossTabDataSetCsvReportRenderer.java +++ b/api/src/main/java/org/openmrs/module/commonreports/renderer/CohortCrossTabDataSetCsvReportRenderer.java @@ -66,25 +66,25 @@ public void render(ReportData results, String argument, OutputStream out) throws Set rows = dsd.getRows().keySet(); // Add rest of the columns - for (String column : columns) { - metaData.addColumn(new DataSetColumn(column, column, Object.class)); - } - data.setMetaData(metaData); - - // Add column values - for (String row : rows) { - DataSetRow dsr = new DataSetRow(); - for (DataSetColumn column : metaData.getColumns()) { - if (column.getName().equals("")) { - dsr.addColumnValue(column, row); - } else { - dsr.addColumnValue(column, ((Cohort) cohortCrossTabDataSetRow.getColumnValue(row + "." + column)) - .size()); - } - } - data.addRow(dsr); - } - dataSetsToRender.put(name, data); + for (String column : columns) { + metaData.addColumn(new DataSetColumn(column, column, Object.class)); + } + data.setMetaData(metaData); + + // Add column values + for (String row : rows) { + DataSetRow dsr = new DataSetRow(); + for (DataSetColumn column : metaData.getColumns()) { + if (column.getName().equals("")) { + dsr.addColumnValue(column, row); + } else { + dsr.addColumnValue(column, + ((Cohort) cohortCrossTabDataSetRow.getColumnValue(row + "." + column)).size()); + } + } + data.addRow(dsr); + } + dataSetsToRender.put(name, data); } else { dataSetsToRender.put(name, ds); } diff --git a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java index a9baf556..ada318f9 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java +++ b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java @@ -138,8 +138,8 @@ public ReportDefinition constructReportDefinition() { String[] vaccinationConceptsListWithSequence = inizService .getValueFromKey("report.MSPP.vaccination.vaccinationConceptsListWithSequence").split(","); - if (inizService.getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept") != null && - inizService.getConceptFromKey("report.MSPP.vaccination.yesAnswer.concept") != null) { + if (inizService.getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept") != null + && inizService.getConceptFromKey("report.MSPP.vaccination.yesAnswer.concept") != null) { CodedObsCohortDefinition isChildFullyVaccinated = new CodedObsCohortDefinition(); isChildFullyVaccinated.setQuestion( inizService.getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept")); diff --git a/api/src/main/resources/messages.properties b/api/src/main/resources/messages.properties index ed37e0cd..666b166b 100644 --- a/api/src/main/resources/messages.properties +++ b/api/src/main/resources/messages.properties @@ -98,7 +98,7 @@ ${project.parent.artifactId}.report.MSPP.visits.category1.label=Children under o ${project.parent.artifactId}.report.MSPP.visits.category2.label=Children aged 1 to 4 years old ${project.parent.artifactId}.report.MSPP.visits.category3.label=Children aged 5 to 9 years old ${project.parent.artifactId}.report.MSPP.visits.category4.label=Children aged 10 to 14 -${project.parent.artifactId}.report.MSPP.visits.category5.label=Children aged 10 to 14 +${project.parent.artifactId}.report.MSPP.visits.category5.label=Children aged 15 to 19 ${project.parent.artifactId}.report.MSPP.visits.category6.label=Young adults aged 20 to 24 ${project.parent.artifactId}.report.MSPP.visits.category7.label=Pregnant women ${project.parent.artifactId}.report.MSPP.visits.category8.label=Family planning clients diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/DisbursementReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/DisbursementReportManagerTest.java index 99cdc71f..537119e0 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/DisbursementReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/DisbursementReportManagerTest.java @@ -85,7 +85,7 @@ public void testReport() throws Exception { // replay ReportDefinition rd = manager.constructReportDefinition(); ReportData data = rds.evaluate(rd, context); - + // verify boolean indicator1 = false; boolean indicator2 = false; @@ -95,19 +95,23 @@ public void testReport() throws Exception { for (Iterator itr = ds.iterator(); itr.hasNext();) { DataSetRow row = itr.next(); - if (row.getColumnValue("Indicator").equals("Registered patients aged 40 and above that have had their NCD screening for the first time")) { + if (row.getColumnValue("Indicator").equals( + "Registered patients aged 40 and above that have had their NCD screening for the first time")) { assertEquals("7", row.getColumnValue("Value")); indicator1 = true; } - if (row.getColumnValue("Indicator").equals("Registered women aged 30 to 49 years that have had their CCS screening for the first time")) { + if (row.getColumnValue("Indicator").equals( + "Registered women aged 30 to 49 years that have had their CCS screening for the first time")) { assertEquals("8", row.getColumnValue("Value")); indicator2 = true; } - if (row.getColumnValue("Indicator").equals("80% (of registered women aged 30 to 49 years that have had their CCS screening for the first time) were VIA positive and referred")) { + if (row.getColumnValue("Indicator").equals( + "80% (of registered women aged 30 to 49 years that have had their CCS screening for the first time) were VIA positive and referred")) { assertEquals("Yes", row.getColumnValue("Value")); indicator3 = true; } - if (row.getColumnValue("Indicator").equals("80% (of registered patients with a Follow-up date and diagnosed with Hypertension & Diabetes) were given medication with at least a 4 weeks prescription")) { + if (row.getColumnValue("Indicator").equals( + "80% (of registered patients with a Follow-up date and diagnosed with Hypertension & Diabetes) were given medication with at least a 4 weeks prescription")) { assertEquals("Yes", row.getColumnValue("Value")); indicator4 = true; } diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPAntenatalReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPAntenatalReportManagerTest.java index e8c8f403..a0f81158 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPAntenatalReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPAntenatalReportManagerTest.java @@ -114,7 +114,6 @@ public void testReport() throws Exception { for (Iterator itr = data.getDataSets().get("MSPP Antenatal Risks").iterator(); itr.hasNext();) { DataSetRow row = itr.next(); - // In CrossTabDataSet reports all rows and columns are in fact just columns of // one row diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java index f28505e8..20017e79 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java @@ -89,7 +89,7 @@ public void testReport_shouldEvaluateReportWithCorrectData() throws Exception { for (Iterator itr = data.getDataSets().get("MSPP Family Planning").iterator(); itr.hasNext();) { DataSetRow row = itr.next(); - + Cohort existentMicrolutFemaleLT25 = (Cohort) row.getColumnValue("existentMicrolutFemaleLT25.Total"); assertNotNull(existentMicrolutFemaleLT25); assertEquals(1, existentMicrolutFemaleLT25.getSize()); diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java index bcf993c0..e0d534d4 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java @@ -133,7 +133,7 @@ public void testReport() throws Exception { assertNotNull(_prenatalFemalesReceivedDT); assertEquals(1, _prenatalFemalesReceivedDT.getSize()); - Cohort _0mTo1yFemalesFullyVaccinated= (Cohort) row + Cohort _0mTo1yFemalesFullyVaccinated = (Cohort) row .getColumnValue("Is the child fully vaccinated?." + MSPPVaccinationReportManager.col1); assertNotNull(_0mTo1yFemalesFullyVaccinated); assertEquals(1, _0mTo1yFemalesFullyVaccinated.getSize()); diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/OutpatientConsultationReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/OutpatientConsultationReportManagerTest.java index 234136ad..de90e29c 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/OutpatientConsultationReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/OutpatientConsultationReportManagerTest.java @@ -80,7 +80,8 @@ public void setupReport_shouldSetupOPDRecBook() { // verif Assert.assertNotNull(rs.getReportDesignByUuid("42b32ac1-fcd0-473d-8fdb-71fd6fc2e26d")); - assertEquals(rs.getReportDesignByUuid("42b32ac1-fcd0-473d-8fdb-71fd6fc2e26d").getRendererType(), CohortCrossTabDataSetCsvReportRenderer.class); + assertEquals(rs.getReportDesignByUuid("42b32ac1-fcd0-473d-8fdb-71fd6fc2e26d").getRendererType(), + CohortCrossTabDataSetCsvReportRenderer.class); } @@ -173,12 +174,12 @@ public void testReportRenderer() throws Exception { // Replay renderer.render(data, "", out); - + // Verify - String expectedFormat = "\"\",\"0-28 days - Males\",\"0-28 days - Females\",\"1-12 months - Males\",\"1-12 months - Females\",\"1-4 years - Males\",\"1-4 years - Females\",\"5-14 years - Males\",\"5-14 years - Females\",\"15-24 years - Males\",\"15-24 years - Females\",\"25-49 years - Males\",\"25-49 years - Females\",\"50-64 years - Males\",\"50-64 years - Females\",\"_> 65 years - Males\",\"_> 65 years - Females\",\"Total - Males\",\"Total - Females\",\"Total\",\"Referred To - Males\",\"Referred To - Females\"\r\n" + - "\"MALARIA\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"1\",\"1\",\"2\",\"0\",\"1\"\r\n" + - "\"FEVER\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"1\",\"0\",\"0\"\r\n" + - "\"DIABETES\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"1\",\"0\",\"0\"\r\n"; + String expectedFormat = "\"\",\"0-28 days - Males\",\"0-28 days - Females\",\"1-12 months - Males\",\"1-12 months - Females\",\"1-4 years - Males\",\"1-4 years - Females\",\"5-14 years - Males\",\"5-14 years - Females\",\"15-24 years - Males\",\"15-24 years - Females\",\"25-49 years - Males\",\"25-49 years - Females\",\"50-64 years - Males\",\"50-64 years - Females\",\"_> 65 years - Males\",\"_> 65 years - Females\",\"Total - Males\",\"Total - Females\",\"Total\",\"Referred To - Males\",\"Referred To - Females\"\r\n" + + "\"MALARIA\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"1\",\"1\",\"2\",\"0\",\"1\"\r\n" + + "\"FEVER\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"1\",\"0\",\"0\"\r\n" + + "\"DIABETES\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"1\",\"0\",\"0\"\r\n"; assertThat(out.toString(), is(expectedFormat)); } diff --git a/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json b/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json index d4c13d76..1828b7aa 100644 --- a/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json +++ b/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json @@ -135,5 +135,5 @@ "report.patients.active" : "true", "report.appointments.active" : "true", "report.visits.active" : "true", - "report.disbursement.active": "true" + "report.disbursement.active" : "true" } \ No newline at end of file From d082e9cda0b9cc12e3dea4529c88199f22d747e7 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Wed, 18 Feb 2026 00:16:26 +0530 Subject: [PATCH 2/8] Fix row value --- api/src/main/resources/messages_fr.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/resources/messages_fr.properties b/api/src/main/resources/messages_fr.properties index 3b6ca001..10adbd25 100644 --- a/api/src/main/resources/messages_fr.properties +++ b/api/src/main/resources/messages_fr.properties @@ -114,7 +114,7 @@ ${project.parent.artifactId}.report.MSPP.emergency.notInCategory.label=Soignés ${project.parent.artifactId}.report.MSPP.emergency.men=Hommes ${project.parent.artifactId}.report.MSPP.emergency.women=Femmes ${project.parent.artifactId}.report.MSPP.emergency.children=Enfants -${project.parent.artifactId}.report.MSPP.emergency.boys=Garçons 0-14 ans +${project.parent.artifactId}.report.MSPP.emergency.boys=Garçons ${project.parent.artifactId}.report.MSPP.emergency.girls=Filles ${project.parent.artifactId}.report.MSPP.emergency.0_14years=(0-14 ans) ${project.parent.artifactId}.report.MSPP.emergency.above14years=(15 ans et plus) From 27f9b6004a8c3cfa9f218059e58ac2a5b94135f6 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Fri, 20 Feb 2026 17:37:01 +0530 Subject: [PATCH 3/8] Fix emergency report --- .../reports/MSPPEmergencyReportManager.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManager.java b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManager.java index 3f7cb93b..fbab2606 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManager.java +++ b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManager.java @@ -178,11 +178,11 @@ public ReportDefinition constructReportDefinition() { emergencies.addRow( svc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.women") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(sexualViolence, males, above14y), parameterMappings); + createCohortComposition(sexualViolence, females, above14y), parameterMappings); emergencies.addRow( - svc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.women") + " " + svc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.men") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(sexualViolence, females, above14y), parameterMappings); + createCohortComposition(sexualViolence, males, above14y), parameterMappings); } { @@ -203,11 +203,11 @@ public ReportDefinition constructReportDefinition() { emergencies.addRow( pvc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.men") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(physicalViolence, females), parameterMappings); + createCohortComposition(physicalViolence, males), parameterMappings); emergencies.addRow( pvc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.women") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(physicalViolence, males), parameterMappings); + createCohortComposition(physicalViolence, females), parameterMappings); } @@ -230,11 +230,11 @@ public ReportDefinition constructReportDefinition() { emergencies.addRow( ovtc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.men") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(otherViolenceType, females), parameterMappings); + createCohortComposition(otherViolenceType, males), parameterMappings); emergencies.addRow( ovtc.getDisplayString() + " - " + MessageUtil.translate("commonreports.report.MSPP.emergency.women") + " " + MessageUtil.translate("commonreports.report.MSPP.emergency.above14years"), - createCohortComposition(otherViolenceType, males), parameterMappings); + createCohortComposition(otherViolenceType, females), parameterMappings); } From 38b72fd1700f28787057885163b0b004f8657ac5 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Fri, 20 Feb 2026 17:48:35 +0530 Subject: [PATCH 4/8] Fix row copy text --- .../MSPPFamilyPlanningReportManager.java | 123 +++++++++++------- 1 file changed, 76 insertions(+), 47 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManager.java b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManager.java index 78f25f28..c6e74bb5 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManager.java +++ b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManager.java @@ -103,86 +103,115 @@ public ReportDefinition constructReportDefinition() { // Add rows for each method and user type combination // Microgynon - New Users - familyPlanning.addRow("newMycogynonFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, - microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 1), - parameterMappings); - familyPlanning.addRow("newMycogynonFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, - microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 1), - parameterMappings); familyPlanning .addRow( - "existentMycogynonFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, microgynonConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 1), + "New - Mycogynon - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 1), parameterMappings); familyPlanning .addRow( - "existentMycogynonFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, microgynonConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 1), + "New - Mycogynon - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 1), parameterMappings); + familyPlanning.addRow( + "Existent - Mycogynon - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 1), + parameterMappings); + familyPlanning.addRow( + "Existent - Mycogynon - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + microgynonConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 1), + parameterMappings); // Microlut - New Users - familyPlanning.addRow("newMicrolutFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, microlutConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 1), parameterMappings); - familyPlanning.addRow("newMicrolutFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, microlutConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 1), parameterMappings); familyPlanning .addRow( - "existentMicrolutFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, microlutConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 1), + "New - Microlut - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + microlutConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 1), parameterMappings); familyPlanning .addRow( - "existentMicrolutFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, microlutConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 1), + "New - Microlut - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + microlutConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 1), parameterMappings); + familyPlanning.addRow("Existent - Microlut - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + microlutConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 1), + parameterMappings); + familyPlanning.addRow("Existent - Microlut - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + microlutConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 1), + parameterMappings); // Depo Provera - New Users (3 months interval) - familyPlanning.addRow("newDepoFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, + familyPlanning.addRow("New - Depo - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, depoProveraInjectionConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 3), parameterMappings); - familyPlanning.addRow("newDepoFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, - depoProveraInjectionConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 3), + familyPlanning.addRow( + "New - Depo - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + depoProveraInjectionConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 3), parameterMappings); familyPlanning - .addRow("existentDepoFemaleLT25", + .addRow("Existent - Depo - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, depoProveraInjectionConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 3), parameterMappings); familyPlanning - .addRow("existentDepoFemaleGT25", + .addRow("Existent - Depo - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, depoProveraInjectionConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 3), parameterMappings); // Jadel - New Users (5 years interval) - familyPlanning.addRow("newJadelFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, jadelConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 60), parameterMappings); - familyPlanning.addRow("newJadelFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, jadelConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 60), parameterMappings); - familyPlanning.addRow("existentJadelFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, jadelConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 60), parameterMappings); - familyPlanning.addRow("existentJadelFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, jadelConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 60), parameterMappings); + familyPlanning.addRow("New - Jadel - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + jadelConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 60), + parameterMappings); + familyPlanning.addRow("New - Jadel - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + jadelConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 60), + parameterMappings); + familyPlanning + .addRow( + "Existent - Jadel - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + jadelConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 60), + parameterMappings); + familyPlanning + .addRow( + "Existent - Jadel - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + jadelConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 60), + parameterMappings); // Condom - New Users (no interval) - familyPlanning.addRow("newCondomFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 0), parameterMappings); - familyPlanning.addRow("newCondomFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 0), parameterMappings); - familyPlanning.addRow("existentCondomFemaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 0), parameterMappings); - familyPlanning.addRow("existentCondomFemaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 0), parameterMappings); + familyPlanning.addRow("New - Condom - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, false, 0), + parameterMappings); + familyPlanning.addRow("New - Condom - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "F", 25, true, 0), + parameterMappings); + familyPlanning + .addRow( + "Existent - Condom - Female - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, false, 0), + parameterMappings); + familyPlanning + .addRow( + "Existent - Condom - Female - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "F", 25, true, 0), + parameterMappings); // Condom - Males - familyPlanning.addRow("newCondomMaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "M", 25, false, 0), parameterMappings); - familyPlanning.addRow("newCondomMaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, newConceptId, "M", 25, true, 0), parameterMappings); - familyPlanning.addRow("existentCondomMaleLT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "M", 25, false, 0), parameterMappings); - familyPlanning.addRow("existentCondomMaleGT25", createFamilyPlanningCohort(fpAdministredConceptId, condomConceptId, - familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "M", 25, true, 0), parameterMappings); + familyPlanning.addRow("New - Condom - Male - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "M", 25, false, 0), + parameterMappings); + familyPlanning.addRow("New - Condom - Male - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, newConceptId, "M", 25, true, 0), + parameterMappings); + familyPlanning + .addRow( + "Existent - Condom - Male - below 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "M", 25, false, 0), + parameterMappings); + familyPlanning + .addRow( + "Existent - Condom - Male - above 25", createFamilyPlanningCohort(fpAdministredConceptId, + condomConceptId, familyPlanningConceptId, typeOfUserConceptId, existentConceptId, "M", 25, true, 0), + parameterMappings); // Add a single column for "Total" (all patients) GenderCohortDefinition allGender = new GenderCohortDefinition(); From 3bebfb7a76d43322a18cbb3b4e907b262830b342 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Mon, 23 Feb 2026 19:09:00 +0530 Subject: [PATCH 5/8] Fix unit tests --- .../reports/MSPPEmergencyReportManagerTest.java | 5 +++++ .../commonreports/reports/MSPPVisitsReportManagerTest.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java index c33802c5..0dfa7175 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java @@ -128,6 +128,11 @@ private Map getColumnValues() { map.put("Sexual Violence - Women (15 years and above).Deceased", 0); map.put("Sexual Violence - Women (15 years and above).Left without permission", 0); map.put("Sexual Violence - Women (15 years and above).Cared for", 0); + map.put("Sexual Violence - Men (15 years and above).Total number", 0); + map.put("Sexual Violence - Men (15 years and above).Referred", 0); + map.put("Sexual Violence - Men (15 years and above).Deceased", 0); + map.put("Sexual Violence - Men (15 years and above).Left without permission", 0); + map.put("Sexual Violence - Men (15 years and above).Cared for", 0); map.put("Physical Violence - Children (0-14 years).Total number", 1); map.put("Physical Violence - Children (0-14 years).Referred", 0); map.put("Physical Violence - Children (0-14 years).Deceased", 1); diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java index 3c82e544..059464d2 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java @@ -121,7 +121,7 @@ public void testReport() throws Exception { expectedValuesMap.put("Children under one year old", "null:null"); expectedValuesMap.put("Children aged 1 to 4 years old", "1.0:null"); expectedValuesMap.put("Children aged 5 to 9 years old", "1.0:null"); - expectedValuesMap.put("Children aged 10 to 14", "4.0:null"); + expectedValuesMap.put("Children aged 10 to 14", "2.0:null"); expectedValuesMap.put("Young adults aged 20 to 24", "3.0:1.0"); expectedValuesMap.put("Pregnant women", "null:3.0"); expectedValuesMap.put("Family planning clients", "null:2.0"); From 6e2a24ab0d962c8e19b31ed7f50e866d132ef583 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Mon, 23 Feb 2026 19:43:28 +0530 Subject: [PATCH 6/8] Fix unit tests+ --- .../commonreports/reports/MSPPEmergencyReportManagerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java index 0dfa7175..d2ef6b63 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java @@ -155,7 +155,7 @@ private Map getColumnValues() { map.put("Other Violence Type - Children (0-14 years).Cared for", 0); map.put("Other Violence Type - Men (15 years and above).Total number", 0); map.put("Other Violence Type - Men (15 years and above).Referred", 0); - map.put("Other Violence Type - Men (15 years and above).Deceased", 0); + map.put("Other Violence Type - Men (15 years and above).Deceased", 1); map.put("Other Violence Type - Men (15 years and above).Left without permission", 0); map.put("Other Violence Type - Men (15 years and above).Cared for", 0); map.put("Other Violence Type - Women (15 years and above).Total number", 1); From b88572a08f0d374e68d62dd46bb6f4ba5530132c Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Tue, 24 Feb 2026 15:06:26 +0530 Subject: [PATCH 7/8] Fix unit tests++ --- .../MSPPEmergencyReportManagerTest.java | 6 ++--- .../MSPPFamilyPlanningReportManagerTest.java | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java index d2ef6b63..b17864b4 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPEmergencyReportManagerTest.java @@ -153,14 +153,14 @@ private Map getColumnValues() { map.put("Other Violence Type - Children (0-14 years).Deceased", 0); map.put("Other Violence Type - Children (0-14 years).Left without permission", 0); map.put("Other Violence Type - Children (0-14 years).Cared for", 0); - map.put("Other Violence Type - Men (15 years and above).Total number", 0); + map.put("Other Violence Type - Men (15 years and above).Total number", 1); map.put("Other Violence Type - Men (15 years and above).Referred", 0); map.put("Other Violence Type - Men (15 years and above).Deceased", 1); map.put("Other Violence Type - Men (15 years and above).Left without permission", 0); map.put("Other Violence Type - Men (15 years and above).Cared for", 0); - map.put("Other Violence Type - Women (15 years and above).Total number", 1); + map.put("Other Violence Type - Women (15 years and above).Total number", 0); map.put("Other Violence Type - Women (15 years and above).Referred", 0); - map.put("Other Violence Type - Women (15 years and above).Deceased", 1); + map.put("Other Violence Type - Women (15 years and above).Deceased", 0); map.put("Other Violence Type - Women (15 years and above).Left without permission", 0); map.put("Other Violence Type - Women (15 years and above).Cared for", 0); map.put("Medical and surgical emergency - Digestive.Total number", 2); diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java index 20017e79..ab8686d0 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPFamilyPlanningReportManagerTest.java @@ -90,51 +90,51 @@ public void testReport_shouldEvaluateReportWithCorrectData() throws Exception { for (Iterator itr = data.getDataSets().get("MSPP Family Planning").iterator(); itr.hasNext();) { DataSetRow row = itr.next(); - Cohort existentMicrolutFemaleLT25 = (Cohort) row.getColumnValue("existentMicrolutFemaleLT25.Total"); + Cohort existentMicrolutFemaleLT25 = (Cohort) row.getColumnValue("Existent - Microlut - Female - below 25.Total"); assertNotNull(existentMicrolutFemaleLT25); assertEquals(1, existentMicrolutFemaleLT25.getSize()); - Cohort existentMicrolutFemaleGT25 = (Cohort) row.getColumnValue("existentMicrolutFemaleGT25.Total"); + Cohort existentMicrolutFemaleGT25 = (Cohort) row.getColumnValue("Existent - Microlut - Female - above 25.Total"); assertNotNull(existentMicrolutFemaleGT25); assertEquals(0, existentMicrolutFemaleGT25.getSize()); - Cohort newMicrolutFemaleLT25 = (Cohort) row.getColumnValue("newMicrolutFemaleLT25.Total"); + Cohort newMicrolutFemaleLT25 = (Cohort) row.getColumnValue("New - Microlut - Female - below 25.Total"); assertNotNull(newMicrolutFemaleLT25); assertEquals(1, newMicrolutFemaleLT25.getSize()); - Cohort newMicrolutFemaleGT25 = (Cohort) row.getColumnValue("newMicrolutFemaleGT25.Total"); + Cohort newMicrolutFemaleGT25 = (Cohort) row.getColumnValue("New - Microlut - Female - above 25.Total"); assertNotNull(newMicrolutFemaleGT25); assertEquals(0, newMicrolutFemaleGT25.getSize()); - Cohort newJadelFemaleLT25 = (Cohort) row.getColumnValue("newJadelFemaleLT25.Total"); + Cohort newJadelFemaleLT25 = (Cohort) row.getColumnValue("New - Jadel - Female - below 25.Total"); assertNotNull(newJadelFemaleLT25); assertEquals(1, newJadelFemaleLT25.getSize()); - Cohort newJadelFemaleGT25 = (Cohort) row.getColumnValue("newJadelFemaleGT25.Total"); + Cohort newJadelFemaleGT25 = (Cohort) row.getColumnValue("New - Jadel - Female - above 25.Total"); assertNotNull(newJadelFemaleGT25); assertEquals(0, newJadelFemaleGT25.getSize()); - Cohort existentDepoFemaleGT25 = (Cohort) row.getColumnValue("existentDepoFemaleGT25.Total"); + Cohort existentDepoFemaleGT25 = (Cohort) row.getColumnValue("Existent - Depo - Female - above 25.Total"); assertNotNull(existentDepoFemaleGT25); assertEquals(1, existentDepoFemaleGT25.getSize()); - Cohort existentDepoFemaleLT25 = (Cohort) row.getColumnValue("existentDepoFemaleLT25.Total"); + Cohort existentDepoFemaleLT25 = (Cohort) row.getColumnValue("Existent - Depo - Female - below 25.Total"); assertNotNull(existentDepoFemaleLT25); assertEquals(0, existentDepoFemaleLT25.getSize()); - Cohort newCondomFemaleGT25 = (Cohort) row.getColumnValue("newCondomFemaleGT25.Total"); + Cohort newCondomFemaleGT25 = (Cohort) row.getColumnValue("New - Condom - Female - above 25.Total"); assertNotNull(newCondomFemaleGT25); assertEquals(1, newCondomFemaleGT25.getSize()); - Cohort newCondomFemaleLT25 = (Cohort) row.getColumnValue("newCondomFemaleLT25.Total"); + Cohort newCondomFemaleLT25 = (Cohort) row.getColumnValue("New - Condom - Female - below 25.Total"); assertNotNull(newCondomFemaleLT25); assertEquals(0, newCondomFemaleLT25.getSize()); - Cohort newCondomMaleGT25 = (Cohort) row.getColumnValue("newCondomMaleGT25.Total"); + Cohort newCondomMaleGT25 = (Cohort) row.getColumnValue("New - Condom - Male - above 25.Total"); assertNotNull(newCondomMaleGT25); assertEquals(1, newCondomMaleGT25.getSize()); - Cohort newCondomMaleLT25 = (Cohort) row.getColumnValue("newCondomMaleLT25.Total"); + Cohort newCondomMaleLT25 = (Cohort) row.getColumnValue("New - Condom - Male - below 25.Total"); assertNotNull(newCondomMaleLT25); assertEquals(0, newCondomMaleLT25.getSize()); } From e94b7a4d3af1a7c4bd2178372f5252e82e26f7b5 Mon Sep 17 00:00:00 2001 From: Siddharth Vaish Date: Tue, 24 Feb 2026 15:33:53 +0530 Subject: [PATCH 8/8] Fix unit tests+++ --- .../commonreports/reports/MSPPVisitsReportManagerTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java index 059464d2..fe43b495 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVisitsReportManagerTest.java @@ -122,6 +122,7 @@ public void testReport() throws Exception { expectedValuesMap.put("Children aged 1 to 4 years old", "1.0:null"); expectedValuesMap.put("Children aged 5 to 9 years old", "1.0:null"); expectedValuesMap.put("Children aged 10 to 14", "2.0:null"); + expectedValuesMap.put("Children aged 15 to 19", "2.0:null"); expectedValuesMap.put("Young adults aged 20 to 24", "3.0:1.0"); expectedValuesMap.put("Pregnant women", "null:3.0"); expectedValuesMap.put("Family planning clients", "null:2.0");