Current version is 0.0.8.
A Python package for H-CUP Tools and Software. The modules implemented in this package are as follows:
- "CCS (Clinical Classification Software)" converts ICD-10 diagnosis and procedure codes to clinically meaningful groups
- "CCI (Chronic Condition Indicator)" identifies chronic conditions from ICD-10 diagnosis codes
- "Elixhauser Comordibity Index" calculates both readmission and mortality risks using a set of ICD-10 diagnosis codes
- "Procedure Classes" identify if a given ICD-10 procedure code is Minor/Major Diagnosis/Therapeutic
- "Utilization Flags" identify if a combination of UB40 revenue codes and ICD-10 procedure codes indicates (or implies) a certain resource utilization e.g. Intensive Care Unit, Ultrasound, X-Ray, etc.
- "Surgery Flags" identify if a CPT code is a surgery related or not. NOTE that, to use this module, users must agree to an additional license agreement with the AMA for using CPT codes here.
NOTE that this package does not support for ICD-9.
Installing from the source:
$ git clone [email protected]:yubin-park/hcuppy.git
$ cd hcuppy
$ python setup.py develop
Or, simply using pip
:
$ pip install hcuppy
hcuppy/
: The package source code is located here.data/
: The raw data files downloaded from the H-CUP website.ccs.py
: a module for CCScci.py
: a module for CCIelixhauser.py
: a module for Elixhauser Comorbidity Indexprcls.py
: a module for Procedure Classuflag.py
: a module for Utilization Flagssflag.py
: a module for Surgery Flagsutils.py
: utility functions for reading data files.
tests/
: test scripts to check the validity of the outputs.LICENSE.txt
: Apache 2.0.README.md
: This README file.setup.py
: a set-up script.
hcuppy
is really simple to use.
Please see some examples below.
NOTE that all functions used below have docstrings.
If you want to see the input parameter specifications,
please type print(<instance>.<function>.__doc__)
.
>>> import json
>>> from hcuppy.ccs import CCSEngine
>>> ce = CCSEngine(mode="dx")
>>> out = ce.get_ccs(["E119", "I10"])
>>> print(json.dumps(out, indent=2))
[
{
"ccs": "49",
"ccs_desc": "Diabetes mellitus without complication",
"ccs_lv1": "3",
"ccs_lv1_desc": "Endocrine; nutritional; and metabolic diseases and immunity disorders",
"ccs_lv2": "3.2",
"ccs_lv2_desc": "Diabetes mellitus without complication [49.]"
},
{
"ccs": "98",
"ccs_desc": "Essential hypertension",
"ccs_lv1": "7",
"ccs_lv1_desc": "Diseases of the circulatory system",
"ccs_lv2": "7.1",
"ccs_lv2_desc": "Hypertension"
}
]
>>>
>>> from hcuppy.cci import CCIEngine
>>> ce = CCIEngine()
>>> out = ce.get_cci(["E119"])
>>> print(json.dumps(out, indent=2))
[
{
"is_chronic": true,
"body_system": "3",
"body_system_desc": "Endocrine, nutritional, and metabolic diseases and immunity disorders"
}
]
The Y22 version implementation requires Present On Admission (POA) information. To use the algorithm, please prepare two arrays of diagnosis codes: one with the full list (dx_full_lst
), and the other with POA (dx_poa_lst
). PLEASE NOTE THAT If you omit dx_poa_lst
, then the algorithm would assume all diagnoses were present on admission.
>>> from hcuppy.elixhauser import ElixhauserEngine
>>> ee = ElixhauserEngine()
>>> dx_full_lst = ["E640", "E119", "B190"]
>>> dx_poa_lst = ["E119", "B190"]
>>> out = ee.get_elixhauser(dx_full_lst, dx_poa_lst)
>>> print(out)
{'cmrbdt_lst': ['WGHTLOSS', 'DIAB_UNCX', 'LIVER_SEV'],
'mrtlt_scr': 29,
'rdmsn_scr': 16}
>>>
>>> from hcuppy.elixhauser_v19 import ElixhauserEngineV19
>>> ee = ElixhauserEngineV19()
>>> out = ee.get_elixhauser(["E119", "E108", "I10", "I110", "Z944"])
>>> print(json.dumps(out, indent=2))
{
"cmrbdt_lst": [
"LIVER",
"DMCX",
"HTNCX",
"CHF"
],
"rdmsn_scr": 31,
"mrtlt_scr": 9
}
>>>
>>> from hcuppy.prcls import PrClsEngine
>>> pce = PrClsEngine()
>>> out = pce.get_prcls(["B231Y0Z"])
>>> print(json.dumps(out, indent=2))
[
{
"class": "1",
"desc": "Minor Diagnostic"
}
]
>>>
>>> from hcuppy.uflag import UFlagEngine
>>> ufe = UFlagEngine()
>>> out = ufe.get_uflag(rev_lst=["0380"], pr_lst=["BB0DZZZ"])
>>> print(json.dumps(out, indent=2))
[
"Blood",
"Chest X-Ray"
]
>>>
Please refer to the test scripts under the tests/
folder if you want to see other example use cases.
Apache 2.0
- Yubin Park, PhD
- Kevin Buchan Jr, PhD