Type: Package
Title: Categorize Injury Diagnosis Codes
Version: 2.1.0
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.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
Depends: R (≥ 2.10)
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Imports: dplyr, stringr, tidyr
NeedsCompilation: no
Packaged: 2025-09-02 11:21:06 UTC; davideugeneclark
Author: David Clark [aut, cre], Adam Black [aut]
Maintainer: David Clark <david.clark@tufts.edu>
Repository: CRAN
Date/Publication: 2025-09-08 18:40:23 UTC

Categorize trauma data and calculate scores

Description

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

  1. assign a severity (AIS) and ISS body region values to each valid ICD-10 injury diagnosis code,

  2. add variables for maximum severity of each body region,

  3. calculate ISS, "New ISS", maximum AIS, and regression-based mortality predictions,

  4. select the first 4 mechanism (external cause) codes and categorize mechanism and intent following CDC guidelines

Usage

cat_trauma2(df, dx_pre, messages = TRUE)

Arguments

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).

  • TRUE - Messages will report completion of each step (may be helpful for large data sets).

  • FALSE - Messages will not be reported.

Details

Data should be in wide format, as in the example below:

Value

A dataframe identical to the dataframe passed to the function with the following additional variables added:

Examples

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)


Categorize ICD-10 injury diagnosis codes similar to the "Barell Matrix" used for ICD-9

Description

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.

Usage

framework(df, dx_pre, severity = FALSE, messages = FALSE)

Arguments

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).

  • TRUE - Program will calculate the estimated survival for each diagnosis and the minimum overall.

  • FALSE - No severity scores will be calculated.

messages

Should the program report completion of each step? Must be TRUE or FALSE (default).

  • TRUE - Messages will report completion of each step (may be helpful for large data sets).

  • FALSE - Messages will not be reported.

Details

Data should be in wide format, as in the example below:

Value

A dataframe identical to the dataframe passed to the function with the following additional variables added:

Examples

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)


Table i10_map_frame

Description

A dataset containing ICD-10 diagnosis codes and their properties for assignment to the CDC Framework.

Usage

i10_map_frame

Format

A data frame with 20,499 rows and 5 variables:

dx

A valid ICD-10 diagnosis code.

cell

The corresponding cell in the CDC Framework.

PmCell

The observed mortality for subjects with a diagnosis in this cell.

PsCell

The observed survival for subjects with a diagnosis in this cell.

version

The most recent date when this dataset was revised. Encoded vyymmdd.

...


Table i10_map_iciss

Description

A dataset containing ICD-10 diagnosis codes and their properties for calculation of several versions of the ICD Injury Severity Score (ICISS).

Usage

i10_map_iciss

Format

A data frame with 20,551 rows and 12 variables:

dx

A valid ICD-10 diagnosis code.

digits1234

The 4-digit version of dx.

tot_int

The number of cases in international data from which the observed survival was calculated.

dsp_int

The observed survival in international data for subjects with this diagnosis.

dsp_int_c

Same as above, but NA if tot_int < 5.

tot_TQP

The number of cases in TQP data from which the observed survival was calculated.

dsp_TQP

The observed survival in TQP data for subjects with this diagnosis.

dsp_TQP_c

Same as above, but NA if tot_TQP < 5.

tot_NIS

The number of cases in NIS data from which the observed survival was calculated.

dsp_NIS

The observed survival in NIS data for subjects with this diagnosis.

dsp_NIS_c

Same as above, but NA if tot_NIS < 5.

Version

The most recent date when this dataset was revised. Encoded vyymmdd.

...


Table i10_map_mech

Description

A dataset containing ICD-10 diagnosis codes and their properties for determination of injury mechanism.

Usage

i10_map_mech

Format

A data frame with 8,117 rows and 5 variables:

dx

A valid ICD-10 diagnosis code.

mechmaj

The CDC major mechanism category.

intent

The CDC intent category.

mechmin

The CDC minor mechanism category, if any.

version

The most recent date when this dataset was revised. Encoded vyymmdd.

...


Table i10_map_sev

Description

A dataset containing ICD-10 diagnosis codes and their properties for determination of ISS and other injury severity scores.

Usage

i10_map_sev

Format

A data frame with 20,551 rows and 8 variables:

dx

A valid ICD-10 diagnosis code.

severity

The associated Abbreviated Injury Score for this diagnosis.

issbr

The associated ISS body region for this diagnosis.

TQIPeffect

The coefficient for this diagnosis in the TQP regression model.

TQIPint

The intercept in the TQP regression model.

NISeffect

The coefficient for this diagnosis in the NIS regression model.

NISint

The intercept in the TQP regression model.

version

The most recent date when this dataset was revised. Encoded vyymmdd.

...


Compute International Classification of Diseases-Based Injury Severity Score (ICISS)

Description

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

  1. assign a severity (DSP) to each valid ICD-10 injury diagnosis code,

  2. calculate one version of ICISS as the product of these DSP, and

  3. calculate another version of ICISS as the minimum of these DSP.

  4. It repeats the above using international data, TQP, and NIS as reference data.

Usage

iciss(df, dx_pre, conservative = TRUE, messages = TRUE)

Arguments

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.

  • TRUE - DSP based on fewer than 5 observations in the reference database will be excluded.

  • FALSE - DSP based on fewer than 5 observations in the reference database will be included.

messages

Should the program report completion of each step? Must be TRUE or FALSE (default).

  • TRUE - Messages will report completion of each step (may be helpful for large data sets).

  • FALSE - Messages will not be reported.

Details

Data should be in wide format, as in the example below

Value

A dataframe identical to the dataframe passed to the function with the following additional variables added:

Examples

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)


Test Data

Description

A dataset containing a sample of trauma registry data for use in examples and tests.

Usage

testdata

Format

A data frame with 20,000 rows and 13 variables:

temp_id

A sequential number to identify individual subjects.

died

A binary indicator variable for death. 1 = died. 0 = survived.

I10_DX1

1st ICD-10-CM injury code recorded on an encounter.

I10_DX2

2nd ICD-10-CM injury code recorded on an encounter.

I10_DX3

3rd ICD-10-CM injury code recorded on an encounter.

I10_DX4

4th ICD-10-CM injury code recorded on an encounter.

I10_DX5

5th ICD-10-CM injury code recorded on an encounter.

I10_DX6

6th ICD-10-CM injury code recorded on an encounter.

I10_DX7

7th ICD-10-CM injury code recorded on an encounter.

I10_DX8

8th ICD-10-CM injury code recorded on an encounter.

I10_DX9

9th ICD-10-CM injury code recorded on an encounter.

I10_DX10

10th ICD-10-CM injury code recorded on an encounter.

Version

The most recent date when this dataset was revised. Encoded vyymmdd.

...