medicafe 0.250805.2__py3-none-any.whl → 0.250806.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.

MediBot/MediBot.bat CHANGED
@@ -307,14 +307,17 @@ if "!internet_available!"=="1" (
307
307
  )
308
308
  echo 6. Run MediBot
309
309
  echo.
310
- echo 7. Open Log File
310
+ echo 7. Troubleshooting: Open Log File
311
311
  echo.
312
- echo 8. Exit
312
+ echo 8. Troubleshooting: Clear Python Cache
313
+ echo.
314
+ echo 9. Exit
313
315
  echo.
314
316
  set /p choice=Enter your choice:
315
317
 
316
318
  :: Update option numbers
317
- if "!choice!"=="8" goto end_script
319
+ if "!choice!"=="9" goto end_script
320
+ if "!choice!"=="8" goto clear_cache
318
321
  if "!choice!"=="7" goto open_latest_log
319
322
  if "!choice!"=="6" goto medibot_flow
320
323
  if "!choice!"=="5" goto united_deductible
@@ -520,6 +523,22 @@ py "%python_script%" "%config_file%" "!new_csv_path!"
520
523
  echo CSV Processor Complete...
521
524
  goto :eof
522
525
 
526
+ :: Clear Python Cache
527
+ :clear_cache
528
+ cls
529
+ echo Clearing Python cache for MediCafe...
530
+ echo.
531
+ cd /d "%~dp0.."
532
+ python "MediBot\update_medicafe.py" --clear-cache
533
+ if errorlevel 1 (
534
+ echo Cache clearing failed.
535
+ pause
536
+ ) else (
537
+ echo Cache clearing completed successfully.
538
+ pause
539
+ )
540
+ goto main_menu
541
+
523
542
  :: Exit Script
524
543
  :end_script
525
544
  echo Exiting MediCafe.
@@ -1,5 +1,5 @@
1
1
  #update_medicafe.py
2
- import subprocess, sys, time, platform
2
+ import subprocess, sys, time, platform, os, shutil
3
3
 
4
4
  # Safe import for pkg_resources with fallback
5
5
  try:
@@ -15,6 +15,40 @@ except ImportError:
15
15
  requests = None
16
16
  print("Warning: requests module not available. Some functionality may be limited.")
17
17
 
18
+ def print_status(message, status_type="INFO"):
19
+ """Print formatted status messages with ASCII-only visual indicators."""
20
+ if status_type == "SUCCESS":
21
+ print("\n" + "="*60)
22
+ print("[SUCCESS] {}".format(message))
23
+ print("="*60)
24
+ elif status_type == "ERROR":
25
+ print("\n" + "="*60)
26
+ print("[ERROR] {}".format(message))
27
+ print("="*60)
28
+ elif status_type == "WARNING":
29
+ print("\n" + "-"*60)
30
+ print("[WARNING] {}".format(message))
31
+ print("-"*60)
32
+ elif status_type == "INFO":
33
+ print("\n" + "-"*60)
34
+ print("[INFO] {}".format(message))
35
+ print("-"*60)
36
+ else:
37
+ print(message)
38
+
39
+ def print_final_result(success, message):
40
+ """Print final result with clear visual indication."""
41
+ if success:
42
+ print_status("UPDATE COMPLETED SUCCESSFULLY", "SUCCESS")
43
+ print("Final Status: {}".format(message))
44
+ else:
45
+ print_status("UPDATE FAILED", "ERROR")
46
+ print("Final Status: {}".format(message))
47
+
48
+ print("\nExiting in 5 seconds...")
49
+ time.sleep(5)
50
+ sys.exit(0 if success else 1)
51
+
18
52
  def get_installed_version(package):
19
53
  try:
