OHDSI Home | Forums | Wiki | Github

Creating new CDM in R for DuckDB

Hi

I’m trying to instantiate a new CDM in R using duckDB as the DB backend. However, I’m running into csv import warnings with file ‘OMOP_CDMv5.4_Field_Level.csv’.

Warning messages:
1: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  invalid input found on input connection 'C:/Users/RBaxter/AppData/Local/Programs/R/R-4.4.1/library/CommonDataModel/csv/OMOP_CDMv5.4_Field_Level.csv'
2: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  EOF within quoted string
3: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  invalid input found on input connection 'C:/Users/RBaxter/AppData/Local/Programs/R/R-4.4.1/library/CommonDataModel/csv/OMOP_CDMv5.4_Field_Level.csv'
4: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  EOF within quoted string
5: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  invalid input found on input connection 'C:/Users/RBaxter/AppData/Local/Programs/R/R-4.4.1/library/CommonDataModel/csv/OMOP_CDMv5.4_Field_Level.csv'
6: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  EOF within quoted string

I get the same whether I use CommonDataModel::executeDdl or CommonDataModel::buildRelease. Here’s my code using the latter:-

options(scipen = 999999, encoding = "UTF-8", graphics.record = TRUE)

require(librarian)
pkgs <- shelf(this.path, libr, tidyverse, crayon, glue, dplyr, ohdsi/DatabaseConnector,
              tidylog, duckdb, CDMConnector, OHDSI/CommonDataModel, quiet = FALSE)

omop_dir <- path.join(this.proj(), "data/sdtm")

CommonDataModel::buildRelease(cdmVersions = "5.4",
                              targetDialects = "duckdb",
                              outputfolder = path.join(omop_dir, "test.duckdb"))

I’ve validated the CSV file in question, it seems fine, so I assume the problem arises from importing into the DB. Has anyone else had this problem before?

Many thanks, Richard

t