Error in `utils::download.file(url = url, destfile = file.path(pathToData, zipName), mode = "wb", method = "auto", quiet = FALSE, extra = list(progressfunction = function(downloaded, total) {     progress <- min(1, downloaded/total)     cli::cli_progress_update(id = pb, set = progress) }))`: download from 'https://cdmconnectordata.blob.core.windows.net/cdmconnector-example-data/empty_cdm_5.4.zip' failed

test_that("checkTablesColumns function works csv with test data", {
listPatientTables <- checkTablesColumns(cdmVersion, filePath, extraTable = FALSE)
expect_in(names(listPatientTables), c("person", "observation_period", "condition_occurrence", "pregnancy",
test_that("checkTablesColumns function works csv with test data - some tables and columns in uppercase", {
expect_in(names(listPatientTables), c("person", "observation_period", "condition_occurrence", "drug_exposure"))
lapply(names(listPatientTables), FUN = function(tableName) {
test_that("checkTablesColumns function works csv with table 'pregnancy'", {
listPatientTables <- checkTablesColumns(cdmVersion, filePath, extraTable = TRUE)
expect_error(checkTablesColumns(cdmVersion, filePath, extraTable = FALSE))
test_that("checkTablesColumns function works csv", {
expect_error(checkTablesColumns(cdmVersion, filePath, extraTable = "pregnancys"))
test_that("Reading patients XLSX and JSON creation for pregnancy", {
# outputPath <- file.path(tempdir(), "test1")
# outputPath explicitly NULL to create the testCases in the testthat folder
readPatients.xl(filePath = filePath, outputPath = NULL, extraTable = FALSE)
test_that("Reading patients XLSX and JSON creation", {
readPatients.xl(filePath = filePath, testName = "pregnancy", outputPath = NULL, extraTable = TRUE)
test_that("Patients to CDM xlsx function", {
TestGenerator::readPatients.xl(filePath = filePath, outputPath = NULL)
cdm <- TestGenerator::patientsCDM(pathJson = NULL, testName = "pregnancy")
number_persons <- cdm[["person"]] %>% dplyr::pull(person_id)
test_that("Patients to CDM xlsx function pregnancy extra table", {
TestGenerator::readPatients.xl(filePath = filePath, testName = "pregnancy", outputPath = NULL, extraTable = TRUE)
expect_equal(cdm$pregnancy %>% colnames(), c("pregnancy_occurrence_id", "person_id", "pregnancy_concept_id", "pregnancy_start_date"))
test_that("Read patients empty tables xl", {
cdm <- TestGenerator::patientsCDM(pathJson = NULL, testName = "test")
test_that("Reading sample MIMIC patients CSV files and JSON creation", {
test_that("Reading MIMIC patients CSV files and JSON creation", {
pathToZipFile <- downloadTestData(datasetName = "mimicIV",
test_that("Mimic data Patients to CDM function", {
cdm <- TestGenerator::patientsCDM(pathJson = outputPath, testName = "test", cdmName = cdmName)
number_persons <- cdm[["person"]] %>% dplyr::pull(person_id) %>% length()
measurement_ids <- cdmTables$measurement %>% pull(measurement_id)
test_that("Patients to CDM version 5.4", {
TestGenerator::readPatients(filePath = filePath, testName = "pregnancy", outputPath = NULL, extraTable = TRUE)
cdm <- TestGenerator::patientsCDM(pathJson = NULL, testName = "pregnancy", cdmVersion = cdmVersion)
# errors if environment variables are not defined
expect_error(TestGenerator::patientsCDM(pathJson = NULL, testName = "pregnancy", cdmVersion = cdmVersion, dbms = "sqlserver"))
expect_error(TestGenerator::patientsCDM(pathJson = NULL, testName = "pregnancy", cdmVersion = cdmVersion, dbms = "spark"))