# \donttest{
library(CDMConnector)
library(CohortSurvival)
observation_period <- dplyr::tibble(
observation_period_id = c(1, 2, 3, 4, 5,6),
person_id = c(1, 2, 3, 4, 5,6),
observation_period_start_date = c(
rep(as.Date("1980-07-20"),6)
),
observation_period_end_date = c(
rep(as.Date("2023-05-20"),6)
),
period_type_concept_id = c(rep(0,6))
)
deathTable <- dplyr::tibble(
person_id = c(1,2,3),
death_date = c(as.Date("2020-01-01"),
as.Date("2020-01-02"),
as.Date("2020-01-01")))
person <- dplyr::tibble(
person_id = c(1, 2, 3, 4, 5),
year_of_birth = c(rep("1990", 5)),
month_of_birth = c(rep("02", 5)),
day_of_birth = c(rep("11", 5)),
gender_concept_id = c(rep(0,5)),
ethnicity_concept_id = c(rep(0,5)),
race_concept_id = c(rep(0,5))
)
cdm <- omopgenerics::cdmFromTables(
tables = list(
person = person,
observation_period = observation_period,
death = deathTable
),
cdmName = "mock_es"
)
#> Warning: ! 3 column in person do not match expected column type:
#> • `year_of_birth` is character but expected integer
#> • `month_of_birth` is character but expected integer
#> • `day_of_birth` is character but expected integer
db <- DBI::dbConnect(duckdb::duckdb(), ":memory:")
cdm2 = CDMConnector::copy_cdm_to(db,
cdm,
schema = "main")
#> Warning: ! 3 column in person do not match expected column type:
#> • `year_of_birth` is character but expected integer
#> • `month_of_birth` is character but expected integer
#> • `day_of_birth` is character but expected integer
attr(cdm2, "cdm_schema") <- "main"
attr(cdm2, "write_schema") <- "main"
cdm2 <- generateDeathCohortSet(cdm=cdm2,
name = "death_cohort")
#> Warning: `generateDeathCohortSet()` was deprecated in CohortSurvival 0.6.0.
# }