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

Art report ver nov 2021 #129

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -195,6 +196,7 @@
<filtering>true</filtering>
</testResource>
</testResources>

</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,30 @@ public class IsantePlusReportsProperties{
public static final String ART_DISPENSATION_FOLLOW_UP_UUID = "ef282113-32bd-49d7-870f-0ef41443e8de";

public static final String NEXT_VISIT_BY_PERIOD_UUID = "f3bef310-0e62-4b4f-88f1-8b7983ea51cb";

public static final String ACTIVITY_AFTER_DISC_BY_PERIOD = "7414a044-ace9-4140-88f2-5b79d869b5c9";

public static final String PATIENTS_VACCINATED_FOR_COVID19 = "de5c0d89-4d01-4f1a-99dd-20b3dd778bc";

public static final String PATIENTS_DIAGNOSE_FOR_COVID19 = "c6381c6e-b9a4-49d3-84bd-210a0bc6b0dd";

public static final String WEEKLYMONITORINGREPORT_UUID = "1c558cf7-d44c-49f2-bf9e-a43be418c990";

public static final String PATIENTS_CONFIRM_COVID19 = "358f6c1f-6751-4ed0-8567-95a3ac227f39";

public static final String PATIENTS_SUSPECTED_COVID19 = "27f98dae-6c6d-4424-87d2-bd41305253f4";

public static final String PATIENTS_HIV_WITHOUT_POSITIVE_HIV_TEST = "3d931155-97ce-4c83-8652-37735bf48e45";

public static final String ACTIVE_PATIENTS_VIRALLOAD_TWELVE_MONTHS = "bb53535b-4d85-4315-8506-8b242e60cfd9";

public static final String ACTIVE_PATIENTS_SCREENED_FOR_TB_UUID = "8a6bf7f0-5a50-4221-83ad-61d29057864e";

public static final String PATIENT_WITH_INCOMPLETE_PROPHYLAXIS_AGAINST_TB_UUID = "f48cf8ec-feb2-4473-89ec-4ab19dc48738";

public static final String PATIENT_SCREENED_NEGATIVE_AGAINST_TB_WITH_NO_PROPHYLAXIS_UUID = "85d9ca70-81d7-4082-93c0-d9eeed450632";

public static final String DDPREPORTBYPERIOD_UUID = "3510620c-5eb8-4ca0-b680-eebc80502ebc";

public static final String PATIENT_WITH_FINGER_PRINT_UUID = "2a06491b-9f73-40a6-bed6-8c39fade8d7a";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.openmrs.GlobalProperty;
import org.openmrs.api.context.Context;
import org.openmrs.module.ModuleFactory;
import org.openmrs.module.isanteplusreports.alertprecoce.util.RegisterAllAlertPrecoceReports;
import org.openmrs.module.isanteplusreports.healthqual.util.RegisterAllHealthQualReports;
import org.openmrs.module.isanteplusreports.pnlsReport.RegisterAllPnlsReports;
import org.openmrs.module.isanteplusreports.util.RegisterAllOtherReports;
Expand All @@ -29,6 +30,7 @@ public void registerReports() {
RegisterAllHealthQualReports.registerAll();
RegisterPatientsArvStatusReports.registerAllPatientsArvStatusReports();
RegisterAllPnlsReports.registerAll();
RegisterAllAlertPrecoceReports.registerAll();
Context.getAdministrationService().saveGlobalProperty(new GlobalProperty("reports.moduleVersion", version));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package org.openmrs.module.isanteplusreports.alertprecoce;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceIndicator;
import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants;
import org.openmrs.module.reporting.report.definition.ReportDefinition;
import org.openmrs.module.reporting.report.definition.service.ReportDefinitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AlertPrecoceManager {

private static final String[] alertPrecoceIndicatorsUuid = {
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_1_UUID,
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_2_UUID,
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_4_UUID,
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_5_UUID,
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_6_UUID,
AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_7_UUID
};


private static final String[] artDistributionIndicatorsUuid = {
AlertPrecoceReportsConstants.APPOINTMENT_PERIOD_INDICATOR_UUID,
AlertPrecoceReportsConstants.DISPENSINGART_PERIOD_INDICATOR_UUID,
AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_UUID,
AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_UUID
};

/*PsychoSocial*/
private static final String[] psychoSocialIndicatorsUuid = {
AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_UUID,
AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_UUID
};

private static final String[] fingerPrintIndicatorsUuid = {
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_UUID,
AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_UUID
};

private static final String[] transisionedPatientIndicatorsUuid = {
AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_UUID
};

private static final String[] vitalStatisticsIndicatorsUuid = {
AlertPrecoceReportsConstants.VITAL_STATISTICS_UUID
};

//private Map<String, AlertPrecoceIndicatorOption> options = new HashMap<>();

@Autowired
private ReportDefinitionService reportDefinitionService;

public List<AlertPrecoceIndicator> getAlertPrecoceIndicators() {
return uuidToReportDefinition(Arrays.asList(alertPrecoceIndicatorsUuid));
}

public List<AlertPrecoceIndicator> getArtDistributionIndicators() {
return uuidToReportDefinition(Arrays.asList(artDistributionIndicatorsUuid));
}
public List<AlertPrecoceIndicator> getPsychoSocialIndicators() {
return uuidToReportDefinition(Arrays.asList(psychoSocialIndicatorsUuid));
}
public List<AlertPrecoceIndicator> getFingerPrintIndicators() {
return uuidToReportDefinition(Arrays.asList(fingerPrintIndicatorsUuid));
}

public List<AlertPrecoceIndicator> getTransisionedPatientIndicators() {
return uuidToReportDefinition(Arrays.asList(transisionedPatientIndicatorsUuid));
}

public List<AlertPrecoceIndicator> getvitalStatisticsIndicators() {
return uuidToReportDefinition(Arrays.asList(vitalStatisticsIndicatorsUuid));
}

private List<AlertPrecoceIndicator> uuidToReportDefinition(List<String> uuids) {
List<AlertPrecoceIndicator> indicators = new ArrayList<AlertPrecoceIndicator>();
for (String uuid : uuids) {
ReportDefinition reportDefinition = reportDefinitionService.getDefinitionByUuid(uuid);
//AlertPrecoceIndicatorOption option = options.get(uuid);
if (reportDefinition != null) {
indicators.add(new AlertPrecoceIndicator(reportDefinition, null));
}
}
return indicators;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package org.openmrs.module.isanteplusreports.alertprecoce;

import java.util.List;

import org.openmrs.module.isanteplusreports.library.dimension.CommonDimension;
import org.openmrs.module.isanteplusreports.library.indicator.AlertPrecoceReportIndicatorLibrary;
import org.openmrs.module.isanteplusreports.reporting.utils.ReportUtils;
import org.openmrs.module.reporting.common.MessageUtil;
import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition;
import org.openmrs.module.reporting.dataset.definition.DataSetDefinition;
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
import org.openmrs.module.reporting.evaluation.parameter.Parameter;
import org.openmrs.module.reporting.indicator.CohortIndicator;

public class AlertPrecoceReportDataset {

public DataSetDefinition constructDataSet(String reportName, String sqlDen, String sqlNum, List<Parameter> parameters) {
CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition();
dsd.setName(reportName);
dsd.setDescription(MessageUtil.translate(reportName));
dsd.setParameters(parameters);

dsd.addDimension("gender", ReportUtils.map(new CommonDimension().gender(), ""));

CohortIndicator numCohortIndicator = AlertPrecoceReportIndicatorLibrary.cohortIndicatorFromSqlResource(sqlNum,reportName + "_num", parameters);
CohortIndicator denCohortIndicator = AlertPrecoceReportIndicatorLibrary.cohortIndicatorFromSqlResource(sqlDen,reportName + "_den", parameters);
/*
dsd.addColumn(
"Numerator",
"Numerator",
Mapped.mapStraightThrough(numCohortIndicator),
"");

dsd.addColumn(
"denominator",
"Denominator",
Mapped.mapStraightThrough(denCohortIndicator),
"");

dsd.addColumn(
"pourcentage",
"Pourcentage",
Mapped.mapStraightThrough(denCohortIndicator),
""); */

dsd.addColumn(
"femaleNumerator",
"Female Numerator",
Mapped.mapStraightThrough(numCohortIndicator),
"gender=F");

dsd.addColumn(
"maleNumerator",
"Male Numerator",
Mapped.mapStraightThrough(numCohortIndicator),
"gender=M");

dsd.addColumn(
"totalNumerator",
"Total Numerator",
Mapped.mapStraightThrough(numCohortIndicator),
"");

dsd.addColumn(
"maleDenominator",
"Male Denominator",
Mapped.mapStraightThrough(denCohortIndicator),
"gender=M");

dsd.addColumn(
"femaleDenominator",
"Female Denominator",
Mapped.mapStraightThrough(denCohortIndicator),
"gender=F");

dsd.addColumn(
"totalDenominator",
"Total Denominator",
Mapped.mapStraightThrough(denCohortIndicator),
"");

return dsd;

}

}
Loading