Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ablack3 committed Jun 13, 2023
1 parent 42a07f6 commit 764154b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/cdm.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ cdm_from_con <- function(con,
verify_write_access(con, write_schema = write_schema)
}

write_schema_tables <- listTables(con, schema = write_schema)
# Add existing GeneratedCohortSet objects to cdm object
if (!is.null(cohort_tables)) {
if (is.null(write_schema)) {
rlang::abort("write_schema is required when using cohort_tables")
}

write_schema_tables <- listTables(con, schema = write_schema)

for (i in seq_along(cohort_tables)) {

cohort_table <- paste0(write_prefix, cohort_tables[i])
Expand Down Expand Up @@ -128,7 +129,7 @@ cdm_from_con <- function(con,
# create the required cohort_set table
cohort_set_ref <- cohort_ref %>%
dplyr::distinct(.data$cohort_definition_id) %>%
dplyr::mutate(cohort_name = paste("cohort", .data$cohort_definition_id)) %>%
dplyr::mutate(cohort_name = paste("cohort", as.integer(.data$cohort_definition_id))) %>%
computeQuery(name = paste0(cohort_table, "_set"),
schema = write_schema,
temporary = FALSE,
Expand Down

0 comments on commit 764154b

Please sign in to comment.