medicafe 0.250707.0__py3-none-any.whl → 0.250708.1__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.
Potentially problematic release.
This version of medicafe might be problematic. Click here for more details.
- MediLink/MediLink_Deductible.py +199 -35
- {medicafe-0.250707.0.dist-info → medicafe-0.250708.1.dist-info}/METADATA +1 -1
- {medicafe-0.250707.0.dist-info → medicafe-0.250708.1.dist-info}/RECORD +6 -6
- {medicafe-0.250707.0.dist-info → medicafe-0.250708.1.dist-info}/LICENSE +0 -0
- {medicafe-0.250707.0.dist-info → medicafe-0.250708.1.dist-info}/WHEEL +0 -0
- {medicafe-0.250707.0.dist-info → medicafe-0.250708.1.dist-info}/top_level.txt +0 -0
MediLink/MediLink_Deductible.py
CHANGED
|
@@ -175,17 +175,29 @@ def manual_deductible_lookup():
|
|
|
175
175
|
def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, member_id, npi):
|
|
176
176
|
try:
|
|
177
177
|
# Log the parameters being sent to the function
|
|
178
|
-
MediLink_ConfigLoader.log("Calling
|
|
178
|
+
MediLink_ConfigLoader.log("Calling eligibility check with parameters:", level="DEBUG")
|
|
179
179
|
MediLink_ConfigLoader.log("payer_id: {}".format(payer_id), level="DEBUG")
|
|
180
180
|
MediLink_ConfigLoader.log("provider_last_name: {}".format(provider_last_name), level="DEBUG")
|
|
181
181
|
MediLink_ConfigLoader.log("date_of_birth: {}".format(date_of_birth), level="DEBUG")
|
|
182
182
|
MediLink_ConfigLoader.log("member_id: {}".format(member_id), level="DEBUG")
|
|
183
183
|
MediLink_ConfigLoader.log("npi: {}".format(npi), level="DEBUG")
|
|
184
184
|
|
|
185
|
-
#
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
# Configuration flag to control which API to use
|
|
186
|
+
# Set to False to use the new Super Connector API, True to use the legacy v3 API
|
|
187
|
+
USE_LEGACY_API = False
|
|
188
|
+
|
|
189
|
+
if USE_LEGACY_API:
|
|
190
|
+
# Use the legacy get_eligibility_v3 function as primary
|
|
191
|
+
MediLink_ConfigLoader.log("Using legacy get_eligibility_v3 API", level="INFO")
|
|
192
|
+
eligibility = MediLink_API_v3.get_eligibility_v3(
|
|
193
|
+
client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
|
|
194
|
+
)
|
|
195
|
+
else:
|
|
196
|
+
# Use the new Super Connector API as primary
|
|
197
|
+
MediLink_ConfigLoader.log("Using new get_eligibility_super_connector API", level="INFO")
|
|
198
|
+
eligibility = MediLink_API_v3.get_eligibility_super_connector(
|
|
199
|
+
client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
|
|
200
|
+
)
|
|
189
201
|
|
|
190
202
|
# Log the response
|
|
191
203
|
MediLink_ConfigLoader.log("Eligibility response: {}".format(json.dumps(eligibility, indent=4)), level="DEBUG")
|
|
@@ -200,47 +212,199 @@ def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, me
|
|
|
200
212
|
MediLink_ConfigLoader.log("Error: {}".format(e), level="ERROR")
|
|
201
213
|
return None
|
|
202
214
|
|
|
203
|
-
#
|
|
204
|
-
def display_eligibility_info(data, dob, member_id, output_file):
|
|
205
|
-
if data is None:
|
|
206
|
-
return
|
|
215
|
+
# Helper functions to extract data from different API response formats
|
|
207
216
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
217
|
+
def extract_legacy_patient_info(policy):
|
|
218
|
+
"""Extract patient information from legacy API response format"""
|
|
219
|
+
patient_info = policy.get("patientInfo", [{}])[0]
|
|
220
|
+
return {
|
|
221
|
+
'lastName': patient_info.get("lastName", ""),
|
|
222
|
+
'firstName': patient_info.get("firstName", ""),
|
|
223
|
+
'middleName': patient_info.get("middleName", "")
|
|
224
|
+
}
|
|
212
225
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
+
def extract_super_connector_patient_info(eligibility_data):
|
|
227
|
+
"""Extract patient information from Super Connector API response format"""
|
|
228
|
+
if not eligibility_data or 'data' not in eligibility_data:
|
|
229
|
+
return {'lastName': '', 'firstName': '', 'middleName': ''}
|
|
230
|
+
|
|
231
|
+
# Navigate to the first eligibility record
|
|
232
|
+
eligibility_list = eligibility_data.get('data', {}).get('checkEligibility', {}).get('eligibility', [])
|
|
233
|
+
if not eligibility_list:
|
|
234
|
+
return {'lastName': '', 'firstName': '', 'middleName': ''}
|
|
235
|
+
|
|
236
|
+
first_eligibility = eligibility_list[0]
|
|
237
|
+
member_info = first_eligibility.get('eligibilityInfo', {}).get('member', {})
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
'lastName': member_info.get("lastName", ""),
|
|
241
|
+
'firstName': member_info.get("firstName", ""),
|
|
242
|
+
'middleName': member_info.get("middleName", "")
|
|
243
|
+
}
|
|
226
244
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
245
|
+
def extract_legacy_remaining_amount(policy):
|
|
246
|
+
"""Extract remaining amount from legacy API response format"""
|
|
247
|
+
deductible_info = policy.get("deductibleInfo", {})
|
|
248
|
+
if 'individual' in deductible_info:
|
|
249
|
+
return deductible_info['individual']['inNetwork'].get("remainingAmount", "")
|
|
250
|
+
elif 'family' in deductible_info:
|
|
251
|
+
return deductible_info['family']['inNetwork'].get("remainingAmount", "")
|
|
252
|
+
else:
|
|
253
|
+
return ""
|
|
254
|
+
|
|
255
|
+
def extract_super_connector_remaining_amount(eligibility_data):
|
|
256
|
+
"""Extract remaining amount from Super Connector API response format"""
|
|
257
|
+
if not eligibility_data or 'data' not in eligibility_data:
|
|
258
|
+
return ""
|
|
259
|
+
|
|
260
|
+
# Navigate to the first eligibility record
|
|
261
|
+
eligibility_list = eligibility_data.get('data', {}).get('checkEligibility', {}).get('eligibility', [])
|
|
262
|
+
if not eligibility_list:
|
|
263
|
+
return ""
|
|
264
|
+
|
|
265
|
+
first_eligibility = eligibility_list[0]
|
|
266
|
+
service_levels = first_eligibility.get('serviceLevels', [])
|
|
267
|
+
|
|
268
|
+
# Look for deductible information in service levels
|
|
269
|
+
for service_level in service_levels:
|
|
270
|
+
individual_services = service_level.get('individual', [])
|
|
271
|
+
for individual in individual_services:
|
|
272
|
+
services = individual.get('services', [])
|
|
273
|
+
for service in services:
|
|
274
|
+
# Look for deductible-related information
|
|
275
|
+
if service.get('service') == 'deductible' or 'deductible' in service.get('text', '').lower():
|
|
276
|
+
return service.get('remainingAmount', "")
|
|
277
|
+
|
|
278
|
+
# If no specific deductible found, try to get from plan levels
|
|
279
|
+
plan_levels = first_eligibility.get('eligibilityInfo', {}).get('planLevels', [])
|
|
280
|
+
for plan_level in plan_levels:
|
|
281
|
+
if plan_level.get('level') == 'deductibleInfo/outOfPocket/coPayMax':
|
|
282
|
+
individual_levels = plan_level.get('individual', [])
|
|
283
|
+
if individual_levels:
|
|
284
|
+
return individual_levels[0].get('remainingAmount', "")
|
|
285
|
+
|
|
286
|
+
return ""
|
|
287
|
+
|
|
288
|
+
def extract_legacy_insurance_info(policy):
|
|
289
|
+
"""Extract insurance information from legacy API response format"""
|
|
290
|
+
insurance_info = policy.get("insuranceInfo", {})
|
|
291
|
+
return {
|
|
292
|
+
'insuranceType': insurance_info.get("insuranceType", ""),
|
|
293
|
+
'insuranceTypeCode': insurance_info.get("insuranceTypeCode", ""),
|
|
294
|
+
'memberId': insurance_info.get("memberId", ""),
|
|
295
|
+
'payerId': insurance_info.get("payerId", "")
|
|
296
|
+
}
|
|
232
297
|
|
|
233
|
-
|
|
234
|
-
|
|
298
|
+
def extract_super_connector_insurance_info(eligibility_data):
|
|
299
|
+
"""Extract insurance information from Super Connector API response format"""
|
|
300
|
+
if not eligibility_data or 'data' not in eligibility_data:
|
|
301
|
+
return {'insuranceType': '', 'insuranceTypeCode': '', 'memberId': '', 'payerId': ''}
|
|
302
|
+
|
|
303
|
+
# Navigate to the first eligibility record
|
|
304
|
+
eligibility_list = eligibility_data.get('data', {}).get('checkEligibility', {}).get('eligibility', [])
|
|
305
|
+
if not eligibility_list:
|
|
306
|
+
return {'insuranceType': '', 'insuranceTypeCode': '', 'memberId': '', 'payerId': ''}
|
|
307
|
+
|
|
308
|
+
first_eligibility = eligibility_list[0]
|
|
309
|
+
insurance_info = first_eligibility.get('eligibilityInfo', {}).get('insuranceInfo', {})
|
|
310
|
+
|
|
311
|
+
# Get coverage type from coverageTypes array
|
|
312
|
+
coverage_types = insurance_info.get('coverageTypes', [])
|
|
313
|
+
insurance_type = ""
|
|
314
|
+
if coverage_types:
|
|
315
|
+
insurance_type = coverage_types[0].get('description', '')
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
'insuranceType': insurance_type,
|
|
319
|
+
'insuranceTypeCode': insurance_info.get("productCode", ""),
|
|
320
|
+
'memberId': insurance_info.get("policyNumber", ""),
|
|
321
|
+
'payerId': insurance_info.get("payerId", "")
|
|
322
|
+
}
|
|
235
323
|
|
|
236
|
-
|
|
324
|
+
def extract_legacy_policy_status(policy):
|
|
325
|
+
"""Extract policy status from legacy API response format"""
|
|
326
|
+
policy_info = policy.get("policyInfo", {})
|
|
327
|
+
return policy_info.get("policyStatus", "")
|
|
328
|
+
|
|
329
|
+
def extract_super_connector_policy_status(eligibility_data):
|
|
330
|
+
"""Extract policy status from Super Connector API response format"""
|
|
331
|
+
if not eligibility_data or 'data' not in eligibility_data:
|
|
332
|
+
return ""
|
|
333
|
+
|
|
334
|
+
# Navigate to the first eligibility record
|
|
335
|
+
eligibility_list = eligibility_data.get('data', {}).get('checkEligibility', {}).get('eligibility', [])
|
|
336
|
+
if not eligibility_list:
|
|
337
|
+
return ""
|
|
338
|
+
|
|
339
|
+
first_eligibility = eligibility_list[0]
|
|
340
|
+
insurance_info = first_eligibility.get('eligibilityInfo', {}).get('insuranceInfo', {})
|
|
341
|
+
|
|
342
|
+
return insurance_info.get("policyStatus", "")
|
|
343
|
+
|
|
344
|
+
def is_legacy_response_format(data):
|
|
345
|
+
"""Determine if the response is in legacy format (has memberPolicies)"""
|
|
346
|
+
return data is not None and "memberPolicies" in data
|
|
347
|
+
|
|
348
|
+
def is_super_connector_response_format(data):
|
|
349
|
+
"""Determine if the response is in Super Connector format (has data.checkEligibility)"""
|
|
350
|
+
return data is not None and "data" in data and "checkEligibility" in data.get("data", {})
|
|
351
|
+
|
|
352
|
+
# Function to extract required fields and display in a tabular format
|
|
353
|
+
def display_eligibility_info(data, dob, member_id, output_file):
|
|
354
|
+
if data is None:
|
|
355
|
+
return
|
|
356
|
+
|
|
357
|
+
# Determine which API response format we're dealing with
|
|
358
|
+
if is_legacy_response_format(data):
|
|
359
|
+
# Handle legacy API response format
|
|
360
|
+
for policy in data.get("memberPolicies", []):
|
|
361
|
+
# Skip non-medical policies
|
|
362
|
+
if policy.get("policyInfo", {}).get("coverageType", "") != "Medical":
|
|
363
|
+
continue
|
|
364
|
+
|
|
365
|
+
patient_info = extract_legacy_patient_info(policy)
|
|
366
|
+
remaining_amount = extract_legacy_remaining_amount(policy)
|
|
367
|
+
insurance_info = extract_legacy_insurance_info(policy)
|
|
368
|
+
policy_status = extract_legacy_policy_status(policy)
|
|
369
|
+
|
|
370
|
+
patient_name = "{} {} {}".format(
|
|
371
|
+
patient_info['firstName'],
|
|
372
|
+
patient_info['middleName'],
|
|
373
|
+
patient_info['lastName']
|
|
374
|
+
).strip()[:20]
|
|
375
|
+
|
|
376
|
+
# Display patient information in a table row format
|
|
377
|
+
table_row = "{:<20} | {:<10} | {:<40} | {:<5} | {:<14} | {:<14}".format(
|
|
378
|
+
patient_name, dob, insurance_info['insuranceType'],
|
|
379
|
+
insurance_info['payerId'], policy_status, remaining_amount)
|
|
380
|
+
output_file.write(table_row + "\n")
|
|
381
|
+
print(table_row) # Print to console for progressive display
|
|
382
|
+
|
|
383
|
+
elif is_super_connector_response_format(data):
|
|
384
|
+
# Handle Super Connector API response format
|
|
385
|
+
patient_info = extract_super_connector_patient_info(data)
|
|
386
|
+
remaining_amount = extract_super_connector_remaining_amount(data)
|
|
387
|
+
insurance_info = extract_super_connector_insurance_info(data)
|
|
388
|
+
policy_status = extract_super_connector_policy_status(data)
|
|
389
|
+
|
|
390
|
+
patient_name = "{} {} {}".format(
|
|
391
|
+
patient_info['firstName'],
|
|
392
|
+
patient_info['middleName'],
|
|
393
|
+
patient_info['lastName']
|
|
394
|
+
).strip()[:20]
|
|
237
395
|
|
|
238
396
|
# Display patient information in a table row format
|
|
239
397
|
table_row = "{:<20} | {:<10} | {:<40} | {:<5} | {:<14} | {:<14}".format(
|
|
240
|
-
patient_name, dob,
|
|
398
|
+
patient_name, dob, insurance_info['insuranceType'],
|
|
399
|
+
insurance_info['payerId'], policy_status, remaining_amount)
|
|
241
400
|
output_file.write(table_row + "\n")
|
|
242
401
|
print(table_row) # Print to console for progressive display
|
|
243
402
|
|
|
403
|
+
else:
|
|
404
|
+
# Unknown response format - log for debugging
|
|
405
|
+
MediLink_ConfigLoader.log("Unknown response format in display_eligibility_info", level="WARNING")
|
|
406
|
+
MediLink_ConfigLoader.log("Response structure: {}".format(json.dumps(data, indent=2)), level="DEBUG")
|
|
407
|
+
|
|
244
408
|
# Main Execution Flow
|
|
245
409
|
if __name__ == "__main__":
|
|
246
410
|
# Step 1: Handle Manual Deductible Lookups
|
|
@@ -26,7 +26,7 @@ MediLink/MediLink_ClaimStatus.py,sha256=GNZ9mRrjxemBHJ5LiJb2DUWhKgWX2vTNY5jxoUgq
|
|
|
26
26
|
MediLink/MediLink_ConfigLoader.py,sha256=u9ecB0SIN7zuJAo8KcoQys95BtyAo-8S2n4mRd0S3XU,4356
|
|
27
27
|
MediLink/MediLink_DataMgmt.py,sha256=jrTAPSNVzs1wwYl1g0_8Mda3k2B27CbaSw8Pu2qmThw,33058
|
|
28
28
|
MediLink/MediLink_Decoder.py,sha256=Suw9CmUHgoe0ZW8sJP_pIO8URBrhO5FmxFF8RcUj9lI,13318
|
|
29
|
-
MediLink/MediLink_Deductible.py,sha256=
|
|
29
|
+
MediLink/MediLink_Deductible.py,sha256=X9oQThxq706xL9Nd0G_VtxakwC9ifG66KKY9G8uRHYs,21175
|
|
30
30
|
MediLink/MediLink_Down.py,sha256=hrDODhs-zRfOKCdiRGENN5Czu-AvdtwJj4Q7grcRXME,6518
|
|
31
31
|
MediLink/MediLink_ERA_decoder.py,sha256=MiOtDcXnmevPfHAahIlTLlUc14VcQWAor9Xa7clA2Ts,8710
|
|
32
32
|
MediLink/MediLink_Gmail.py,sha256=OYsASNgP4YSTaSnj9XZxPPiy0cw41JC-suLIgRyNrlQ,31439
|
|
@@ -44,8 +44,8 @@ MediLink/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
44
44
|
MediLink/openssl.cnf,sha256=76VdcGCykf0Typyiv8Wd1mMVKixrQ5RraG6HnfKFqTo,887
|
|
45
45
|
MediLink/test.py,sha256=kSvvJRL_3fWuNS3_x4hToOnUljGLoeEw6SUTHQWQRJk,3108
|
|
46
46
|
MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
|
|
47
|
-
medicafe-0.
|
|
48
|
-
medicafe-0.
|
|
49
|
-
medicafe-0.
|
|
50
|
-
medicafe-0.
|
|
51
|
-
medicafe-0.
|
|
47
|
+
medicafe-0.250708.1.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
|
|
48
|
+
medicafe-0.250708.1.dist-info/METADATA,sha256=jpcoIsxM7jFiXBks6w5AT8rYb5nZaZdTIMd6NrCYlwg,5501
|
|
49
|
+
medicafe-0.250708.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
50
|
+
medicafe-0.250708.1.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
|
|
51
|
+
medicafe-0.250708.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|