Package 'icdpicr'

Title: 'ICD' Programs for Injury Categorization in R
Description: Categorization and scoring of injury severity typically involves trained personnel with access to injured persons or their medical records. 'icdpicr' contains a function that provides automated calculation of Abbreviated Injury Scale ('AIS') and Injury Severity Score ('ISS') from International Classification of Diseases ('ICD') codes and may be a useful substitute to manual injury severity scoring. 'ICDPIC' was originally developed in 'Stata', and 'icdpicr' is an open-access update that accepts both 'ICD-9' and 'ICD-10' codes.
Authors: Adam Black [aut, cre, cph], David Clark [aut, cph]
Maintainer: Adam Black <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2024-10-25 05:47:56 UTC
Source: https://github.com/ablack3/icdpicr

Help Index


Categorize trauma data

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-9 or ICD-10 injury diagnosis code,

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

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

  4. select first 4 e-codes/mechanism codes and categorize major mechanism, minor mechanism, and intent

Usage

cat_trauma(df, dx_pre, icd10, i10_iss_method, calc_method = 1, verbose = FALSE)

Arguments

df

A dataframe in wide format containing ICD-9 and/or 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.)

icd10

Should ICD-10 codes be included? Must be one of: TRUE, FALSE, "cm", or "base".

  • TRUE - ICD-10 codes will be processed by the program

  • FALSE - Any ICD-10 codes in the data will be ignored.

  • "cm" - ICD-10-CM codes will be processed by the program

  • "base" - Basic ICD-10 (international) codes will be processed by the program

i10_iss_method

Method for calculating ISS from ICD-10 codes. Ignored if icd10 = FALSE. Must be one of:

  • "roc_max_NIS" Table derived empirically from National Inpatient Sample (NIS) maximizing area under an ROC curve. For ICD10 codes not in NIS the mapping based on TQIP data will be used as a backup. This option is recommended if the user's data are similar to NIS data.

  • "roc_max_TQIP" Table derived empirically from the Trauma Quality Improvement Program (TQIP) data maximizing area under an ROC curve. For ICD-10 codes not in TQIP the mapping based on NIS data will be used as a backup. This option is recommended if the user's data are similar to TQIP data.

  • "roc_max_NIS_only" Table derived as for "roc_max_NIS", but injury ICD-10 codes not in the NIS dataset will be ignored

  • "roc_max_TQIP_only" Table derived as for "roc_max_TQIP", but injury ICD-10 codes not in the TQIP dataset will be ignored.

  • "gem_max" Table derived by mapping ICD-10-CM to ICD-9-CM using the CMS general equivalence mapping tables and then to AIS and ISS using the ICDPIC table inherited from the Stata version. Mapping conflicts handled by taking the max AIS.

  • "gem_min" Same as "gem_max" except that mapping conflicts are handled by taking the min AIS.

calc_method

ISS calculation method: Method 1 (default) will assign an ISS of 75 if any AIS is 6. Method 2 will change any AIS = 6 to 5 and then calculate ISS normally.

verbose

Should updates be printed to the console? TRUE or FALSE (default). This can be helpful for long running computations.

Details

Data should be in wide format:

ID dx1 dx2 dx3 etc.
31416 800.1 959.9 E910.9
31417 800.24 410.0

Codes for AIS severity:

  • 1 = Minor

  • 2 = Moderate

  • 3 = Serious

  • 4 = Severe

  • 5 = Critical

  • 6 = Unsurvivable

  • 9 = Unknown

Value

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: new injury severity score

  • ecode_1-ecode_4: first 4 mechanism/E-Codes (including ICD-10 if requested) found in each row of data

  • mechmaj1-mechmaj4: CDC external cause of injury major mechanism for each E-Code captured

  • mechmin1-mechmin4: CDC external cause of injury minor mechanism for each E-Code captured

  • intent1-intent4: intent for each E-Code captured

  • lowmech: lowest CDC external cause of injury major mechanism for all E-Codes captured

  • Pmort: The model predicted probability of mortality (only added if using ICD-10 codes with one of the roc_max methods)

Examples

