Package: hccpy
hccpyHierachical Condition Categories Python Package.This module implements theHierachical Condition Categoriesthat are used for adjusting risks for the Medicare population.
The original SAS implementation can be foundhere.The latest version is 0.1.9 which was released on 05/13/2023.Currently, hccpy supports:CMS-HCC V22CMS-HCC V23CMS-HCC V24CMS-HCC V28CMS-HCC ESRDHHS-HCC 2019 (V05)HHS-HCC 2022 (V07)Note that hccpy does not have support for ICD-9.InstallingInstalling from the source:$ git clone git@github.com:yubin-park/hccpy.git
$ cd hccpy
$ python setup.py developOr, simply usingpip:$ pip install hccpyFile Structurehccpy/: The package source code is located here.data/: The raw data files directly downloaded fromthe National Burequ of Economics ResearchHere, you see the original SAS scripts and data files for the CMS HCC models._AGESEXV2.py: a Python re-write of theAGESEXV2.TXTSAS script._V2218O1M.py: a Python re-write of theV2218O1M.TXTSAS script._V2218O1P.py: a Python re-write of theV2219O1P.TXTSAS script._V22I0ED2.py: a Python re-write of theV22I0ED2.TXTSAS script._V2318P1M.py: a Python re-write of theV2318P1M.TXTSAS script._V2419P1M.py: a Python re-write of theV2419P1M.TXTSAS script.hcc.py: themainmodule that combines the various logical components for CMS-HCChhshcc.py: themainmodule for HHS-HCCutils.py: utility functions for reading data filestests/: 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 Exampleshccpyis really simple to use.
Please see some examples below:ImportingTo import theHCCEngineclass fromhccpy:>>>importjson>>>fromhccpy.hccimportHCCEngine>>>he=HCCEngine()>>>print(he.profile.__doc__)ReturnstheHCCriskprofileofagivenpatientinformation.Parameters----------dx_lst:listofstrAlistofICD10codesforthemeasurementyear.age:intorfloatTheageofthepatient.sex:strThesexofthepatient;{"M","F"}elig:strTheeligibilitysegmentofthepatient.Allowedvaluesareasfollows:-"CFA":CommunityFullBenefitDualAged-"CFD":CommunityFullBenefitDualDisabled-"CNA":CommunityNonDualAged-"CND":CommunityNonDualDisabled-"CPA":CommunityPartialBenefitDualAged-"CPD":CommunityPartialBenefitDualDisabled-"INS":LongTermInstitutional-"NE":NewEnrollee-"SNPNE":SNPNEorec:strOriginalreasonforentitlementcode.-"0":Oldageandsurvivor's insurance-"1":Disabilityinsurancebenefits-"2":End-stagerenaldisease-"3":BothDIBandESRDmedicaid:boolIfthepatientisinMedicaidornot.>>>HCC-Profiling a Member with Diagnosis CodesTo get a HCC profile from a list of diagnosis codes (in ICD-10):>>>rp=he.profile(["E1169","I5030","I509","I211","I209","R05"])>>>print(json.dumps(rp,indent=2)){"risk_score":1.3139999999999998,"details":{"CNA_M70_74":0.379,"CNA_HCC85":0.323,"CNA_HCC88":0.14,"CNA_HCC18":0.318,"CNA_HCC85_gDiabetesMellit":0.154,"CNA_DIABETES_CHF":0.0},"hcc_lst":["HCC85","HCC88","HCC18"],"hcc_map":{"I5030":"HCC85","I209":"HCC88","E1169":"HCC18","I509":"HCC85"},"parameters":{"age":70,"sex":"M","elig":"CNA","medicaid":false,"disabled":0,"origds":0}}>>>HCC for the new model, V28Please use "V28" when initializing the engine.>>>fromhccpy.hccimportHCCEngine>>>he=HCCEngine("28")Also, see thetest_v23()examples intests/hcc_tests.py.Coding Intensity Factor and Normalization FactorsYou can add normalization factors and coding intensity factors to directly calculate the adjusted risk score.By default, these two parameters are set as:cif=0.059,# coding intensity factor.norm_params={"C":1.015,# community/institution models"D":1.022,# ESRD Dialysis"G":1.028# ESRD Graft}You can overwrite these parameters. For example, this setting below would not adjust the raw risk score.HCCEngine(version="28",cif=0,norm_params={"C":1})To see the adjusted risk scores,>>>fromhccpy.hccimportHCCEngine>>>he=HCCEngine("28")>>>rp=he.profile(["E1169","I5030","I509","I211","I209","R05"],age=70,sex="M",elig="CNA")>>>rp["risk_score_adj"]Also, see thetest_norm_factors()examples intests/hcc_tests.py.HCC-Profiling a New MemberIf a member is new, then provide theelig="NE"in the input:>>>rp=he.profile([],elig="NE",age=65)>>>print(json.dumps(rp,indent=2)){"risk_score":0.514,"details":{"NE_NMCAID_NORIGDIS_NEM65":0.514},"hcc_lst":[],"hcc_map":{},"parameters":{"age":65,"sex":"M","elig":"NE_NMCAID_NORIGDIS_NE","medicaid":false,"disabled":0,"origds":0}}>>>HCC-Profiling a Intitutionalized MemberIf a member has a different eligibility status, change the eligibility as follows (e.g. institutionalized member):>>>rp=he.profile(["E1169","I5030","I509","I209"],elig="INS")>>>print(json.dumps(rp,indent=2)){"risk_score":2.6059999999999994,"details":{"INS_M70_74":1.323,"INS_HCC88":0.497,"INS_HCC18":0.441,"INS_HCC85":0.191,"INS_HCC85_gDiabetesMellit":0.0,"INS_DIABETES_CHF":0.154},"hcc_lst":["HCC88","HCC18","HCC85"],"hcc_map":{"I209":"HCC88","E1169":"HCC18","I509":"HCC85","I5030":"HCC85"},"parameters":{"age":70,"sex":"M","elig":"INS","medicaid":false,"disabled":0,"origds":0}}HCC-Describing a Hierachical Condition CategoryTo get the description, hierarchy parents and children of a HCC:>>>hcc_doc=he.describe_hcc("HCC19")# either "HCC19", "hcc19" or "19">>>print(json.dumps(hcc_doc,indent=2)){"description":"Diabetes without Complication","children":[],"parents":["HCC17","HCC18"]}Eligible Risk Adjustment CodesNot all claims are eligible for risk adjustment.
For professional claims, a certain set of CPT codes is required to be eligible, while for institutional claims, a certain set of bill types is needed.
This module provides an easy interface for determining if a certain claim is eligible for risk adjustment or not.NOTE: This function uses CPT codes, and this requiresAMA CPT license.
Once you carefully review the license, you need to downloada data file.>>>fromhccpy.raeligibleimportRAEligible>>>rae=RAEligible()>>>rae.load(fn="CY2019Q2_CPTHCPCS_CMS_20190425.csv")>>>rae.is_eligible(pr_lst=["C5271"])True>>>rae.is_eligible(pr_lst=["C5270"])False>>>NOTE: The data file (CY2019Q2_CPTHCPCS_CMS_20190425.csv) should be located in the same folder.NOTEhttps://packaging.python.org/tutorials/packaging-projects/python -m build
twine upload dist/*LicenseApache 2.0Authors/MaintainersYubin Park @yubin-parkThomas Chen @t-kychenMatt Walker @mwalker14David Roberts @dr00bKevin Buchan Jr. @kevinbuchanjrReferenceshttps://www.nber.org/data/cms-risk-adjustment.htmlhttps://www.cms.gov/medicare/health-plans/medicareadvtgspecratestats/risk-adjustors.htmlhttps://github.com/calyxhealth/pyriskadjusthttps://github.com/AlgorexHealth/hcc-pythonhttps://github.com/galtay/hcc_risk_modelshttps://www.cms.gov/cciio/resources/forms-reports-and-other-resources/downloads/ra-march-31-white-paper-032416.pdfhttps://www.cms.gov/cciio/resources/regulations-and-guidance/index.html