hccinfhir 0.0.1__py3-none-any.whl → 0.0.3__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.
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.3
2
+ Name: hccinfhir
3
+ Version: 0.0.3
4
+ Summary: HCC Algorithm for FHIR Resources
5
+ Project-URL: Homepage, https://github.com/mimilabs/hccinfhir
6
+ Project-URL: Issues, https://github.com/mimilabs/hccinfhir/issues
7
+ Author-email: Yubin Park <yubin.park@mimilabs.ai>
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.8
12
+ Requires-Dist: pydantic>=2.10.3
13
+ Description-Content-Type: text/markdown
14
+
15
+ # `hccinfhir` (HCC in FHIR)
16
+ A Python library for extracting standardized service-level data from FHIR ExplanationOfBenefit resources, with a focus on supporting HCC (Hierarchical Condition Category) risk adjustment calculations.
17
+
18
+ ## Features
19
+ - Extract diagnosis codes, procedures, providers, and other key data elements from FHIR EOBs
20
+ - Support for both BCDA (Blue Button 2.0) and standard FHIR R4 formats
21
+ - Pydantic models for type safety and data validation
22
+ - Standardized Service Level Data (SLD) output format
23
+
24
+ ## Installation
25
+ ```bash
26
+ pip install hccinfhir
27
+ ```
28
+
29
+ ## Why FHIR-Based HCC Processing?
30
+ Risk Adjustment calculations traditionally rely on processed claims data, leading to information loss and reconciliation challenges. `hccinfhir` processes FHIR resources directly because:
31
+ - FHIR represents the source of truth with complete clinical and administrative data
32
+ - Risk Adjustment requires multiple data elements beyond diagnosis codes
33
+ - Direct processing eliminates data transformation errors and simplifies reconciliation
34
+
35
+ ## Data Model & Flexibility
36
+ While built for native FHIR processing, `hccinfhir` works with any data source that can be transformed into the SLD (Service Level Data) format:
37
+
38
+ ```python
39
+ sld = [{
40
+ "procedure_code": "99214",
41
+ "diagnosis_codes": ["E11.9", "I10"],
42
+ "claim_type": "71",
43
+ "provider_specialty": "01",
44
+ "service_date": "2024-01-15"
45
+ }, ...]
46
+ ```
47
+
48
+ For more details on the SLD format, see the `models.py` file.
49
+
50
+ ## Core Components
51
+
52
+ ### 1. Extractor Module
53
+ Processes FHIR ExplanationOfBenefit resources to extract Minimum Data Elements (MDE):
54
+ ```python
55
+ from hccinfhir.extractor import extract_sld, extract_sld_list
56
+
57
+ sld = extract_sld(eob_data) # Process single EOB
58
+
59
+ sld_list = extract_sld_list([eob1, eob2]) # Process multiple EOBs
60
+ ```
61
+
62
+ ### 2. Filter Module
63
+ Implements claim filtering rules:
64
+ - Inpatient/outpatient criteria - Type of Bill + Eligible CPT/HCPCS
65
+ - Professional service requirements - Eligible CPT/HCPCS
66
+ - Provider validation (Not in scope for this release, applicable to RAPS)
67
+ ```python
68
+ from hccinfhir.filter import apply_filter
69
+
70
+ filtered_sld = apply_filter(sld_list)
71
+ ```
72
+
73
+
74
+ ### 3. Logic Module (In Development)
75
+ Implements core HCC calculation logic:
76
+ - Maps diagnosis codes to HCC categories
77
+ - Applies hierarchical rules and interactions
78
+ - Calculates final RAF scores
79
+ - Integrates with standard CMS data files
80
+
81
+ ## Usage
82
+ ```python
83
+ from hccinfhir import HCCInFHIR
84
+
85
+ hcc_processor = HCCInFHIR()
86
+ sld_list = hcc_processor.extract_sld_list(eob_list)
87
+ filtered_sld = hcc_processor.apply_filters(sld_list) # future
88
+ raf_details = hcc_processor.calculate_raf(filtered_sld, demographic_data) # future
89
+ ```
90
+
91
+ ## Testing
92
+ ```bash
93
+ $ python3 -m hatch shell
94
+ $ python3 -m pip install -e .
95
+ $ python3 -m pytest tests/*
96
+ ```
97
+
98
+ ## Dependencies
99
+ - Pydantic >= 2.10.3
100
+ - Standard Python libraries
101
+
102
+ ## Research: FHIR BCDA and 837 Field Mapping Analysis
103
+
104
+ ### Core Identifiers
105
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
106
+ |-------|------------|------------------|-------------------|
107
+ | claim_id | CLM01 segment | eob.id | ✓ Direct mapping |
108
+ | patient_id | NM109 when NM101='IL' | eob.patient.reference (last part after '/') | ✓ Aligned but different formats |
109
+
110
+ ### Provider Information
111
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
112
+ |-------|------------|-------------------|-------------------|
113
+ | performing_provider_npi | NM109 when NM101='82' and NM108='XX' | careTeam member with role 'performing'/'rendering' | ✓ Aligned |
114
+ | billing_provider_npi | NM109 when NM101='85' and NM108='XX' | contained resources with NPI system identifier | ✓ Conceptually aligned |
115
+ | provider_specialty | PRV03 when PRV01='PE' | careTeam member qualification with specialty system | ✓ Aligned but different code systems |
116
+
117
+ ### Claim Type Information
118
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
119
+ |-------|------------|-------------------|-------------------|
120
+ | claim_type | GS08 (mapped via CLAIM_TYPES) | eob.type with claim_type system | ✓ Aligned but different coding |
121
+ | facility_type | CLM05-1 (837I only) | facility.extension with facility_type system | ✓ Aligned for institutional claims |
122
+ | service_type | CLM05-2 (837I only) | extension or eob.type with service_type system | ✓ Aligned for institutional claims |
123
+
124
+ ### Service Line Information
125
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
126
+ |-------|------------|-------------------|-------------------|
127
+ | procedure_code | SV1/SV2 segment, element 2 | item.productOrService with pr system | ✓ Aligned |
128
+ | ndc | LIN segment after service line | item.productOrService with ndc system or extension | ✓ Aligned but different locations |
129
+ | quantity | SV1/SV2 element 4 | item.quantity.value | ✓ Direct mapping |
130
+ | quantity_unit | SV1/SV2 element 5 | item.quantity.unit | ✓ Direct mapping |
131
+ | service_date | DTP segment with qualifier 472 | item.servicedPeriod or eob.billablePeriod | ✓ Aligned |
132
+ | place_of_service | SV1 element 6 | item.locationCodeableConcept with place_of_service system | ✓ Aligned |
133
+ | modifiers | SV1/SV2 segment, additional qualifiers | item.modifier with pr system | ✓ Aligned |
134
+
135
+ ### Diagnosis Information
136
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
137
+ |-------|------------|-------------------|-------------------|
138
+ | linked_diagnosis_codes | SV1/SV2 diagnosis pointers + HI segment codes | item.diagnosisSequence + diagnosis lookup | ✓ Aligned but different structure |
139
+ | claim_diagnosis_codes | HI segment codes | diagnosis array with icd10cm/icd10 systems | ✓ Aligned |
140
+
141
+ ### Additional Fields
142
+ | Field | 837 Source | FHIR BCDA Source | Alignment Analysis |
143
+ |-------|------------|-------------------|-------------------|
144
+ | allowed_amount | Not available in 837 | item.adjudication with 'eligible' category | ⚠️ Only in FHIR |
145
+
146
+ ### Key Differences and Notes
147
+
148
+ 1. **Structural Differences**:
149
+ - 837 uses a segment-based approach with positional elements
150
+ - FHIR uses a nested object structure with explicit systems and codes
151
+
152
+ 2. **Code Systems**:
153
+ - FHIR explicitly defines systems for each code (via SYSTEMS constant)
154
+ - 837 uses implicit coding based on segment position and qualifiers
155
+
156
+ 3. **Data Validation**:
157
+ - FHIR implementation uses Pydantic models for validation
158
+ - 837 implements manual validation and parsing
159
+
160
+ 4. **Diagnosis Handling**:
161
+ - 837: Direct parsing from HI segment with position-based lookup
162
+ - FHIR: Uses sequence numbers and separate diagnosis array
163
+
164
+ 5. **Provider Information**:
165
+ - 837: Direct from NM1 segments with role qualifiers
166
+ - FHIR: Through careTeam structure with role coding
167
+
168
+ ### TODO: Enhancement Suggestions
169
+
170
+ 1. Consider adding validation for code systems in 837 parser to match FHIR's explicitness
171
+ 2. Standardize date handling between both implementations
172
+ 3. Add support for allowed_amount in 837 if available in different segments
173
+ 4. Consider adding more robust error handling in both implementations
174
+
175
+ ## Contributing
176
+ Join us at [mimilabs](https://mimilabs.ai/signup). Reference data available in MIMILabs data lakehouse.
177
+
178
+ ## License
179
+ Apache License 2.0
@@ -0,0 +1,28 @@
1
+ hccinfhir/__init__.py,sha256=OCyYCv4jTOlYHZbTw2DTks3e6_YT1N2JXAOuyR03KNE,43
2
+ hccinfhir/extractor.py,sha256=IHKxHEsuU5JIPnScv8x9v_L28aG5F6edZZ0VeYpBF6Y,1770
3
+ hccinfhir/extractor_837.py,sha256=84OeYB1nXl329osWagkkuX0q4MVATnHGk7VZa9p6zoI,7160
4
+ hccinfhir/extractor_fhir.py,sha256=Yu6Ce-2iKvn0j21t_EJUeXjwjZYbTh5HgqChMz8KkjI,8445
5
+ hccinfhir/filter.py,sha256=C05uFhqSVb0J7BpKPGt4hwQrCd0_HbGSmrxKHIZLg4w,2259
6
+ hccinfhir/models.py,sha256=dH0qICn8yjsqc35INYSG4HbvYyegRCPtQOPTJf5Qozw,2033
7
+ hccinfhir/data/__init__.py,sha256=SGiSkpGrnxbvtEFMMlk82NFHOE50hFXcgKwKUSuVZUg,45
8
+ hccinfhir/data/ra_eligible_cpt_hcpcs_2023.csv,sha256=VVoA4s0hsFmcRIugyFdbvSoeLcn7M7z0DITT6l4YqL8,39885
9
+ hccinfhir/data/sample_837_0.txt,sha256=eggrD259uHa05z2dfxWBpUDseSDp_AQcLyN_adpHyTw,5295
10
+ hccinfhir/data/sample_837_1.txt,sha256=E155MdemSDYoXokuTXUZ6Br_RGGedYv5t5dh-eMRmuk,1322
11
+ hccinfhir/data/sample_837_10.txt,sha256=zSJXI78vHAksA7FFQEVLvepefdpMM2_AexLyoDimV3Q,1129
12
+ hccinfhir/data/sample_837_11.txt,sha256=suVxlZEllEOy6dYgbzGIphKW6hDAKdYQTZFM3Ob84q4,817
13
+ hccinfhir/data/sample_837_2.txt,sha256=2bvXzaiopr7pO3D3pL7nLxcpgqKXrhu3lbulveJDJ-I,1125
14
+ hccinfhir/data/sample_837_3.txt,sha256=_B1Ktpsg7bOnA5BwZ7AUB0o7MME5AmLGuxzHq42FWok,1113
15
+ hccinfhir/data/sample_837_4.txt,sha256=jpzyiHKmRGMqN1ij9s1X4zRj0a2PXwtee4mjn4BRF3g,1077
16
+ hccinfhir/data/sample_837_5.txt,sha256=eYG4URk3zAr5UsnBKO5Wezo8dnL_HXGCMmXWJu0nxPA,1300
17
+ hccinfhir/data/sample_837_6.txt,sha256=pnKQf2cVcZpUl8PGeYzZxRxjKOMcISN2dBObIMtLx7E,1331
18
+ hccinfhir/data/sample_837_7.txt,sha256=5Y-x7ZA9d_qGaIrpVGfXKQBXqbxKiQ5CWOwEW1XGlds,1253
19
+ hccinfhir/data/sample_837_8.txt,sha256=J-zm0fzp6F19r2SWfHcCtab9ezd3c4YaSRO-RatJ-c4,1250
20
+ hccinfhir/data/sample_837_9.txt,sha256=nIIurZ0tLHw6ZfDM__U-WqV8Q0u4K3WP56-r3BnAEv8,1341
21
+ hccinfhir/data/sample_eob_1.json,sha256=_NGSVR2ysFpx-DcTvyga6dFCzhQ8Vi9fNzQEMPz5awU,3124
22
+ hccinfhir/data/sample_eob_2.json,sha256=FcnJcx0ApOczxjJ_uxVLzCep9THfNf4xs9Yf7hxk8e4,1769
23
+ hccinfhir/data/sample_eob_200.ndjson,sha256=CxpjeQ1DCMUzZILaM68UEhfxO0p45YGhDDoCZeq8PxU,1917986
24
+ hccinfhir/data/sample_eob_3.json,sha256=4BW4wOMBEEU9RDfJR15rBEvk0KNHyuMEh3e055y87Hc,2306
25
+ hccinfhir-0.0.3.dist-info/METADATA,sha256=Ekro5D_Wg4htDTmM1NDJOE03Z9BSggoQEdHKSsv1DY8,7654
26
+ hccinfhir-0.0.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
27
+ hccinfhir-0.0.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
+ hccinfhir-0.0.3.dist-info/RECORD,,
@@ -1,89 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: hccinfhir
3
- Version: 0.0.1
4
- Summary: HCC Algorithm for FHIR Resources
5
- Project-URL: Homepage, https://github.com/mimilabs/hccinfhir
6
- Project-URL: Issues, https://github.com/mimilabs/hccinfhir/issues
7
- Author-email: Yubin Park <yubin.park@mimilabs.ai>
8
- Classifier: License :: OSI Approved :: Apache Software License
9
- Classifier: Operating System :: OS Independent
10
- Classifier: Programming Language :: Python :: 3
11
- Requires-Python: >=3.8
12
- Requires-Dist: pydantic>=2.10.3
13
- Description-Content-Type: text/markdown
14
-
15
- # `hccinfhir` (HCC in FHIR)
16
- HCC (Hierarchical Condition Category) Algorithm Implementation for FHIR Resources
17
-
18
- ## Overview
19
- `hccinfhir` implements the CMS-HCC Risk Adjustment model using FHIR (Fast Healthcare Interoperability Resources) data. It processes Blue Button 2.0 API (BCDA) data to calculate Hierarchical Condition Category (HCC) Risk Adjustment Factors (RAF).
20
-
21
- ## Why FHIR-Based HCC Processing?
22
- Risk Adjustment calculations traditionally rely on processed claims data, leading to information loss and reconciliation challenges. `hccinfhir` processes FHIR resources directly because:
23
- - FHIR represents the source of truth with complete clinical and administrative data
24
- - Risk Adjustment requires multiple data elements beyond diagnosis codes
25
- - Direct processing eliminates data transformation errors and simplifies reconciliation
26
-
27
- ## Data Flexibility
28
- While built for native FHIR processing, `hccinfhir` works with any data source that can be transformed into the MDE format:
29
-
30
- ```python
31
- mde = [{
32
- "procedure_code": "99214",
33
- "diagnosis_codes": ["E11.9", "I10"],
34
- "claim_type": "71",
35
- "provider_specialty": "01",
36
- "service_date": "2024-01-15"
37
- }, ...]
38
- ```
39
-
40
- ## Components
41
-
42
- ### 1. Extractor Module
43
- Processes FHIR ExplanationOfBenefit resources to extract Minimum Data Elements (MDE):
44
- ```python
45
- from hccinfhir.extractor import extract_mde, extract_mde_list
46
-
47
- mde = extract_mde(eob_data) # Process single EOB
48
-
49
- mde_list = extract_mde_list([eob1, eob2]) # Process multiple EOBs
50
- ```
51
-
52
- ### 2. Logic Module (In Development)
53
- Implements core HCC calculation logic:
54
- - Maps diagnosis codes to HCC categories
55
- - Applies hierarchical rules and interactions
56
- - Calculates final RAF scores
57
- - Integrates with standard CMS data files
58
-
59
- ### 3. Filter Module (In Development)
60
- Implements claim filtering rules:
61
- - Inpatient/outpatient criteria
62
- - Professional service requirements
63
- - Provider validation
64
- - Date range filtering
65
-
66
- ## Installation
67
- ```bash
68
- pip install hccinfhir
69
- ```
70
-
71
- ## Usage
72
- ```python
73
- from hccinfhir import HCCInFHIR
74
-
75
- hcc_processor = HCCInFHIR()
76
- mde_list = hcc_processor.extract_mde_list(eob_list)
77
- filtered_mde = hcc_processor.apply_filters(mde_list) # future
78
- raf_details = hcc_processor.calculate_raf(filtered_mde, demographic_data) # future
79
- ```
80
-
81
- ## Dependencies
82
- - Pydantic >= 2.10.3
83
- - Standard Python libraries
84
-
85
- ## Contributing
86
- Join us at [mimilabs](https://mimilabs.ai/signup). Reference data available in MIMILabs data lakehouse.
87
-
88
- ## License
89
- Apache License 2.0
@@ -1,10 +0,0 @@
1
- hccinfhir/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
- hccinfhir/extractor.py,sha256=XRoWxmXAvqqmXkNjmr-yWmkKhKuFcVO5W3RyV9oCEQc,4288
3
- hccinfhir/data/__init__.py,sha256=daEdpEyAJIa8b2VkCqSKcw8PaExcB6Qro80XNes_sHA,2
4
- hccinfhir/data/sample_eob_1.json,sha256=_NGSVR2ysFpx-DcTvyga6dFCzhQ8Vi9fNzQEMPz5awU,3124
5
- hccinfhir/data/sample_eob_2.json,sha256=FcnJcx0ApOczxjJ_uxVLzCep9THfNf4xs9Yf7hxk8e4,1769
6
- hccinfhir/data/sample_eob_3.json,sha256=4BW4wOMBEEU9RDfJR15rBEvk0KNHyuMEh3e055y87Hc,2306
7
- hccinfhir-0.0.1.dist-info/METADATA,sha256=nFVxOtMDW1xRb_Ff_58Pc3x6FQkucve7yCGLpG7TKgI,2998
8
- hccinfhir-0.0.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
9
- hccinfhir-0.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
- hccinfhir-0.0.1.dist-info/RECORD,,