Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ Imports:
bslib,
checkmate,
data.table,
DBI,
dplyr,
DT,
duckdb,
ellmer,
glue,
httr2,
Expand Down
37 changes: 9 additions & 28 deletions R/cdm54data.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,12 @@ choicesList <- function(tableName) {
return(choicesList[[tableName]])
}

#' Read a parquet file using DuckDB.
#' @param file Path to the parquet file.
#' Read an RDS file.
#' @param file Path to the RDS file.
#' @return A data frame.
#' @noRd
read_parquet_file <- function(file) {
con <- DBI::dbConnect(duckdb::duckdb())
on.exit(DBI::dbDisconnect(
con,
shutdown = TRUE
),
add = TRUE
)
path_sql <- gsub(
"'",
"''",
path.expand(file)
)
DBI::dbGetQuery(
con,
paste0(
"SELECT * FROM read_parquet('",
path_sql,
"')"
)
)
read_rds_file <- function(file) {
readRDS(file)
}

columnNames <- function(
Expand All @@ -58,7 +39,7 @@ columnNames <- function(

# supported_tables <- file.path(cdmSpecificationPath) |>
# list.files() |>
# stringr::str_remove(".parquet")
# stringr::str_remove(".rds")

supported_tables <- c(
"person",
Expand Down Expand Up @@ -86,10 +67,10 @@ columnNames <- function(
cdmSpecificationPath,
paste0(
name,
".parquet"
".rds"
)
)
table_data <- read_parquet_file(file) |>
table_data <- read_rds_file(file) |>
data.table::as.data.table()
if (isTRUE(ommitTime)) {
table_data <- table_data[
Expand Down Expand Up @@ -119,10 +100,10 @@ columnNames <- function(
cdmSpecificationPath,
paste0(
table_name,
".parquet"
".rds"
)
)
table_data <- read_parquet_file(file) |>
table_data <- read_rds_file(file) |>
data.table::as.data.table()
if (isTRUE(ommitTime)) {
table_data <- table_data[
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/cohort.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/concept.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/cost.rds
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/death.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/domain.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/episode.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/note.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added inst/cdmTableSpecifications/emptycdm_5.4/person.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading