Skip to main content

hcuppy

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

Installing from the source:

$ git clone git@github.com:yubin-park/hcuppy.git
$ cd hcuppy
$ python setup.py develop

Or, simply using pip:

$ pip install hcuppy

File Structure

  • hcuppy/: The package source code is located here.
    • data/: The raw data files downloaded from the H-CUP website.
    • ccs.py: a module for CCS
    • cci.py: a module for CCI
    • elixhauser.py: a module for Elixhauser Comorbidity Index
    • prcls.py: a module for Procedure Class
    • uflag.py: a module for Utilization Flags
    • sflag.py: a module for Surgery Flags
    • utils.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.

Code Examples

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__).

Using CCS

>>> 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"
  }
]
>>>

Using CCI

>>> 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"
  }
]

Using Elixhauser Comorbidity Index

>>> from hcuppy.elixhauser import ElixhauserEngine
>>> ee = ElixhauserEngine()
>>> 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
}
>>>

Using Procedure Class

>>> from hcuppy.prcls import PrClsEngine
>>> pce = PrClsEngine()
>>> out = pce.get_prcls(["B231Y0Z"])
>>> print(json.dumps(out, indent=2))
[
  {
    "class": "1",
    "desc": "Minor Diagnostic"
  }
]
>>>

Using Utilization Flag

>>> 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.

License

Apache 2.0

Authors

Yubin Park, PhD

References

Metadata

Release files for hcuppy 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hcuppy 0.0.7
File Size Uploaded Provenance
hcuppy-0.0.7.tar.gz 9.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hcuppy 0.0.7
File Interpreter ABI Platform
hcuppy-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 2.5 MB

Release files / hcuppy-0.0.7.tar.gz

Download URL hcuppy-0.0.7.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d88d70769681dcd0fb4ae82222adfadf515b92cde83c57f8592bdf65d137dd13
BLAKE2b-256 checksum
How to use checksums
abed760869dfe841b90991d6a463394d02fd8962976e8b2760849348f01e2957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / hcuppy-0.0.7-py3-none-any.whl

Download URL hcuppy-0.0.7-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fd05e9fe2836c561c0f1e10a36503e628f2d0570bc43637a0af7e79c47eb8046
BLAKE2b-256 checksum
How to use checksums
da5090a7a6b85202281ad4c63fbf03022dedbed8f45ceddfde7c2edb22e3d33d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Security for hcuppy 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page