mutate_ccsr_dx | R Documentation |
Given a data.frame with ICD-10-CM diagnosis codes, this function appends a column of the corresponding Clinical Classifications Software Refined (CCSR) categories, in tidy format
mutate_ccsr_dx(.data, dx_col)
.data |
Data frame with column named |
dx_col |
The (unquoted) name of the column in |
The Clinical Classifications Software Refined (CCSR) software
provides both one-to-one mapping (see
classify_ccsr_dx1
)
and one-to-many (see ccsr_dx
) mapping of ICD-10-CM
diagnosis codes to CCSR categories. The one-to-many mapping is
necessary because many ICD-10 codes span multiple meaningful
categories, and the identification of all conditions related to
a diagnosis code would be lost by categorizing some ICD-10-CM
codes into a single category.
For example, consider the code I11.0 (Hypertensive heart disease with heart failure) which encompasses both heart failure (CCSR category CIR019) and hypertension with complications (CIR008). Classifying this code as heart failure alone would miss meaningful information, but on the other hand, some analyses require mutually exclusive categorization.
This function addresses identifying all CCSR categories associated with an ICD code. For example, consider a data.frame with an ICD-10 code per row:
pt_id | ICD10dx |
A | K432 |
A | A401 |
B | ... |
The corresponding CCSR codes for these two codes are below. Note that
K432
only has one CCSR category, while A401
has two.
ICD10 | CCSR1 | CCSR2 | CCSR(n) |
K432 | DIG010 | --- | ... |
A401 | INF002 | INF003 | ... |
... | ... | ... | ... |
Running this function for patient A's two codes, results in three
rows because A401
has two categories (plus the single row for K432
).
See the tidy data section
of R for Data Science or the corresponding paper
for more on this conceptual approach.
pt_id | ICD10dx | CCSR |
A | K432 | DIG010 |
A | A401 | INF002 |
A | A401 | INF003 |
B | ... | ... |
There are numerous differences between CCSR and CCS (the predecessor to CCSR).
The CCS classifies codes into multi-level categories in a hierarchical manner,
which allows users of CCS to use varying levels of specificity in their
classification (see classify_ccs
), while the CCSR does not have
multiple classification levles. Additionally, CCSR does not classify codes into
mutually exclusive categories (for ICD-10 diagnosis codes) and the categories
used in CCSR aren't the same as the old categories used in CCS.
See Appendix A of the CCSR user guide for more details on the differences between CCSR and CCS.
An object of the same type as .data
. The returned data.frame
will have a new column named CCSR
containing the CCSR categories
assocaited with the ICD code in the dx_col
column. For ICD codes
with multiple CCSR categories, multiple rows will be returned
(in a longer, tidy format).
classify_ccsr_dx1
for identifying a single CCSR
category based on the principal diagnosis
classify_ccs
for the legacy CCS categories
library(dplyr)
library(tibble) # for tribble fxn
## Using a df to return a tidy df
tibble::tribble(
~pt_id, ~ICD10,
"A", "K432",
"A", "A401") %>%
mutate_ccsr_dx(dx_col = ICD10)
df <- tibble::tribble(
~pt_id, ~ICD10,
"A", "K432",
"A", "A401",
"B", "I495",
"B", "E8771",
"C", "A5442",
"C", "A564"
)
df %>%
mutate_ccsr_dx(dx_col = ICD10) %>%
mutate(CCSR_expl = explain_ccsr(CCSR))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.