medicafe 0.251014.0__py3-none-any.whl → 0.251015.0__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.

MediBot/__init__.py CHANGED
@@ -19,7 +19,7 @@ Smart Import Integration:
19
19
  medibot_main = get_components('medibot_main')
20
20
  """
21
21
 
22
- __version__ = "0.251014.0"
22
+ __version__ = "0.251015.0"
23
23
  __author__ = "Daniel Vidaud"
24
24
  __email__ = "daniel@personalizedtransformation.com"
25
25
 
MediCafe/__init__.py CHANGED
@@ -27,7 +27,7 @@ Smart Import System:
27
27
  api_suite = get_api_access()
28
28
  """
29
29
 
30
- __version__ = "0.251014.0"
30
+ __version__ = "0.251015.0"
31
31
  __author__ = "Daniel Vidaud"
32
32
  __email__ = "daniel@personalizedtransformation.com"
33
33
 
@@ -778,7 +778,17 @@ def convert_eligibility_to_enhanced_format(data, dob, member_id, patient_id="",
778
778
  'data_source': 'Legacy',
779
779
  'is_successful': bool(patient_name and remaining_amount != 'Not Found')
780
780
  }
781
-
781
+
782
+ # Provide a diagnostic reason when the patient name couldn't be resolved
783
+ if not patient_name:
784
+ try:
785
+ if not compatibility.get("has_patient_info"):
786
+ result['error_reason'] = 'Legacy API response missing patientInfo'
787
+ else:
788
+ result['error_reason'] = 'Legacy patientInfo present but name fields blank'
789
+ except Exception:
790
+ result['error_reason'] = 'Unable to resolve patient name from Legacy response'
791
+
782
792
  if MediLink_ConfigLoader:
783
793
  MediLink_ConfigLoader.log("Successfully converted Legacy API response: {}".format(result), level="DEBUG")
784
794
  return result
@@ -815,7 +825,17 @@ def convert_eligibility_to_enhanced_format(data, dob, member_id, patient_id="",
815
825
  'data_source': 'OptumAI',
816
826
  'is_successful': bool(patient_name and remaining_amount != 'Not Found')
817
827
  }
818
-
828
+
829
+ # Provide a diagnostic reason when the patient name couldn't be resolved
830
+ if not patient_name:
831
+ try:
832
+ if not compatibility.get("has_patient_info"):
833
+ result['error_reason'] = 'OptumAI response missing member info'
834
+ else:
835
+ result['error_reason'] = 'OptumAI member info present but name fields blank'
836
+ except Exception:
837
+ result['error_reason'] = 'Unable to resolve patient name from OptumAI response'
838
+
819
839
  if MediLink_ConfigLoader:
820
840
  MediLink_ConfigLoader.log("Successfully converted Super Connector API response: {}".format(result), level="DEBUG")
821
841
  return result
@@ -929,7 +949,8 @@ def merge_responses(optumai_data, legacy_data, dob, member_id):
929
949
  'policy_status': 'Not Available',
930
950
  'remaining_amount': 'Not Found',
931
951
  'data_source': 'None',
932
- 'is_successful': False
952
+ 'is_successful': False,
953
+ 'error_reason': 'No eligibility responses returned from OptumAI or Legacy APIs'
933
954
  }
934
955
 
935
956
  # Helper to check if data is valid (not None, has required fields)
@@ -1047,7 +1068,8 @@ def merge_responses(optumai_data, legacy_data, dob, member_id):
1047
1068
  'policy_status': 'Not Available',
1048
1069
  'remaining_amount': 'Not Found',
1049
1070
  'payer_id': '',
1050
- 'data_source': 'None'
1071
+ 'data_source': 'None',
1072
+ 'error_reason': 'Unable to extract patient name from available eligibility responses'
1051
1073
  }
1052
1074
 
1053
1075
  # Intelligently backfill missing fields from Legacy API (secondary)
@@ -1129,6 +1151,22 @@ def merge_responses(optumai_data, legacy_data, dob, member_id):
1129
1151
  if 'data_source' not in merged or not merged['data_source']:
1130
1152
  merged['data_source'] = 'OptumAI' if primary == optumai_data else 'Legacy' if primary else 'None'
1131
1153
 
