hccinfhir 0.2.2__tar.gz → 0.2.3__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.
Files changed (62) hide show
  1. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/PKG-INFO +5 -5
  2. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/README.md +4 -4
  3. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/datamodels.py +121 -6
  4. hccinfhir-0.2.3/hccinfhir/extractor_834.py +704 -0
  5. hccinfhir-0.2.3/hccinfhir/sample_files/sample_834_02.txt +1 -0
  6. hccinfhir-0.2.3/hccinfhir/sample_files/sample_834_03.txt +1 -0
  7. hccinfhir-0.2.3/hccinfhir/sample_files/sample_834_04.txt +1 -0
  8. hccinfhir-0.2.3/hccinfhir/sample_files/sample_834_05.txt +1 -0
  9. hccinfhir-0.2.3/hccinfhir/sample_files/sample_834_06.txt +1 -0
  10. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/pyproject.toml +1 -1
  11. hccinfhir-0.2.2/hccinfhir/extractor_834.py +0 -511
  12. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/.gitignore +0 -0
  13. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/LICENSE +0 -0
  14. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/__init__.py +0 -0
  15. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/constants.py +0 -0
  16. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/__init__.py +0 -0
  17. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/hcc_is_chronic.csv +0 -0
  18. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/hcc_is_chronic_without_esrd_model.csv +0 -0
  19. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_coefficients_2025.csv +0 -0
  20. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_coefficients_2026.csv +0 -0
  21. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_dx_to_cc_2025.csv +0 -0
  22. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_dx_to_cc_2026.csv +0 -0
  23. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_eligible_cpt_hcpcs_2023.csv +0 -0
  24. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_eligible_cpt_hcpcs_2024.csv +0 -0
  25. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_eligible_cpt_hcpcs_2025.csv +0 -0
  26. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_eligible_cpt_hcpcs_2026.csv +0 -0
  27. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_hierarchies_2025.csv +0 -0
  28. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_hierarchies_2026.csv +0 -0
  29. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/data/ra_labels_2026.csv +0 -0
  30. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/defaults.py +0 -0
  31. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/extractor.py +0 -0
  32. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/extractor_837.py +0 -0
  33. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/extractor_fhir.py +0 -0
  34. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/filter.py +0 -0
  35. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/hccinfhir.py +0 -0
  36. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_calculate.py +0 -0
  37. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_coefficients.py +0 -0
  38. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_demographics.py +0 -0
  39. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_dx_to_cc.py +0 -0
  40. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_hierarchies.py +0 -0
  41. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/model_interactions.py +0 -0
  42. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/__init__.py +0 -0
  43. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_834_01.txt +0 -0
  44. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_0.txt +0 -0
  45. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_1.txt +0 -0
  46. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_10.txt +0 -0
  47. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_11.txt +0 -0
  48. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_12.txt +0 -0
  49. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_2.txt +0 -0
  50. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_3.txt +0 -0
  51. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_4.txt +0 -0
  52. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_5.txt +0 -0
  53. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_6.txt +0 -0
  54. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_7.txt +0 -0
  55. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_8.txt +0 -0
  56. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_837_9.txt +0 -0
  57. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_eob_1.json +0 -0
  58. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_eob_2.json +0 -0
  59. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_eob_200.ndjson +0 -0
  60. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/sample_files/sample_eob_3.json +0 -0
  61. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/samples.py +0 -0
  62. {hccinfhir-0.2.2 → hccinfhir-0.2.3}/hccinfhir/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hccinfhir
3
- Version: 0.2.2
3
+ Version: 0.2.3
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
@@ -80,7 +80,7 @@ print(f"HCCs: {result.hcc_list}")
80
80
  - **Custom Data Files**: Full support for custom coefficients, mappings, and hierarchies
81
81
  - **Flexible File Resolution**: Absolute paths, relative paths, or bundled data files
82
82
  - **Type-Safe**: Built on Pydantic with full type hints
83
- - **Well-Tested**: 181 comprehensive tests covering all features
83
+ - **Well-Tested**: 189 comprehensive tests covering all features
84
84
 
85
85
  ## 📊 Data Sources & Use Cases
86
86
 
@@ -1037,8 +1037,8 @@ result = processor.run([eob], demographics) # Note: [eob] not eob
1037
1037
  claim = get_837_sample(0) # Cases 0-12 (returns string)
1038
1038
  claims = get_837_sample_list([0, 1, 2]) # Returns list
1039
1039
 
1040
- # X12 834 enrollment samples
1041
- enrollment_834 = get_834_sample(1) # Currently only case 1 available (returns string)
1040
+ # X12 834 enrollment samples (6 CA DHCS scenarios)
1041
+ enrollment_834 = get_834_sample(1) # Cases 1-6 available (returns string)
1042
1042
 
1043
1043
  # List all available samples
1044
1044
  info = list_available_samples()
@@ -1056,7 +1056,7 @@ hatch shell
1056
1056
  # Install in development mode
1057
1057
  pip install -e .
1058
1058
 
