https://github.com/rmgpanw/codemapper
R package for working with clinical codes
https://github.com/rmgpanw/codemapper
rpackage ukbiobank
Last synced: 8 months ago
JSON representation
R package for working with clinical codes
- Host: GitHub
- URL: https://github.com/rmgpanw/codemapper
- Owner: rmgpanw
- License: other
- Created: 2022-04-26T20:57:55.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-07-15T10:12:53.000Z (11 months ago)
- Last Synced: 2025-09-05T05:16:24.606Z (9 months ago)
- Topics: rpackage, ukbiobank
- Language: R
- Homepage: https://rmgpanw.github.io/codemapper/
- Size: 9.74 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Codemeta: codemeta.json
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# codemapper
[](https://github.com/rmgpanw/codemapper/actions) [](https://codecov.io/gh/rmgpanw/codemapper?branch=master) [](https://github.com/rmgpanw/codemapper/actions) [](https://rstudio.cloud/project/4007004) [](https://zenodo.org/badge/latestdoi/485945478) [](https://www.repostatus.org/#wip)
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](https://biobank.ndph.ox.ac.uk/ukb/refer.cgi?id=592)) and the UK Biobank [data codings file](https://biobank.ctsu.ox.ac.uk/crystal/exinfo.cgi?src=accessing_data_guide), both of which are publicly available.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
```{r eval=FALSE}
# install.packages("devtools")
devtools::install_github("rmgpanw/codemapper")
```
## Basic example
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:
```{r example}
library(codemapper)
all_lkps_maps_dummy <- build_all_lkps_maps_dummy()
```
Look up Read 2 codes for hypertension:
```{r}
htn_read2 <- code_descriptions_like("Hypertension",
code_type = "read2",
all_lkps_maps = all_lkps_maps_dummy)
htn_read2
```
Map these to ICD10:
```{r}
htn_icd10 <- map_codes(
codes = htn_read2$code,
from = "read2",
to = "icd10",
all_lkps_maps = all_lkps_maps_dummy
)
htn_icd10
```
See `vignette('codemapper')` for further details, including how to build a clinical codelist with R Shiny using `RunCodelistBuilder()`.
## UK Biobank
Also included are functions for using CALIBER code lists (`vignette('caliber')`) and Phecodes (`vignette('phecodes')`) with UK Biobank data.