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.0.0 [eburn@Windows 10 x64:R 4.2.1/C:\Users\eburn\AppData\Local\Temp\Rtmp4k1fQN\file1a4106e606dc8.duckdb]
#> $ cohort_definition_id <int> 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1…
#> $ subject_id <int> 1447, 2903, 5, 2703, 4719, 2477, 3731, 61, 1964, …
#> $ cohort_start_date <date> 1990-09-21, 2013-12-12, 2012-10-08, 2014-10-07, …
#> $ cohort_end_date <date> 1990-10-12, 2014-01-02, 2012-12-07, 2014-10-28, …