hccinfhir 0.2.2__py3-none-any.whl → 0.2.4__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/data/ph_race_and_ethnicity_cdc_v1.3.csv +1325 -0
- hccinfhir/datamodels.py +123 -6
- hccinfhir/extractor_834.py +600 -355
- hccinfhir/sample_files/sample_834_02.txt +1 -0
- hccinfhir/sample_files/sample_834_03.txt +1 -0
- hccinfhir/sample_files/sample_834_04.txt +1 -0
- hccinfhir/sample_files/sample_834_05.txt +1 -0
- hccinfhir/sample_files/sample_834_06.txt +1 -0
- hccinfhir/utils.py +40 -0
- {hccinfhir-0.2.2.dist-info → hccinfhir-0.2.4.dist-info}/METADATA +7 -5
- {hccinfhir-0.2.2.dist-info → hccinfhir-0.2.4.dist-info}/RECORD +13 -7
- {hccinfhir-0.2.2.dist-info → hccinfhir-0.2.4.dist-info}/WHEEL +0 -0
- {hccinfhir-0.2.2.dist-info → hccinfhir-0.2.4.dist-info}/licenses/LICENSE +0 -0
hccinfhir/datamodels.py
CHANGED
|
@@ -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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
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
|
|
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,76 @@ 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_qualifier: AMT qualifier code (e.g., 'D' = premium, 'C1' = copay)
|
|
291
|
+
amount: Premium or cost share amount (numeric)
|
|
292
|
+
|
|
293
|
+
# HCP History (multiple coverage periods)
|
|
294
|
+
hcp_history: List of historical HCP coverage periods
|
|
227
295
|
"""
|
|
296
|
+
# Header Info
|
|
297
|
+
source: Optional[str] = None
|
|
298
|
+
report_date: Optional[str] = None
|
|
299
|
+
|
|
228
300
|
# Identifiers
|
|
229
301
|
member_id: Optional[str] = None
|
|
230
302
|
mbi: Optional[str] = None
|
|
231
303
|
medicaid_id: Optional[str] = None
|
|
304
|
+
hic: Optional[str] = None
|
|
305
|
+
cin: Optional[str] = None
|
|
306
|
+
cin_check_digit: Optional[str] = None
|
|
307
|
+
|
|
308
|
+
# Name
|
|
309
|
+
first_name: Optional[str] = None
|
|
310
|
+
last_name: Optional[str] = None
|
|
311
|
+
middle_name: Optional[str] = None
|
|
232
312
|
|
|
233
313
|
# Demographics
|
|
234
314
|
dob: Optional[str] = None
|
|
235
315
|
age: Optional[int] = None
|
|
236
316
|
sex: Optional[str] = None
|
|
317
|
+
race: Optional[str] = None
|
|
318
|
+
language: Optional[str] = None
|
|
319
|
+
death_date: Optional[str] = None
|
|
320
|
+
|
|
321
|
+
# Address
|
|
322
|
+
address_1: Optional[str] = None
|
|
323
|
+
address_2: Optional[str] = None
|
|
324
|
+
city: Optional[str] = None
|
|
325
|
+
state: Optional[str] = None
|
|
326
|
+
zip: Optional[str] = None
|
|
327
|
+
phone: Optional[str] = None
|
|
237
328
|
|
|
238
329
|
# Coverage tracking
|
|
239
330
|
maintenance_type: Optional[str] = None
|
|
331
|
+
maintenance_reason_code: Optional[str] = None
|
|
332
|
+
benefit_status_code: Optional[str] = None
|
|
240
333
|
coverage_start_date: Optional[str] = None
|
|
241
334
|
coverage_end_date: Optional[str] = None
|
|
242
335
|
|
|
@@ -248,6 +341,21 @@ class EnrollmentData(BaseModel):
|
|
|
248
341
|
is_partial_benefit_dual: bool = False
|
|
249
342
|
medicare_status_code: Optional[str] = None
|
|
250
343
|
medi_cal_aid_code: Optional[str] = None
|
|
344
|
+
medi_cal_eligibility_status: Optional[str] = None
|
|
345
|
+
|
|
346
|
+
# CA DHCS / FAME Specific
|
|
347
|
+
fame_county_id: Optional[str] = None
|
|
348
|
+
case_number: Optional[str] = None
|
|
349
|
+
fame_card_issue_date: Optional[str] = None
|
|
350
|
+
fame_redetermination_date: Optional[str] = None
|
|
351
|
+
fame_death_date: Optional[str] = None
|
|
352
|
+
primary_aid_code: Optional[str] = None
|
|
353
|
+
carrier_code: Optional[str] = None
|
|
354
|
+
fed_contract_number: Optional[str] = None
|
|
355
|
+
client_reporting_cat: Optional[str] = None
|
|
356
|
+
res_addr_flag: Optional[str] = None
|
|
357
|
+
reas_add_ind: Optional[str] = None
|
|
358
|
+
res_zip_deliv_code: Optional[str] = None
|
|
251
359
|
|
|
252
360
|
# Risk Adjustment Fields
|
|
253
361
|
orec: Optional[str] = None
|
|
@@ -255,4 +363,13 @@ class EnrollmentData(BaseModel):
|
|
|
255
363
|
snp: bool = False
|
|
256
364
|
low_income: bool = False
|
|
257
365
|
lti: bool = False
|
|
258
|
-
new_enrollee: bool = False
|
|
366
|
+
new_enrollee: bool = False
|
|
367
|
+
|
|
368
|
+
# HCP Info
|
|
369
|
+
hcp_code: Optional[str] = None
|
|
370
|
+
hcp_status: Optional[str] = None
|
|
371
|
+
amount_qualifier: Optional[str] = None
|
|
372
|
+
amount: Optional[float] = None
|
|
373
|
+
|
|
374
|
+
# HCP History
|
|
375
|
+
hcp_history: List[HCPCoveragePeriod] = []
|