Skip to content

Commit

Permalink
Snakecase functions are deprecated in CDMConnector 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmlft committed Jan 23, 2025
1 parent 04dd18d commit 76676dd
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions data-raw/test_db/create_test_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ schema <- "main"
withr::with_envvar(
new = c(EUNOMIA_DATA_FOLDER = dir),
{
invisible(CDMConnector::eunomia_dir(dataset_name = name, cdm_version = version))
invisible(CDMConnector::eunomiaDir(datasetName = name, cdmVersion = version))
}
)

Expand Down Expand Up @@ -103,7 +103,7 @@ write_table(dummy_observations, con, "observation", schema = schema)

## Verify integrity, turn warnings into error
tryCatch(
cdm <- CDMConnector::cdm_from_con(con, cdm_schema = schema, write_schema = schema),
cdm <- CDMConnector::cdmFromCon(con, cdmSchema = schema, writeSchema = schema),
warning = function(cnd) {
msg <- sprintf("CDM integrity check produced warnings: %s", conditionMessage(cnd))
rlang::abort(msg, call = NULL)
Expand Down
8 changes: 4 additions & 4 deletions data-raw/test_db/dummy/add_dummy_bundle_concepts.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ here::i_am("data-raw/test_db/dummy/add_dummy_bundle_concepts.R")
db_path <- here::here("data-raw/test_db/eunomia/synthea-allergies-10k_5.3_1.0.duckdb")

con <- connect_to_db(db_path)
eunomia_cdm <- CDMConnector::cdm_from_con(
eunomia_cdm <- CDMConnector::cdmFromCon(
con = con,
cdm_schema = "main",
write_schema = "main",
cdm_name = "synthea-allergies-10k"
cdmSchema = "main",
writeSchema = "main",
cdmName = "synthea-allergies-10k"
)
eunomia_concepts <- eunomia_cdm$concept |> dplyr::pull(concept_id)

Expand Down
2 changes: 1 addition & 1 deletion preprocessing/R/concepts.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate the `omopcat_concepts` table
#'
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdm_from_con()`]
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdmFromCon()`]
#' @param concept_ids A vector of concept IDs
#'
#' @return A `data.frame` with the monthly counts
Expand Down
2 changes: 1 addition & 1 deletion preprocessing/R/monthly_counts.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate the 'omopcat_monthly_counts' table
#'
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdm_from_con()`]
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdmFromCon()`]
#' @param threshold Threshold value below which values will be replaced by `replacement`
#' @param replacement Value with which values below `threshold` will be replaced
#' @param level At which resolution the counts should be summarised.
Expand Down
12 changes: 6 additions & 6 deletions preprocessing/R/preprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ preprocess <- function(out_path = Sys.getenv("PREPROCESS_OUT_PATH")) {
#' configured through the relevant environment variables.
#'
#' When not in production, creates a CDM from one of the CDMConnector example
#' datasets (`"GiBleed"` by default), using [`CDMConnector::eunomia_dir()`].
#' datasets (`"GiBleed"` by default), using [`CDMConnector::eunomiaDir()`].
#' This is intended for use in testing and development.
#'
#' @param .envir Passed on to [`connect_to_db()`], controls the scope in which the database
Expand All @@ -124,16 +124,16 @@ preprocess <- function(out_path = Sys.getenv("PREPROCESS_OUT_PATH")) {
)
} else {
name <- Sys.getenv("DB_NAME", unset = "GiBleed")
duckdb_path <- CDMConnector::eunomia_dir(dataset_name = name)
duckdb_path <- CDMConnector::eunomiaDir(datasetName = name)
rlang::check_installed("duckdb")
con <- connect_to_db(duckdb::duckdb(duckdb_path), .envir = .envir)
}

# Load the data in a CDMConnector object
CDMConnector::cdm_from_con(
CDMConnector::cdmFromCon(
con = con,
cdm_schema = Sys.getenv("DB_CDM_SCHEMA", unset = "main"),
write_schema = Sys.getenv("DB_CDM_SCHEMA", unset = "main"),
cdm_name = name
cdmSchema = Sys.getenv("DB_CDM_SCHEMA", unset = "main"),
writeSchema = Sys.getenv("DB_CDM_SCHEMA", unset = "main"),
cdmName = name
)
}
2 changes: 1 addition & 1 deletion preprocessing/R/summary_stats.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate the `omopcat_summary_stats` table
#'
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdm_from_con()`]
#' @param cdm A [`CDMConnector`] object, e.g. from [`CDMConnector::cdmFromCon()`]
#' @param threshold Threshold value below which values will be replaced by `replacement`
#' @param replacement Value with which values below `threshold` will be replaced
#'
Expand Down
2 changes: 1 addition & 1 deletion preprocessing/man/generate_concepts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion preprocessing/man/generate_monthly_counts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion preprocessing/man/generate_summary_stats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 76676dd

Please sign in to comment.