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.2 [unknown@Linux 6.5.0-1025-azure:R 4.4.2//tmp/RtmpDAEb5F/file19d332eba788.duckdb]
#> $ cohort_definition_id <int> 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3…
#> $ subject_id <int> 2088, 569, 1024, 1072, 1428, 2501, 3079, 3547, 37…
#> $ cohort_start_date <date> 1911-09-07, 1939-09-24, 1982-03-17, 1990-10-28, …
#> $ cohort_end_date <date> 1911-12-06, 1939-10-29, 1982-03-31, 1990-11-18, …
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 |