Charlson and Van Walraven scores

suppressWarnings({
  suppressPackageStartupMessages({
    requireNamespace("knitr")
    library("icd")
    library("magrittr")
    })
  })
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

ICD code scoring systems

A common use of ICD codes is calculation as a Charlson score, which gives a measure of how well a patient is, albeit based on the limited available in admission and discharge diagnoses. The Charlson scoring system attributes scores based on presence of diseases falling into any of the Charlson comorbidities. Quan updated the scores given to each comorbidity to better reflect morbidity and mortality in a more recent population. Van Walraven provides a similar scoring methodology for the Elixhauser comorbidities (as used by the US AHRQ).

More complicated scoring systems may use lab values, patient demographic information, and so on. Any contributions to this package for calculations of scoring systems based on comorbidities and other data would be welcome.

Vermont example data, Charlson scores

The Vermont data are actually discharge, not admission diagnoses, but can be used to demonstrate generating Charlson scores.

head(icd.data::vermont_dx[1:10])
v <- wide_to_long(icd.data::vermont_dx)
head(v)
charlson(v) %>% summary
head(charlson(v))
head(names(charlson(v)))

This default result is a numeric vector with the names (top numbers) as the patient identifiers. Those who like working with 'tidy' data frames can use:

head(charlson(v, return_df = TRUE))

Behind the scenes, icd calculates the Charlson comorbidities for those ICD codes, applies the Charlson scoring system, and returns the Charlson score for each patient.

Vermont example data, Van Walraven scores

The same principle can be used to calculate the Van Walraven score, which is the Charlson score counterpart for Elixhauser comorbidities.

`Vermont Van Walraven Scores` <- van_walraven(v)
hist(`Vermont Van Walraven Scores`)

Working with mixed ICD-9 and ICD-10 codes

All the functions in icd work with one code type. They are tolerant of having different sub-types of ICD-9 or ICD-10 codes together for comorbidity calculations, but patients with mixed data can be combined. E.g. patient A has two ICD-9 and two ICD-10 codes:

icd9 <- data.frame(pts = c("A", "A"), c("041.04", "244.9"))
icd10 <- data.frame(pts = c("A", "A"), c("C82.28", "M08.979"))
both <- comorbid_elix(icd9) | comorbid_elix(icd10)
van_walraven_from_comorbid(both)

More commonly, some patients before a certain date will have ICD-9 codes, and others will have ICD-10 codes:

icd9 <- data.frame(pts = c("A", "A"), c("041.04", "244.9"))
icd10 <- data.frame(pts = c("B", "B"), c("C82.28", "M08.979"))
both <- rbind(comorbid_elix(icd9), comorbid_elix(icd10))
van_walraven_from_comorbid(both)


Try the icd package in your browser

Any scripts or data that you put into this service are public.

icd documentation built on Aug. 19, 2018, 1:05 a.m.