In this example we’re going to summarise the characteristics of individuals with an ankle sprain, ankle fracture, forearm fracture, or a hip fracture using the Eunomia synthetic data.
We’ll begin by creating our study cohorts.
library(CDMConnector)
library(CohortConstructor)
library(CodelistGenerator)
library(PhenotypeR)
library(dplyr)
library(ggplot2)
con <- DBI::dbConnect(duckdb::duckdb(),
dbdir = CDMConnector::eunomiaDir()
)
cdm <- CDMConnector::cdmFromCon(con,
cdmSchema = "main",
writeSchema = "main",
cdmName = "Eunomia"
)
cdm$injuries <- conceptCohort(cdm = cdm,
conceptSet = list(
"ankle_sprain" = 81151,
"ankle_fracture" = 4059173,
"forearm_fracture" = 4278672,
"hip_fracture" = 4230399
),
name = "injuries")
cdm$injuries |>
glimpse()
#> Rows: ??
#> Columns: 4
#> Database: DuckDB v1.1.3 [unknown@Linux 6.5.0-1025-azure:R 4.4.2//tmp/Rtmp7ENswT/file1f3228495c74.duckdb]
#> $ cohort_definition_id <int> 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3…
#> $ subject_id <int> 2334, 3807, 5143, 159, 239, 1072, 1843, 2138, 231…
#> $ cohort_start_date <date> 1942-11-24, 1956-01-02, 1965-04-07, 1976-05-19, …
#> $ cohort_end_date <date> 1943-02-22, 1956-03-02, 1965-05-07, 1976-06-16, …