knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(codemapper) library(dplyr) all_lkps_maps_dummy <- build_all_lkps_maps_dummy()
ICD10 codes may be recorded as either 'ICD10_CODE' or 'ALT_CODE' format. For example, 'E10.9' (Type 1 diabetes mellitus without complications) is recorded as 'E109' in 'ALT_CODE' format.
Both formats are provided in the ICD10 lookup table:
all_lkps_maps_dummy$icd10_lkp
However only the 'ALT_CODE' format is used in all other mapping tables that include ICD10 codes:
all_lkps_maps_dummy$icd9_icd10 %>% select(ICD9, ICD10, DESCRIPTION_ICD10)
Searching for ICD10 codes in 'ICD10_FORMAT' will yield no results:
# ICD10_CODE format - no codes found lookup_codes(codes = "E10.9", code_type = "icd10", all_lkps_maps = all_lkps_maps_dummy, unrecognised_codes = "warning") # ALT_CODE format - now recognised lookup_codes(codes = "E109", code_type = "icd10", all_lkps_maps = all_lkps_maps_dummy, unrecognised_codes = "warning")
Use reformat_icd10_codes()
to convert from one form to the other:
reformat_icd10_codes(icd10_codes = c("E10.9"), all_lkps_maps = all_lkps_maps_dummy, input_icd10_format = "ICD10_CODE", output_icd10_format = "ALT_CODE") %>% lookup_codes(code_type = "icd10", all_lkps_maps = all_lkps_maps_dummy)
While for many ICD10 codes simply removing the '.' will correctly convert from 'ICD10_CODE' format to 'ALT_CODE' format, this approach will not work in the following cases:
Undivided 3 character ICD10 codes, which have an appended 'X' character in 'ALT_CODE' format. For example, 'I10' for Essential (primary) hypertension is recorded as 'I10X'.
r
reformat_icd10_codes(icd10_codes = c("I10"),
all_lkps_maps = all_lkps_maps_dummy,
input_icd10_format = "ICD10_CODE",
output_icd10_format = "ALT_CODE") %>%
lookup_codes(code_type = "icd10",
all_lkps_maps = all_lkps_maps_dummy)
ICD10 codes with a 5th character modifier. In these cases, a single code in 'ICD10_CODE' format will map to multiple codes in 'ALT_CODE`format and vice versa.
```r
m90_alt_code <- reformat_icd10_codes(icd10_codes = c("M90.0"), all_lkps_maps = all_lkps_maps_dummy, input_icd10_format = "ICD10_CODE", output_icd10_format = "ALT_CODE") %>% lookup_codes(code_type = "icd10", all_lkps_maps = all_lkps_maps_dummy)
m90_alt_code
reformat_icd10_codes( icd10_codes = m90_alt_code$code, all_lkps_maps = all_lkps_maps_dummy, input_icd10_format = "ALT_CODE", output_icd10_format = "ICD10_CODE" ) ```
UK Biobank data also records ICD10 codes in 'ALT_CODE' format, with the exception of undivided 3 character ICD10 codes, where no 'X' is appended. For example, 'I10X' for Essential (primary) hypertension is recorded as 'I10' in UK Biobank.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.