R/metadata.R
map_ICD10_CCS.Rd
Map ICD-10 codes to clinically meaningful
categories within the Clinical Classifications Software (ccs
)
and the Clinical Classifications Software Refined (ccsr
).
map_ICD10_CCS(df, icd_column)
map_ICD10_CCSR(df, icd_column)
a data frame containing ICD-10 codes
a variable name or column number in df
containing ICD-10 codes.
The input data frame with additional CCS/CCSR classifications. CCS categories are mutually exclusive. CCSR categories are not.
This function is designed to be compatible with both ICD-10 and ICD-10-CM versions.
mock_icd_data <- data.frame(
list(icd10_code = c("J44", "J44X", "J440")),
stringsAsFactors = FALSE)
mock_icd_data <- map_ICD10_CCS(mock_icd_data, "icd10_code")
mock_icd_data <- map_ICD10_CCSR(mock_icd_data, "icd10_code")
str(mock_icd_data)
#> 'data.frame': 3 obs. of 12 variables:
#> $ icd10_code : chr "J44" "J440" "J44X"
#> $ ccs_cat_code : chr "127" "127" "127"
#> $ ccs_cat_desc : chr "Chronic obstructive pulmonary disease and bronchiectasis" "Chronic obstructive pulmonary disease and bronchiectasis" "Chronic obstructive pulmonary disease and bronchiectasis"
#> $ ccs_L1_code : chr "8" "8" "8"
#> $ ccs_L1_desc : chr "Diseases of the respiratory system" "Diseases of the respiratory system" "Diseases of the respiratory system"
#> $ ccs_L2_code : chr "8.2" "8.2" "8.2"
#> $ ccs_L2_desc : chr "Chronic obstructive pulmonary disease and bronchiectasis [127.]" "Chronic obstructive pulmonary disease and bronchiectasis [127.]" "Chronic obstructive pulmonary disease and bronchiectasis [127.]"
#> $ ccsr_body_system_code : chr "RSP" "RSP" "RSP"
#> $ ccsr_body_system_label: chr "Diseases of the respiratory system" "Diseases of the respiratory system" "Diseases of the respiratory system"
#> $ ccsr_cat_code : chr "RSP008" "RSP008" "RSP008"
#> $ ccsr_cat_desc : chr "Chronic obstructive pulmonary disease and bronchiectasis" "Chronic obstructive pulmonary disease and bronchiectasis" "Chronic obstructive pulmonary disease and bronchiectasis"
#> $ ccsr_cat_rank : num 1 1 1