1059
- # Run all tests (181 tests)
1059
+ # Run all tests (189 tests)
1060
1060
  pytest tests/
1061
1061
 
1062
1062
  # Run specific test file
@@ -65,7 +65,7 @@ print(f"HCCs: {result.hcc_list}")
65
65
  - **Custom Data Files**: Full support for custom coefficients, mappings, and hierarchies
66
66
  - **Flexible File Resolution**: Absolute paths, relative paths, or bundled data files
67
67
  - **Type-Safe**: Built on Pydantic with full type hints
68
- - **Well-Tested**: 181 comprehensive tests covering all features
68
+ - **Well-Tested**: 189 comprehensive tests covering all features
69
69
 
70
70
  ## 📊 Data Sources & Use Cases
71
71
 
@@ -1022,8 +1022,8 @@ result = processor.run([eob], demographics) # Note: [eob] not eob
1022
1022
  claim = get_837_sample(0) # Cases 0-12 (returns string)
1023
1023
  claims = get_837_sample_list([0, 1, 2]) # Returns list
1024
1024
 
1025
- # X12 834 enrollment samples
1026
- enrollment_834 = get_834_sample(1) # Currently only case 1 available (returns string)
1025
+ # X12 834 enrollment samples (6 CA DHCS scenarios)
1026
+ enrollment_834 = get_834_sample(1) # Cases 1-6 available (returns string)
1027
1027
 
1028
1028
  # List all available samples
1029
1029
  info = list_available_samples()
@@ -1041,7 +1041,7 @@ hatch shell
1041
1041
  # Install in development mode
1042
1042
  pip install -e .
1043
1043
 
1044
- # Run all tests (181 tests)
1044
+ # Run all tests (189 tests)
1045
1045
  pytest tests/
1046
1046
 
1047
1047
  # Run specific test file
@@ -195,22 +195,64 @@ class RAFResult(BaseModel):
195
195
 
196
196
  model_config = {"extra": "forbid", "validate_assignment": True}
197
197
 
198
+ class HCPCoveragePeriod(BaseModel):
199
+ """A single HCP (Health Care Plan) coverage period from HD loop"""
200
+ start_date: Optional[str] = None
201
+ end_date: Optional[str] = None
202
+ hcp_code: Optional[str] = None
203
+ hcp_status: Optional[str] = None
204
+ aid_codes: Optional[str] = None # REF*CE composite
205
+
206
+
198
207
  class EnrollmentData(BaseModel):
199
208
  """
200
209
  Enrollment and demographic data extracted from 834 transactions.
201
210
 
202
211
  Focus: Extract data needed for risk adjustment and Medicaid coverage tracking.
212
+ Supports California DHCS Medi-Cal 834 format with FAME fields.
203
213
 
204
214
  Attributes:
205
- member_id: Unique identifier for the member
206
- mbi: Medicare Beneficiary Identifier
207
- medicaid_id: Medicaid/Medi-Cal ID number
215
+ # Header Info
216
+ source: Interchange sender ID (ISA06)
217
+ report_date: Transaction date (GS04)
218
+
219
+ # Identifiers
220
+ member_id: Unique identifier for the member (REF*0F)
221
+ mbi: Medicare Beneficiary Identifier (REF*6P)
222
+ medicaid_id: Medicaid/Medi-Cal ID number (REF*23)
223
+ hic: Medicare HICN (REF*F6)
224
+ cin: Client Index Number from REF*3H
225
+ cin_check_digit: CIN check digit from REF*3H
226
+
227
+ # Name
228
+ first_name: Member first name (NM104)
229
+ last_name: Member last name (NM103)
230
+ middle_name: Member middle name (NM105)
231
+
232
+ # Demographics
208
233
  dob: Date of birth (YYYY-MM-DD)
209
234
  age: Calculated age
210
235
  sex: Member sex (M/F)
211
- maintenance_type: 001=Change, 021=Add, 024=Cancel, 025=Reinstate
236
+ race: Race/ethnicity code (DMG05)
237
+ language: Preferred language (LUI02)
238
+ death_date: Date of death if applicable
239
+
240
+ # Address
241
+ address_1: Street address line 1 (N301)
242
+ address_2: Street address line 2 (N302)
243
+ city: City (N401)
244
+ state: State code (N402)
245
+ zip: Postal code (N403)
246
+ phone: Phone number (PER04)
247
+
248
+ # Coverage tracking
249
+ maintenance_type: 001=Change, 021=Add, 024=Cancel, 025=Reinstate (INS03)
250
+ maintenance_reason_code: Maintenance reason (INS04)
251
+ benefit_status_code: A=Active, C=COBRA, etc. (INS05)
212
252
  coverage_start_date: Coverage effective date
213
- coverage_end_date: Coverage termination date (critical for Medicaid loss detection)
253
+ coverage_end_date: Coverage termination date
254
+
255
+ # Medicaid/Medicare Status
214
256
  has_medicare: Member has Medicare coverage
215
257
  has_medicaid: Member has Medicaid coverage
216
258
  dual_elgbl_cd: Dual eligibility status code ('00','01'-'08')
@@ -218,25 +260,75 @@ class EnrollmentData(BaseModel):
218
260
  is_partial_benefit_dual: Partial Benefit Dual (uses CPA_/CPD_ prefix)
219
261
  medicare_status_code: QMB, SLMB, QI, QDWI, etc.
220
262
  medi_cal_aid_code: California Medi-Cal aid code
263
+ medi_cal_eligibility_status: Medi-Cal eligibility status from REF*6O
264
+
265
+ # CA DHCS / FAME Specific
266
+ fame_county_id: FAME county ID (REF*ZX or N4*CY)
267
+ case_number: Case number (REF*1L)
268
+ fame_card_issue_date: FAME card issue date
269
+ fame_redetermination_date: FAME redetermination date (REF*17)
270
+ fame_death_date: FAME death date
271
+ primary_aid_code: Primary AID code (REF*RB)
272
+ carrier_code: Carrier code
273
+ fed_contract_number: Federal contract number
274
+ client_reporting_cat: Client reporting category
275
+ res_addr_flag: Residential address flag from REF*6O
276
+ reas_add_ind: Reason address indicator from REF*6O
277
+ res_zip_deliv_code: Residential zip delivery code
278
+
279
+ # Risk Adjustment Fields
221
280
  orec: Original Reason for Entitlement Code
222
281
  crec: Current Reason for Entitlement Code
223
282
  snp: Special Needs Plan enrollment
224
283
  low_income: Low Income Subsidy (Part D)
225
284
  lti: Long-Term Institutionalized
226
285
  new_enrollee: New enrollee status (<= 3 months)
286
+
287
+ # HCP (Health Care Plan) Info
288
+ hcp_code: Current HCP code (HD04 first part)
289
+ hcp_status: Current HCP status (HD04 second part)
290
+ amount: Premium or cost share amount
291
+
292
+ # HCP History (multiple coverage periods)
293
+ hcp_history: List of historical HCP coverage periods
227
294
  """