20
54
  process = subprocess.Popen(
@@ -78,6 +112,87 @@ def check_internet_connection():
78
112
  except requests.ConnectionError:
79
113
  return False
80
114
 
115
+ def clear_python_cache(workspace_path=None):
116
+ """
117
+ Clear Python bytecode cache files to prevent import issues after updates.
118
+
119
+ Args:
120
+ workspace_path (str, optional): Path to the workspace root. If None,
121
+ will attempt to detect automatically.
122
+
123
+ Returns:
124
+ bool: True if cache was cleared successfully, False otherwise
125
+ """
126
+ try:
127
+ print_status("Clearing Python bytecode cache...", "INFO")
128
+
129
+ # If no workspace path provided, try to detect it
130
+ if not workspace_path:
131
+ # Try to find the MediCafe workspace by looking for common directories
132
+ current_dir = os.getcwd()
133
+ potential_paths = [
134
+ current_dir,
135
+ os.path.dirname(current_dir),
136
+ os.path.join(current_dir, '..'),
137
+ os.path.join(current_dir, '..', '..')
138
+ ]
139
+
140
+ for path in potential_paths:
141
+ if os.path.exists(os.path.join(path, 'MediCafe')) and \
142
+ os.path.exists(os.path.join(path, 'MediBot')) and \
143
+ os.path.exists(os.path.join(path, 'MediLink')):
144
+ workspace_path = path
145
+ break
146
+
147
+ if not workspace_path:
148
+ print_status("Could not detect workspace path. Cache clearing skipped.", "WARNING")
149
+ return False
150
+
151
+ print("Workspace path: {}".format(workspace_path))
152
+
153
+ # Directories to clear cache from
154
+ cache_dirs = [
155
+ os.path.join(workspace_path, 'MediCafe'),
156
+ os.path.join(workspace_path, 'MediBot'),
157
+ os.path.join(workspace_path, 'MediLink'),
158
+ workspace_path # Root workspace
159
+ ]
160
+
161
+ cleared_count = 0
162
+ for cache_dir in cache_dirs:
163
+ if os.path.exists(cache_dir):
164
+ # Remove __pycache__ directories
165
+ pycache_path = os.path.join(cache_dir, '__pycache__')
166
+ if os.path.exists(pycache_path):
167
+ try:
168
+ shutil.rmtree(pycache_path)
169
+ print("Cleared cache: {}".format(pycache_path))
170
+ cleared_count += 1
171
+ except Exception as e:
172
+ print("Warning: Could not clear cache at {}: {}".format(pycache_path, e))
173
+
174
+ # Remove .pyc files
175
+ for root, dirs, files in os.walk(cache_dir):
176
+ for file in files:
177
+ if file.endswith('.pyc'):
178
+ try:
179
+ os.remove(os.path.join(root, file))
180
+ print("Removed .pyc file: {}".format(os.path.join(root, file)))
181
+ cleared_count += 1
182
+ except Exception as e:
183
+ print("Warning: Could not remove .pyc file {}: {}".format(file, e))
184
+
185
+ if cleared_count > 0:
186
+ print_status("Successfully cleared {} cache items".format(cleared_count), "SUCCESS")
187
+ return True
188
+ else:
189
+ print_status("No cache files found to clear", "INFO")
190
+ return True
191
+
192
+ except Exception as e:
193
+ print_status("Error clearing cache: {}".format(e), "ERROR")
194
+ return False
195
+
81
196
  def compare_versions(version1, version2):
82
197
  v1_parts = list(map(int, version1.split(".")))
83
198
  v2_parts = list(map(int, version2.split(".")))
@@ -88,9 +203,8 @@ def upgrade_package(package, retries=3, delay=2): # Updated retries to 3
88
203
  Attempts to upgrade the package multiple times with delays in between.
89
204
  """
90
205
  if not check_internet_connection():
91
- print("Error: No internet connection detected. Please check your internet connection and try again.")
92
- time.sleep(3) # Pause for 3 seconds before exiting
93
- sys.exit(1)
206
+ print_status("No internet connection detected. Please check your internet connection and try again.", "ERROR")
207
+ print_final_result(False, "No internet connection available")
94
208
 
95
209
  for attempt in range(1, retries + 1):
96
210
  print("Attempt {} to upgrade {}...".format(attempt, package))
@@ -110,24 +224,24 @@ def upgrade_package(package, retries=3, delay=2): # Updated retries to 3
110
224
  new_version = get_installed_version(package) # Get new version after upgrade
111
225
  if compare_versions(new_version, get_latest_version(package)) >= 0: # Compare versions
112
226
  if attempt == 1:
113
- print("Upgrade succeeded!")
227
+ print_status("Upgrade succeeded!", "SUCCESS")
114
228
  else:
115
- print("Attempt {}: Upgrade succeeded!".format(attempt))
229
+ print_status("Attempt {}: Upgrade succeeded!".format(attempt), "SUCCESS")
116
230
  time.sleep(delay)
117
231
  return True
118
232
  else:
119
- print("Upgrade failed. Current version remains: {}".format(new_version))
233
+ print_status("Upgrade failed. Current version remains: {}".format(new_version), "WARNING")
120
234
  if attempt < retries:
121
235
  print("Retrying in {} seconds...".format(delay))
122
236
  time.sleep(delay)
123
237
  else:
124
238
  print(stderr.decode().strip())
125
- print("Attempt {}: Upgrade failed.".format(attempt))
239
+ print_status("Attempt {}: Upgrade failed.".format(attempt), "WARNING")
126
240
  if attempt < retries:
127
241
  print("Retrying in {} seconds...".format(delay))
128
242
  time.sleep(delay)
129
243
 
130
- print("Error: All upgrade attempts failed.")
244
+ print_status("All upgrade attempts failed.", "ERROR")
131
245
  return False
132
246
 
133
247
  def ensure_dependencies():
@@ -149,7 +263,7 @@ def ensure_dependencies():
149
263
  is_windows_py34 = sys.version_info[:2] == (3, 4) and platform.system() == 'Windows'
150
264
 
151
265
  if is_windows_py34:
152
- print("Detected Windows with Python 3.4")
266
+ print_status("Detected Windows with Python 3.4", "INFO")
153
267
  print("Please ensure the following packages are installed manually:")
154
268
  for pkg in problematic_packages:
155
269
  package_name, version = pkg.split('==')
@@ -187,7 +301,7 @@ def ensure_dependencies():
187
301
  print("Required version of {}: {}".format(package_name, version))
188
302
  time.sleep(2) # Pause for 2 seconds to allow user to read the output
189
303
  if not upgrade_package(package_name): # Attempt to upgrade/downgrade to the required version
190
- print("Warning: Failed to upgrade/downgrade {} to version {}.".format(package_name, version))
304
+ print_status("Failed to upgrade/downgrade {} to version {}.".format(package_name, version), "WARNING")
191
305
  time.sleep(2) # Pause for 2 seconds after failure message
192
306
  elif version and installed_version == version: # Check if installed version matches required version
193
307
  print("All versions match for {}. No changes needed.".format(package_name))
@@ -199,13 +313,13 @@ def ensure_dependencies():
199
313
  print("Latest version of {}: {}".format(package_name, latest_version))
200
314
  time.sleep(2) # Pause for 2 seconds to allow user to read the output
201
315
  if not upgrade_package(package_name):
202
- print("Warning: Failed to upgrade {}.".format(package_name))
316
+ print_status("Failed to upgrade {}.".format(package_name), "WARNING")
203
317
  time.sleep(2) # Pause for 2 seconds after failure message
204
318
  except pkg_resources.DistributionNotFound:
205
319
  print("Package {} is not installed. Attempting to install...".format(package_name))
206
320
  time.sleep(2) # Pause for 2 seconds before attempting installation
207
321
  if not upgrade_package(package_name):
208
- print("Warning: Failed to install {}.".format(package_name))
322
+ print_status("Failed to install {}.".format(package_name), "WARNING")
209
323
  time.sleep(2) # Pause for 2 seconds after failure message
210
324
 
211
325
  def check_for_updates_only():
@@ -234,60 +348,77 @@ def check_for_updates_only():
234
348
  print("UP_TO_DATE")
235
349
 
236
350
  def main():
351
+ print_status("MediCafe Update Utility", "INFO")
352
+ print("Starting update process...")
353
+
237
354
  # Ensure internet connection before proceeding
238
355
  if not check_internet_connection():
239
- print("Error: No internet connection. Please check your connection and try again.")
240
- time.sleep(3) # Pause for 3 seconds before exiting
241
- sys.exit(1)
356
+ print_status("No internet connection. Please check your connection and try again.", "ERROR")
357
+ print_final_result(False, "No internet connection available")
242
358
 
243
359
  # Ensure all dependencies are met before proceeding
244
360
  response = input("Do you want to check dependencies? (yes/no, default/enter is no): ").strip().lower()
245
361
  if response in ['yes', 'y']:
246
362
  ensure_dependencies()
247
363
  else:
248
- print("Skipping dependency check.")
364
+ print_status("Skipping dependency check.", "INFO")
249
365
  time.sleep(3) # Pause for 3 seconds before proceeding
250
366
 
251
367
  package = "medicafe"
252
368
 
253
369
  current_version = get_installed_version(package)
254
370
  if not current_version:
255
- print("{} is not installed.".format(package))
256
- time.sleep(3) # Pause for 3 seconds before exiting
257
- sys.exit(1)
371
+ print_status("{} is not installed.".format(package), "ERROR")
372
+ print_final_result(False, "Package not installed")
258
373
 
259
374
  latest_version = get_latest_version(package)
260
375
  if not latest_version:
261
- print("Could not retrieve the latest version information.")
262
- time.sleep(3) # Pause for 3 seconds before exiting
263
- sys.exit(1)
376
+ print_status("Could not retrieve the latest version information.", "ERROR")
377
+ print_final_result(False, "Unable to fetch latest version")
264
378
 
265
379
  print("Current version of {}: {}".format(package, current_version))
266
380
  print("Latest version of {}: {}".format(package, latest_version))
267
381
 
268
382
  if compare_versions(latest_version, current_version) > 0:
269
- print("A newer version is available. Proceeding with upgrade.")
383
+ print_status("A newer version is available. Proceeding with upgrade.", "INFO")
270
384
  if upgrade_package(package):
271
385
  # Verify upgrade
272
386
  time.sleep(3)
273
387
  new_version = get_installed_version(package)
274
388
  if compare_versions(new_version, latest_version) >= 0:
275
- print("Upgrade successful. New version: {}".format(new_version))
389
+ print_status("Upgrade successful. New version: {}".format(new_version), "SUCCESS")
390
+
391
+ # Clear Python cache after successful upgrade
392
+ print_status("Clearing Python cache to prevent import issues...", "INFO")
393
+ if clear_python_cache():
394
+ print_status("Cache cleared successfully. Update complete.", "SUCCESS")
395
+ else:
396
+ print_status("Cache clearing failed, but update was successful.", "WARNING")
397
+
398
+ print_final_result(True, "Successfully upgraded to version {}".format(new_version))
276
399
  else:
277
- print("Upgrade failed. Current version remains: {}".format(new_version))
278
- time.sleep(3) # Pause for 3 seconds before exiting
279
- sys.exit(1)
400
+ print_status("Upgrade failed. Current version remains: {}".format(new_version), "ERROR")
401
+ print_final_result(False, "Upgrade verification failed")
280
402
  else:
281
- time.sleep(3) # Pause for 3 seconds before exiting
282
- sys.exit(1)
403
+ print_final_result(False, "Upgrade process failed")
283
404
  else:
284
- print("You already have the latest version installed.")
285
- time.sleep(3) # Pause for 3 seconds before exiting
286
- sys.exit(1)
405
+ print_status("You already have the latest version installed.", "SUCCESS")
406
+ print_final_result(True, "Already running latest version")
287
407
 
288
408
  if __name__ == "__main__":
289
- if len(sys.argv) > 1 and sys.argv[1] == "--check-only":
290
- check_for_updates_only()
291
- sys.exit(0)
409
+ if len(sys.argv) > 1:
410
+ if sys.argv[1] == "--check-only":
411
+ check_for_updates_only()
412
+ sys.exit(0)
413
+ elif sys.argv[1] == "--clear-cache":
414
+ # Standalone cache clearing mode
415
+ print_status("MediCafe Cache Clearing Utility", "INFO")
416
+ workspace_path = sys.argv[2] if len(sys.argv) > 2 else None
417
+ if clear_python_cache(workspace_path):
418
+ print_status("Cache clearing completed successfully", "SUCCESS")
419
+ sys.exit(0)
420
+ else:
421
+ print_status("Cache clearing failed", "ERROR")
422
+ sys.exit(1)
292
423
  else:
293
424
  main()
@@ -1,5 +1,19 @@
1
1
  # MediLink_Gmail.py
2
2
  import sys, os, subprocess, time, webbrowser, requests, json, ssl, signal
3
+
4
+ # Set up Python path to find MediCafe when running directly
5
+ def setup_python_path():
6
+ """Set up Python path to find MediCafe package"""
7
+ current_dir = os.path.dirname(os.path.abspath(__file__))
8
+ workspace_root = os.path.dirname(current_dir)
9
+
10
+ # Add workspace root to Python path if not already present
11
+ if workspace_root not in sys.path:
12
+ sys.path.insert(0, workspace_root)
13
+
14
+ # Set up paths before importing MediCafe
15
+ setup_python_path()
16
+
3
17
  from MediCafe.core_utils import get_shared_config_loader
4
18
 
5
19
  # Get shared config loader
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250805.2
3
+ Version: 0.250806.1
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,4 +1,4 @@
1
- MediBot/MediBot.bat,sha256=gSL5EyZJmAsrBo-7uJA2YLnYqAZKPuXugI9d1FCq2Os,22277
1
+ MediBot/MediBot.bat,sha256=XPFbEHu3cctsmZVK44YhX521budCZsu8j5b28djzWn8,22698
2
2
  MediBot/MediBot.py,sha256=E1vE8AskTFf5lp8GVaJKXOUyKZTbi6t01f1taJmMwVQ,28779
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  MediBot/MediBot_Crosswalk_Library.py,sha256=X-lo8bvT-vmCqbrKFi_ApmVI6wQs53mz1ygyVeCf1SI,23463
@@ -15,7 +15,7 @@ MediBot/PDF_to_CSV_Cleaner.py,sha256=ZZphmq-5K04DkrZNlcwNAIoZPOD_ROWvS3PMkKFxeiM
15
15
  MediBot/__init__.py,sha256=mdTybtb5aRozmwDuAtf9nO8wv03HjNCDU0PnJy4Pwko,2957
16
16
  MediBot/get_medicafe_version.py,sha256=uyL_UIE42MyFuJ3SRYxJp8sZx8xjTqlYZ3FdQuxLduY,728
17
17
  MediBot/update_json.py,sha256=vvUF4mKCuaVly8MmoadDO59M231fCIInc0KI1EtDtPA,3704
18
- MediBot/update_medicafe.py,sha256=-l3jaWLkwehX3ju5OhxPMo621_UWOH4dauHbJj-JNcY,13255
18
+ MediBot/update_medicafe.py,sha256=SxBvETfpAx0_85gRmZ6C1nNb2kphbdGtLuw5rM_mgKM,19176
19
19
  MediCafe/MediLink_ConfigLoader.py,sha256=gCC4me808KzSNneRTj6h3IFwjERxP-Q9XQUayPZu7Ew,7009
20
20
  MediCafe/__init__.py,sha256=6bSEXGy35ljEeTv40LcsokC8riYGk6lRj1QDpSepwnA,5461
21
21
  MediCafe/__main__.py,sha256=Sr_4BHC3_o11472EEJ9qcrfuQLTyPZJHNqTTLb1yVx8,12050
@@ -49,7 +49,7 @@ MediLink/MediLink_Deductible_Validator.py,sha256=2g-lZd-Y5fJ1mfP87vM6oABg0t5Om-7
49
49
  MediLink/MediLink_Display_Utils.py,sha256=Bl15Ofqh09KIYsNXzM6WIE97Gp_4RVUw43J0NUzIERY,3121
50
50
  MediLink/MediLink_Down.py,sha256=vZEFNWa6drpXK8DCzt3DAlHdPGdhv3HoLnQh9cppT8o,11793
51
51
  MediLink/MediLink_ERA_decoder.py,sha256=MiOtDcXnmevPfHAahIlTLlUc14VcQWAor9Xa7clA2Ts,8710
52
- MediLink/MediLink_Gmail.py,sha256=9gd_Lp7Bz-seUxquaOAC34fPOHLH7aeCM2yCOaHRVOo,35329
52
+ MediLink/MediLink_Gmail.py,sha256=Wl8g9D-CpsBpmyvAAErL7T327RYy_sRR2gY3SHJbNx8,35807
53
53
  MediLink/MediLink_GraphQL.py,sha256=O6OCaumT0zIC7YcIAwLOOYxiQnYhoMc48UL8ilNIBec,45720
54
54
  MediLink/MediLink_Mailer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  MediLink/MediLink_Parser.py,sha256=w2ZD4minjwkaMz7nzP_r8v_Ow_uM5KHjpPSY8mIHcdE,9787
@@ -73,9 +73,9 @@ MediLink/test_cob_library.py,sha256=wUMv0-Y6fNsKcAs8Z9LwfmEBRO7oBzBAfWmmzwoNd1g,
73
73
  MediLink/test_timing.py,sha256=yH2b8QPLDlp1Zy5AhgtjzjnDHNGhAD16ZtXtZzzESZw,2042
74
74
  MediLink/test_validation.py,sha256=FJrfdUFK--xRScIzrHCg1JeGdm0uJEoRnq6CgkP2lwM,4154
75
75
  MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
76
- medicafe-0.250805.2.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
77
- medicafe-0.250805.2.dist-info/METADATA,sha256=VGHRuX2s8kSmlQKvUW92Ux1ZOMM1sslKpHA_SbMIWks,5501
78
- medicafe-0.250805.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
79
- medicafe-0.250805.2.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
80
- medicafe-0.250805.2.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
81
- medicafe-0.250805.2.dist-info/RECORD,,
76
+ medicafe-0.250806.1.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
77
+ medicafe-0.250806.1.dist-info/METADATA,sha256=4owDcBuLzZPv15SUNG7tFNb8U9e5xQiY1AoLnNsc63I,5501
78
+ medicafe-0.250806.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
79
+ medicafe-0.250806.1.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
80
+ medicafe-0.250806.1.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
81
+ medicafe-0.250806.1.dist-info/RECORD,,