From 96aabb9630708659eb2b98b325acfced5065225b Mon Sep 17 00:00:00 2001 From: Pavel Grafkin Date: Wed, 15 Aug 2018 18:21:35 -0400 Subject: [PATCH] Added ability to select whether rollups should be enabled for Cost & Util reports (cherry picked from commit b1e0a6b) --- .../cohortanalysis/CohortAnalysisTask.java | 26 ++++++++++++++++++- .../webapi/service/CohortAnalysisService.java | 7 +++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/ohdsi/webapi/cohortanalysis/CohortAnalysisTask.java b/src/main/java/org/ohdsi/webapi/cohortanalysis/CohortAnalysisTask.java index 6364f474cf..618a28a150 100644 --- a/src/main/java/org/ohdsi/webapi/cohortanalysis/CohortAnalysisTask.java +++ b/src/main/java/org/ohdsi/webapi/cohortanalysis/CohortAnalysisTask.java @@ -47,6 +47,10 @@ public class CohortAnalysisTask { private List periods; + private boolean rollupUtilizationVisit; + + private boolean rollupUtilizationDrug; + public String getSourceKey() { return sourceKey; } @@ -270,7 +274,27 @@ public void setPeriods(final List periods) { this.periods = periods; } - + + public boolean getRollupUtilizationVisit() { + + return rollupUtilizationVisit; + } + + public void setRollupUtilizationVisit(boolean rollupUtilizationVisit) { + + this.rollupUtilizationVisit = rollupUtilizationVisit; + } + + public boolean getRollupUtilizationDrug() { + + return rollupUtilizationDrug; + } + + public void setRollupUtilizationDrug(boolean rollupUtilizationDrug) { + + this.rollupUtilizationDrug = rollupUtilizationDrug; + } + @Override public String toString() { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/main/java/org/ohdsi/webapi/service/CohortAnalysisService.java b/src/main/java/org/ohdsi/webapi/service/CohortAnalysisService.java index 9b8b5421ae..39eefb4f95 100644 --- a/src/main/java/org/ohdsi/webapi/service/CohortAnalysisService.java +++ b/src/main/java/org/ohdsi/webapi/service/CohortAnalysisService.java @@ -210,12 +210,15 @@ public static String getCohortAnalysisSql(CohortAnalysisTask task) { String[] params = new String[]{"CDM_schema", "results_schema", "source_name", "smallcellcount", "runHERACLESHeel", "CDM_version", "cohort_definition_id", "list_of_analysis_ids", "condition_concept_ids", "drug_concept_ids", "procedure_concept_ids", "observation_concept_ids", - "measurement_concept_ids", "cohort_period_only", "source_id", "periods"}; + "measurement_concept_ids", "cohort_period_only", "source_id", "periods", "rollupUtilizationVisit", "rollupUtilizationDrug"}; + String[] values = new String[]{cdmTableQualifier, resultsTableQualifier, task.getSource().getSourceName(), String.valueOf(task.getSmallCellCount()), String.valueOf(task.runHeraclesHeel()).toUpperCase(), task.getCdmVersion(), cohortDefinitionIds, analysisIds, conditionIds, drugIds, procedureIds, observationIds, measurementIds,String.valueOf(task.isCohortPeriodOnly()), - String.valueOf(task.getSource().getSourceId()), concatenatedPeriods}; + String.valueOf(task.getSource().getSourceId()), concatenatedPeriods, + String.valueOf(task.getRollupUtilizationVisit()).toUpperCase(), String.valueOf(task.getRollupUtilizationDrug()).toUpperCase() + }; sql = SqlRender.renderSql(sql, params, values); sql = SqlTranslate.translateSql(sql, task.getSource().getSourceDialect(), SessionUtils.sessionId(), resultsTableQualifier);