295
+ # Header Info
296
+ source: Optional[str] = None
297
+ report_date: Optional[str] = None
298
+
228
299
  # Identifiers
229
300
  member_id: Optional[str] = None
230
301
  mbi: Optional[str] = None
231
302
  medicaid_id: Optional[str] = None
303
+ hic: Optional[str] = None
304
+ cin: Optional[str] = None
305
+ cin_check_digit: Optional[str] = None
306
+
307
+ # Name
308
+ first_name: Optional[str] = None
309
+ last_name: Optional[str] = None
310
+ middle_name: Optional[str] = None
232
311
 
233
312
  # Demographics
234
313
  dob: Optional[str] = None
235
314
  age: Optional[int] = None
236
315
  sex: Optional[str] = None
316
+ race: Optional[str] = None
317
+ language: Optional[str] = None
318
+ death_date: Optional[str] = None
319
+
320
+ # Address
321
+ address_1: Optional[str] = None
322
+ address_2: Optional[str] = None
323
+ city: Optional[str] = None
324
+ state: Optional[str] = None
325
+ zip: Optional[str] = None
326
+ phone: Optional[str] = None
237
327
 
238
328
  # Coverage tracking
239
329
  maintenance_type: Optional[str] = None
330
+ maintenance_reason_code: Optional[str] = None
331
+ benefit_status_code: Optional[str] = None
240
332
  coverage_start_date: Optional[str] = None
241
333
  coverage_end_date: Optional[str] = None
242
334
 
@@ -248,6 +340,21 @@ class EnrollmentData(BaseModel):
248
340
  is_partial_benefit_dual: bool = False
249
341
  medicare_status_code: Optional[str] = None
250
342
  medi_cal_aid_code: Optional[str] = None
343
+ medi_cal_eligibility_status: Optional[str] = None
344
+
345
+ # CA DHCS / FAME Specific
346
+ fame_county_id: Optional[str] = None
347
+ case_number: Optional[str] = None
348
+ fame_card_issue_date: Optional[str] = None
349
+ fame_redetermination_date: Optional[str] = None
350
+ fame_death_date: Optional[str] = None
351
+ primary_aid_code: Optional[str] = None
352
+ carrier_code: Optional[str] = None
353
+ fed_contract_number: Optional[str] = None
354
+ client_reporting_cat: Optional[str] = None
355
+ res_addr_flag: Optional[str] = None
356
+ reas_add_ind: Optional[str] = None
357
+ res_zip_deliv_code: Optional[str] = None
251
358
 
252
359
  # Risk Adjustment Fields
253
360
  orec: Optional[str] = None
@@ -255,4 +362,12 @@ class EnrollmentData(BaseModel):
255
362
  snp: bool = False
256
363
  low_income: bool = False
257
364
  lti: bool = False
258
- new_enrollee: bool = False
365
+ new_enrollee: bool = False
366
+
367
+ # HCP Info
368
+ hcp_code: Optional[str] = None
369
+ hcp_status: Optional[str] = None
370
+ amount: Optional[str] = None
371
+
372
+ # HCP History
373
+ hcp_history: List[HCPCoveragePeriod] = []