Skip to content

Commit

Permalink
include 705b bean and set report dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
Injiri committed Mar 20, 2024
1 parent 7e9c3fb commit dc17b37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Parameter> getParameters(ReportDescriptor reportDescriptor) {
return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date",
Expand All @@ -126,13 +136,14 @@ protected List<Mapped<DataSetDefinition>> 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(
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/resources/content/kenyaemr.common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<ref bean="kenyaemr.common.report.sgbvlinelist"/>
<ref bean="kenyaemr.common.report.sgbvRegister"/>
<ref bean="kenyaemr.common.report.moh705A"/>
<!-- <ref bean="kenyaemr.common.report.moh705B"/>-->
<ref bean="kenyaemr.common.report.moh705B"/>
<ref bean="kenyaemr.common.report.IDSRSuspectedCaseList"/>
</set>
</property>
Expand Down

0 comments on commit dc17b37

Please sign in to comment.