1154
+ # If patient name still missing or unknown, infer a failure reason when possible
1155
+ try:
1156
+ if (not merged.get('patient_name')) or (merged.get('patient_name') == 'Unknown Patient'):
1157
+ if not merged.get('error_reason'):
1158
+ if is_super_connector_response_format(optumai_data or {}):
1159
+ raw = (optumai_data or {}).get('rawGraphQLResponse', {})
1160
+ elig = raw.get('data', {}).get('checkEligibility', {}).get('eligibility', [])
1161
+ merged['error_reason'] = 'OptumAI response contained no eligibility records' if not elig else 'OptumAI eligibility present but member name missing'
1162
+ elif is_legacy_response_format(legacy_data or {}):
1163
+ policies = (legacy_data or {}).get('memberPolicies', [])
1164
+ merged['error_reason'] = 'Legacy API returned no memberPolicies records' if not policies else 'Legacy policy present but patient name missing'
1165
+ else:
1166
+ merged['error_reason'] = 'Patient name not found in responses or CSV backfill'
1167
+ except Exception:
1168
+ pass
1169
+
1132
1170
  # Set final success status
1133
1171
  merged['is_successful'] = bool(merged.get('patient_name') and
1134
1172
  merged.get('patient_name') != 'Unknown Patient' and
@@ -1214,6 +1252,13 @@ def backfill_enhanced_result(enhanced_result, csv_row=None):
1214
1252
  csv_name = _format_patient_name_from_csv_row(csv_row)
1215
1253
  if csv_name:
1216
1254
  result['patient_name'] = csv_name
1255
+ else:
1256
+ # Attach CSV-specific diagnostic if still missing
1257
+ try:
1258
+ if not result.get('error_reason'):
1259
+ result['error_reason'] = 'CSV patient name fields missing or blank'
1260
+ except Exception:
1261
+ pass
1217
1262
 
1218
1263
  # Backfill patient_id
1219
1264
  if not result.get('patient_id') and csv_row is not None:
@@ -227,7 +227,9 @@ def _normalize_post_api_data(eligibility_result):
227
227
  'insurance_type': str(eligibility_result.get('insurance_type', '')),
228
228
  'policy_status': str(eligibility_result.get('policy_status', '')),
229
229
  'remaining_amount': str(eligibility_result.get('remaining_amount', '')),
230
- 'data_source': str(eligibility_result.get('data_source', ''))
230
+ 'data_source': str(eligibility_result.get('data_source', '')),
231
+ 'error_reason': str(eligibility_result.get('error_reason', '')),
232
+ 'is_successful': bool(eligibility_result.get('is_successful', False))
231
233
  }
232
234
 
233
235
  # Default unknown patient name when blank
@@ -440,6 +442,9 @@ def _display_primary_line(record, line_number, col_widths, context):
440
442
  str(record.get('data_source', ''))[:col_widths['data_source']], col_widths['data_source']
441
443
  ))
442
444
 
445
+ # After primary line in post-API view, display an explanatory error row when appropriate
446
+ _maybe_display_error_row(record, context)
447
+
443
448
  def _display_secondary_line(record, col_widths, context):
444
449
  """Display secondary line with dashes for grouped data"""
445
450
  patient_id_dashes = '-' * min(len(str(record.get('patient_id', ''))), col_widths['patient_id'])
@@ -491,4 +496,30 @@ def _display_secondary_line(record, col_widths, context):
491
496
  policy_status_dashes, col_widths['policy_status'],
492
497
  str(record.get('remaining_amount', ''))[:col_widths['remaining_amount']], col_widths['remaining_amount'],
493
498
  str(record.get('data_source', ''))[:col_widths['data_source']], col_widths['data_source']
494
- ))
499
+ ))
500
+
501
+ # For grouped secondary lines, we do not repeat error rows
502
+
503
+ def _maybe_display_error_row(record, context):
504
+ """Print an explanatory error row beneath the primary line when name or other lookups failed."""
505
+ try:
506
+ if context != 'post_api':
507
+ return
508
+ name_unknown = (not record.get('patient_name')) or (record.get('patient_name') == 'Unknown Patient')
509
+ has_error = (record.get('status') == 'Error') or (record.get('data_source') in ['None', 'Error'])
510
+ amount_missing = (str(record.get('remaining_amount', '')) == 'Not Found')
511
+ reason = record.get('error_reason', '')
512
+
513
+ if not reason:
514
+ if name_unknown:
515
+ reason = 'Patient name could not be determined from API responses or CSV backfill'
516
+ elif amount_missing:
517
+ reason = 'Deductible remaining amount not found in eligibility response'
518
+ elif has_error:
519
+ reason = 'Eligibility lookup encountered an error; see logs for details'
520
+
521
+ if reason:
522
+ print(" >> Error: {}".format(reason))
523
+ except Exception:
524
+ # Never let diagnostics break table rendering
525
+ pass
MediLink/__init__.py CHANGED
@@ -22,7 +22,7 @@ Smart Import Integration:
22
22
  datamgmt = get_components('medilink_datamgmt')
