hccinfhir 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- hccinfhir/__init__.py +1 -1
- hccinfhir/model_calculate.py +5 -1
- {hccinfhir-0.1.4.dist-info → hccinfhir-0.1.5.dist-info}/METADATA +93 -11
- {hccinfhir-0.1.4.dist-info → hccinfhir-0.1.5.dist-info}/RECORD +6 -6
- {hccinfhir-0.1.4.dist-info → hccinfhir-0.1.5.dist-info}/WHEEL +0 -0
- {hccinfhir-0.1.4.dist-info → hccinfhir-0.1.5.dist-info}/licenses/LICENSE +0 -0
hccinfhir/__init__.py
CHANGED
hccinfhir/model_calculate.py
CHANGED
|
@@ -83,9 +83,11 @@ def calculate_raf(diagnosis_codes: List[str],
|
|
|
83
83
|
coefficients = apply_coefficients(demographics, hcc_set, interactions, model_name)
|
|
84
84
|
|
|
85
85
|
hcc_chronic = set()
|
|
86
|
+
interactions_chronic = {}
|
|
86
87
|
for hcc in hcc_set:
|
|
87
88
|
if is_chronic_mapping.get((hcc, model_name), False):
|
|
88
89
|
hcc_chronic.add(hcc)
|
|
90
|
+
interactions_chronic = apply_interactions(demographics, hcc_chronic, model_name)
|
|
89
91
|
|
|
90
92
|
demographic_interactions = {}
|
|
91
93
|
for key, value in interactions.items():
|
|
@@ -104,11 +106,13 @@ def calculate_raf(diagnosis_codes: List[str],
|
|
|
104
106
|
model_name)
|
|
105
107
|
coefficients_chronic_only = apply_coefficients(demographics,
|
|
106
108
|
hcc_chronic,
|
|
107
|
-
|
|
109
|
+
interactions_chronic,
|
|
108
110
|
model_name)
|
|
109
111
|
|
|
110
112
|
# Calculate risk scores
|
|
113
|
+
print(f"Coefficients: {coefficients}")
|
|
111
114
|
risk_score = sum(coefficients.values())
|
|
115
|
+
print(f"Risk Score: {risk_score}")
|
|
112
116
|
risk_score_demographics = sum(coefficients_demographics.values())
|
|
113
117
|
risk_score_chronic_only = sum(coefficients_chronic_only.values()) - risk_score_demographics
|
|
114
118
|
risk_score_hcc = risk_score - risk_score_demographics
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: hccinfhir
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: HCC Algorithm for FHIR Resources
|
|
5
5
|
Project-URL: Homepage, https://github.com/mimilabs/hccinfhir
|
|
6
6
|
Project-URL: Issues, https://github.com/mimilabs/hccinfhir/issues
|
|
@@ -60,12 +60,12 @@ print(f"HCCs: {result.hcc_list}")
|
|
|
60
60
|
HCCInFHIR supports three primary data sources for HCC risk adjustment calculations:
|
|
61
61
|
|
|
62
62
|
### 1. **CMS Encounter Data Records (EDRs)**
|
|
63
|
-
- **Input**: X12 837
|
|
63
|
+
- **Input**: X12 837 5010 transaction files (text format) + demographic data from payers
|
|
64
64
|
- **Use Case**: Medicare Advantage plans processing encounter data for CMS submissions
|
|
65
65
|
- **Output**: Risk scores with detailed HCC mappings and interactions
|
|
66
66
|
|
|
67
67
|
### 2. **Clearinghouse 837 Claims**
|
|
68
|
-
- **Input**: X12 837 institutional/professional claim files + patient demographics
|
|
68
|
+
- **Input**: X12 837 5010 institutional/professional claim files + patient demographics
|
|
69
69
|
- **Use Case**: Health plans and providers calculating risk scores from claims data
|
|
70
70
|
- **Output**: Service-level analysis with filtering and risk score calculations
|
|
71
71
|
|
|
@@ -579,17 +579,99 @@ except ModelNotFoundError as e:
|
|
|
579
579
|
print(f"Model configuration error: {e}")
|
|
580
580
|
```
|
|
581
581
|
|
|
582
|
-
|
|
582
|
+
### Custom Valuesets
|
|
583
|
+
|
|
584
|
+
Users can generate custom and more specific valuesets using the mimilabs data lakehouse.
|
|
585
|
+
|
|
586
|
+
For example, the valuesets in the package are created as follows:
|
|
587
|
+
|
|
588
|
+
`ra_dx_to_cc_mapping_2026.csv`
|
|
589
|
+
```sql
|
|
590
|
+
WITH latest_years AS (
|
|
591
|
+
SELECT
|
|
592
|
+
model_name,
|
|
593
|
+
MAX(year) as latest_year
|
|
594
|
+
FROM mimi_ws_1.cmspayment.ra_dx_to_cc_mapping
|
|
595
|
+
WHERE model_type = 'Initial'
|
|
596
|
+
AND year <= 2026 -- Don't go beyond 2026
|
|
597
|
+
GROUP BY model_name
|
|
598
|
+
)
|
|
599
|
+
SELECT
|
|
600
|
+
r.diagnosis_code,
|
|
601
|
+
r.cc,
|
|
602
|
+
r.model_name
|
|
603
|
+
FROM mimi_ws_1.cmspayment.ra_dx_to_cc_mapping r
|
|
604
|
+
INNER JOIN latest_years l
|
|
605
|
+
ON r.model_name = l.model_name
|
|
606
|
+
AND r.year = l.latest_year
|
|
607
|
+
WHERE r.model_type = 'Initial'
|
|
608
|
+
ORDER BY r.model_name, r.diagnosis_code;
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
`ra_hierarchies_2026.csv`
|
|
612
|
+
```sql
|
|
613
|
+
WITH latest_dates AS (
|
|
614
|
+
SELECT
|
|
615
|
+
model_domain,
|
|
616
|
+
model_version,
|
|
617
|
+
model_fullname,
|
|
618
|
+
MAX(eff_last_date) as latest_eff_last_date
|
|
619
|
+
FROM mimi_ws_1.cmspayment.ra_hierarchies
|
|
620
|
+
GROUP BY model_domain, model_version, model_fullname
|
|
621
|
+
)
|
|
622
|
+
SELECT
|
|
623
|
+
r.cc_parent,
|
|
624
|
+
r.cc_child,
|
|
625
|
+
r.model_domain,
|
|
626
|
+
r.model_version,
|
|
627
|
+
r.model_fullname
|
|
628
|
+
FROM mimi_ws_1.cmspayment.ra_hierarchies r
|
|
629
|
+
INNER JOIN latest_dates l
|
|
630
|
+
ON r.model_domain = l.model_domain
|
|
631
|
+
AND r.model_version = l.model_version
|
|
632
|
+
AND r.model_fullname = l.model_fullname
|
|
633
|
+
AND r.eff_last_date = l.latest_eff_last_date
|
|
634
|
+
ORDER BY r.model_domain, r.model_version, r.model_fullname, r.cc_parent, r.cc_child;
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
`ra_coefficients_2026.csv`
|
|
639
|
+
```sql
|
|
640
|
+
WITH preferred_records AS (
|
|
641
|
+
SELECT
|
|
642
|
+
model_domain,
|
|
643
|
+
model_version,
|
|
644
|
+
MAX(eff_last_date) as latest_eff_last_date
|
|
645
|
+
FROM mimi_ws_1.cmspayment.ra_coefficients
|
|
646
|
+
GROUP BY model_domain, model_version
|
|
647
|
+
)
|
|
648
|
+
SELECT
|
|
649
|
+
r.coefficient,
|
|
650
|
+
r.value,
|
|
651
|
+
r.model_domain,
|
|
652
|
+
r.model_version
|
|
653
|
+
FROM mimi_ws_1.cmspayment.ra_coefficients r
|
|
654
|
+
INNER JOIN preferred_records p
|
|
655
|
+
ON r.model_domain = p.model_domain
|
|
656
|
+
AND r.model_version = p.model_version
|
|
657
|
+
AND r.eff_last_date = p.latest_eff_last_date
|
|
658
|
+
ORDER BY r.model_domain, r.model_version, r.coefficient;
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
`ra_eligible_cpt_hcpcs_2026.csv`
|
|
662
|
+
```sql
|
|
663
|
+
SELECT DISTINCT cpt_hcpcs_code
|
|
664
|
+
FROM mimi_ws_1.cmspayment.ra_eligible_cpt_hcpcs
|
|
665
|
+
WHERE is_included = 'yes' AND YEAR(mimi_src_file_date) = 2025;
|
|
666
|
+
```
|
|
583
667
|
|
|
584
|
-
```bash
|
|
585
|
-
# Install development dependencies
|
|
586
|
-
pip install -e ".[dev]"
|
|
587
668
|
|
|
588
|
-
|
|
589
|
-
pytest tests/
|
|
669
|
+
## 🧪 Testing
|
|
590
670
|
|
|
591
|
-
|
|
592
|
-
|
|
671
|
+
```bash
|
|
672
|
+
$ hatch shell
|
|
673
|
+
$ pip install -e .
|
|
674
|
+
$ pytest tests/*
|
|
593
675
|
```
|
|
594
676
|
|
|
595
677
|
## 📄 License
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
hccinfhir/__init__.py,sha256=
|
|
1
|
+
hccinfhir/__init__.py,sha256=G_5m6jm3_BK5NdcZWoi0NEKJEsE_LjAU1RaLaL9xNPU,1043
|
|
2
2
|
hccinfhir/datamodels.py,sha256=Vp64Blwq8qWe-q1slCK8jMO9SIErUgkXusGZ0laXiWo,5936
|
|
3
3
|
hccinfhir/extractor.py,sha256=xL9c2VT-e2I7_c8N8j4Og42UEgVuCzyn9WFp3ntM5Ro,1822
|
|
4
4
|
hccinfhir/extractor_837.py,sha256=Jhxb5glRA8Yi8lbRwdltggXCvr_84nlsZEMRIgxyy4A,13169
|
|
5
5
|
hccinfhir/extractor_fhir.py,sha256=Rg_L0Vg5tz_L2VJ_jvZwWz6RMlPAkHwj4LiK-OWQvrQ,8458
|
|
6
6
|
hccinfhir/filter.py,sha256=j_yD2g6RBXVUV9trKkWzsQ35x3fRvfKUPvEXKUefI64,2007
|
|
7
7
|
hccinfhir/hccinfhir.py,sha256=6jvLoJF1TcqTGXbDA-_l3os6-xO68SKRr2l26LjzlgM,6982
|
|
8
|
-
hccinfhir/model_calculate.py,sha256=
|
|
8
|
+
hccinfhir/model_calculate.py,sha256=fPhSqfxN9-9EPyp8z-O8XZWMXmLU6Hun7OhXAgsgDFw,5688
|
|
9
9
|
hccinfhir/model_coefficients.py,sha256=ZsVY0S_X_BzDvcCmzCEf31v8uixbGmPAsR6nVEyCbIA,5530
|
|
10
10
|
hccinfhir/model_demographics.py,sha256=7W5NLW7aAjpn25BJzqfP8iSouD9uA6epGguJJ6BPuC0,7043
|
|
11
11
|
hccinfhir/model_dx_to_cc.py,sha256=guJny2Mb9z8YRNWCXGSIE3APbE06zwnA2NRkjAeUs60,1765
|
|
@@ -43,7 +43,7 @@ hccinfhir/sample_files/sample_eob_1.json,sha256=_NGSVR2ysFpx-DcTvyga6dFCzhQ8Vi9f
|
|
|
43
43
|
hccinfhir/sample_files/sample_eob_2.json,sha256=FcnJcx0ApOczxjJ_uxVLzCep9THfNf4xs9Yf7hxk8e4,1769
|
|
44
44
|
hccinfhir/sample_files/sample_eob_200.ndjson,sha256=CxpjeQ1DCMUzZILaM68UEhfxO0p45YGhDDoCZeq8PxU,1917986
|
|
45
45
|
hccinfhir/sample_files/sample_eob_3.json,sha256=4BW4wOMBEEU9RDfJR15rBEvk0KNHyuMEh3e055y87Hc,2306
|
|
46
|
-
hccinfhir-0.1.
|
|
47
|
-
hccinfhir-0.1.
|
|
48
|
-
hccinfhir-0.1.
|
|
49
|
-
hccinfhir-0.1.
|
|
46
|
+
hccinfhir-0.1.5.dist-info/METADATA,sha256=2FjYMUdQ67RQHeayhpmAhCuVyEGYSnUxcVbyC1mTn8w,21979
|
|
47
|
+
hccinfhir-0.1.5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
48
|
+
hccinfhir-0.1.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
49
|
+
hccinfhir-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|