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.
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.
- 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.
Installation
pip install icd-mappings
Usage
Below are some examples on how to use this tool.
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']
# And many more... You can check all available mappers this way
mapper.show_mappers()
>>> From icd9 to:
>>> - icd10
>>> - chapter
>>> - ccs
>>> - cci
>>> From icd10 to:
>>> - icd9
>>> - chapter
>>> - ccsr
>>> - ccir
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for icd_mappings-0.3.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12278fd56ba31d253517c2d3e437b6123173b9bde421746ac1943eaa3dfff297 |
|
MD5 | f83ff4876619201b92bda72dac2d560b |
|
BLAKE2b-256 | 9d8cf0105b4b0e10f7e1df60cd2c28e84e42031f8cfddf0a63dd1cde9a7a9054 |