Skip to main content

This python tool enables a variety of mappings between ICD diagnostic codes (International Classification of Diseases) with a single line of code.

Project description

ICD-Mappings

This python tool enables a variety of mappings of ICD codes (International Classification of Diseases) to different medical concepts with a single line of code.

Supported Mappings

From ICD-9 CM diagnostic codes to:

  • ICD-10 CM: International Classification of Diseases version 10 Clinical Modification.
  • ICD-9 Chapters: 19 Chapters of ICD-9-CM.
  • CCS: Clinical Classification Software. All 14k ICD-9-CM diagnostic codes can be mapped into just 283 clinical categories.
  • CCI: Chronic Condition Indicator. True or False whether the diagnostic is chronic.
  • CCC Category: Pediatric Complex Chronic Conditions Classification System v3 - Category (15 categories).
  • CCC Subcategory: Pediatric Complex Chronic Conditions Classification System v3 - Subcategory (64 subcategories).

From ICD-10 CM diagnostic codes to:

  • ICD-9 CM: International Classification of Diseases version 9 Clinical Modification
  • ICD-10 CM Chapters: 22 Chapters of ICD-10 CM.
  • ICD-10 CM Blocks: ~130 Blocks of ICD-10 CM.
  • CCS(R): Clinical Classification Software (Refined). All the 70k ICD-10-CM diagnostic codes can be mapped into just 530 clinical categories.
  • CCI(R): Chronic Condition Indicator (Refined). True or False Whether the diagnostic is chronic.
  • CCC Category: Pediatric Complex Chronic Conditions Classification System v3 - Category (15 categories).
  • CCC Subcategory: Pediatric Complex Chronic Conditions Classification System v3 - Subcategory (64 subcategories).

Installation

pip install icd-mappings

Usage

Below are some examples on how to use this tool for both the Mapper and Validator classes

Mapper

This class allows you to map between ontologies.

from icdmappings import Mapper

mapper = Mapper()

icd9code = '29410' 
mapper.map(icd9code, source='icd9', target='ccs')
>>> '653'

# you can pass any Iterable of codes (list, numpy array, pandas Series, you name it)
icd9codes = ['29410', '5362', 'NOT_A_CODE', '3669']
mapper.map(icd9codes, source='icd9', target='ccs')
>>> ['653', '141', None, '86']

# which of these diagnostics are chronic?
mapper.map(icd9codes, source='icd9', target='cci')
>>> [True, False, None, True]

# icd9 to icd10
mapper.map(icd9codes, source='icd9', target='icd10')
>>> ['F0280', 'R111000', None, 'H269']

# icd10 to chapters and blocks
icd10codes = ['F0280', 'R111000', 'NOT_A_CODE', 'H269', 'H27.8']
mapper.map(icd10codes, source='icd10', target='chapter')
>>> ['5', '18', None, '7', '7']

mapper.map(icd10codes, source='icd10', target='block')
>>> ['F00-F09', 'R10-R19', None, 'H25-H28', 'H25-H28']


# Pediatric Complex Chronic Conditions (CCC)
icd9codes = ['135', '179', '243']
mapper.map(icd9codes, source='icd9', target='ccc_category')
>>> ['hemato_immu', 'malignancy', 'metabolic']

mapper.map(icd9codes, source='icd9', target='ccc_subcategory')
>>> ['Sarcoidosis', 'Neoplasms', 'Endocrine disorders']

# And many more... You can check all available mappers this way
mapper.show_mappers()
>>> From icd9 to:
>>>         - cci
>>>         - ccs
>>>         - chapter
>>>         - icd10
>>>         - ccc_category
>>>         - ccc_subcategory
>>> From icd10 to:
>>>         - icd9
>>>         - block
>>>         - chapter
>>>         - ccsr
>>>         - ccir
>>>         - ccc_category
>>>         - ccc_subcategory

Validator

This class helps you validate codes for a given ontology. Currently supports ICD9 and ICD10 codes.

from icdmappings import Validator

validator = Validator()

icd9code = '3591'

validator.validate(icd9code, expects='icd9_diagnostic')
>>> True

icd9codes = ['3591','NOT_A_CODE', '00321']
validator.validate(icd9codes, expects='icd9_diagnostic')
>>> [True, False, True]

# can also check procedure codes
icd9codes = ['3582', '5731', 'NOT_A_CODE']
validator.validate(icd9codes, expects='icd9_procedure')
>>> [True, True, False]

# likewise for ICD10

icd10code = 'B530'
validator.validate(icd10code, expects='icd10_diagnostic')
>>> True

Feature requests

Feel free to request a new functionality or report a bug by creating a new issue.

Acknowledgments

Tekaichi for building the initial version of the icd9->ccs pipeline

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icd_mappings-0.5.0.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icd_mappings-0.5.0-py3-none-any.whl (3.3 MB view details)

Uploaded Python 3

File details

Details for the file icd_mappings-0.5.0.tar.gz.

File metadata

  • Download URL: icd_mappings-0.5.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Darwin/24.0.0

File hashes

Hashes for icd_mappings-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ff418f5fb00076b38178b487dcf45825111d9069fa98d95d0129ca2bb27d4460
MD5 1e0b1093c3774519ab9a9889835d8731
BLAKE2b-256 0ee3782ae07a009fb7b88b4237ebf94c85a5a5b7c1db2a854491dd1b09db6888

See more details on using hashes here.

File details

Details for the file icd_mappings-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: icd_mappings-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.1 Darwin/24.0.0

File hashes

Hashes for icd_mappings-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc9ec78c299eac65d9254b4f4a097b80c83212421041cf7629b4ad1682db0f0
MD5 7d2660b312828e1ed897c02478669dc1
BLAKE2b-256 9818a9804798c83547eaf92b86d893031a6bdec60502b9f4100978158b7c11d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page