The goal of codemapper is to facilitate working with clinical codes used in electronic health records.
This package relies primarily on UK Biobank resource 592 (Clinical coding classification systems and maps) and the UK Biobank data codings file, both of which are publicly available.
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("rmgpanw/codemapper")
A data analyst using electronic health records for research into hypertension may wish to build a list of clinical codes that capture this condition.
First, build a local resource containing lookup and mapping tables for various clinical codings systems. A dummy dataset is used here:
library(codemapper)
all_lkps_maps_dummy <- build_all_lkps_maps_dummy()
Look up Read 2 codes for hypertension:
htn_read2 <- code_descriptions_like("Hypertension",
code_type = "read2",
all_lkps_maps = all_lkps_maps_dummy)
htn_read2
#> # A tibble: 1 × 3
#> code description code_type
#> <chr> <chr> <chr>
#> 1 G20.. Essential hypertension read2
Map these to ICD10:
htn_icd10 <- map_codes(
codes = htn_read2$code,
from = "read2",
to = "icd10",
all_lkps_maps = all_lkps_maps_dummy
)
htn_icd10
#> # A tibble: 1 × 3
#> code description code_type
#> <chr> <chr> <chr>
#> 1 I10X Essential (primary) hypertension icd10
See vignette('codemapper')
for further details, including how to build a clinical codelist with R Shiny using RunCodelistBuilder()
.
Also included are functions for using CALIBER code lists (vignette('caliber')
) and Phecodes (vignette('phecodes')
) with UK Biobank data.