Skip to content

Commit

Permalink
fix oracleTempSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Jan 17, 2025
1 parent 5cfdc38 commit 0fa1c12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions R/AdditionalCovariates.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#' cohort during the time periods relative to target population cohort index
#'
#' @param connection The database connection
#' @param oracleTempSchema The temp schema if using oracle

#' @param tempEmulationSchema The schema to use for temp tables
#' @param oracleTempSchema DEPRECATED The temp schema if using oracle
#' @param cdmDatabaseSchema The schema of the OMOP CDM data
#' @param cdmVersion version of the OMOP CDM data
#' @param cohortTable the table name that contains the target population cohort
Expand All @@ -40,6 +42,7 @@
#' @export
getCohortCovariateData <- function(
connection,
tempEmulationSchema = NULL,
oracleTempSchema = NULL,
cdmDatabaseSchema,
cdmVersion = "5",
Expand All @@ -49,6 +52,14 @@ getCohortCovariateData <- function(
cohortIds,
covariateSettings,
...) {
if (!is.null(oracleTempSchema) && oracleTempSchema != "") {
rlang::warn("The 'oracleTempSchema' argument is deprecated. Use 'tempEmulationSchema' instead.",
.frequency = "regularly",
.frequency_id = "oracleTempSchema"
)
tempEmulationSchema <- oracleTempSchema
}

# Some SQL to construct the covariate:
sql <- paste(
"select a.@row_id_field AS row_id, @covariate_id AS covariate_id,",
Expand Down Expand Up @@ -104,7 +115,7 @@ getCohortCovariateData <- function(
sql <- SqlRender::translate(
sql = sql,
targetDialect = attr(connection, "dbms"),
tempEmulationSchema = oracleTempSchema
tempEmulationSchema = tempEmulationSchema
)

# Retrieve the covariate:
Expand Down Expand Up @@ -135,7 +146,7 @@ getCohortCovariateData <- function(
sql <- SqlRender::translate(
sql = sql,
targetDialect = attr(connection, "dbms"),
tempEmulationSchema = oracleTempSchema
tempEmulationSchema = tempEmulationSchema
)

# Retrieve the covariateRef:
Expand Down
2 changes: 1 addition & 1 deletion R/ExtractData.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ getPlpData <- function(

covariateData <- FeatureExtraction::getDbCovariateData(
connection = connection,
oracleTempSchema = databaseDetails$tempEmulationSchema,
tempEmulationSchema = databaseDetails$tempEmulationSchema,
cdmDatabaseSchema = databaseDetails$cdmDatabaseSchema,
cdmVersion = databaseDetails$cdmVersion,
cohortTable = "#cohort_person",
Expand Down

0 comments on commit 0fa1c12

Please sign in to comment.