Using Hierarchical Condition Codes

Andrew Cooper (original)

Jack Wasey (minor updates)

2019-05-06

Hierarchical Condition Categories (HCC) is a method of categorizing ICD codes created by the Centers for Medicare and Medicaid Services (CMS), which is implemented in the icd package for R. The package provides fast comorbidity calculations for HCCs and other maps which translate ICD codes to comorbidities.

HCC is designed to categorize the risk level of a patient with chronic or serious illness using diagnoses and demographic information. Healthcare providers implement HCC in payment models for patients, as it can help predict the amount of services a patient will need in the future. HCC can be a useful tool in analysis with ICD codes, and the ICD package provides methods to use them.

HCC first assigns ICD codes to Condition Categories (CC). Condition categories are numeric values ranked based on severity/risk. If an ICD code belongs to more than one CC, the most severe CC is assigned. In other words, HCC classifies patients based on their most severe conditions.

We can see the mapping of ICD-9 and ICD-10 codes to HCC with the icd9_map_cc and icd10_map_cc data.

library("icd")
head(icd9_map_cc)
##   icd_code  cc year
## 1     0031   2 2007
## 2    00322 112 2007
## 3    00323  37 2007
## 4    00324  37 2007
## 5     0064 112 2007
## 6     0074   5 2007

The method returns a table with each ICD-9 code and its corresponding CC. The third column labeled “year” specifies the year that a ICD-9 code was assigned to a corresponding CC. This is needed because HCC has been changed and updated over the years, so the CC assigned to a code in one year might be different from the CC assigned to that same code in another year.

ICD also provides a method for mapping specific ICD codes to HCCs. The method comorbid_hcc takes as input a list of ICD-9 or ICD-10 codes and outputs a mapping of those codes to their corresponding CCs. For this example, we have an arbitrary table of five ICD-9 codes along with their corresponding patient identifiers and dates of visit.

pts <- data.frame(patient_id = c("1", "2", "3", "4", "4"),
                  icd_code = c("20084", "1742", "30410", "41514", "95893"),
                  date = as.Date(c("2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04", "2011-01-04")))

pts
##   patient_id icd_code       date
## 1          1    20084 2011-01-01
## 2          2     1742 2011-01-02
## 3          3    30410 2011-01-03
## 4          4    41514 2011-01-04
## 5          4    95893 2011-01-04

Unlike the other icd comorbidity functions, comorbid_hcc requires a data frame in the ‘long’ format (i.e., multiple rows per patients). If the data has one row per patient, but multiple codes and dates in different columns, this is the ‘wide’ format. Both codes and dates would have to be gathered together into their own columns, using tools like dplyr before passing the data to comorbid_hcc. comorbid_hcc also requires the ICD codes to be in ‘short’ format. If your codes are in “decimal” format, you can easily convert them with the function decimal_to_short.

Now that our data are in the correct form, we run the mapping function comorbid_hcc with our input, specifying the name of the column in our dataset that contains patients’ visit dates.

comorbid_hcc(pts)
##   patient_id       date hcc
## 1          1 2011-01-01   9
## 2          2 2011-01-02  10
## 3          3 2011-01-03  52
## 4          4 2011-01-04 164

Each of the four patients is assigned to an appropriate CC based on the risk level of their most severe diagnoses.