Package: drgpy
drgpydrgpyis a Python library for assigning a combination of diagnosis and procedure codes to Diagnosis Related Groups (MS-DRG) that is used in Medicare inpatient reimbursement today.NOTE the current default version is configured as MSDRG v40. However, the latest version is not thoroughly tested yet. Please use at your own risk.
Rawfiles:https://www.cms.gov/files/zip/icd-10-ms-drg-definitions-manual-files-v372.zipInstallingInstalling from the source:$ git clone git@github.com:yubin-park/drgpy.git
$ cd drgpy
$ python setup.py developOr, simply usingpip:$ pip install drgpyFile Structuredrgpy/: The package source code is located here.data/: The raw data files downloaded fromthe CMS website.msdrg.py: The main file for the MS-DRG logic._mdcsrdr.py: A script that reads/parsesmdcs_xx_xx.txtdata files._appndxrdr.py: A script that reads/parsesappendix_xx.txtdata files._mdcs0007.py: logics for MDC00 - MDC07_mdcs0811.py: logics for MDC08 - MDC11_mdcs1221.py: logics for MDC12 - MDC21_mdcs2225.py: logics for MDC22 - MDC25tests/: 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 Examplesdrgpyis 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 typeprint(<instance>.<function>.__doc__).A Wrapper Model for All VersionsTo use a wrapper model for all versions from 36 to 40, please use as follows:>>>fromdrgpy.msdrg_allversimportDRGEngineAllVers>>>de=DRGEngineAllVers()ReturnthecorrespondingDRGcodeforthediagnosesandproceduresParameters----------dx_lst:listAlistofICD-10diagnosiscodespr_lst:listAlistofICD-10procedurecodesdate:strYYYY-MM-DDformatDependingonthedateoftheclaim,theenginewillchoosetheappropriateversion.e.g.datebetween2020-10-01willusev39...gender:str"F"or"M"is_alive:booleanifthepatientisaliveatdischarge(True)Each Version SeparatelyNOTE that this usage doesn't require the date field.>>>fromdrgpy.msdrgimportDRGEngine>>>de=DRGEngine(version="v40")>>>print(de.get_drg.__doc__)ReturnthecorrespondingDRGcodeforthediagnosesandproceduresParameters----------dx_lst:listAlistofICD-10diagnosiscodespr_lst:listAlistofICD-10procedurecodesgender:str"F"or"M"is_alive:booleanifthepatientisaliveatdischarge(True)>>>>>>de.get_drg(["B20"],[])'977'>>>de.get_drg([],["02HA0RS"])'983'>>>de.get_drg([],["02HA0RS","02PA0RZ"])'002'>>>Please refer to the test scripts under thetests/folder if you want to see other example use cases.Raw Data Change LogFor v38+, inmdcs_00_07.txt, editNON-OPERATING ROOM PROCEDURES
02H63JZ*toNON-OPERATING ROOM PROCEDURES

  02H63JZ*For any version, inmdcs_08_11.txt, removeTo qualify as bilateral or multiple joint procedures you must have at least one code from two different lower extremity sites as listed below.
Examples: left hip  and right hip - bilateral; left hip and left knee - multiple;  left hip and right ankle - multiple; left knee and right knee - bilateralInmdcs_00_07.txt, removeCOMBINATION OF CODES IN THE NEXT FOUR LISTS
...Alos, in v40, duplicate sections exist for this part.Inmdcs_12_21.txt, removePrincipal or secondary diagnosis of newborn or neonate,with other significant problems, not assigned to DRG 789 through 793 or 795Inmdcs_12_21.txt, for v38+ DRG 768 and 798, editNON-OPERATING ROOM PROCEDURES
10D07Z3* Extraction of Products of Conception, Low Forceps, Via Natural or Artificial OpeningtoNON-OPERATING ROOM PROCEDURES

  10D07Z3* Extraction of Products of Conception, Low Forceps, Via Natural or Artificial OpeningInmdcs_12_21.txt, for DRG 807,NON-OPERATING ROOM PROCEDURES
10D07Z3*toNON-OPERATING ROOM PROCEDURES

  10D07Z3*For v36, in appendix_D_E.txt,Removed
10D17Z9 14 768
10D18Z9 14 796As the DRG definition say other OR procedures except for these two above, but these are included as OR procedures in the appendix. Rather than changing the algorithm to deal with the discrepancy, we edit the underlying data to maintain consistency.Any versions, in mdcs_08_11.txt,There are group-level or conditions for 456&457&458, e.g., one of... "and" with one of...Their categories are renamed as EXTENSIVE FUSION PART AB12..LicenseApache 2.0AuthorsYubin Park, PhDReferenceshttps://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/AcuteInpatientPPS/MS-DRG-Classifications-and-Software.htmlhttps://www.cms.gov/files/zip/icd-10-ms-drg-definitions-manual-files-v372.ziphttps://content.findacode.com/files/tutorials/DRG-Grouper-2019.pdf