Run cohort-level diagnostics
cohortDiagnostics.Rd
Runs phenotypeR diagnostics on the cohort. The diganotics include: * Age groups and sex summarised. * A summary of visits of everyone in the cohort using visit_occurrence table. * A summary of age and sex density of the cohort. * Attritions of the cohorts. * Overlap between cohorts (if more than one cohort is being used).
Examples
# \donttest{
cdm_local <- omock::mockCdmReference() |>
omock::mockPerson(nPerson = 100) |>
omock::mockObservationPeriod() |>
omock::mockConditionOccurrence() |>
omock::mockDrugExposure() |>
omock::mockObservation() |>
omock::mockMeasurement() |>
omock::mockCohort(name = "my_cohort")
cdm_local$visit_occurrence <- dplyr::tibble(
person_id = 1L,
visit_occurrence_id = 1L,
visit_concept_id = 1L,
visit_start_date = as.Date("2000-01-01"),
visit_end_date = as.Date("2000-01-01"),
visit_type_concept_id = 1L
)
cdm_local$procedure_occurrence <- dplyr::tibble(
person_id = 1L,
procedure_occurrence_id = 1L,
procedure_concept_id = 1L,
procedure_date = as.Date("2000-01-01"),
procedure_type_concept_id = 1L
)
db <- DBI::dbConnect(duckdb::duckdb())
cdm <- CDMConnector::copyCdmTo(con = db,
cdm = cdm_local,
schema ="main",
overwrite = TRUE)
cdm$my_cohort |> cohortDiagnostics()
#> • Getting cohort summary
#> ℹ adding demographics columns
#> ℹ adding tableIntersectCount 1/1
#> ℹ summarising data
#> ✔ summariseCharacteristics finished!
#> • Getting age density
#> • Getting cohort attrition
#> # A tibble: 2,307 × 13
#> result_id cdm_name group_name group_level strata_name strata_level
#> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1 mock database cohort_name cohort_1 overall overall
#> 2 1 mock database cohort_name cohort_1 overall overall
#> 3 1 mock database cohort_name cohort_1 overall overall
#> 4 1 mock database cohort_name cohort_1 overall overall
#> 5 1 mock database cohort_name cohort_1 overall overall
#> 6 1 mock database cohort_name cohort_1 overall overall
#> 7 1 mock database cohort_name cohort_1 overall overall
#> 8 1 mock database cohort_name cohort_1 overall overall
#> 9 1 mock database cohort_name cohort_1 overall overall
#> 10 1 mock database cohort_name cohort_1 overall overall
#> # ℹ 2,297 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> # estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> # additional_name <chr>, additional_level <chr>
CDMConnector::cdmDisconnect(cdm = cdm)
# }