medicafe 0.250720.1__py3-none-any.whl → 0.250723.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.

@@ -88,11 +88,16 @@ def read_fixed_width_data(file_path):
88
88
  # TODO (Refactor) Consider consolidating with the other read_fixed_with_data
89
89
  def read_general_fixed_width_data(file_path, slices):
90
90
  # handle any fixed-width data based on provided slice definitions
91
- with open(file_path, 'r', encoding='utf-8') as file:
92
- next(file) # Skip the header
93
- for line_number, line in enumerate(file, start=1):
94
- insurance_name = {key: line[start:end].strip() for key, (start, end) in slices.items()}
95
- yield insurance_name, line_number
91
+ try:
92
+ with open(file_path, 'r', encoding='utf-8') as file:
93
+ next(file) # Skip the header
94
+ for line_number, line in enumerate(file, start=1):
95
+ insurance_name = {key: line[start:end].strip() for key, (start, end) in slices.items()}
96
+ yield insurance_name, line_number
97
+ except FileNotFoundError:
98
+ print("File not found: {}".format(file_path))
99
+ MediLink_ConfigLoader.log("File not found: {}".format(file_path), level="ERROR")
100
+ return
96
101
 
97
102
  def consolidate_csvs(source_directory, file_prefix="Consolidated", interactive=False):