23
23
  """
24
24
 
25
- __version__ = "0.251014.0"
25
+ __version__ = "0.251015.0"
26
26
  __author__ = "Daniel Vidaud"
27
27
  __email__ = "daniel@personalizedtransformation.com"
28
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.251014.0
3
+ Version: 0.251015.0
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2/MediCafe
6
6
  Author: Daniel Vidaud
@@ -12,7 +12,7 @@ MediBot/MediBot_dataformat_library.py,sha256=D46fdPtxcgfWTzaLBtSvjtozzZBNqNiODgu
12
12
  MediBot/MediBot_debug.bat,sha256=F5Lfi3nFEEo4Ddx9EbX94u3fNAMgzMp3wsn-ULyASTM,6017
13
13
  MediBot/MediBot_docx_decoder.py,sha256=9BSjV-kB90VHnqfL_5iX4zl5u0HcHvHuL7YNfx3gXpQ,33143
14
14
  MediBot/MediBot_smart_import.py,sha256=Emvz7NwemHGCHvG5kZcUyXMcCheidbGKaPfOTg-YCEs,6684
15
- MediBot/__init__.py,sha256=TyG5kcEesXMqTWWrLSP5qp6C3KEvEHDd5liMjhDfYjo,3192
15
+ MediBot/__init__.py,sha256=RZDruyBkYuWNTwJuX6TMpymOyX3V6jq-jUTBwV249rE,3192
16
16
  MediBot/clear_cache.bat,sha256=F6-VhETWw6xDdGWG2wUqvtXjCl3lY4sSUFqF90bM8-8,1860
17
17
  MediBot/crash_diagnostic.bat,sha256=j8kUtyBg6NOWbXpeFuEqIRHOkVzgUrLOqO3FBMfNxTo,9268
18
18
  MediBot/f_drive_diagnostic.bat,sha256=4572hZaiwZ5wVAarPcZJQxkOSTwAdDuT_X914noARak,6878
@@ -22,13 +22,13 @@ MediBot/process_csvs.bat,sha256=3tI7h1z9eRj8rUUL4wJ7dy-Qrak20lRmpAPtGbUMbVQ,3489
22
22
  MediBot/update_json.py,sha256=vvUF4mKCuaVly8MmoadDO59M231fCIInc0KI1EtDtPA,3704
23
23
  MediBot/update_medicafe.py,sha256=G1lyvVOHYuho1d-TJQNN6qaB4HBWaJ2PpXqemBoPlRQ,17937
24
24
  MediCafe/MediLink_ConfigLoader.py,sha256=NoLb2YiJwlkrRYCt2PHvcFJ7yTIRWQCrsvkZIJWreM4,11141
25
- MediCafe/__init__.py,sha256=3WhV7uJK9-E-3-URJ1WbMddv6uTZJcgFAuTtIXU9uvE,5721
25
+ MediCafe/__init__.py,sha256=DGCg0jShqGBlX0QwzU-oOvl21DxN0Yadu1qEYVTFVtU,5721
26
26
  MediCafe/__main__.py,sha256=mRNyk3D9Ilnu2XhgVI_rut7r5Ro7UIKtwV871giAHI8,12992
27
27
  MediCafe/api_core.py,sha256=r9cqa5-HU4A7iz3NLxzRwuxsxOfDiJn9SRgtPjT83qU,90764
28
28
  MediCafe/api_factory.py,sha256=I5AeJoyu6m7oCrjc2OvVvO_4KSBRutTsR1riiWhTZV0,12086
29
29
  MediCafe/api_utils.py,sha256=KWQB0q1k5E6frOFFlKWcFpHNcqfrS7KJ_82672wbupw,14041
30
30
  MediCafe/core_utils.py,sha256=XKUpyv7yKjIQ8iNrhD76PIURyt6GZxb98v0daiI7aaw,27303
31
- MediCafe/deductible_utils.py,sha256=1d0ui0-S0B-Bv2iDbYIujy_L_Y4XphW98Iu59GYLc8A,58722
31
+ MediCafe/deductible_utils.py,sha256=Qpp5joZ0KxSWbN6qQU1OM0fE-n__v5jtzdOV4UR0CT8,61446
32
32
  MediCafe/error_reporter.py,sha256=t9AAkkVsmZMxPMSA6DW7wDf2cxXpFfA9oJW5-thg5VQ,8176
33
33
  MediCafe/graphql_utils.py,sha256=3BYl4wrox40063RwCtIqsrxSMA5rdchCP69RGi-U4aY,51317
34
34
  MediCafe/logging_config.py,sha256=auT65LN5oDEXVhkMeLke63kJHTWxYf2o8YihAfQFgzU,5493
@@ -49,7 +49,7 @@ MediLink/MediLink_DataMgmt.py,sha256=9hc5jyWU65nYT66afDybOyYAcW-DvEYuHpWTun96U50
49
49
  MediLink/MediLink_Decoder.py,sha256=1gzdybNg4Vv69s5PNbX8bPNrXT_N_kPpFpt2HpkauWA,16430
50
50
  MediLink/MediLink_Deductible.py,sha256=jr-TrfOTxQDc4dwvwUy4jSSb_AnsU0pWLq_kyktAgZk,57942
51
51
  MediLink/MediLink_Deductible_Validator.py,sha256=x6tHJOi88TblUpDPSH6QhIdXXRgr3rXI7kYPVGZYCgU,24998
52
- MediLink/MediLink_Display_Utils.py,sha256=zIuXGmHz0aHs3FD6JVNptj0FjJuUO9i9QAx-kGsmI_s,22988
52
+ MediLink/MediLink_Display_Utils.py,sha256=wWGbqhGL_6vZrVE4_7-xYg7fdjVbTR1149VJTS3deI0,24513
53
53
  MediLink/MediLink_Down.py,sha256=s4_z-RaqHYanjwbQCl-OSkg4XIpcIQ2Q6jXa8-q_QXw,28111
54
54
  MediLink/MediLink_Gmail.py,sha256=muqZI3girXDu92KT5Nft7dLHtpnQAjH-QfvdcGo28_Y,26801
55
55
  MediLink/MediLink_Mailer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,15 +63,15 @@ MediLink/MediLink_insurance_utils.py,sha256=g741Fj2K26cMy0JX5d_XavMw9LgkK6hjaUJY
63
63
  MediLink/MediLink_main.py,sha256=CAXu0IRzhra3ppIFDcCppFNAZp7kCuN6gPtJSdFqGzs,24857
64
64
  MediLink/MediLink_smart_import.py,sha256=B5SfBn_4bYEWJJDolXbjnwKx_-MaqGZ76LyXQwWDV80,9838
65
65
  MediLink/Soumit_api.py,sha256=5JfOecK98ZC6NpZklZW2AkOzkjvrbYxpJpZNH3rFxDw,497
66
- MediLink/__init__.py,sha256=PIA4bRbuHFfSmHUsG0GHI6KIAO-_nmLOfbm-tdjtOug,3888
66
+ MediLink/__init__.py,sha256=pUz0lDh96t0FYdCxUQlawfKMvDiib088-00IsHgRwfk,3888
67
67
  MediLink/gmail_http_utils.py,sha256=gtqCCrzJC7e8JFQzMNrf7EbK8na2h4sfTu-NMaZ_UHc,4006
68
68
  MediLink/gmail_oauth_utils.py,sha256=Ugr-DEqs4_RddRMSCJ_dbgA3TVeaxpbAor-dktcTIgY,3713
69
69
  MediLink/openssl.cnf,sha256=76VdcGCykf0Typyiv8Wd1mMVKixrQ5RraG6HnfKFqTo,887
70
70
  MediLink/test.py,sha256=DM_E8gEbhbVfTAm3wTMiNnK2GCD1e5eH6gwTk89QIc4,3116
71
71
  MediLink/webapp.html,sha256=MI9zZ4y1_h5Ji3nz2fmm6Q29AsPunks-wR-R8Ct73-w,19856
72
- medicafe-0.251014.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
73
- medicafe-0.251014.0.dist-info/METADATA,sha256=gmDGZvMH-ZkpsXBbZSL85cG_WmrrH8CnyeMj_ZV5Mdg,3414
74
- medicafe-0.251014.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
75
- medicafe-0.251014.0.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
76
- medicafe-0.251014.0.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
77
- medicafe-0.251014.0.dist-info/RECORD,,
72
+ medicafe-0.251015.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
73
+ medicafe-0.251015.0.dist-info/METADATA,sha256=AVt3fFn191rtXLPHcmal5udTp73FL8RTu8fu-YpMndU,3414
74
+ medicafe-0.251015.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
75
+ medicafe-0.251015.0.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
76
+ medicafe-0.251015.0.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
77
+ medicafe-0.251015.0.dist-info/RECORD,,