hccpy是hcc的python实现
hccp的Python项目详细描述
HCCPY
层次条件分类python包。
此模块实现用于调整医疗保险人群风险的Hierachical Condition Categories。 原始的sas实现可以找到here。 目前,HCCPY支持V22、V23和V24(beta)。
注:此软件包不支持ICD-9。
安装
从源安装:
$ git clone git@github.com:yubin-park/hccpy.git
$ cd hccpy
$ python setup.py develop
或者,只需使用pip
:
$ pip install hccpy
文件结构
hccpy/
:包源代码位于此处。data/
:直接从the National Burequ of Economics Research下载的原始数据文件- 在这里,您可以看到CMS-HCC模型的原始SAS脚本和数据文件
_AGESEXV2.py
:Python重新编写了AGESEXV2.TXT
SAS脚本_V2218O1M.py
:python重新编写V2218O1M.TXT
sas脚本。_V2218O1P.py
:python重新编写V2219O1P.TXT
sas脚本。_V22I0ED2.py
:Python重新编写V22I0ED2.TXT
SAS脚本_V2318P1M.py
:python重新编写V2318P1M.TXT
sas脚本。_V2419P1M.py
:python重新编写V2419P1M.TXT
sas脚本。hcc.py
:组合各种逻辑组件的main模块utils.py
:用于读取数据文件的实用函数
tests/
:测试脚本以检查输出的有效性。LICENSE.txt
:阿帕奇2.0README.md
:这个自述文件setup.py
:一个设置脚本
代码示例
hccpy
使用起来非常简单。
请参阅以下示例:
导入
从hccpy
导入HCCEngine
类:
>>>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.>>>
肝癌诊断代码
从诊断代码列表(ICD-10)中获取HCC资料:
>>>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分析新成员
如果成员是新成员,则在输入中提供elig="NE"
:
>>>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分析初始成员
如果一个成员具有不同的资格状态,请按以下方式更改资格(例如,制度化成员):
>>>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描述的是一个分级状态类别
要获取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"]}
合格的风险调整代码
并非所有索赔都有资格进行风险调整。 对于专业索赔,要求有一套特定的CPT代码,而对于机构索赔,则需要有一套特定的票据类型。 该模块提供了一个简单的界面,用于确定某个索赔是否符合风险调整的条件。
注意:这个函数使用cpt代码,这需要AMA CPT license。 仔细检查许可证后,需要下载a 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>>>
注意:数据文件(CY2019Q2_CPTHCPCS_CMS_20190425.csv
)应该位于同一文件夹中。
许可证
阿帕奇2.0
作者
- Yubin Park,博士
- 陈国强
参考文献
- https://www.nber.org/data/cms-risk-adjustment.html
- https://www.cms.gov/medicare/health-plans/medicareadvtgspecratestats/risk-adjustors.html
- https://github.com/calyxhealth/pyriskadjust
- https://github.com/AlgorexHealth/hcc-python
- https://github.com/galtay/hcc_risk_models
- https://www.cms.gov/cciio/resources/forms-reports-and-other-resources/downloads/ra-march-31-white-paper-032416.pdf
- https://www.cms.gov/cciio/resources/regulations-and-guidance/index.html