myelin-pps 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- myelin_pps-1.0.0/LICENSE +21 -0
- myelin_pps-1.0.0/PKG-INFO +475 -0
- myelin_pps-1.0.0/README.md +433 -0
- myelin_pps-1.0.0/myelin/__init__.py +167 -0
- myelin_pps-1.0.0/myelin/converter/__init__.py +16 -0
- myelin_pps-1.0.0/myelin/converter/icd_converter.py +387 -0
- myelin_pps-1.0.0/myelin/converter/parse_icd_table.py +129 -0
- myelin_pps-1.0.0/myelin/core.py +801 -0
- myelin_pps-1.0.0/myelin/database/__init__.py +0 -0
- myelin_pps-1.0.0/myelin/database/manager.py +121 -0
- myelin_pps-1.0.0/myelin/helpers/__init__.py +27 -0
- myelin_pps-1.0.0/myelin/helpers/claim_examples.py +115 -0
- myelin_pps-1.0.0/myelin/helpers/cms_downloader.py +854 -0
- myelin_pps-1.0.0/myelin/helpers/excel_exporter.py +830 -0
- myelin_pps-1.0.0/myelin/helpers/ub04_coordinates.py +288 -0
- myelin_pps-1.0.0/myelin/helpers/ub04_data/ub04_blank.pdf +0 -0
- myelin_pps-1.0.0/myelin/helpers/ub04_field_map.py +287 -0
- myelin_pps-1.0.0/myelin/helpers/ub04_pdf.py +735 -0
- myelin_pps-1.0.0/myelin/helpers/utils.py +298 -0
- myelin_pps-1.0.0/myelin/helpers/zipCL_loader.py +167 -0
- myelin_pps-1.0.0/myelin/hhag/__init__.py +4 -0
- myelin_pps-1.0.0/myelin/hhag/hhag_client.py +144 -0
- myelin_pps-1.0.0/myelin/hhag/hhag_output.py +44 -0
- myelin_pps-1.0.0/myelin/input/__init__.py +41 -0
- myelin_pps-1.0.0/myelin/input/claim.py +281 -0
- myelin_pps-1.0.0/myelin/input/ioce.py +14 -0
- myelin_pps-1.0.0/myelin/input/irf_pai.py +38 -0
- myelin_pps-1.0.0/myelin/input/oasis.py +21 -0
- myelin_pps-1.0.0/myelin/ioce/__init__.py +23 -0
- myelin_pps-1.0.0/myelin/ioce/ioce_client.py +799 -0
- myelin_pps-1.0.0/myelin/ioce/ioce_output.py +598 -0
- myelin_pps-1.0.0/myelin/irfg/__init__.py +7 -0
- myelin_pps-1.0.0/myelin/irfg/irfg_client.py +171 -0
- myelin_pps-1.0.0/myelin/irfg/irfg_output.py +24 -0
- myelin_pps-1.0.0/myelin/mce/__init__.py +4 -0
- myelin_pps-1.0.0/myelin/mce/mce_client.py +137 -0
- myelin_pps-1.0.0/myelin/mce/mce_output.py +139 -0
- myelin_pps-1.0.0/myelin/msdrg/__init__.py +6 -0
- myelin_pps-1.0.0/myelin/msdrg/drg_client.py +652 -0
- myelin_pps-1.0.0/myelin/msdrg/msdrg_output.py +121 -0
- myelin_pps-1.0.0/myelin/plugins/__init__.py +16 -0
- myelin_pps-1.0.0/myelin/plugins/hookspecs.py +27 -0
- myelin_pps-1.0.0/myelin/plugins/manager.py +53 -0
- myelin_pps-1.0.0/myelin/pricers/__init__.py +47 -0
- myelin_pps-1.0.0/myelin/pricers/asc/__init__.py +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/client.py +785 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210101/AA.txt +4281 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210101/BB.txt +1933 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210101/EE.txt +1841 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210401/AA.csv +4268 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210401/BB.csv +1935 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210401/EE.csv +1840 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210701/AA.csv +4277 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210701/BB.csv +1948 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20210701/EE.csv +1843 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20211001/AA.csv +4277 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20211001/BB.csv +1972 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/20211001/EE.csv +1845 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2021/wage_index.txt +463 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220101/AA.csv +4026 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220101/BB.csv +1974 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220101/EE.csv +2007 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220101/FF.csv +4029 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220401/AA.txt +4027 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220401/BB.txt +1998 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220401/EE.txt +2007 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220401/FF.txt +4031 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220701/AA.txt +4028 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220701/BB.txt +2016 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220701/EE.txt +2007 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20220701/FF.txt +4032 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20221001/AA.csv +4028 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20221001/BB.csv +2030 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20221001/EE.csv +2007 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/20221001/FF.csv +4032 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2022/wage_index.txt +463 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230101/AA.csv +4082 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230101/BB.csv +2046 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230101/EE.csv +2096 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230101/FF.csv +4084 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230401/AA.csv +4082 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230401/BB.csv +2082 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230401/EE.csv +2096 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230401/FF.csv +4084 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230701/AA.csv +4086 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230701/BB.csv +2113 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230701/EE.csv +2100 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20230701/FF.csv +4090 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20231001/AA.csv +4088 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20231001/BB.csv +2169 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20231001/EE.csv +2100 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/20231001/FF.csv +6 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2023/wage_index.txt +463 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240101/AA.txt +4129 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240101/BB.txt +2351 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240101/EE.txt +2127 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240101/FF.txt +4130 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240401/AA.csv +4133 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240401/BB.csv +2357 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240401/EE.csv +2127 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240401/FF.csv +4134 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240701/AA.txt +4140 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240701/BB.txt +2400 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240701/EE.txt +2127 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20240701/FF.txt +4141 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20241001/AA.csv +4141 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20241001/BB.csv +2422 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20241001/EE.csv +2127 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/20241001/FF.csv +4142 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2024/wage_index.txt +463 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250101/AA.csv +4198 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250101/BB.csv +2475 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250101/EE.csv +2112 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250101/FF.csv +4202 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250401/AA.csv +4199 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250401/BB.csv +2495 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250401/EE.csv +2113 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250401/FF.csv +4203 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250401/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250701/AA.csv +4215 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250701/BB.csv +2521 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250701/EE.csv +2113 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250701/FF.csv +4219 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20250701/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20251001/AA.csv +4216 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20251001/BB.csv +2551 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20251001/EE.csv +2113 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/20251001/FF.csv +4220 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2025/wage_index.txt +504 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260101/AA.csv +4837 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260101/BB.csv +2526 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260101/EE.csv +1561 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260101/FF.csv +4841 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260101/data.pkl +0 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260401/AA.csv +4848 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260401/BB.csv +2547 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260401/EE.csv +1563 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260401/FF.csv +4852 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260701/AA.csv +4846 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260701/BB.csv +2566 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260701/EE.csv +1563 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/20260701/FF.csv +4852 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/2026/wage_index.csv +487 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_2022.csv +89 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_2023.csv +185 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_2024.csv +110 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_2025.csv +110 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_2026.csv +134 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data/normalized/code_pairs_combined.csv +624 -0
- myelin_pps-1.0.0/myelin/pricers/asc/data_loader.py +550 -0
- myelin_pps-1.0.0/myelin/pricers/asc/scripts/code_pair_normalizer.py +282 -0
- myelin_pps-1.0.0/myelin/pricers/esrd.py +1005 -0
- myelin_pps-1.0.0/myelin/pricers/fqhc.py +401 -0
- myelin_pps-1.0.0/myelin/pricers/hha.py +462 -0
- myelin_pps-1.0.0/myelin/pricers/hospice.py +463 -0
- myelin_pps-1.0.0/myelin/pricers/ipf.py +508 -0
- myelin_pps-1.0.0/myelin/pricers/ipps.py +920 -0
- myelin_pps-1.0.0/myelin/pricers/ipsf.py +872 -0
- myelin_pps-1.0.0/myelin/pricers/irf.py +389 -0
- myelin_pps-1.0.0/myelin/pricers/ltch.py +439 -0
- myelin_pps-1.0.0/myelin/pricers/opps.py +351 -0
- myelin_pps-1.0.0/myelin/pricers/opsf.py +615 -0
- myelin_pps-1.0.0/myelin/pricers/snf.py +283 -0
- myelin_pps-1.0.0/myelin/pricers/url_loader.py +25 -0
- myelin_pps-1.0.0/myelin_pps.egg-info/PKG-INFO +475 -0
- myelin_pps-1.0.0/myelin_pps.egg-info/SOURCES.txt +177 -0
- myelin_pps-1.0.0/myelin_pps.egg-info/dependency_links.txt +1 -0
- myelin_pps-1.0.0/myelin_pps.egg-info/requires.txt +21 -0
- myelin_pps-1.0.0/myelin_pps.egg-info/top_level.txt +1 -0
- myelin_pps-1.0.0/pyproject.toml +69 -0
- myelin_pps-1.0.0/setup.cfg +4 -0
- myelin_pps-1.0.0/tests/test_excel_exporter.py +495 -0
- myelin_pps-1.0.0/tests/test_myelin.py +525 -0
- myelin_pps-1.0.0/tests/test_ub04_pdf.py +442 -0
myelin_pps-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LibrePPS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: myelin-pps
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A comprehensive Python toolkit for interacting with key components of the US healthcare reimbursement system.
|
|
5
|
+
Author-email: Josh Lankford <lankford.josh@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/LibrePPS/myelin
|
|
8
|
+
Project-URL: Repository, https://github.com/LibrePPS/myelin.git
|
|
9
|
+
Project-URL: Issues, https://github.com/LibrePPS/myelin/issues
|
|
10
|
+
Keywords: cms,drg,msdrg,ioce,mce,ipps,opps,ipf,ipsf,ltch,opsf,hospice
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
19
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: beautifulsoup4>=4.13.4
|
|
24
|
+
Requires-Dist: jpype1>=1.6.0
|
|
25
|
+
Requires-Dist: pydantic>=2.11.7
|
|
26
|
+
Requires-Dist: requests>=2.32.4
|
|
27
|
+
Requires-Dist: tqdm>=4.67.1
|
|
28
|
+
Requires-Dist: pluggy>=1.5.0
|
|
29
|
+
Requires-Dist: sqlalchemy>=2.0.43
|
|
30
|
+
Requires-Dist: pypdf>=6.9.2
|
|
31
|
+
Requires-Dist: reportlab>=4.4.10
|
|
32
|
+
Provides-Extra: excel
|
|
33
|
+
Requires-Dist: openpyxl>=3.1.5; extra == "excel"
|
|
34
|
+
Provides-Extra: pdf
|
|
35
|
+
Requires-Dist: pypdf>=6.9.2; extra == "pdf"
|
|
36
|
+
Requires-Dist: reportlab>=4.4.10; extra == "pdf"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: openpyxl>=3.1.5; extra == "all"
|
|
39
|
+
Requires-Dist: pypdf>=6.9.2; extra == "all"
|
|
40
|
+
Requires-Dist: reportlab>=4.4.10; extra == "all"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# Myelin
|
|
44
|
+
|
|
45
|
+
Myelin is a comprehensive Python toolkit for interacting with key components of the US healthcare reimbursement system. It provides a unified, developer-friendly interface to official CMS (Centers for Medicare & Medicaid Services) software, enabling programmatic access to:
|
|
46
|
+
|
|
47
|
+
- **MS-DRG Grouper:** Assigns inpatient claims to Diagnosis-Related Groups (DRGs) for payment determination.
|
|
48
|
+
- **HHA Grouper (HHAG):** Groups home health claims based on clinical and functional status, using OASIS data.
|
|
49
|
+
- **IRF Grouper (IRFG):** Groups inpatient rehabilitation facility claims.
|
|
50
|
+
- **MCE Editor:** Validates inpatient claims against the Medicare Code Editor (MCE) to ensure clinical coherence.
|
|
51
|
+
- **IOCE Editor:** Processes outpatient claims through the Integrated Outpatient Code Editor (IOCE) to assign Ambulatory Payment Classifications (APCs).
|
|
52
|
+
- **IPPS Pricer:** Calculates reimbursement for inpatient claims under the Inpatient Prospective Payment System (IPPS).
|
|
53
|
+
- **OPPS Pricer:** Calculates reimbursement for outpatient claims under the Outpatient Prospective Payment System (OPPS).
|
|
54
|
+
- **IPF Pricer:** Calculates reimbursement for inpatient claims under the Inpatient Psychiatric Facility Prospective Payment System (IPF PPS).
|
|
55
|
+
- **IRF Pricer:** Calculates reimbursement for inpatient rehabilitation facility claims.
|
|
56
|
+
- **LTCH Pricer:** Calculates reimbursement for long-term care hospital claims.
|
|
57
|
+
- **SNF Pricer:** Calculates reimbursement for skilled nursing facility claims.
|
|
58
|
+
- **HHA Pricer:** Calculates reimbursement for home health claims.
|
|
59
|
+
- **Hospice Pricer:** Calculates reimbursement for hospice claims.
|
|
60
|
+
- **ESRD Pricer:** Calculates reimbursement for End-Stage Renal Disease claims.
|
|
61
|
+
- **FQHC Pricer:** Calculates reimbursement for Federally Qualified Health Center claims.
|
|
62
|
+
|
|
63
|
+
Built on top of the official Java-based CMS tools, Myelin uses `jpype` to create a seamless bridge to Python, allowing developers, analysts, and researchers to integrate these critical healthcare components into their workflows for automation, analytics, and research.
|
|
64
|
+
|
|
65
|
+
## What is Myelin?
|
|
66
|
+
|
|
67
|
+
In the complex world of healthcare reimbursement, claims are processed through a series of steps to determine how much a provider should be paid. Myelin simplifies this process by providing a single, easy-to-use Python library that handles the most important of these steps:
|
|
68
|
+
|
|
69
|
+
- **Grouping:** Assigning a standardized code (like a DRG or APC) that categorizes the patient's episode of care.
|
|
70
|
+
- **Editing:** Checking the claim for errors or inconsistencies based on clinical and coding rules.
|
|
71
|
+
- **Pricing:** Calculating the final payment amount based on the assigned group and other factors.
|
|
72
|
+
|
|
73
|
+
By wrapping the official CMS software, Myelin ensures that you are using the same logic as Medicare and other major payers, providing a high degree of accuracy and reliability.
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- **Unified Interface:** A single, consistent API for interacting with multiple CMS tools.
|
|
78
|
+
- **Flexible Claim Construction:** Easily create and modify claims using Pydantic data models.
|
|
79
|
+
- **Support for Multiple Editors and Groupers:** Includes interfaces for the MCE (inpatient), IOCE (outpatient), HHA (home health), and IRF (inpatient rehabilitation) grouper/editors.
|
|
80
|
+
- **Comprehensive Pricer Suite:** Full-featured pricers for IPPS, OPPS, IPF, IRF, LTCH, SNF, HHA, Hospice, ESRD, and FQHC.
|
|
81
|
+
- **UB-04 PDF Read/Write:** Convert `Claim` objects to filled CMS-1450/UB-04 PDFs and read filled UB-04 PDFs back into `Claim` objects.
|
|
82
|
+
- **Extensible:** The underlying architecture makes it easy to add new components or customize existing ones.
|
|
83
|
+
- **Example Scripts:** Get up and running quickly with a comprehensive set of examples in the `example.py` file.
|
|
84
|
+
|
|
85
|
+
## Requirements
|
|
86
|
+
|
|
87
|
+
- Python 3.10+
|
|
88
|
+
- Java (JRE/JDK, Java 17+ is recommended)
|
|
89
|
+
- JPype1 (Python-Java bridge)
|
|
90
|
+
- DRG, MCE, IOCE, and Pricer Java JAR files (provided in the `jars/` directory or downloadable)
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
|
|
94
|
+
Install from PyPI:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install myelin-pps
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Optional extras are available for UB-04 PDF read/write support and the Excel exporters:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install myelin-pps[pdf]
|
|
104
|
+
pip install myelin-pps[excel]
|
|
105
|
+
pip install myelin-pps[all]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or install from source:
|
|
109
|
+
|
|
110
|
+
1. **Clone this repository:**
|
|
111
|
+
```bash
|
|
112
|
+
git clone https://github.com/LibrePPS/myelin.git
|
|
113
|
+
cd Myelin
|
|
114
|
+
```
|
|
115
|
+
2. **Install Python dependencies:**
|
|
116
|
+
```bash
|
|
117
|
+
pip install -r requirements.txt
|
|
118
|
+
```
|
|
119
|
+
To use UB-04 PDF read/write support, install the optional PDF dependencies:
|
|
120
|
+
```bash
|
|
121
|
+
pip install .[pdf]
|
|
122
|
+
```
|
|
123
|
+
To use the `to_excel()` / `to_excel_bytes()` exporters, install the optional Excel dependencies:
|
|
124
|
+
```bash
|
|
125
|
+
pip install .[excel]
|
|
126
|
+
```
|
|
127
|
+
Or install everything at once with the `all` extra:
|
|
128
|
+
```bash
|
|
129
|
+
pip install .[all]
|
|
130
|
+
```
|
|
131
|
+
or, if you use [uv](https://github.com/astral-sh/uv):
|
|
132
|
+
```bash
|
|
133
|
+
uv sync
|
|
134
|
+
```
|
|
135
|
+
with PDF support:
|
|
136
|
+
```bash
|
|
137
|
+
uv sync --extra pdf
|
|
138
|
+
```
|
|
139
|
+
with Excel support:
|
|
140
|
+
```bash
|
|
141
|
+
uv sync --extra excel
|
|
142
|
+
```
|
|
143
|
+
or all extras:
|
|
144
|
+
```bash
|
|
145
|
+
uv sync --extra all
|
|
146
|
+
```
|
|
147
|
+
dev dependencies:
|
|
148
|
+
```bash
|
|
149
|
+
uv sync --group dev
|
|
150
|
+
```
|
|
151
|
+
3. **Ensure Java is installed and available in your PATH.**
|
|
152
|
+
- Check with: `java -version`
|
|
153
|
+
|
|
154
|
+
## Testing
|
|
155
|
+
```bash
|
|
156
|
+
pytest tests/
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
# Linting & Formatting
|
|
160
|
+
Before commiting run [ruff](https://docs.astral.sh/ruff/) tooling.
|
|
161
|
+
|
|
162
|
+
Linter:
|
|
163
|
+
```bash
|
|
164
|
+
ruff check .
|
|
165
|
+
```
|
|
166
|
+
Autofix what you can, manually fix the remaining errors.
|
|
167
|
+
|
|
168
|
+
Import Sorting and Formatter:
|
|
169
|
+
```bash
|
|
170
|
+
ruff check --select I --fix
|
|
171
|
+
ruff format
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## Setup
|
|
176
|
+
|
|
177
|
+
Myelin is designed to handle the setup and configuration of the environment for you. By default, it will:
|
|
178
|
+
- Create the `jars/` and `data/` directories if they don't exist.
|
|
179
|
+
- Download the latest CMS grouper and editor JARs.
|
|
180
|
+
- Download the latest CMS pricer JARs.
|
|
181
|
+
- Create and populate the necessary SQLite databases for the pricers.
|
|
182
|
+
|
|
183
|
+
To get started, simply instantiate the `Myelin` class:
|
|
184
|
+
```python
|
|
185
|
+
from myelin import Myelin
|
|
186
|
+
|
|
187
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Usage
|
|
191
|
+
|
|
192
|
+
The `example.py` script provides a comprehensive set of examples for using all the features of myelin. Here's a brief overview of how to use each component through the `Myelin` class:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
uv run example.py
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### MS-DRG Grouper
|
|
199
|
+
|
|
200
|
+
The `DrgClient` is used to process inpatient claims and assign a DRG.
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
from myelin import Myelin
|
|
204
|
+
from myelin.helpers.test_examples import claim_example
|
|
205
|
+
|
|
206
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
207
|
+
|
|
208
|
+
claim = claim_example()
|
|
209
|
+
drg_output = myelin.drg_client.process(claim)
|
|
210
|
+
print(drg_output.model_dump_json(indent=2))
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### HHA Grouper (HHAG)
|
|
214
|
+
|
|
215
|
+
The `HhagClient` is used to process home health claims. This grouper has a special requirement for OASIS assessment data, which can be provided in `oasis` object class on the `Claim` object.
|
|
216
|
+
|
|
217
|
+
The following variables are supported within the `oasis` class:
|
|
218
|
+
- **Risk flags (boolean/int):** `fall_risk`, `weight_loss`, `multiple_hospital_stays`, `multiple_ed_visits`, `mental_behavior_risk`, `compliance_risk`, `five_or_more_meds`, `exhaustion`, `other_risk`, `none_of_above`.
|
|
219
|
+
- **Functional status (string codes):** `grooming`, `dress_upper`, `dress_lower`, `bathing`, `toileting`, `transferring`, `ambulation`.
|
|
220
|
+
|
|
221
|
+
If the `"oasis"` key is not provided, a set of defaults will be used.
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
from myelin import Myelin
|
|
225
|
+
from myelin.helpers.test_examples import claim_example
|
|
226
|
+
from datetime import datetime
|
|
227
|
+
|
|
228
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
229
|
+
|
|
230
|
+
claim = claim_example()
|
|
231
|
+
claim.from_date = datetime(2025, 1, 1)
|
|
232
|
+
claim.thru_date = datetime(2025, 1, 31)
|
|
233
|
+
|
|
234
|
+
# Add OASIS data
|
|
235
|
+
claim.oasis_assessment = OasisAssessment()
|
|
236
|
+
claim.oasis_assessment.fall_risk = 1
|
|
237
|
+
claim.oasis_assessment.multiple_hospital_stays = 1
|
|
238
|
+
claim.oasis_assessment.grooming = "1"
|
|
239
|
+
|
|
240
|
+
hhag_output = myelin.hhag_client.process(claim)
|
|
241
|
+
print(hhag_output.model_dump_json(indent=2))
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### IRF Grouper (IRFG)
|
|
245
|
+
|
|
246
|
+
The `IrfgClient` is used to process inpatient rehabilitation facility claims.
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
from myelin import Myelin
|
|
250
|
+
from myelin.helpers.test_examples import claim_example
|
|
251
|
+
|
|
252
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
253
|
+
|
|
254
|
+
claim = claim_example()
|
|
255
|
+
irfg_output = myelin.irfg_client.process(claim)
|
|
256
|
+
print(irfg_output.model_dump_json(indent=2))
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### MCE Editor
|
|
260
|
+
|
|
261
|
+
The `MceClient` is used to validate inpatient claims against the MCE edits.
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
from myelin import Myelin
|
|
265
|
+
from myelin.helpers.test_examples import claim_example
|
|
266
|
+
|
|
267
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
268
|
+
|
|
269
|
+
claim = claim_example()
|
|
270
|
+
mce_output = myelin.mce_client.process(claim)
|
|
271
|
+
print(mce_output.model_dump_json(indent=2))
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### IOCE Editor
|
|
275
|
+
|
|
276
|
+
The `IoceClient` is used to process outpatient claims through the IOCE editor.
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
from myelin import Myelin
|
|
280
|
+
from myelin.helpers.test_examples import opps_claim_example
|
|
281
|
+
|
|
282
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
283
|
+
|
|
284
|
+
opps_claim = opps_claim_example()
|
|
285
|
+
ioce_output = myelin.ioce_client.process(opps_claim)
|
|
286
|
+
print(ioce_output.model_dump_json(indent=2))
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Inpatient & Long-Term Care Pricers
|
|
290
|
+
|
|
291
|
+
This suite of pricers calculates reimbursement for various inpatient and long-term care settings. The IPPS, IPF, and LTCH pricers require the output from the `DrgClient`, while the SNF pricer operates directly on the claim.
|
|
292
|
+
|
|
293
|
+
- **`IppsClient`:** For standard inpatient claims (IPPS).
|
|
294
|
+
- **`IpfClient`:** For inpatient psychiatric facility (IPF) claims.
|
|
295
|
+
- **`LtchClient`:** For long-term care hospital (LTCH) claims.
|
|
296
|
+
- **`SnfClient`:** For skilled nursing facility (SNF) claims.
|
|
297
|
+
- **`IrfClient`:** For inpatient rehabilitation facility (IRF) claims.
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
from myelin import Myelin
|
|
301
|
+
from myelin.helpers.test_examples import claim_example
|
|
302
|
+
from datetime import datetime
|
|
303
|
+
|
|
304
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
305
|
+
|
|
306
|
+
claim = claim_example()
|
|
307
|
+
drg_output = myelin.drg_client.process(claim)
|
|
308
|
+
irfg_output = myelin.irfg_client.process(claim)
|
|
309
|
+
|
|
310
|
+
# IPPS Pricer
|
|
311
|
+
ipps_output = myelin.ipps_client.process(claim, drg_output)
|
|
312
|
+
print("IPPS Output:", ipps_output.model_dump_json(indent=2))
|
|
313
|
+
|
|
314
|
+
# IPF Pricer
|
|
315
|
+
ipf_output = myelin.ipf_client.process(claim, drg_output)
|
|
316
|
+
print("IPF Output:", ipf_output.model_dump_json(indent=2))
|
|
317
|
+
|
|
318
|
+
# LTCH Pricer
|
|
319
|
+
# LTCH may require specific provider IDs or other claim modifications
|
|
320
|
+
ltch_claim = claim_example()
|
|
321
|
+
ltch_claim.billing_provider.other_id = "012006"
|
|
322
|
+
ltch_drg_output = myelin.drg_client.process(ltch_claim)
|
|
323
|
+
ltch_output = myelin.ltch_client.process(ltch_claim, ltch_drg_output)
|
|
324
|
+
print("LTCH Output:", ltch_output.model_dump_json(indent=2))
|
|
325
|
+
|
|
326
|
+
# SNF Pricer
|
|
327
|
+
# SNF claims have specific requirements for bill type, DX, etc.
|
|
328
|
+
snf_claim = claim_example()
|
|
329
|
+
snf_claim.admit_date = datetime(2025, 1, 1)
|
|
330
|
+
snf_claim.from_date = datetime(2025, 1, 1)
|
|
331
|
+
snf_claim.thru_date = datetime(2025, 1, 20)
|
|
332
|
+
snf_claim.bill_type = "327"
|
|
333
|
+
snf_claim.principal_dx.code = "B20"
|
|
334
|
+
snf_output = myelin.snf_client.process(snf_claim)
|
|
335
|
+
print("SNF Output:", snf_output.model_dump_json(indent=2))
|
|
336
|
+
|
|
337
|
+
# IRF Pricer
|
|
338
|
+
irf_output = myelin.irf_client.process(claim, irfg_output)
|
|
339
|
+
print("IRF Output:", irf_output.model_dump_json(indent=2))
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Outpatient Pricers
|
|
343
|
+
|
|
344
|
+
- **`OppsClient`:** For standard outpatient claims (OPPS).
|
|
345
|
+
- **`HhaClient`:** For home health agency (HHA) claims.
|
|
346
|
+
- **`EsrdClient`:** For end-stage renal disease (ESRD) claims.
|
|
347
|
+
- **`FqhcClient`:** For federally qualified health center (FQHC) claims.
|
|
348
|
+
|
|
349
|
+
### OPPS Pricer
|
|
350
|
+
|
|
351
|
+
The `OppsClient` is used to calculate the reimbursement for an outpatient claim. It requires the output from the `IoceClient`.
|
|
352
|
+
|
|
353
|
+
```python
|
|
354
|
+
from myelin import Myelin
|
|
355
|
+
from myelin.helpers.test_examples import opps_claim_example
|
|
356
|
+
|
|
357
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
358
|
+
|
|
359
|
+
opps_claim = opps_claim_example()
|
|
360
|
+
ioce_output = myelin.ioce_client.process(opps_claim)
|
|
361
|
+
opps_output = myelin.opps_client.process(opps_claim, ioce_output)
|
|
362
|
+
print(opps_output.model_dump_json(indent=2))
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Hospice Pricer
|
|
366
|
+
|
|
367
|
+
The `HospiceClient` calculates reimbursement for hospice claims. It operates directly on the claim object.
|
|
368
|
+
|
|
369
|
+
```python
|
|
370
|
+
from myelin import Myelin
|
|
371
|
+
from myelin.helpers.test_examples import claim_example
|
|
372
|
+
from myelin.input import LineItem, ValueCode
|
|
373
|
+
from datetime import datetime
|
|
374
|
+
|
|
375
|
+
myelin = Myelin(build_jar_dirs=True, build_db=True)
|
|
376
|
+
|
|
377
|
+
claim = claim_example()
|
|
378
|
+
claim.bill_type = "812"
|
|
379
|
+
claim.patient_status = "40"
|
|
380
|
+
claim.value_codes.append(ValueCode(code="61", amount=35300.00))
|
|
381
|
+
claim.thru_date = datetime(2025, 7, 10)
|
|
382
|
+
claim.lines.append(
|
|
383
|
+
LineItem(
|
|
384
|
+
hcpcs="Q5001",
|
|
385
|
+
revenue_code="0651",
|
|
386
|
+
service_date=datetime(2025, 7, 1),
|
|
387
|
+
units=9
|
|
388
|
+
)
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
hospice_output = myelin.hospice_client.process(claim)
|
|
392
|
+
print(hospice_output.model_dump_json(indent=2))
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### UB-04 PDF Read/Write
|
|
396
|
+
|
|
397
|
+
Myelin can generate a filled CMS-1450/UB-04 PDF from a `Claim` and can also parse a filled UB-04 PDF back into a `Claim`.
|
|
398
|
+
Currently only one [PDF](https://www.cms.gov/regulations-and-guidance/legislation/paperworkreductionactof1995/pra-listing-items/cms-1450) is supported but we may expand this in the future.
|
|
399
|
+
|
|
400
|
+
```python
|
|
401
|
+
from myelin.input.claim import Claim
|
|
402
|
+
from myelin.helpers.ub04_pdf import write_ub04_calibration_pdf
|
|
403
|
+
from myelin.helpers.claim_examples import claim_example
|
|
404
|
+
|
|
405
|
+
claim = claim_example()
|
|
406
|
+
|
|
407
|
+
# Write a filled UB-04 PDF and also get the bytes in memory
|
|
408
|
+
pdf_bytes = claim.to_ub04_pdf("sample-ub04.pdf")
|
|
409
|
+
|
|
410
|
+
# Read a filled UB-04 PDF back into a Claim
|
|
411
|
+
parsed_claim = Claim.from_ub04_pdf("sample-ub04.pdf")
|
|
412
|
+
|
|
413
|
+
print(parsed_claim.model_dump_json(indent=2, exclude_none=True))
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
You can also generate the PDF entirely in memory:
|
|
417
|
+
|
|
418
|
+
```python
|
|
419
|
+
pdf_bytes = claim.to_ub04_pdf()
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
To generate a calibration PDF that labels every mapped field position on the bundled template:
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
write_ub04_calibration_pdf("ub04-calibration.pdf")
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
UB-04 PDF support requires the optional `pdf` extra.
|
|
429
|
+
|
|
430
|
+
### Excel Export
|
|
431
|
+
|
|
432
|
+
Every `MyelinOutput` can be exported to a multi-sheet Excel workbook for
|
|
433
|
+
sharing with business users. Each pricer / editor / grouper result is written
|
|
434
|
+
to its own sheet, with a `Summary` sheet up front containing the high-level
|
|
435
|
+
metrics from every module.
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
from myelin import Myelin, MyelinOutput
|
|
439
|
+
from myelin.helpers.claim_examples import claim_example
|
|
440
|
+
|
|
441
|
+
with Myelin() as myelin:
|
|
442
|
+
claim = claim_example()
|
|
443
|
+
results = myelin.process(claim)
|
|
444
|
+
results.to_excel("output.xlsx", claim=claim)
|
|
445
|
+
|
|
446
|
+
# Or grab the bytes directly (e.g. for an HTTP response)
|
|
447
|
+
excel_bytes = results.to_excel_bytes(claim=claim)
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Excel export support requires the optional `excel` extra (`pip install myelin-pps[excel]`).
|
|
451
|
+
|
|
452
|
+
## Project Structure
|
|
453
|
+
|
|
454
|
+
- `myelin/client.py` – Main class for interacting with the CMS tools and example usage.
|
|
455
|
+
- `msdrg/` – MS-DRG Grouper client and output models
|
|
456
|
+
- `hhag/` – HHA Grouper client and output models
|
|
457
|
+
- `irfg/` – IRF Grouper client and output models
|
|
458
|
+
- `mce/` – MCE Editor client and output models
|
|
459
|
+
- `ioce/` – IOCE Editor client and output models
|
|
460
|
+
- `pricers/` – Clients for all pricers (IPPS, OPPS, IPF, IRF, LTCH, SNF, HHA, Hospice, ESRD, FQHC)
|
|
461
|
+
- `input/` – Pydantic models for claims and related data
|
|
462
|
+
- `helpers/` – Utility scripts, including the CMS downloader
|
|
463
|
+
- `jars/` – Directory for Java JAR files (not tracked in git)
|
|
464
|
+
- `data/` – Directory for SQLite databases (not tracked in git)
|
|
465
|
+
|
|
466
|
+
## Troubleshooting
|
|
467
|
+
|
|
468
|
+
- **JVM Not Started:** Ensure Java is installed and the JAR path is correct.
|
|
469
|
+
- **Missing JARs:** The `Myelin` class should handle this automatically. If not, ensure the `jars/` directory is writable.
|
|
470
|
+
- **JPype Errors:** Make sure JPype1 is installed and matches your Python version.
|
|
471
|
+
- **Pricer Errors:** Ensure you have created the databases by running `Myelin(build_db=True)`.
|
|
472
|
+
|
|
473
|
+
## License
|
|
474
|
+
|
|
475
|
+
MIT License. See [LICENSE](LICENSE).
|