Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: battlesister
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Size: 79.5 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Codemeta

README.Rmd

---
title: icd README
output:
  md_document:
    variant: gfm
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: Jack O. Wasey 
---



```{r, echo = FALSE}
suppressPackageStartupMessages({
  library(icd, warn.conflicts = FALSE)
  library(magrittr, warn.conflicts = FALSE)
})
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
patient_data <- data.frame(
  visit_id = c(1000, 1000, 1000, 1000, 1001, 1001, 1002, 1000),
  icd9 = as.icd9cm(c("40201", "2258", "7208", "25001",
                     "34400", "4011", "4011", NA)),
  stringsAsFactors = FALSE
  )
```

# icd


[![CRAN](https://www.r-pkg.org/badges/version/icd "CRAN")](https://cran.r-project.org/package=icd)
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-blue.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Travis](https://travis-ci.org/jackwasey/icd.svg?branch=main "Travis Build Status")](https://travis-ci.org/jackwasey/icd)
[![Appveyor](https://ci.appveyor.com/api/projects/status/9ncfgxht3n5i8t60/branch/main?svg=true "Appveyor Build Status")](https://ci.appveyor.com/project/jackwasey/icd/branch/main)
[![codecov.io](https://codecov.io/github/jackwasey/icd/coverage.svg?branch=main "Code Coverage")](https://codecov.io/github/jackwasey/icd?branch=main)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2092/badge)](https://bestpractices.coreinfrastructure.org/projects/2092)
[![Dependencies](https://tinyverse.netlify.com/badge/icd)](https://cran.r-project.org/package=icd)
[![CRAN RStudio mirror downloads last calendar month](https://cranlogs.r-pkg.org/badges/icd  "RStudio Mirror Downloads")](https://cran.r-project.org/package=icd)



# Fast comorbidities from ICD-9 and ICD-10 codes, decoding, manipulation and validation

## Introduction

```{r pkgdesc, results = "asis", echo = FALSE}
cat(packageDescription("icd")$Description)
```

`icd` is used by many researchers around the world who work in public health, epidemiology, clinical research, nutrition, journalism, health administration, insurance, and more. I'm grateful for contact from people in these fields for their feedback and code contributions, and I'm pleased to say that `icd` has been used in works like the [Pulitzer finalist](http://www.pulitzer.org/finalists/staff-propublica) work on [maternal death](http://www.pulitzer.org/finalists/staff-propublica) by [ProPublica](https://www.propublica.org).

## Features

 * find comorbidities of patients based on ICD-9 or ICD-10 codes, e.g. Cancer, Heart Disease
     + several standard mappings of ICD codes to comorbidities are included (Quan, Deyo, Elixhauser, AHRQ, PCCC)
     + *very fast* assignment of ICD codes to comorbidities (using novel matrix multiplication algorithm and C++ internally -- see 'efficiency' vignette for details)
 * use your existing wide or long data format, icd can guess which columns are ICD-9 or ICD-10 codes.
 * explain and summarize groups of ICD codes in natural language, using ICD editions from the WHO, USA, France and Belgium. Many different annual editions of these data are available, and these may be downloaded automatically when used, or in bulk with `download_all_icd_data()`.
 * Charlson and Van Walraven score calculations
 * Hierarchical Condition Codes (HCC) from CMS
 * Clinical Classifications Software (CCS) comorbidities from AHRQ
 * Pediatric Complex Chronic Condition comorbidities
 * AHRQ ICD-10 procedure code classification
 * correct conversion between different representations of ICD codes, with and without a decimal points, leading and trailing characters (this is not trivial for ICD-9-CM). ICD-9 to ICD-10 cross-walk is not yet implemented
 * comprehensive test suite to increase confidence in accurate processing of ICD codes

## Examples

See also the vignettes and examples embedded in the help for each function for more. Here's a taste: 

```{r example}
# install.packages("icd")
library(icd)

# Typical diagnostic code data, with many-to-many relationship
patient_data

# get comorbidities using Quan's application of Deyo's Charlson comorbidity groups
comorbid_charlson(patient_data)

# or go straight to the Charlson scores:
charlson(patient_data)

# plot summary of Uranium Cancer Registry sample data using AHRQ comorbidities
plot_comorbid(uranium_pathology)
```

## Comorbidities example: make "Table 1" summary data

A common requirement for medical research involving patients is determining new or existing comorbidities. This is often reported in *Table 1* of research papers to demonstrate the similarity or differences of groups of patients. This package is focussed on fast and accurate generation of this comorbidity information from raw lists of ICD-9 and ICD-10 codes.

Here we are using the US National Hospital Discharge Survey 2010 data from the [nhds](https://github.com/jackwasey/nhds) package. For the sake of example, let us compare emergency to other admissions. A real table would have more patient features; this primarily demonstrates how to get ICD codes into your Table 1.

NHDS 2010 comorbidities to demonstrate Table One creation. Presented as counts (percentage prevalence in group).
```{r tableone}
nhds <- nhds::nhds2010
# get the comorbidities using the Quan-Deyo version of the Charlson categories
cmb <- icd::comorbid_quan_deyo(nhds, abbrev_names = FALSE)
nhds <- cbind(nhds, cmb, stringsAsFactors = FALSE)
Y <- nhds$adm_type == "emergency"
tab_dat <- vapply(
  unname(unlist(icd_names_charlson)),
  function(x) {
    c(sprintf("%i (%.2f%%)", 
              sum(nhds[Y, x]), 
              100 * mean(nhds[Y, x])),
      sprintf("%i (%.2f%%)",
              sum(nhds[!Y, x]),
              100 * mean(nhds[!Y, x])))
  },
  character(2)
)
knitr::kable(t(tab_dat), col.names = c("Emergency", "Not emergency"))
```

## How to get help

Look at the help files for details and examples of almost every function in this package. There are several vignettes showing the main features (See list with `vignette(package = "icd")`):

 - Introduction `vignette("introduction", package = "icd")`
 - Charlson scores `vignette("charlson-scores", package = "icd")`
 - Examples using ICD-10 codes `vignette("ICD-10", package = "icd")`
 - CMS Hierarchical Condition Codes (HCC) `vignette("CMS-HCC", package = "icd")`
 - Pediatric Complex Chronic Conditions (PCCC) `vignette("PCCC", package = "icd")`
 - Working with ICD code ranges `vignette("ranges", package = "icd")`
 - Comparing comorbidity maps `vignette("compare-maps", package = "icd")`
 - Paper detailing efficient matrix method of comorbidities `vignette("efficiency", package = "icd")`

Many users have emailed me directly for help, and I'll do what I can, but it is often better to examine or add to the list of [issues](https://github.com/jackwasey/icd) so we can help each other. Advanced users may look at the [source code](https://github.com/jackwasey/icd), particularly the extensive test suite which exercises all the key functions.

``` r
?comorbid
?comorbid_hcc
?explain_code
?is_valid
```

## ICD-9 codes

ICD-9 codes are still in heavy use around the world, particularly in the USA where the ICD-9-CM (Clinical Modification) was in widespread use until the end of 2015. ICD-10 has been used worldwide for reporting cause of death for more than a decade, and ICD-11 is due to be released in 2019. ICD-10-CM is now the primary coding scheme for US hospital admission and discharge diagnoses used for regulatory purposes and billing. A vast amount of electronic patient data is recorded with ICD-9 codes of some kind: this package enables their use in R alongside ICD-10.

ICD-9 codes are not numbers, and great care is needed when matching individual codes and ranges of codes. It is easy to make mistakes, hence the need for this package. ICD-9 codes can be presented in *short* 5 character format, or *decimal* format, with a decimal place separating the code into two groups. There are also codes beginning with V and E which have different validation rules. Zeroes after a decimal place are meaningful, so numeric ICD-9 codes cannot be used in most cases. In addition, most clinical databases contain invalid codes, and even decimal and non-decimal format codes in different places. This package primarily deals with ICD-9-CM (Clinical Modification) codes, but should be applicable or easily extendable to the original WHO ICD-9 system.

## ICD-10 codes

ICD-10 has a somewhat simpler format, with consistent use of a letter, then two alphanumeric characters. However, especially for ICD-10-CM, there are a multitude of qualifiers, e.g. specifying recurrence, laterality, which vastly increase the number of possible codes. This package recognizes validity of codes by syntax alone, or whether the codes appear in a canonical list. There is not yet the capability of converting between ICD-9 and ICD-10, but comorbidities can be generated from older ICD-9 codes and newer ICD-10 codes in parallel, and the comorbidities can then be compared.

Owner

  • Login: battlesister
  • Kind: user

GitHub Events

Total
  • Push event: 2
  • Create event: 14
Last Year
  • Push event: 2
  • Create event: 14

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
DESCRIPTION cran
  • R >= 3.5 depends
  • Rcpp >= 0.12.3 imports
  • methods * imports
  • RODBC * suggests
  • graphics * suggests
  • httr * suggests
  • jsonlite * suggests
  • knitr * suggests
  • magrittr * suggests
  • nhds * suggests
  • readxl * suggests
  • rmarkdown >= 1.11 suggests
  • roxygen2 >= 5.0.0 suggests
  • stats * suggests
  • testthat >= 0.11.1 suggests
  • utils * suggests
  • xml2 * suggests
benchmarks/icd-JSS3447-replication/Dockerfile docker
  • rocker/tidyverse latest build