OHDSI / Eunomia

@@ -36,7 +36,10 @@
Loading
36 36
#' @export
37 37
getEunomiaConnectionDetails <- function(databaseFile = tempfile(fileext = ".sqlite")) {
38 38
  extractFolder <- tempdir()
39 -
  unzip(zipfile = system.file("zip", "cdm.zip", package = "Eunomia"), exdir = extractFolder)
39 +
  file <- xzfile(system.file("sqlite", "cdm.tar.xz", package = "Eunomia"), open = "rb")
40 +
  untar(file, exdir = extractFolder)
41 +
  close(file)
42 +
  # unzip(zipfile = system.file("zip", "cdm.zip", package = "Eunomia"), exdir = extractFolder)
40 43
  file.rename(from = file.path(extractFolder, "cdm.sqlite"), to = databaseFile)
41 44
  details <- DatabaseConnector::createConnectionDetails(dbms = "sqlite", server = databaseFile)
42 45
  return(details)

@@ -23,9 +23,32 @@
Loading
23 23
#'
24 24
#'
25 25
#' @examples
26 -
#' \dontrun{
27 -
#' exportToCsv("c:/temp/csv")
28 -
#' }
26 +
#' \donttest{
27 +
#' # For this example we'll create a temp folder:
28 +
#' folder <- tempfile()
29 +
#' dir.create(folder)
30 +
#'
31 +
#' exportToCsv(folder)
32 +
#'
33 +
#' list.files(folder)
34 +
#'
35 +
#'  #  [1] "CARE_SITE.csv"             "CDM_SOURCE.csv"            "COHORT.csv"
36 +
#'  #  [4] "COHORT_ATTRIBUTE.csv"      "CONCEPT.csv"               "CONCEPT_ANCESTOR.csv"
37 +
#'  #  [7] "CONCEPT_CLASS.csv"         "CONCEPT_RELATIONSHIP.csv"  "CONCEPT_SYNONYM.csv"
38 +
#'  # [10] "CONDITION_ERA.csv"         "CONDITION_OCCURRENCE.csv"  "COST.csv"
39 +
#'  # [13] "DEATH.csv"                 "DEVICE_EXPOSURE.csv"       "DOMAIN.csv"
40 +
#'  # [16] "DOSE_ERA.csv"              "DRUG_ERA.csv"              "DRUG_EXPOSURE.csv"
41 +
#'  # [19] "DRUG_STRENGTH.csv"         "FACT_RELATIONSHIP.csv"     "LOCATION.csv"
42 +
#'  # [22] "MEASUREMENT.csv"           "METADATA.csv"              "NOTE.csv"
43 +
#'  # [25] "NOTE_NLP.csv"              "OBSERVATION.csv"           "OBSERVATION_PERIOD.csv"
44 +
#'  # [28] "PAYER_PLAN_PERIOD.csv"     "PERSON.csv"                "PROCEDURE_OCCURRENCE.csv"
45 +
#'  # [31] "PROVIDER.csv"              "RELATIONSHIP.csv"          "SOURCE_TO_CONCEPT_MAP.csv"
46 +
#'  # [34] "SPECIMEN.csv"              "VISIT_DETAIL.csv"          "VISIT_OCCURRENCE.csv"
47 +
#'  # [37] "VOCABULARY.csv"
48 +
#'
49 +
#'  # Cleaning up the temp folder used in this example:
50 +
#'  unlink(folder, recursive = TRUE)
51 +
#'  }
29 52
#'
30 53
#' @export
31 54
exportToCsv <- function(outputFolder = file.path(getwd(), "csv"),
@@ -39,7 +62,7 @@
Loading
39 62
  saveCsv <- function(table) {
40 63
    fileName <- file.path(outputFolder, sprintf("%s.csv", table))
41 64
    writeLines(sprintf("Saving table %s to file %s", table, fileName))
42 -
    data <- renderTranslateQuerySql(conn, "SELECT * FROM @table;", table = table)
65 +
    data <- DatabaseConnector::renderTranslateQuerySql(conn, "SELECT * FROM @table;", table = table)
43 66
    write.csv(data, fileName, row.names = FALSE, na = "")
44 67
    return(NULL)
45 68
  }
Files Coverage
R 72.00%
Project Totals (3 files) 72.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading