Error in `eunomiaDir(datasetName = dataset_name, cdmVersion = cdm_version, 
    databaseFile = database_file)`: Set the `EUNOMIA_DATA_FOLDER` environment variable in your .Renviron file.

dus_cohort = dus_cohort, person = person,
comorbidities = comorbidities, medication = medication,
observation_period = observation_period, cohort1 = emptyCohort,
table = cdm$dus_cohort, cohortSetRef = dplyr::tibble(
cohort_definition_id = c(1, 2), cohort_name = c("exposed", "unexposed")
table = cdm$comorbidities, cohortSetRef = dplyr::tibble(
cohort_definition_id = c(1, 2), cohort_name = c("covid", "headache")
cohort_name = c("acetaminophen", "ibuprophen", "naloxone")
targetCohortTable = "medication", window = c(-365, 0)
targetCohortTable = "comorbidities", window = c(-Inf, 0)
targetCohortTable = "medication", window = list("short" = c(-30, 0))
targetCohortTable = "medication", window = list("long" = c(-365, 0))
omopgenerics::settings(cdm$medication) |> nrow() * 4 # 2 group_level 4 estimate type
omopgenerics::settings(cdm$medication) |> nrow() * 8 # 2 group_level 4 estimate type 2 window
omopgenerics::settings(cdm$comorbidities) |> nrow() * 4 # 2 group_level 4 estimate type
dplyr::filter(variable_name == "Number records")) > 0)
dplyr::filter(variable_name == "Number subjects")) > 0)
dplyr::filter(variable_name == "Number records")) == 0)
dplyr::filter(variable_name == "Number subjects")) == 0)
counts = "not an option", demographics = FALSE
"Cohort start date", "Cohort end date", "Age", "Sex", "Prior observation",
c("Blood type", "Number visits") %in% result$variable_name |> unique()
expect_true("mean" == unique(result$estimate_name[result$variable_name == "Number visits"]))
expect_true("count" == unique(result$estimate_name[result$variable_name == "Blood type"]))
expect_false("Blood type" %in% result$variable_name |> unique())
expect_true("Number visits" %in% result$variable_name |> unique())
cdm <- mockCohortCharacteristics(connectionDetails = connectionDetails)
cdm$cohort1 |> dplyr::filter(cohort_definition_id == 0) |>
targetCohortTable = "cohort2", window = c(-365, 0)
targetCohortTable = "cohort2", window = c(-Inf, 0)
targetCohortTable = "cohort2", window = c(-365, 0), targetCohortId = 1
summariseCharacteristics(tableIntersectFlag = list("Visits" = list(
tableName = "visit_occurrence", window = c(-365, 0)
#     summariseCharacteristics(tableIntersect = list("Visits" = list(
#       tableName = "visit_occurrence", value = "visit_concept_id",
cohort_definition_id = c(1, 1, 1, 2, 2, 2),
observation_period_id = c(1, 2, 3, 4, 5),
tableName = "visit_occurrence", window = c(-Inf, -1)
variable_name == "Number visits anytime before",
variable_name == "Flag visits anytime before",
variable_name == "Date visits anytime before",
variable_name == "Days visits anytime after",
cohort_definition_id = c(1, 1, 1, 1, 1, 1),
targetCohortTable = "cohort1", window = c(-Inf, -1)
variable_name == "Cohort 1 anytime before",
"Cohort 1 (flag) anytime before" = list(
variable_name == "Cohort 1 (flag) anytime before",
variable_name == "Date cohort 1 anytime before",
variable_name == "Days cohort 1 anytime after",
cdm <- CDMConnector::cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")
dplyr::filter(grepl("statin", concept_name, ignore.case = TRUE)) |>
dplyr::filter(grepl("serum", concept_name, ignore.case = TRUE)) |>
dplyr::filter(grepl("allergy", concept_name, ignore.case = TRUE)) |>
dplyr::filter(grepl("bypass", concept_name, ignore.case = TRUE)) |>
dplyr::filter(grepl("laceration", concept_name, ignore.case = TRUE)) |>
conceptSet = codelist, window = c(-Inf, -1)
variable_name == "Codelist count anytime before",
variable_name == "Codelist flag anytime before",
variable_name == "Codelist date anytime before",
variable_name == "Codelist days anytime before",

# 2 group_level 4 estimate type 2 window