Codelist diagnostics
a02_CodelistDiagnostics.Rmd
Introduction
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.0 [unknown@Linux 6.8.0-1014-azure:R 4.4.1//tmp/RtmpbpMFwy/file1940715e8f2f.duckdb]
#> $ cohort_definition_id <int> 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 2, 2, 2…
#> $ subject_id <int> 4748, 63, 452, 905, 1751, 2006, 2153, 3397, 3666,…
#> $ cohort_start_date <date> 1984-10-25, 2000-10-15, 1964-10-26, 1979-02-26, …
#> $ cohort_end_date <date> 1984-12-24, 2000-10-29, 1964-11-30, 1979-03-12, …
Summarising code use
code_diag <- codelistDiagnostics(cdm$injuries)
tableCohortCodeUse(code_diag)
Database name | ||||||||
---|---|---|---|---|---|---|---|---|
Eunomia | ||||||||
Cohort name | Codelist name | Standard concept name | Standard concept ID | Source concept name | Source concept id | Domain id | Estimate name | |
Record count | Person count | |||||||
ankle_fracture | ankle_fracture | overall | - | overall | overall | overall | 464 | 427 |
Fracture of ankle | 4059173 | Fracture of ankle | 4059173 | condition | 464 | 427 | ||
ankle_sprain | ankle_sprain | overall | - | overall | overall | overall | 1,915 | 1,357 |
Sprain of ankle | 81151 | Sprain of ankle | 81151 | condition | 1,915 | 1,357 | ||
forearm_fracture | forearm_fracture | overall | - | overall | overall | overall | 569 | 510 |
Fracture of forearm | 4278672 | Fracture of forearm | 4278672 | condition | 569 | 510 | ||
hip_fracture | hip_fracture | overall | - | overall | overall | overall | 138 | 132 |
Closed fracture of hip | 4230399 | Closed fracture of hip | 4230399 | condition | 138 | 132 |