98
103
  """
@@ -157,7 +157,9 @@ def manual_deductible_lookup():
157
157
  for i, payer_id in enumerate(payer_ids, 1):
158
158
  print("Checking Payer ID {} ({}/{}): {}".format(payer_id, i, len(payer_ids), payer_id))
159
159
 
160
- eligibility_data = get_eligibility_info(client, payer_id, provider_last_name, formatted_dob, member_id, npi, run_validation=True)
160
+ # Use the current mode setting for validation
161
+ run_validation = DEBUG_MODE
162
+ eligibility_data = get_eligibility_info(client, payer_id, provider_last_name, formatted_dob, member_id, npi, run_validation=run_validation)
161
163
  if eligibility_data:
162
164
  found_data = True
163
165
  # Generate unique output file for manual request
@@ -201,66 +203,77 @@ def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, me
201
203
  MediLink_ConfigLoader.log("member_id: {}".format(member_id), level="DEBUG")
202
204
  MediLink_ConfigLoader.log("npi: {}".format(npi), level="DEBUG")
203
205
 
204
- # Configuration flag to control which API to use
205
- # Set to False to use the new Super Connector API, True to use the legacy v3 API
206
- USE_LEGACY_API = True # Changed to True to use legacy as primary
207
-
208
- # Always get legacy response first
209
- MediLink_ConfigLoader.log("Getting legacy get_eligibility_v3 API response", level="INFO")
210
- legacy_eligibility = MediLink_API_v3.get_eligibility_v3(
211
- client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
212
- )
213
-
214
- # Also get Super Connector response for comparison
215
- MediLink_ConfigLoader.log("Getting new get_eligibility_super_connector API response", level="INFO")
216
- super_connector_eligibility = None
217
- try:
218
- super_connector_eligibility = MediLink_API_v3.get_eligibility_super_connector(
206
+ # Check if we're in legacy mode (no validation) or debug mode (with validation)
207
+ if run_validation:
208
+ # Debug mode: Call both APIs and run validation
209
+ MediLink_ConfigLoader.log("Running in DEBUG MODE - calling both APIs", level="INFO")
210
+
211
+ # Get legacy response
212
+ MediLink_ConfigLoader.log("Getting legacy get_eligibility_v3 API response", level="INFO")
213
+ legacy_eligibility = MediLink_API_v3.get_eligibility_v3(
219
214
  client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
220
215
  )
221
- except Exception as e:
222
- MediLink_ConfigLoader.log("Super Connector API failed: {}".format(e), level="ERROR")
223
-
224
- # Run validation if requested and we have both responses
225
- if run_validation and legacy_eligibility and super_connector_eligibility:
226
- validation_file_path = os.path.join(os.getenv('TEMP'), 'validation_report_{}_{}.txt'.format(member_id, date_of_birth))
227
- validation_report = MediLink_Deductible_Validator.run_validation_comparison(
228
- legacy_eligibility, super_connector_eligibility, validation_file_path
229
- )
230
- print("\nValidation report generated: {}".format(validation_file_path))
231
216
 
232
- # Log any Super Connector API errors
233
- if super_connector_eligibility and "rawGraphQLResponse" in super_connector_eligibility:
234
- raw_response = super_connector_eligibility.get('rawGraphQLResponse', {})
235
- errors = raw_response.get('errors', [])
236
- if errors:
237
- print("Super Connector API returned {} error(s):".format(len(errors)))
238
- for i, error in enumerate(errors):
239
- error_code = error.get('code', 'UNKNOWN')
240
- error_desc = error.get('description', 'No description')
241
- print(" Error {}: {} - {}".format(i+1, error_code, error_desc))
242
-
243
- # Check for data in error extensions (some APIs return data here)
244
- extensions = error.get('extensions', {})
245
- if extensions and 'details' in extensions:
246
- details = extensions.get('details', [])
247
- if details:
248
- print(" Found {} detail records in error extensions".format(len(details)))
249
- # Log first detail record for debugging
250
- if details:
251
- first_detail = details[0]
252
- print(" First detail: {}".format(first_detail))
217
+ # Get Super Connector response for comparison
218
+ MediLink_ConfigLoader.log("Getting new get_eligibility_super_connector API response", level="INFO")
219
+ super_connector_eligibility = None
220
+ try:
221
+ super_connector_eligibility = MediLink_API_v3.get_eligibility_super_connector(
222
+ client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
223
+ )
224
+ except Exception as e:
225
+ MediLink_ConfigLoader.log("Super Connector API failed: {}".format(e), level="ERROR")
253
226
 
254
- # Check status code
255
- status_code = super_connector_eligibility.get('statuscode')
256
- if status_code and status_code != '200':
257
- print("Super Connector API status code: {} (non-200 indicates errors)".format(status_code))
227
+ # Run validation if we have both responses
228
+ if legacy_eligibility and super_connector_eligibility:
229
+ validation_file_path = os.path.join(os.getenv('TEMP'), 'validation_report_{}_{}.txt'.format(member_id, date_of_birth))
230
+ validation_report = MediLink_Deductible_Validator.run_validation_comparison(
231
+ legacy_eligibility, super_connector_eligibility, validation_file_path
232
+ )
233
+ print("\nValidation report generated: {}".format(validation_file_path))
234
+
235
+ # Log any Super Connector API errors
236
+ if "rawGraphQLResponse" in super_connector_eligibility:
237
+ raw_response = super_connector_eligibility.get('rawGraphQLResponse', {})
238
+ errors = raw_response.get('errors', [])
239
+ if errors:
240
+ print("Super Connector API returned {} error(s):".format(len(errors)))
241
+ for i, error in enumerate(errors):
242
+ error_code = error.get('code', 'UNKNOWN')
243
+ error_desc = error.get('description', 'No description')
244
+ print(" Error {}: {} - {}".format(i+1, error_code, error_desc))
245
+
246
+ # Check for data in error extensions (some APIs return data here)
247
+ extensions = error.get('extensions', {})
248
+ if extensions and 'details' in extensions:
249
+ details = extensions.get('details', [])
250
+ if details:
251
+ print(" Found {} detail records in error extensions".format(len(details)))
252
+ # Log first detail record for debugging
253
+ if details:
254
+ first_detail = details[0]
255
+ print(" First detail: {}".format(first_detail))
256
+
257
+ # Check status code
258
+ status_code = super_connector_eligibility.get('statuscode')
259
+ if status_code and status_code != '200':
260
+ print("Super Connector API status code: {} (non-200 indicates errors)".format(status_code))
261
+
262
+ # Open validation report in Notepad
263
+ os.system('notepad.exe "{}"'.format(validation_file_path))
258
264
 
259
- # Open validation report in Notepad
260
- os.system('notepad.exe "{}"'.format(validation_file_path))
261
-
262
- # Return the primary response (legacy for now)
263
- eligibility = legacy_eligibility if USE_LEGACY_API else super_connector_eligibility
265
+ # Return legacy response for consistency
266
+ eligibility = legacy_eligibility
267
+
268
+ else:
269
+ # Legacy mode: Only call legacy API
270
+ MediLink_ConfigLoader.log("Running in LEGACY MODE - calling legacy API only", level="INFO")
271
+
272
+ # Only get legacy response
273
+ MediLink_ConfigLoader.log("Getting legacy get_eligibility_v3 API response", level="INFO")
274
+ eligibility = MediLink_API_v3.get_eligibility_v3(
275
+ client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
276
+ )
264
277
 
265
278
  # Log the response
266
279
  MediLink_ConfigLoader.log("Eligibility response: {}".format(json.dumps(eligibility, indent=4)), level="DEBUG")
@@ -630,19 +643,54 @@ def display_eligibility_info(data, dob, member_id, output_file):
630
643
  MediLink_ConfigLoader.log("Unknown response format in display_eligibility_info", level="WARNING")
631
644
  MediLink_ConfigLoader.log("Response structure: {}".format(json.dumps(data, indent=2)), level="DEBUG")
632
645
 
646
+ # Global mode flags (will be set in main)
647
+ LEGACY_MODE = False
648
+ DEBUG_MODE = False
649
+
633
650
  # Main Execution Flow
634
651
  if __name__ == "__main__":
635
652
  print("\n" + "=" * 80)
636
653
  print("MEDILINK DEDUCTIBLE LOOKUP TOOL")
637
654
  print("=" * 80)
638
- print("This tool provides manual and batch eligibility lookups with validation.")
639
- print("Validation reports compare legacy vs Super Connector API responses.")
655
+ print("This tool provides manual and batch eligibility lookups.")
640
656
  print("=" * 80)
641
657
 
658
+ # User input switch for mode selection
659
+ print("\nSelect operation mode:")
660
+ print("1. Legacy Mode (Default) - Single API calls, consolidated output")
661
+ print("2. Debug Mode - Dual API calls with validation reports")
662
+ print("3. Exit")
663
+
664
+ mode_choice = input("\nEnter your choice (1-3) [Default: 1]: ").strip()
665
+ if not mode_choice:
666
+ mode_choice = "1"
667
+
668
+ if mode_choice == "3":
669
+ print("\nExiting. Thank you for using MediLink Deductible Tool!")
670
+ sys.exit(0)
671
+ elif mode_choice not in ["1", "2"]:
672
+ print("Invalid choice. Using Legacy Mode (Default).")
673
+ mode_choice = "1"
674
+
675
+ # Set mode flags
676
+ LEGACY_MODE = (mode_choice == "1")
677
+ DEBUG_MODE = (mode_choice == "2")
678
+
679
+ if LEGACY_MODE:
680
+ print("\nRunning in LEGACY MODE")
681
+ print("- Single API calls (Legacy API only)")
682
+ print("- Progressive output during processing")
683
+ print("- Consolidated output file at the end")
684
+ else:
685
+ print("\nRunning in DEBUG MODE")
686
+ print("- Dual API calls (Legacy + Super Connector)")
687
+ print("- Validation reports and comparisons")
688
+ print("- Detailed logging and error reporting")
689
+
642
690
  while True:
643
691
  print("\nChoose an option:")
644
- print("1. Manual Patient Lookup (with validation)")
645
- print("2. Batch CSV Processing (with validation)")
692
+ print("1. Manual Patient Lookup")
693
+ print("2. Batch CSV Processing")
646
694
  print("3. Exit")
647
695
 
648
696
  choice = input("\nEnter your choice (1-3): ").strip()
@@ -696,8 +744,9 @@ if __name__ == "__main__":
696
744
  print("Processing patient {}/{}: Member ID {}, DOB {}".format(
697
745
  processed_count, total_patients, member_id, dob))
698
746
 
699
- # Run with validation enabled for batch processing
700
- eligibility_data = get_eligibility_info(client, payer_id, provider_last_name, dob, member_id, npi, run_validation=True)
747
+ # Run with validation enabled only in debug mode
748
+ run_validation = DEBUG_MODE
749
+ eligibility_data = get_eligibility_info(client, payer_id, provider_last_name, dob, member_id, npi, run_validation=run_validation)
701
750
  if eligibility_data is not None:
702
751
  display_eligibility_info(eligibility_data, dob, member_id, output_file) # Display as we get the result
703
752
  processed_patients.add((dob, member_id)) # Mark this patient as processed
@@ -719,14 +768,15 @@ if __name__ == "__main__":
719
768
  if open_report in ['y', 'yes']:
720
769
  os.system('notepad.exe "{}"'.format(output_file_path))
721
770
 
722
- # Print summary of validation reports
723
- print("\n" + "=" * 80)
724
- print("VALIDATION SUMMARY")
725
- print("=" * 80)
726
- print("Validation reports have been generated for each patient processed.")
727
- print("Each report compares the legacy API response with the Super Connector API response.")
728
- print("Check the TEMP directory for validation_report_*.txt files.")
729
- print("=" * 80)
771
+ # Print summary of validation reports only in debug mode
772
+ if DEBUG_MODE:
773
+ print("\n" + "=" * 80)
774
+ print("VALIDATION SUMMARY")
775
+ print("=" * 80)
776
+ print("Validation reports have been generated for each patient processed.")
777
+ print("Each report compares the legacy API response with the Super Connector API response.")
778
+ print("Check the TEMP directory for validation_report_*.txt files.")
779
+ print("=" * 80)
730
780
 
731
781
  # Ask if user wants to continue
732
782
  continue_choice = input("\nDo you want to perform another operation? (Y/N): ").strip().lower()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250720.1
3
+ Version: 0.250723.0
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,11 +1,11 @@
1
- MediBot/MediBot.bat,sha256=9df6kV6qnmnqP59G6OdT5osqnyfIGeQYbVJgfsfiPxM,13260
2
- MediBot/MediBot.py,sha256=KNR3Pj46W9dQaE3OH3fFAHoa6P-hS8pjJ9xB5STEqOU,19513
1
+ MediBot/MediBot.bat,sha256=anz5i-Td1k3HhRUvkCqHsw9lBLVmO6q9bt5kLTfr1Iw,13282
2
+ MediBot/MediBot.py,sha256=v9R-vMHQPPdL5oCFY-_YPd5eZkRExXDNKoxejvTp6pA,23231
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- MediBot/MediBot_Crosswalk_Library.py,sha256=eYFcP6KjnzOfZbAYhs6Umv4sKguRJAQkKgYQQynJ50M,49025
4
+ MediBot/MediBot_Crosswalk_Library.py,sha256=wwOzfu7YVFzicGu679XMIw3pVX0HjR3VJpcqq9UcvZ8,50208
5
5
  MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- MediBot/MediBot_Preprocessor.py,sha256=uPGj0OwlHi0CByvNy9gKnfwfK7Y6lzQ7sLchwJw3l7g,13010
7
- MediBot/MediBot_Preprocessor_lib.py,sha256=XdDkBTmjsSlOfnuc3iBYKudQRhGo3DEL_zboYGqovnQ,37697
8
- MediBot/MediBot_UI.py,sha256=tdTXLQ_nUVbtpkxUGSuKbEgYv6CFk6EsmEMAVMLL4_A,11165
6
+ MediBot/MediBot_Preprocessor.py,sha256=Lc9uQnE5SAa0dQTOREdPV1QUB2cywXTHJ1h2w-fyeeQ,13331
7
+ MediBot/MediBot_Preprocessor_lib.py,sha256=irojPF1oQCt78H1GjJ0hfILUpO12d4rfFjfoViVaBEk,41194
8
+ MediBot/MediBot_UI.py,sha256=BSQ6VBk2t6eWJYD9it2kwdtGaE3Bt2bIdwVy5s0bRd0,12697
9
9
  MediBot/MediBot_dataformat_library.py,sha256=JXTV-HWahqeYF_lbNn1UYxqUtZ6ZBeFXHOyRGlDq4xM,8406
10
10
  MediBot/MediBot_docx_decoder.py,sha256=z-_oVrSocu4-CenDGDHOkDeqPcKqZqm6Ao9mABgqxJU,23561
11
11
  MediBot/MediPost.py,sha256=C1hZJFr65rN6F_dckjdBxFC0vL2CoqY9W3YFqU5HXtE,336
@@ -15,20 +15,20 @@ MediBot/update_json.py,sha256=9FJZb-32EujpKuSoCjyCbdTdthOIuhcMoN4Wchuzn8A,2508
15
15
  MediBot/update_medicafe.py,sha256=rx1zUvCI99JRdr8c1csMGI2uJBl3pqusvX-xr3KhmR4,11881
16
16
  MediLink/MediLink.py,sha256=O3VSLm2s5viCRBL1is7Loj_nSaLMMcFZ-weXAmVp_20,21588
17
17
  MediLink/MediLink_277_decoder.py,sha256=Z3hQK2j-YzdXjov6aDlDRc7M_auFBnl3se4OF5q6_04,4358
18
- MediLink/MediLink_837p_cob_library.py,sha256=-Rn40XFUAi_0CxcqSALlXiQmgWH2FE0THkNmxkAJAO0,29755
19
- MediLink/MediLink_837p_encoder.py,sha256=OiYU2cyr9rFBGv7XOwYuZjCKWbUNb9vN2TcX6vvUZWM,27242
20
- MediLink/MediLink_837p_encoder_library.py,sha256=0NwTIiRw76oleRn-S1Dn-Rv8IBUqjz7dn1W_MT9LA_o,47076
18
+ MediLink/MediLink_837p_cob_library.py,sha256=pWWd03yXTamNJKDbPCdOCkfglW4OLXQtIN3eiMSdfAA,29934
19
+ MediLink/MediLink_837p_encoder.py,sha256=ODdDl_hBDYCf3f683qB3I51FGCKxrMeKL3gfT0wNAFM,28073
20
+ MediLink/MediLink_837p_encoder_library.py,sha256=y4cTt8G2yQbMm8oEmccJJTb0yOTeUj8CrcfI1IpOLxY,48688
21
21
  MediLink/MediLink_837p_utilities.py,sha256=Bi91S1aJbsEOpWXp_IOUgCQ76IPiOJNkOfXXtcirzmI,10416
22
22
  MediLink/MediLink_API_Generator.py,sha256=vBZ8moR9tvv7mb200HlZnJrk1y-bQi8E16I2r41vgVM,10345
23
23
  MediLink/MediLink_API_v2.py,sha256=mcIgLnXPS_NaUBrkKJ8mxCUaQ0AuQUeU1vG6DoplbVY,7733
24
- MediLink/MediLink_API_v3.py,sha256=D17yXicLRvHfEsx5c-VUNZlke5oSnclQu6cKJACzeHA,40745
24
+ MediLink/MediLink_API_v3.py,sha256=SH3nS95qrJDWAvptr7RYT8C4lDFWNPpBfnMs2uFn2Og,40923
25
25
  MediLink/MediLink_APIs.py,sha256=jm3f9T034MJKH8A_CIootULoeuk7H8s7PazpFZRCbKI,6222
26
26
  MediLink/MediLink_Azure.py,sha256=Ow70jctiHFIylskBExN7WUoRgrKOvBR6jNTnQMk6lJA,210
27
- MediLink/MediLink_ClaimStatus.py,sha256=DkUL5AhmuaHsdKiQG1btciJIuexl0OLXBEH40j1KFTg,9927
27
+ MediLink/MediLink_ClaimStatus.py,sha256=kXIDidxSGuqTwjFNMQIKms42jqIu5Qmnet-7Ohe8zjE,11645
28
28
  MediLink/MediLink_ConfigLoader.py,sha256=u9ecB0SIN7zuJAo8KcoQys95BtyAo-8S2n4mRd0S3XU,4356
29
- MediLink/MediLink_DataMgmt.py,sha256=jrTAPSNVzs1wwYl1g0_8Mda3k2B27CbaSw8Pu2qmThw,33058
29
+ MediLink/MediLink_DataMgmt.py,sha256=MjCF1L-4RkQnz_vBULPB-DVsEtv0X1WHT1o9YjCGQ7s,33280
30
30
  MediLink/MediLink_Decoder.py,sha256=Suw9CmUHgoe0ZW8sJP_pIO8URBrhO5FmxFF8RcUj9lI,13318
31
- MediLink/MediLink_Deductible.py,sha256=nD9dwStQY34FYmnuqg361UgFX8vLpZk88Im0LZJ45IQ,36732
31
+ MediLink/MediLink_Deductible.py,sha256=btFzmW48biiSce8zES_giAGQggPs5foutNG2slk-Pcw,38916
32
32
  MediLink/MediLink_Deductible_Validator.py,sha256=2g-lZd-Y5fJ1mfP87vM6oABg0t5Om-7EkEkilVvDWYY,22888
33
33
  MediLink/MediLink_Down.py,sha256=hrDODhs-zRfOKCdiRGENN5Czu-AvdtwJj4Q7grcRXME,6518
34
34
  MediLink/MediLink_ERA_decoder.py,sha256=MiOtDcXnmevPfHAahIlTLlUc14VcQWAor9Xa7clA2Ts,8710
@@ -49,8 +49,8 @@ MediLink/test.py,sha256=kSvvJRL_3fWuNS3_x4hToOnUljGLoeEw6SUTHQWQRJk,3108
49
49
  MediLink/test_cob_library.py,sha256=wUMv0-Y6fNsKcAs8Z9LwfmEBRO7oBzBAfWmmzwoNd1g,13841
50
50
  MediLink/test_validation.py,sha256=FJrfdUFK--xRScIzrHCg1JeGdm0uJEoRnq6CgkP2lwM,4154
51
51
  MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
52
- medicafe-0.250720.1.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
- medicafe-0.250720.1.dist-info/METADATA,sha256=O51wyX4FSnXp7JwidtHgLoexu1Loazewxl2FPfyRczY,5501
54
- medicafe-0.250720.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
- medicafe-0.250720.1.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
- medicafe-0.250720.1.dist-info/RECORD,,
52
+ medicafe-0.250723.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
+ medicafe-0.250723.0.dist-info/METADATA,sha256=DnfVSp4mnwoZN4-GkhRA_UQJWi6kQOkqY8KNTr3K1Eo,5501
54
+ medicafe-0.250723.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
+ medicafe-0.250723.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
+ medicafe-0.250723.0.dist-info/RECORD,,