Skip to contents

Converts a vector of ICD diagnosis codes into a vector of Clinical Classifications Software (CCS) categories using the HCUP's software

Usage

classify_ccs(icd_codes, code_type, level = NULL)

Source

HCUP page for CCS with ICD-9

HCUP page for CCS beta with ICD-10

Arguments

icd_codes

Vector of ICD codes, without decimals

code_type

One of "dx9", "dx10", "pr9", or "pr10", corresponding to the type and version of ICD codes used

level

The level of CCS to use. The default is to use the single-level CCS category ("single"). See Details section for use with mutli-level CCS

Value

A vector of the same length as icd_codes. If level="all", then a tibble will be returned, with each ICD code per row

Details

Single vs Multi-level CCS categories

Unlike the CCS (CCS Refined), the original CCS classification has "single-level" and "multi-level" categories.

This system classifies all diagnoses and procedures into unique groups. The single-level CCS aggregates diagnoses into 285 mutually exclusive categories and procedures into 231 mutually exclusive categories.

The multi-level CCS expands the single-level CCS into a hierarchical system. The multi-level system has four levels for diagnoses and three levels for procedures, which provide the opportunity to examine general groupings or to assess very specific conditions and procedures. The multi-level CCS groups single-level CCS categories into broader body systems or condition categories (e.g., "Diseases of the Circulatory System," "Mental Disorders," and "Injury").

The levels allowed in the multi-level CCS depends on the version/type of ICD codes used:

  • dx9 (ICD-9-CM diagnosis): Allows levels 1 - 4

  • pr9 (ICD-9-CM procedure): Allows levels 1 - 3

  • dx10 and pr10 (ICD-10): Allows levels 1 - 2

An example using CCS for diagnosis codes is shown below:

CCS_lvl1CCS_level2CCS (single-level)
DX-1DX-1.1DX1, DX2, DX3, DX9
DX-1DX-1.2DX4
DX-1DX-1.3DX5, DX6, DX7
DX-1DX-1.4DX8
DX-1DX-1.5DX10

It also splits single-level CCS categories to provide more detail. For example, the single-level CCS diagnosis category 4 (Mycoses) can be further split into 1.2.1 (Candidiasis of the mouth) and 1.2.2 (Other mycoses).

Further details can be found on the CCS fact sheet.

Problems with the original notation

The notation used in the original CCS categories has a few limitations in how it names categories.

First, the CCS category CCS = '3' maps to "Other bacterial infections" for diagnostic codes, but the same category (CCS = '3') maps to "Laminectomy" for procedures. Second, the CCS category is supposed to be treated as a string (because HCUP designs their software for SAS), but R will appropriately assume these categories are numbers.

The third issue is the ambiguity of single-level and multi-level CCS categories. In the original software, the first level of the multi-level CCS uses the same syntax as the single-level categories. For example, "4" represents "Mycoses" as a single-level category, but maps to "Diseases of the blood and blood-forming organs" as a multi-level category!

This all turns out to be incredibly confusing as the same number "3" could represent:

  • "Other bacterial infections" if it's the single-level category for a diagnosis

  • "Endocrine; nutritional; and metabolic diseases and immunity disorders" if it's the multi-level category for a diagnosis

  • "Laminectomy" if it's the single-level category for a procedure

  • "Operations on the eye" if it's the multi-level category for a procedure

Notation used in this package

To address these issues, this package prepends "DX" or "PR" before the default CCS category (e.g. 3 becomes DX3 or PR3 for diagnoses or procedures, respectively). For the multi-level categories, the prefixes are "DX-" and "PR-".

Although this is a trivial change for most applications, it is mentioned here because (for the purposes of reproducibility) this notation should be changed back to the original format for any publications or uses beyond this package.

See also

See explain_ccs to convert the CCS category into a description of the category

Use ccsr_dx to use CCSR categories, which are prefered for ICD-10 data

CCS_dx9_map, CCS_pr9_map, CCS_dx10_map, and CCS_pr10_map in the hcup.data package for the datasets

Examples

library(dplyr)
## Look up ICD-9 DX codes
classify_ccs("8442", code_type = "dx9", level = "single")
#> [1] "DX232"

# Vectorized
tibble(ICD = c("8442", "1403", "9682",  "36463", "3595")) %>%
  mutate(CCS      = classify_ccs(ICD, code_type = "dx9"),
         CCS_expl = explain_ccs(CCS))
#> No value provided for `level`. Using `level = single` as the default
#> This message is displayed once every 8 hours.
#> # A tibble: 5 × 3
#>   ICD   CCS   CCS_expl                                
#>   <chr> <chr> <chr>                                   
#> 1 8442  DX232 Sprains and strains                     
#> 2 1403  DX11  Cancer of head and neck                 
#> 3 9682  DX242 Poisoning by other medications and drugs
#> 4 36463 DX91  Other eye disorders                     
#> 5 3595  DX95  Other nervous system disorders          

## Works the same for ICD-9 PR codes
classify_ccs("066", code_type = "pr9")
#> No value provided for `level`. Using `level = single` as the default
#> This message is displayed once every 8 hours.
#> [1] "PR10"

## Also works for ICD-10, but CCSR is prefered
classify_ccs("M61019",  "dx10", level="single")
#> [1] "DX211"
classify_ccs("0TY10Z1", "pr10", "single")
#> [1] "PR105"

## Specify level to use multi-level CCS
c("0223","1100") %>%
  classify_ccs(code_type = "dx9", level="1")
#> [1] "DX-1" "DX-1"

# If you want to see all levels use `level="all"`
# which returns a tibble
df <- c("0223","1100") %>%
  classify_ccs(code_type = "dx9", level="all")
df
#>   I9_DX CCS CCS_lvl1 CCS_lvl2 CCS_lvl3   CCS_lvl4
#> 1  0223 DX2     DX-1   DX-1.1 DX-1.1.2 DX-1.1.2.5
#> 2  1100 DX4     DX-1   DX-1.2 DX-1.2.2       <NA>

if(rlang::is_installed("dplyr", version = "1.0.0")){
  df %>% # requires dplyr::across()
    mutate(across(c(CCS, CCS_lvl1), explain_ccs))
}
#>   I9_DX                          CCS                          CCS_lvl1 CCS_lvl2
#> 1  0223 Septicemia (except in labor) Infectious and parasitic diseases   DX-1.1
#> 2  1100                      Mycoses Infectious and parasitic diseases   DX-1.2
#>   CCS_lvl3   CCS_lvl4
#> 1 DX-1.1.2 DX-1.1.2.5
#> 2 DX-1.2.2       <NA>