Skip to content

Commit

Permalink
add workaround for gibleed condition_occurrence csv column ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
ablack3 committed Sep 18, 2024
1 parent be002d9 commit 29dc6dd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/EunomiaData.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ loadDataFiles <- function(dataPath,
message(dataFileMessage, appendLF = TRUE)
}

# The GiBleed condition occurrence csv file has a column ordering that does
# not match the spec so for now we ignore types in this file
if (inputFormat == "csv") {
if (tableName %in% unique(spec$cdmTableName)) {
if (tableName %in% unique(spec$cdmTableName) && tableName != "condition_occurrence") {
# in the GiBleed dataset there is a cohort_attribute table which is not in the cdm spec csv file
# In the cases of tables not in the cdm spec we will use readr's guess for the R datatype
colTypes <- paste(spec[spec$cdmTableName == tableName,]$readrTypes, collapse = "")
Expand Down Expand Up @@ -259,10 +261,10 @@ loadDataFiles <- function(dataPath,
}

if (verbose) {
message("saving table: ",tableName," (rows: ", nrow(tableData), ")",appendLF = TRUE)
message("saving table: ", tableName," (rows: ", nrow(tableData), ")", appendLF = TRUE)
}

DBI::dbWriteTable(conn = connection, name = tableName, value = tableData, append=TRUE)
DBI::dbWriteTable(conn = connection, name = tableName, value = tableData, append = TRUE)
}
}

Expand Down

0 comments on commit 29dc6dd

Please sign in to comment.