-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwva2022.rmd
69 lines (50 loc) · 1.51 KB
/
wva2022.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: "World Health Organization (WHO) 2022 Verbal Autopsy (VA) Codes"
output: rmarkdown::github_document
author:
- Bryan Gascon <[email protected]>
- Richard Wen <[email protected]>
---
WHO VA 2022 codes to ICD mapping.
## Libraries
```{r}
library(tidyverse)
library(cghrCodes)
```
## Read Data
Read data from `../data` folder:
* `whovatoicd10mapping.csv`: original raw WHO VA mappings compiled from the WHO VA 2022 PDF manual by Bryan Gascon
```{r}
wva2022raw <- read_csv("../data/whova2022toicd10mapping.csv", show_col_types=FALSE)
wva2022raw
```
## Preprocess
Preprocess the data by removing `VAs-` from the codes.
```{r}
wva2022 <- wva2022raw %>%
rename_all(tolower) %>%
mutate(who_va_code=str_remove(who_va_code, "^VAs-+"))
wva2022
```
## Collapse ICD-10 Ranges
Collapse the individual ICD-10 ranges to add a short form column with consecutive ranges defined by `-`:
```{r}
wva2022$icd_range_codes_short <- apply(wva2022, 1, function(x) paste(collapseICD10(x["icd_range_codes"]), collapse=","))
wva2022
```
## Expand ICD-10 Ranges
Expands the ICD-10 codes from the `icd_range_codes` column to create an ICD-10 code for each WHO VA code:
```{r}
icd10towva2022 <- expandICD10Data(
wva2022,
icd10Column="icd_range_codes",
expandColumn="icd10_code"
)
icd10towva2022
```
## Save Data
Writes the collapsed and expanded WHO VA 2022 agreement codes to the `../data` folder.
```{r}
write_csv(wva2022, "../data/wva2022_raw.csv", na="")
write_csv(icd10towva2022, "../data/icd10towva2022_raw.csv", na="")
```