Title: Translate ICD-9 into Injury Severity Score
Version: 0.0.0.2
Description: 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.
Depends: R (≥ 3.3.0)
License: GPL-3
URL: https://github.com/dajuntian/InjurySeverityScore
BugReports: https://github.com/dajuntian/InjurySeverityScore/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Imports: dplyr, tidyr, rlang
NeedsCompilation: no
Packaged: 2019-05-19 02:21:50 UTC; Dajun Tian
Author: Dajun Tian [aut, cre], David E. Clark & Turner M. Osler & David R. Hahn [dtc] (map from ICD-9, cited from 'ICDPIC')
Maintainer: Dajun Tian <tiandajun@gmail.com>
Repository: CRAN
Date/Publication: 2019-05-19 04:11:18 UTC

Calculate injury severity score from ICD-9

Description

Calculate injury severity score from ICD-9

Usage

injury_score(indata, id_var, dx_var, has_dot = TRUE, tall = TRUE)

Arguments

indata

A data frame

id_var

A variable for patient id

dx_var

A character varaible for dx code

has_dot

A logical varaible indicates whether ICD code has dot

tall

A logical variable incates data is tall (T) or wide (F)

Value

A data frame contains iss score

See Also

https://github.com/dajuntian/InjurySeverityScore/blob/master/README.md

Examples

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)
injury_score(sample_data, subj, code)

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