MyNixOS website logo
Description

Translate ICD-9 into Injury Severity Score.

Calculate the injury severity score (ISS) based on the dictionary in 'ICDPIC' from <https://ideas.repec.org/c/boc/bocode/s457028.html>. The original code was written in 'STATA 11'. The original 'STATA' code was written by David Clark, Turner Osler and David Hahn. I implement the same logic for easier access. Ref: David E. Clark & Turner M. Osler & David R. Hahn, 2009. "ICDPIC: Stata module to provide methods for translating International Classification of Diseases (Ninth Revision) diagnosis codes into standard injury categories and/or scores," Statistical Software Components S457028, Boston College Department of Economics, revised 29 Oct 2010.

Rdoc

InjurySeverityScore

Translate ICD-9 to Injury Severity Score. This is rewritten from STATA into R package based on ICDPIC. The reference was seen here: https://ideas.repec.org/c/boc/bocode/s457028.html. The dictionary of mapping ICD9 to body region and severity score were also downloaded from ICDPIC.

Input Dataset

Function injury_score requires the input dataset has at least two variables. One is patient id and the other is the icd9 code. The icd9 code must be character. The icd9 code could be with or without dot and is indicated through has_dot parameter.

Output

Output dataset will use the patient id as the primary key and contains variable iss which is the injury severity score. For the definition of injury severity score, go to https://en.wikipedia.org/wiki/Injury_Severity_Score. Other variables br1-br6 are the maximum score for each body region. 9 indicated unknown score and 0 indicated no valid injury code under that body region. And max1-max3 are the top 3 scores out of all.

A score of 99 for iss indicates that valid injury ICD-9 exists but none had known injury score.

Example 1 (ICD code with dot)

  1. If you don't have the package, install through one of the following:
  • install.packages('InjurySeverityScore')
  • install.packages("devtools"); devtools::install_github("dajuntian/InjurySeverityScore")
  1. Generate sample dataset
pat_id <- c(2,2,2,2,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1)
icd9 <- c('874.2', '874.8', '900.81', '900.82', '900.89', '805.06', 
          'E966', '805.07', 'V14.0', '807.02', 'V70.4', '821.01', '823.20', 
          '860.0', '861.01', '861.21', '861.22', '863.84', '864.04', '865.04', 
          '865.09', '866.02', '868.04', '958.4')
sample_data <- data.frame(subj = pat_id, code = icd9, stringsAsFactors = FALSE)
  1. Load the package and calculate injury severity score.
library(InjurySeverityScore)
?InjurySeverityScore::injury_score #see help
injury_score(sample_data, subj, code, has_dot = T)

Example 2 (ICD code without dot)

pat_id <- c(2,2,2,2,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1)
icd9 <- c('8742', '8748', '90081', '90082', '90089', '80506', 
          'E966', '80507', 'V140', '80702', 'V704', '82101', '82320', 
          '8600', '86101', '86121', '86122', '86384', '86404', '86504', 
          '86509', '86602', '86804', '9584')
sample_data <- data.frame(subj = pat_id, code = icd9, stringsAsFactors = FALSE)
injury_score(sample_data, subj, code, has_dot = F)

Both examples would have the following output:

#  subj br_1 br_2 br_3 br_4 br_5 br_6 max_1 max_2 max_3 iss
#1    2    3    0    0    0    0    1     3     1     0  10
#2    1    2    0    3    5    3    0     5     3     3  43

Example 3 (Data in wide form instead of tall form)

data2 <- data.frame(pid = c(1,2), diag1 = c('900.89', '805.06'),
                    diag2 = c('863.84', '865.04'),stringsAsFactors = FALSE)
#  pid  diag1  diag2
#1   1 900.89 863.84
#2   2 805.06 865.04                
injury_score(data2, pid, diag, tall = FALSE)
Metadata

Version

0.0.0.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows