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.1.3 [unknown@Linux 6.5.0-1025-azure:R 4.4.2//tmp/RtmpeAWfLq/file1f8c1218097f.duckdb]
#> $ cohort_definition_id <int> 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 1…
#> $ subject_id <int> 42, 1475, 3119, 3547, 5119, 1569, 2160, 2724, 275…
#> $ cohort_start_date <date> 1930-10-04, 1951-02-25, 1985-07-03, 1977-12-03, …
#> $ cohort_end_date <date> 1931-01-02, 1951-04-26, 1985-09-01, 1978-01-02, …
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 |