From d30b34d541b50d2d2f1a19c569e7afb07799673b Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Fri, 6 Oct 2023 09:53:04 -0700 Subject: [PATCH] Bad table naming fix --- R/cohort-diagnostics-definition.R | 7 +++---- R/cohort-diagnostics-main.R | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/R/cohort-diagnostics-definition.R b/R/cohort-diagnostics-definition.R index 5c4842c3..937f2176 100644 --- a/R/cohort-diagnostics-definition.R +++ b/R/cohort-diagnostics-definition.R @@ -210,14 +210,13 @@ getConceptSetDetailsFromCohortDefinition <- getCdCohortRows <- function(dataSource, cohortIds) { - sql <- "SELECT {@use_cg_table} ? {cohort_definition_id as cohort_id,} * FROM @schema.@cohort_table - WHERE {@use_cg_table} ? {cohort_definition_id} : {cohort_id} IN (@cohort_ids)" + sql <- "SELECT * FROM @schema.@cohort_table + WHERE cohort_id IN (@cohort_ids)" dataSource$connectionHandler$queryDb( sql = sql, schema = dataSource$schema, cohort_table = dataSource$cohortTableName, - cohort_ids = cohortIds, - use_cg_table = dataSource$useCgTable + cohort_ids = cohortIds ) } diff --git a/R/cohort-diagnostics-main.R b/R/cohort-diagnostics-main.R index af0e136e..dd4ae2a7 100644 --- a/R/cohort-diagnostics-main.R +++ b/R/cohort-diagnostics-main.R @@ -274,7 +274,7 @@ createCdDatabaseDataSource <- function( } getDatabaseTable <- function(dataSource) { - databaseTable <- loadResultsTable(dataSource, dataSource$databaseTable, required = TRUE) + databaseTable <- loadResultsTable(dataSource, dataSource$prefixTable(dataSource$databaseTable), required = TRUE) if (nrow(databaseTable) > 0 & "vocabularyVersion" %in% colnames(databaseTable)) { databaseTable <- databaseTable %>%