df_in <- read.table(header = TRUE, text = "
    ident    dx1     dx2     dx3
    31416   800.1   959.9   E910.9
    31417   800.24  410.0   NA
")
df_out <- cat_trauma(df_in, "dx", icd10 = FALSE)

ICDPICR

Description

International Classification of Diseases Programs for Injury Categorization. The ICDPICR package is an adaptation of the ICDPIC package originally written for Stata. The original ICDPIC is a collection of Stata programs for injury categorization and is available as a Stata download or online at https://ideas.repec.org/c/boc/bocode/s457028.html

Version

ICDPICR Version 0.1.0 was adapted from the ICDPIC Version 3.0 Stata program, especially to accommodate both ICD-9 and ICD-10 diagnosis codes. Some of the functionality of the original Stata program was reduced in the interest of providing updates for only the most useful elements of the original ICDPIC program, and some of this functionality has been restored along with other features in the current ICDPICR Version 1.0. ICDPICR is open source and all code is availble at https://github.com/ablack3/icdpicr. Documentation can be found online at https://ablack3.github.io/icdpicr/.

Description

ICDPICR (International Classification of Diseases Programs for Injury Categorization in R) is an R package currently consisting of a single function "cat_trauma" that performs the same task that the "trauma" program does in the Stata version of ICDPIC. The intention of these programs is to provide inexpensive methods for translating International Classification of Diseases (ICD) diagnosis codes into standard injury categories and/or scores. The authors would appreciate suggestions or corrections from any user of the software. Bug reports or feature requests may be submitted at https://github.com/ablack3/icdpicr/issues. Publications of studies in which these programs or tables are used should cite the authors.

Methods

For each valid ICD-9-CM or ICD-10-CM injury diagnosis, ICDPICR is programmed to generate an approximate AIS and body region, using the original AIS anatomic classification (as modified by Baker and colleagues) into six body regions: Head and neck, face, chest, abdomen and pelvic contents, extremities and pelvic bones, and general. In addition, each code referring to a mechanism of injury is categorized as recommended or proposed by the CDC. For each injured person, ICDPICR determines the maximal AIS in each body region and overall, an Injury Severity Score (RISS), a regression-based prediction of mortality, and CDC mechanism/intent categories.

Mapping of ICD-9-CM E-codes to CDC mechanism categories simply involved translation of the programming code from Stata into R, using essentially the same table. Mapping of ICD-10-CM codes to mechanism categories was based on a similar table published by the CDC.

The National Trauma Data Standard used by the ACS Trauma Quality Improvement Project (TQIP) considers valid ICD-10-CM injury codes to be those in the ranges S00-S99, T07, T14, T20-T28, and T30-32. ICDPICR recognizes only these codes in the calculation of injury severity from ICD-10-CM, and also requires that the codes have a decimal point in the fourth position and the letter "A", "B", or "C" in the eighth position (indicating an initial encounter). Mapping of ICD-10-CM codes to AIS severity may be performed in several ways, as described below.

"ROCmax" mapping method for ICD-10-CM codes or basic ICD-10 codes: The ROCmax option in ICDPICR Version 1.0 allows the user to choose either TQIP or National Inpatient Survey (NIS) as the reference database. Ridge regression is used to estimate the independent effect of each injury diagnosis on mortality. If one of the ROCmax options is chosen, a prediction of mortality for each subject (Pmort) is provided directly from the regression, as well as an estimated Injury Severity Score (ISS). As in the earlier Stata version of ICDPIC, a "New Injury Severity Score" (NISS) is now also calculated for all options.

"GEM" mapping method for ICD-10-CM codes: ICD-10-CM codes are first mapped to ICD-9-CM codes using the General Equivalency Mapping (GEM) tables provided by the Centers for Medicare and Medicaid Services (CMS), and then those ICD-9-CM codes are mapped to AIS using the table inherited from the Stata version of ICDPIC. The user is given the option to ignore ICD-10-CM codes if desired. Otherwise, if the GEM maps an ICD-10-CM code to two or more ICD-9-CM codes associated with different severities, the user is given the option whether to assign the greater or lesser of these severities ("GEMmax" or "GEMmin"). When the GEM maps an ICD-10-CM code to two or more ICD-9-CM codes associated with different AIS body regions, the verbal description of the ICD-10-CM code in the GEM table is used to assign a body region.

A GEM mapping method is necessary when injuries have been coded with ICD-9-CM codes only, and may be preferable when they have been coded with a mix of ICD-9-CM and ICD-10-CM.

For any of the mapping methods in ICDPICR, the maximum AIS Severity for each AIS body region (MXAISBR1 ... MXAISBR6 in the output) is 0 if there are no valid injury codes for that body region. It is recorded as "missing" if there are valid codes for that body region, but their severity cannot be determined. Otherwise, it is the maximum known severity (1 through 6) for that body region. Maximum AIS Severity (MAXAIS in the output data) is the maximum of (MXAISBR1 ... MXAISBR6); MAXAIS will thus be 0 if there is no diagnosis code associated with an AIS severity.

Injury Severity Score (RISS) is calculated according to the classic description of Baker and colleagues, namely the sum of the squares of the three largest elements of (MXAISBR1 ... MXAISBR6). The user can choose whether to assign RISS=75 when any injury is assigned a severity of 6, or to reassign a severity of 5 to these injuries and calculate RISS as above. The first option, RISS = 75 when any severity = 6, is the default in ICDPICR, since by definition an AIS severity of 6 should denote an injury that is uniformly fatal and thus should rarely be found in hospital data.

Functions

cat_trauma provides various classifications and characterizations of trauma based on ICD-9 or ICD-10 injury diagnosis codes. Details can be found in the help file for cat_trauma.


ICD10CM injury codes

Description

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

Usage

injury

Format

A data frame with 100,477 rows and 11 variables:

dx1

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

dx2

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

dx3

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

dx4

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

dx5

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

dx6

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

dx7

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

dx8

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

dx9

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

dx10

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

died

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

...