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::eunomia_dir()
)
cdm <- CDMConnector::cdm_from_con(con,
cdm_schem = "main",
write_schema = "main",
cdm_name = "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.4.0/C:\Users\eburn\AppData\Local\Temp\RtmpQ5dPSc\file6cbc7ab01fbe.duckdb]
#> $ cohort_definition_id <int> 2, 2, 3, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2…
#> $ subject_id <int> 1079, 1796, 4675, 1878, 3644, 418, 3612, 32, 3827…
#> $ cohort_start_date <date> 1983-02-06, 2016-05-01, 2006-11-11, 1976-02-08, …
#> $ cohort_end_date <date> 1983-02-20, 2016-06-05, 2006-12-11, 1976-02-29, …
Database name | |||||||||
---|---|---|---|---|---|---|---|---|---|
Eunomia | |||||||||
Cohort name | Codelist name | Standard concept name | Standard concept ID | Source concept name | Source concept ID | Source concept value | Domain ID | Estimate name | |
Record count | Person count | ||||||||
ankle_fracture | ankle_fracture | overall | - | NA | NA | NA | NA | 464 | 427 |
Fracture of ankle | 4059173 | Fracture of ankle | 4059173 | 16114001 | condition | 464 | 427 | ||
ankle_sprain | ankle_sprain | overall | - | NA | NA | NA | NA | 1,915 | 1,357 |
Sprain of ankle | 81151 | Sprain of ankle | 81151 | 44465007 | condition | 1,915 | 1,357 | ||
forearm_fracture | forearm_fracture | overall | - | NA | NA | NA | NA | 569 | 510 |
Fracture of forearm | 4278672 | Fracture of forearm | 4278672 | 65966004 | condition | 569 | 510 | ||
hip_fracture | hip_fracture | overall | - | NA | NA | NA | NA | 138 | 132 |
Closed fracture of hip | 4230399 | Closed fracture of hip | 4230399 | 359817006 | condition | 138 | 132 |