hccinfhir 0.0.3__tar.gz → 0.0.4__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.
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/PKG-INFO +65 -7
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/README.md +64 -6
- hccinfhir-0.0.4/hccinfhir/data/ra_coefficients_2025.csv +6352 -0
- hccinfhir-0.0.4/hccinfhir/data/ra_dx_to_cc_2025.csv +53952 -0
- hccinfhir-0.0.4/hccinfhir/data/ra_hierarchies_2025.csv +487 -0
- hccinfhir-0.0.4/hccinfhir/datamodels.py +84 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/extractor.py +3 -3
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/extractor_837.py +1 -2
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/extractor_fhir.py +1 -1
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/filter.py +1 -1
- hccinfhir-0.0.4/hccinfhir/hccinfhir.py +142 -0
- hccinfhir-0.0.4/hccinfhir/model_calculate.py +50 -0
- hccinfhir-0.0.4/hccinfhir/model_coefficients.py +143 -0
- hccinfhir-0.0.4/hccinfhir/model_demographics.py +191 -0
- hccinfhir-0.0.4/hccinfhir/model_dx_to_cc.py +70 -0
- hccinfhir-0.0.4/hccinfhir/model_hierarchies.py +70 -0
- hccinfhir-0.0.4/hccinfhir/model_interactions.py +342 -0
- hccinfhir-0.0.4/hccinfhir/samples/__init__.py +2 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/pyproject.toml +2 -2
- hccinfhir-0.0.3/hccinfhir/models.py +0 -44
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/.gitignore +0 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/LICENSE +0 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/__init__.py +0 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/data/__init__.py +0 -0
- {hccinfhir-0.0.3 → hccinfhir-0.0.4}/hccinfhir/data/ra_eligible_cpt_hcpcs_2023.csv +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_0.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_1.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_10.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_11.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_2.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_3.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_4.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_5.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_6.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_7.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_8.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_837_9.txt +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_eob_1.json +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_eob_2.json +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_eob_200.ndjson +0 -0
- {hccinfhir-0.0.3/hccinfhir/data → hccinfhir-0.0.4/hccinfhir/samples}/sample_eob_3.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: hccinfhir
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
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
|
|
@@ -45,7 +45,26 @@ sld = [{
|
|
|
45
45
|
}, ...]
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Or, for direct risk score calculation from a list of diagnosis codes, you only need the model name, diagnosis codes, and basic demographic factors:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from hccinfhir.model_calculate import calculate_raf
|
|
52
|
+
|
|
53
|
+
diagnosis_codes = ['E119', 'I509'] # Diabetes without complications, Heart failure
|
|
54
|
+
age = 67
|
|
55
|
+
sex = 'F'
|
|
56
|
+
model_name = "CMS-HCC Model V24"
|
|
57
|
+
|
|
58
|
+
result = calculate_raf(
|
|
59
|
+
diagnosis_codes=diagnosis_codes,
|
|
60
|
+
model_name=model_name,
|
|
61
|
+
age=age,
|
|
62
|
+
sex=sex
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
For more details on the SLD format, see the `datamodels.py` file.
|
|
49
68
|
|
|
50
69
|
## Core Components
|
|
51
70
|
|
|
@@ -71,21 +90,33 @@ filtered_sld = apply_filter(sld_list)
|
|
|
71
90
|
```
|
|
72
91
|
|
|
73
92
|
|
|
74
|
-
### 3. Logic Module
|
|
93
|
+
### 3. Logic Module
|
|
75
94
|
Implements core HCC calculation logic:
|
|
76
95
|
- Maps diagnosis codes to HCC categories
|
|
77
96
|
- Applies hierarchical rules and interactions
|
|
78
97
|
- Calculates final RAF scores
|
|
79
98
|
- Integrates with standard CMS data files
|
|
80
99
|
|
|
81
|
-
|
|
100
|
+
```python
|
|
101
|
+
from hccinfhir.model_calculate import calculate_raf
|
|
102
|
+
|
|
103
|
+
diagnosis_codes = ['E119', 'I509'] # Diabetes without complications, Heart failure
|
|
104
|
+
result = calculate_raf(
|
|
105
|
+
diagnosis_codes=diagnosis_codes,
|
|
106
|
+
model_name="CMS-HCC Model V24",
|
|
107
|
+
age=67,
|
|
108
|
+
sex='F'
|
|
109
|
+
)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. Running HCC on FHIR data
|
|
113
|
+
|
|
82
114
|
```python
|
|
83
115
|
from hccinfhir import HCCInFHIR
|
|
84
116
|
|
|
85
117
|
hcc_processor = HCCInFHIR()
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
raf_details = hcc_processor.calculate_raf(filtered_sld, demographic_data) # future
|
|
118
|
+
|
|
119
|
+
result = hcc_processor.run(eob_list, demographic_data)
|
|
89
120
|
```
|
|
90
121
|
|
|
91
122
|
## Testing
|
|
@@ -172,6 +203,33 @@ $ python3 -m pytest tests/*
|
|
|
172
203
|
3. Add support for allowed_amount in 837 if available in different segments
|
|
173
204
|
4. Consider adding more robust error handling in both implementations
|
|
174
205
|
|
|
206
|
+
## Data Files
|
|
207
|
+
|
|
208
|
+
`ra_dx_to_cc_mapping_2025.csv`
|
|
209
|
+
```sql
|
|
210
|
+
SELECT diagnosis_code, cc, model_name
|
|
211
|
+
FROM ra_dx_to_cc_mapping
|
|
212
|
+
WHERE year = 2025 and model_type = 'Initial';
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`ra_hierarchies_2025.csv`
|
|
216
|
+
```sql
|
|
217
|
+
SELECT cc_parent,
|
|
218
|
+
cc_child,
|
|
219
|
+
model_domain,
|
|
220
|
+
model_version,
|
|
221
|
+
model_fullname
|
|
222
|
+
FROM ra_hierarchies
|
|
223
|
+
WHERE eff_last_date > '2025-01-01';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`ra_coefficients_2025.csv`
|
|
227
|
+
```sql
|
|
228
|
+
SELECT coefficient, value, model_domain, model_version
|
|
229
|
+
FROM ra_coefficients
|
|
230
|
+
WHERE eff_last_date > '2025-01-01';
|
|
231
|
+
```
|
|
232
|
+
|
|
175
233
|
## Contributing
|
|
176
234
|
Join us at [mimilabs](https://mimilabs.ai/signup). Reference data available in MIMILabs data lakehouse.
|
|
177
235
|
|
|
@@ -31,7 +31,26 @@ sld = [{
|
|
|
31
31
|
}, ...]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Or, for direct risk score calculation from a list of diagnosis codes, you only need the model name, diagnosis codes, and basic demographic factors:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from hccinfhir.model_calculate import calculate_raf
|
|
38
|
+
|
|
39
|
+
diagnosis_codes = ['E119', 'I509'] # Diabetes without complications, Heart failure
|
|
40
|
+
age = 67
|
|
41
|
+
sex = 'F'
|
|
42
|
+
model_name = "CMS-HCC Model V24"
|
|
43
|
+
|
|
44
|
+
result = calculate_raf(
|
|
45
|
+
diagnosis_codes=diagnosis_codes,
|
|
46
|
+
model_name=model_name,
|
|
47
|
+
age=age,
|
|
48
|
+
sex=sex
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
For more details on the SLD format, see the `datamodels.py` file.
|
|
35
54
|
|
|
36
55
|
## Core Components
|
|
37
56
|
|
|
@@ -57,21 +76,33 @@ filtered_sld = apply_filter(sld_list)
|
|
|
57
76
|
```
|
|
58
77
|
|
|
59
78
|
|
|
60
|
-
### 3. Logic Module
|
|
79
|
+
### 3. Logic Module
|
|
61
80
|
Implements core HCC calculation logic:
|
|
62
81
|
- Maps diagnosis codes to HCC categories
|
|
63
82
|
- Applies hierarchical rules and interactions
|
|
64
83
|
- Calculates final RAF scores
|
|
65
84
|
- Integrates with standard CMS data files
|
|
66
85
|
|
|
67
|
-
|
|
86
|
+
```python
|
|
87
|
+
from hccinfhir.model_calculate import calculate_raf
|
|
88
|
+
|
|
89
|
+
diagnosis_codes = ['E119', 'I509'] # Diabetes without complications, Heart failure
|
|
90
|
+
result = calculate_raf(
|
|
91
|
+
diagnosis_codes=diagnosis_codes,
|
|
92
|
+
model_name="CMS-HCC Model V24",
|
|
93
|
+
age=67,
|
|
94
|
+
sex='F'
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. Running HCC on FHIR data
|
|
99
|
+
|
|
68
100
|
```python
|
|
69
101
|
from hccinfhir import HCCInFHIR
|
|
70
102
|
|
|
71
103
|
hcc_processor = HCCInFHIR()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
raf_details = hcc_processor.calculate_raf(filtered_sld, demographic_data) # future
|
|
104
|
+
|
|
105
|
+
result = hcc_processor.run(eob_list, demographic_data)
|
|
75
106
|
```
|
|
76
107
|
|
|
77
108
|
## Testing
|
|
@@ -158,6 +189,33 @@ $ python3 -m pytest tests/*
|
|
|
158
189
|
3. Add support for allowed_amount in 837 if available in different segments
|
|
159
190
|
4. Consider adding more robust error handling in both implementations
|
|
160
191
|
|
|
192
|
+
## Data Files
|
|
193
|
+
|
|
194
|
+
`ra_dx_to_cc_mapping_2025.csv`
|
|
195
|
+
```sql
|
|
196
|
+
SELECT diagnosis_code, cc, model_name
|
|
197
|
+
FROM ra_dx_to_cc_mapping
|
|
198
|
+
WHERE year = 2025 and model_type = 'Initial';
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`ra_hierarchies_2025.csv`
|
|
202
|
+
```sql
|
|
203
|
+
SELECT cc_parent,
|
|
204
|
+
cc_child,
|
|
205
|
+
model_domain,
|
|
206
|
+
model_version,
|
|
207
|
+
model_fullname
|
|
208
|
+
FROM ra_hierarchies
|
|
209
|
+
WHERE eff_last_date > '2025-01-01';
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
`ra_coefficients_2025.csv`
|
|
213
|
+
```sql
|
|
214
|
+
SELECT coefficient, value, model_domain, model_version
|
|
215
|
+
FROM ra_coefficients
|
|
216
|
+
WHERE eff_last_date > '2025-01-01';
|
|
217
|
+
```
|
|
218
|
+
|
|
161
219
|
## Contributing
|
|
162
220
|
Join us at [mimilabs](https://mimilabs.ai/signup). Reference data available in MIMILabs data lakehouse.
|
|
163
221
|
|