From dc17b37f089ce1844abd0f32cb55ef3549b001d0 Mon Sep 17 00:00:00 2001 From: injiri Date: Wed, 20 Mar 2024 18:38:49 +0300 Subject: [PATCH] include 705b bean and set report dimension --- .../builder/common/MOH705BReportBuilder.java | 15 +++++++++++++-- .../main/resources/content/kenyaemr.common.xml | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java index 4a7f1d5c29..4c715adc28 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java @@ -17,6 +17,7 @@ import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportAddonUtils; import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportingUtils; import org.openmrs.module.kenyaemr.reporting.library.ETLReports.MOH705.MOH705IndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; import org.openmrs.module.reporting.evaluation.parameter.Mapped; @@ -113,6 +114,15 @@ public class MOH705BReportBuilder extends AbstractReportBuilder { @Autowired private MOH705IndicatorLibrary moh705indicatorLibrary; + private final CommonDimensionLibrary commonDimensionLibrary; + + @Autowired + public MOH705BReportBuilder(MOH705IndicatorLibrary moh705indicatorLibrary, CommonDimensionLibrary commonDimensionLibrary) { + this.moh705indicatorLibrary = moh705indicatorLibrary; + this.commonDimensionLibrary = commonDimensionLibrary; + } + + @Override protected List getParameters(ReportDescriptor reportDescriptor) { return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date", @@ -126,13 +136,14 @@ protected List> buildDataSets(ReportDescriptor reportD } protected DataSetDefinition moh705BDataset() { + String indParams = "startDate=${startDate},endDate=${endDate}"; + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); cohortDsd.setName("MOH705B"); cohortDsd.setDescription("MOH 705B"); - - String indParams = "startDate=${startDate},endDate=${endDate}"; + cohortDsd.addDimension("day", ReportUtils.map(commonDimensionLibrary.encountersOfMonthPerDay(), indParams)); ReportingUtils.addRow(cohortDsd, "DA", "Diarrhoea", ReportUtils.map( diff --git a/api/src/main/resources/content/kenyaemr.common.xml b/api/src/main/resources/content/kenyaemr.common.xml index f5886f143c..6d2d666bfa 100644 --- a/api/src/main/resources/content/kenyaemr.common.xml +++ b/api/src/main/resources/content/kenyaemr.common.xml @@ -88,7 +88,7 @@ - +