| Title: | Categorize Injury Diagnosis Codes |
|---|---|
| Description: | Functions read a dataframe containing one or more International Classification of Diseases Tenth Revision codes per subject. They return original data with injury categorizations and severity scores added. |
| Authors: | David Clark [aut, cre], Adam Black [aut] |
| Maintainer: | David Clark <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.1.1 |
| Built: | 2026-06-08 20:12:57 UTC |
| Source: | https://github.com/clark-david/icdpicr2 |
This function adds Abbreviated Injury Scores (AIS), Injury Severity Scores (ISS), and other descriptors of injury to a dataframe. For each observation this function will
assign a severity (AIS) and ISS body region values to each valid ICD-10 injury diagnosis code,
add variables for maximum severity of each body region,
calculate ISS, "New ISS", maximum AIS, and regression-based mortality predictions,
select the first 4 mechanism (external cause) codes and categorize mechanism and intent following CDC guidelines
cat_trauma2(df, dx_pre, messages = TRUE)cat_trauma2(df, dx_pre, messages = TRUE)
df |
A dataframe in wide format containing ICD-10 diagnosis codes with a common column name prefix. Diagnosis codes should be character strings and may have a decimal or not. |
dx_pre |
Prefix for diagnosis code column names (example: dx1, dx2, etc.) |
messages |
Should the program report completion of each step? Must be TRUE or FALSE (default).
|
Data should be in wide format, as in the example below:
A dataframe identical to the dataframe passed to the function with the following additional variables added:
sev_1-sev_n: AIS severity for diagnosis codes 1..n
issbr_1-issbr_n: ISS body region for diagnosis codes 1..n
mxaisbr1-mxaisbr6: maximum AIS severity for each of the 6 ISS body regions
maxais: maximum AIS severity over all ISS body regions
riss: computed injury severity score
niss: computed "new injury severity score"
PmortTQP: TQP model predicted probability of mortality
PmortNIS: NIS model predicted probability of mortality
mechcode_1-mechcode_4: first 4 mechanism codes found in each row of data
mech_1-mech_4: CDC external cause of injury major mechanism for each mechanism code captured
intent_1-intent_4: intent for each mechanism code captured
df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- cat_trauma2(df_in, "dx", TRUE)df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- cat_trauma2(df_in, "dx", TRUE)
This function categorizes ICD-10 diagnosis codes according to the table given in Hedegaard H, Johnson RL, Garnett MF, Thomas KE. The 2020 International Classification of Diseases, 10th Revision, Clinical Modification injury diagnosis framework for categorizing injuries by body region and nature of injury. Nat Health Stat Reports 2020;150:1-26, and (if option selected) predicts mortality for each subject as described in Clark DE, Ahmad S. Estimating injury severity using the Barell matrix. Inj Prev 2006;12:111-116.
framework(df, dx_pre, severity = FALSE, messages = FALSE)framework(df, dx_pre, severity = FALSE, messages = FALSE)
df |
A dataframe in wide format containing ICD-10 diagnosis codes with a common column name prefix. Diagnosis codes should be character strings and may have a decimal or not. |
dx_pre |
Prefix for diagnosis code column names (example: dx1, dx2, etc.) |
severity |
Should the program calculate a severity score? Must be TRUE or FALSE (default).
|
messages |
Should the program report completion of each step? Must be TRUE or FALSE (default).
|
Data should be in wide format, as in the example below:
A dataframe identical to the dataframe passed to the function with the following additional variables added:
cell_1-cell_n: Cell assigned for diagnosis codes 1..n
PsCell_1-PsCell_n: Survival in TQP and NIS for patients with a diagnosis in this cell
bPSmin: The minimum of PsCell_1-PsCell_n for this subject
df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- framework(df_in, "dx", TRUE, FALSE)df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- framework(df_in, "dx", TRUE, FALSE)
A dataset containing ICD-10 diagnosis codes and their properties for assignment to the CDC Framework.
i10_map_framei10_map_frame
A data frame with 20,499 rows and 5 variables:
A valid ICD-10 diagnosis code.
The corresponding cell in the CDC Framework.
The observed mortality for subjects with a diagnosis in this cell.
The observed survival for subjects with a diagnosis in this cell.
The most recent date when this dataset was revised. Encoded vyymmdd.
...
A dataset containing ICD-10 diagnosis codes and their properties for calculation of several versions of the ICD Injury Severity Score (ICISS).
i10_map_icissi10_map_iciss
A data frame with 20,551 rows and 12 variables:
A valid ICD-10 diagnosis code.
The 4-digit version of dx.
The number of cases in international data from which the observed survival was calculated.
The observed survival in international data for subjects with this diagnosis.
Same as above, but NA if tot_int < 5.
The number of cases in TQP data from which the observed survival was calculated.
The observed survival in TQP data for subjects with this diagnosis.
Same as above, but NA if tot_TQP < 5.
The number of cases in NIS data from which the observed survival was calculated.
The observed survival in NIS data for subjects with this diagnosis.
Same as above, but NA if tot_NIS < 5.
The most recent date when this dataset was revised. Encoded vyymmdd.
...
A dataset containing ICD-10 diagnosis codes and their properties for determination of injury mechanism.
i10_map_mechi10_map_mech
A data frame with 8,117 rows and 5 variables:
A valid ICD-10 diagnosis code.
The CDC major mechanism category.
The CDC intent category.
The CDC minor mechanism category, if any.
The most recent date when this dataset was revised. Encoded vyymmdd.
...
A dataset containing ICD-10 diagnosis codes and their properties for determination of ISS and other injury severity scores.
i10_map_sevi10_map_sev
A data frame with 20,551 rows and 8 variables:
A valid ICD-10 diagnosis code.
The associated Abbreviated Injury Score for this diagnosis.
The associated ISS body region for this diagnosis.
The coefficient for this diagnosis in the TQP regression model.
The intercept in the TQP regression model.
The coefficient for this diagnosis in the NIS regression model.
The intercept in the NIS regression model.
The most recent date when this dataset was revised. Encoded vyymmdd.
...
This function adds Diagnosis-specific Survival Probabilities (DSP) to a dataframe, based on the table provided by Gedeborg and colleagues (J Trauma Acute Care Surgery 2014) and also TQP and NIS. ICD-10-CM codes longer than four digits are treated as if they were four-digit ICD-10 codes as published by the World Health Organization. Thus, an ICD-10-CM code like S00552A is considered the same as S005. For each observation this function will
assign a severity (DSP) to each valid ICD-10 injury diagnosis code,
calculate one version of ICISS as the product of these DSP, and
calculate another version of ICISS as the minimum of these DSP.
It repeats the above using international data, TQP, and NIS as reference data.
iciss(df, dx_pre, conservative = TRUE, messages = TRUE)iciss(df, dx_pre, conservative = TRUE, messages = TRUE)
df |
A dataframe in wide format containing ICD-10 diagnosis codes with a common column name prefix. Diagnosis codes should be character strings and may have a decimal or not. |
dx_pre |
Prefix for diagnosis code column names (example: dx1, dx2, etc.) |
conservative |
Should the program exclude DSP based on fewer than 5 observations? Must be TRUE (default) or FALSE.
|
messages |
Should the program report completion of each step? Must be TRUE or FALSE (default).
|
Data should be in wide format, as in the example below
A dataframe identical to the dataframe passed to the function with the following additional variables added:
dsp_int1-dsp_intn: DSP for diagnosis codes 1..n, from international data
dsp_TQP1-dsp_TQPn: DSP for diagnosis codes 1..n, from TQP data
dsp_TQP1-dsp_NISn: DSP for diagnosis codes 1..n, from NIS data
PS_int_prod: ICISS calculated as the product of dsp_int1-dsp_intn
PS_int_min: ICISS calculated as the minimum of dsp_int1-dsp_intn
PS_TQP_prod: ICISS calculated as the product of dsp_TQP1-dsp_TQPn
PS_TQP_min: ICISS calculated as the minimum of dsp_TQP1-dsp_TQPn
PS_NIS_prod: ICISS calculated as the product of dsp_NIS1-dsp_NISn
PS_NIS_min: ICISS calculated as the minimum of dsp_NIS1-dsp_NISn
df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- iciss(df_in, "dx", TRUE, FALSE)df_in <- read.table(header = TRUE, text = " ident dx1 dx2 dx3 31416 S32110A S3251 NA 31417 S72141A T07XXXA D62 ") df_out <- iciss(df_in, "dx", TRUE, FALSE)
A dataset containing a sample of trauma registry data for use in examples and tests.
testdatatestdata
A data frame with 20,000 rows and 13 variables:
A sequential number to identify individual subjects.
A binary indicator variable for death. 1 = died. 0 = survived.
1st ICD-10-CM injury code recorded on an encounter.
2nd ICD-10-CM injury code recorded on an encounter.
3rd ICD-10-CM injury code recorded on an encounter.
4th ICD-10-CM injury code recorded on an encounter.
5th ICD-10-CM injury code recorded on an encounter.
6th ICD-10-CM injury code recorded on an encounter.
7th ICD-10-CM injury code recorded on an encounter.
8th ICD-10-CM injury code recorded on an encounter.
9th ICD-10-CM injury code recorded on an encounter.
10th ICD-10-CM injury code recorded on an encounter.
The most recent date when this dataset was revised. Encoded vyymmdd.
...