medicafe 0.250806.13__py3-none-any.whl → 0.250806.14__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
@@ -1,7 +1,44 @@
1
- ::MediBot.bat - Updated to use MediCafe entry point
1
+ ::MediBot.bat - Streamlined version with coordinated debug system
2
2
  @echo off
3
3
  setlocal enabledelayedexpansion
4
4
 
5
+ :: Debug mode selection
6
+ echo ========================================
7
+ echo MediBot Launcher
8
+ echo ========================================
9
+ echo.
10
+ echo Choose your mode:
11
+ echo 1. Normal Mode (Production)
12
+ echo 2. Debug Mode (Full diagnostics with automated checks)
13
+ echo.
14
+ set /p debug_choice="Enter your choice (1-2): "
15
+
16
+ if "!debug_choice!"=="2" (
17
+ echo.
18
+ echo ========================================
19
+ echo DEBUG MODE ACTIVATED
20
+ echo ========================================
21
+ echo [DEBUG] Running full diagnostic suite with automated checks...
22
+ echo [DEBUG] This will run all checks without user interaction.
23
+ echo [DEBUG] Results will be displayed for review.
24
+ echo.
25
+ goto full_debug_mode
26
+ ) else if "!debug_choice!"=="1" (
27
+ echo [INFO] Starting Normal Mode...
28
+ goto normal_mode
29
+ ) else (
30
+ echo [ERROR] Invalid choice. Starting Normal Mode...
31
+ goto normal_mode
32
+ )
33
+
34
+ :normal_mode
35
+ :: Normal production mode - streamlined without excessive debug output
36
+ cls
37
+ echo ========================================
38
+ echo MediBot Starting
39
+ echo ========================================
40
+ echo.
41
+
5
42
  :: Define paths with local fallbacks for F: drive dependencies
6
43
  set "source_folder=C:\MEDIANSI\MediCare"
7
44
  set "target_folder=C:\MEDIANSI\MediCare\CSV"
@@ -21,11 +58,26 @@ set "config_file_local=MediBot\json\config.json"
21
58
  set "temp_file_legacy=F:\Medibot\last_update_timestamp.txt"
22
59
  set "temp_file_local=MediBot\last_update_timestamp.txt"
23
60
 
61
+ :: FIXED: Always prioritize local file if it exists
62
+ if exist "%upgrade_medicafe_local%" (
63
+ set "upgrade_medicafe=%upgrade_medicafe_local%"
64
+ set "use_local_update=1"
65
+ ) else (
66
+ set "use_local_update=0"
67
+ )
68
+
24
69
  :: Determine which paths to use based on availability
25
70
  if exist "F:\Medibot" (
26
71
  set "local_storage_path=%local_storage_legacy%"
27
72
  set "config_file=%config_file_legacy%"
28
73
  set "temp_file=%temp_file_legacy%"
74
+
75
+ :: Only use F: drive update script if local doesn't exist
76
+ if "!use_local_update!"=="0" (
77
+ if exist "%upgrade_medicafe_legacy%" (
78
+ set "upgrade_medicafe=%upgrade_medicafe_legacy%"
79
+ )
80
+ )
29
81
  ) else (
30
82
  set "local_storage_path=%local_storage_local%"
31
83
  set "config_file=%config_file_local%"
@@ -34,424 +86,92 @@ if exist "F:\Medibot" (
34
86
  if not exist "MediBot\json" mkdir "MediBot\json" 2>nul
35
87
  if not exist "MediBot\DOWNLOADS" mkdir "MediBot\DOWNLOADS" 2>nul
36
88
  )
89
+
37
90
  set "firefox_path=C:\Program Files\Mozilla Firefox\firefox.exe"
38
91
  set "claims_status_script=..\MediLink\MediLink_ClaimStatus.py"
39
92
  set "deductible_script=..\MediLink\MediLink_Deductible.py"
40
93
  set "package_version="
41
94
  set PYTHONWARNINGS=ignore
42
95
 
43
- :: Check if Python is installed and the path is correctly set
96
+ :: Check if Python is installed
44
97
  python --version >nul 2>&1
45
98
  if %errorlevel% neq 0 (
46
- echo Python is not installed or not added to PATH.
47
- exit /b
99
+ echo [ERROR] Python is not installed or not added to PATH.
100
+ echo Please run in Debug Mode to diagnose Python issues.
101
+ pause
102
+ exit /b 1
48
103
  )
49
104
 
50
105
  :: Check if critical directories exist
51
106
  if not exist "%source_folder%" (
52
- echo.
53
- echo Warning: Source folder not found at: %source_folder%
54
- echo.
55
- echo Would you like to provide an alternate path for the source folder?
107
+ echo [WARNING] Source folder not found at: %source_folder%
56
108
  set /p provide_alt_source="Enter 'Y' to provide alternate path, or any other key to continue: "
57
109
  if /i "!provide_alt_source!"=="Y" (
58
- echo.
59
- echo Please enter the full path to your source folder.
60
- echo Example: C:\MediCare\Data
61
- echo Example with spaces: "G:\My Drive\MediCare\Data"
62
- echo.
63
- echo Note: If your path contains spaces, please include quotes around the entire path.
64
- echo.
65
- set /p alt_source_path="Enter source folder path: "
66
- :: Remove any surrounding quotes from user input and re-add them for consistency
67
- set "alt_source_path=!alt_source_path:"=!"
68
- if exist "!alt_source_path!" (
69
- echo Source folder found at: !alt_source_path!
70
- set "source_folder=!alt_source_path!"
71
- ) else (
72
- echo Source folder not found at: !alt_source_path!
73
- echo Continuing with default path...
74
- )
75
- ) else (
76
- echo Continuing with default path...
77
- )
78
- )
79
-
80
- if not exist "%local_storage_path%" (
81
- echo.
82
- echo Warning: Local storage path not found at: %local_storage_path%
83
- echo.
84
- echo Would you like to provide an alternate path for the local storage?
85
- set /p provide_alt_storage="Enter 'Y' to provide alternate path, or any other key to continue: "
86
- if /i "!provide_alt_storage!"=="Y" (
87
- echo.
88
- echo Please enter the full path to your local storage folder.
89
- echo Example: C:\MediBot\Downloads
90
- echo Example with spaces: "G:\My Drive\MediBot\Downloads"
91
- echo.
92
- echo Note: If your path contains spaces, please include quotes around the entire path.
93
- echo.
94
- set /p alt_storage_path="Enter local storage path: "
95
- :: Remove any surrounding quotes from user input and re-add them for consistency
96
- set "alt_storage_path=!alt_storage_path:"=!"
97
- if exist "!alt_storage_path!" (
98
- echo Local storage folder found at: !alt_storage_path!
99
- set "local_storage_path=!alt_storage_path!"
100
- ) else (
101
- echo Local storage folder not found at: !alt_storage_path!
102
- echo Continuing with default path...
103
- )
104
- ) else (
105
- echo Continuing with default path...
110
+ set /p alt_source_folder="Enter the alternate source folder path: "
111
+ if not "!alt_source_folder!"=="" set "source_folder=!alt_source_folder!"
106
112
  )
107
113
  )
108
114
 
109
115
  if not exist "%target_folder%" (
110
- echo.
111
- echo Warning: Target folder not found at: %target_folder%
112
- echo.
113
- echo Would you like to provide an alternate path for the target folder?
114
- set /p provide_alt_target="Enter 'Y' to provide alternate path, or any other key to continue: "
115
- if /i "!provide_alt_target!"=="Y" (
116
- echo.
117
- echo Please enter the full path to your target folder.
118
- echo Example: C:\MediCare\CSV
119
- echo Example with spaces: "G:\My Drive\MediCare\CSV"
120
- echo.
121
- echo Note: If your path contains spaces, please include quotes around the entire path.
122
- echo.
123
- set /p alt_target_path="Enter target folder path: "
124
- :: Remove any surrounding quotes from user input and re-add them for consistency
125
- set "alt_target_path=!alt_target_path:"=!"
126
- if exist "!alt_target_path!" (
127
- echo Target folder found at: !alt_target_path!
128
- set "target_folder=!alt_target_path!"
129
- ) else (
130
- echo Target folder not found at: !alt_target_path!
131
- echo Continuing with default path...
132
- )
133
- ) else (
134
- echo Continuing with default path...
135
- )
116
+ mkdir "%target_folder%" 2>nul
136
117
  )
137
118
 
138
- :: Check if the MediCafe package is installed and retrieve its version
139
- echo Checking for installed MediCafe package version...
140
- python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" > temp.txt 2>nul
141
- set /p package_version=<temp.txt
142
- del temp.txt
143
-
144
- if not defined package_version (
145
- echo MediCafe package version not detected or MediCafe not installed. Consider manual re-install.
146
- exit /b
147
- )
148
-
149
- :: Extract version number and display it
150
- for /f "tokens=2 delims==" %%a in ("%package_version%") do (
151
- set "medicafe_version=%%a"
152
- )
153
-
154
- if not defined medicafe_version (
155
- echo Failed to detect MediCafe version.
119
+ :: Check if the MediCafe package is installed
120
+ python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2>nul
121
+ if errorlevel 1 (
122
+ echo [WARNING] MediCafe package not found. Attempting to install...
123
+ python -m pip install medicafe --upgrade
124
+ if errorlevel 1 (
125
+ echo [ERROR] Failed to install MediCafe package.
126
+ echo Please run in Debug Mode to diagnose package issues.
127
+ pause
128
+ exit /b 1
129
+ )
156
130
  ) else (
157
- echo Detected MediCafe version: %medicafe_version%
158
- ping -n 2 127.0.0.1 >nul
131
+ for /f "tokens=2 delims==" %%i in ('python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2^>nul') do set "package_version=%%i"
159
132
  )
160
133
 
161
134
  :: Check for internet connectivity
162
- ping -n 1 google.com > nul 2>&1
163
- if %ERRORLEVEL% neq 0 (
135
+ ping -n 1 google.com >nul 2>&1
136
+ if errorlevel 1 (
164
137
  set "internet_available=0"
165
- echo No internet connection detected.
166
138
  ) else (
167
139
  set "internet_available=1"
168
- echo Internet connection detected.
169
- )
170
-
171
- :: Common pre-menu setup
172
- echo Setting up the environment...
173
- if not exist "%config_file%" (
174
- echo Configuration file missing.
175
- echo.
176
- echo Expected configuration file path: %config_file%
177
- echo.
178
- echo Would you like to provide an alternate path for the configuration file?
179
- set /p provide_alt="Enter 'Y' to provide alternate path, or any other key to exit: "
180
- if /i "!provide_alt!"=="Y" (
181
- echo.
182
- echo Please enter the full path to your configuration file.
183
- echo Example: C:\MediBot\config\config.json
184
- echo Example with spaces: "G:\My Drive\MediBot\config\config.json"
185
- echo.
186
- echo Note: If your path contains spaces, please include quotes around the entire path.
187
- echo.
188
- set /p alt_config_path="Enter configuration file path: "
189
- :: Remove any surrounding quotes from user input and re-add them for consistency
190
- set "alt_config_path=!alt_config_path:"=!"
191
- if exist "!alt_config_path!" (
192
- echo Configuration file found at: !alt_config_path!
193
- set "config_file=!alt_config_path!"
194
- goto config_check_complete
195
- ) else (
196
- echo Configuration file not found at: !alt_config_path!
197
- echo.
198
- set /p retry="Would you like to try another path? (Y/N): "
199
- if /i "!retry!"=="Y" (
200
- goto retry_config_path
201
- ) else (
202
- goto end_script
203
- )
204
- )
205
- ) else (
206
- goto end_script
207
- )
208
- ) else (
209
- goto config_check_complete
210
- )
211
-
212
- :retry_config_path
213
- echo.
214
- echo Please enter the full path to your configuration file.
215
- echo Example: C:\MediBot\config\config.json
216
- echo Example with spaces: "G:\My Drive\MediBot\config\config.json"
217
- echo.
218
- echo Note: If your path contains spaces, please include quotes around the entire path.
219
- echo.
220
- set /p alt_config_path="Enter configuration file path: "
221
- :: Remove any surrounding quotes from user input and re-add them for consistency
222
- set "alt_config_path=!alt_config_path:"=!"
223
- if exist "!alt_config_path!" (
224
- echo Configuration file found at: !alt_config_path!
225
- set "config_file=!alt_config_path!"
226
- ) else (
227
- echo Configuration file not found at: !alt_config_path!
228
- echo.
229
- set /p retry="Would you like to try another path? (Y/N): "
230
- if /i "!retry!"=="Y" (
231
- goto retry_config_path
232
- ) else (
233
- goto end_script
234
- )
235
- )
236
-
237
- :config_check_complete
238
-
239
- :: Check if the file exists and attempt to copy it to the local directory
240
- echo Checking for the update script...
241
- ping -n 2 127.0.0.1 >nul
242
-
243
- :: DIAGNOSTIC SECTION - Analyze F: drive accessibility
244
- echo.
245
- echo ==========================================
246
- echo F: DRIVE ACCESSIBILITY DIAGNOSTICS
247
- echo ==========================================
248
- echo.
249
-
250
- :: Check if F: drive exists at all
251
- echo [DIAGNOSTIC] Checking F: drive existence...
252
- if exist "F:\" (
253
- echo [OK] F: drive is accessible
254
-
255
- :: Check F: drive properties
256
- echo [DIAGNOSTIC] F: drive properties:
257
- dir F:\ | find "Directory of" 2>nul || echo [!] Cannot read F: drive directory listing
258
-
259
- :: Check available space
260
- echo [DIAGNOSTIC] F: drive free space:
261
- dir F:\ | find "bytes free" 2>nul || echo [!] Cannot determine free space
262
-
263
- :: Check if F:\Medibot directory exists
264
- echo [DIAGNOSTIC] Checking F:\Medibot directory...
265
- if exist "F:\Medibot" (
266
- echo [OK] F:\Medibot directory exists
267
-
268
- :: Check directory permissions by attempting to create a test file
269
- echo [DIAGNOSTIC] Testing write permissions to F:\Medibot...
270
- echo test > "F:\Medibot\permission_test.tmp" 2>nul
271
- if exist "F:\Medibot\permission_test.tmp" (
272
- echo [OK] Write permissions confirmed
273
- del "F:\Medibot\permission_test.tmp" >nul 2>&1
274
- ) else (
275
- echo [ERROR] PERMISSION DENIED - Cannot write to F:\Medibot
276
- echo [ERROR] This is likely the cause of the path error!
277
- )
278
-
279
- :: List contents of F:\Medibot
280
- echo [DIAGNOSTIC] F:\Medibot directory contents:
281
- dir /b "F:\Medibot" 2>nul || echo [!] Cannot list directory contents (permission issue?)
282
-
283
- :: Check if update_medicafe.py specifically exists
284
- echo [DIAGNOSTIC] Checking for update_medicafe.py...
285
- if exist "F:\Medibot\update_medicafe.py" (
286
- echo [OK] update_medicafe.py found at F:\Medibot\update_medicafe.py
287
- echo [DIAGNOSTIC] File details:
288
- dir "F:\Medibot\update_medicafe.py" 2>nul || echo [!] Cannot read file details
289
-
290
- :: Test file accessibility by attempting to read it
291
- echo [DIAGNOSTIC] Testing file read permissions...
292
- type "F:\Medibot\update_medicafe.py" | find "#update_medicafe.py" >nul 2>&1
293
- if %errorlevel% equ 0 (
294
- echo [OK] File is readable
295
- ) else (
296
- echo [ERROR] FILE READ ERROR - Cannot read update_medicafe.py
297
- echo [ERROR] File exists but is not accessible (permission/lock issue?)
298
- )
299
- ) else (
300
- echo [ERROR] update_medicafe.py NOT FOUND at F:\Medibot\update_medicafe.py
301
- )
302
-
303
- ) else (
304
- echo [ERROR] F:\Medibot directory does NOT exist
305
- echo [DIAGNOSTIC] Attempting to create F:\Medibot...
306
- mkdir "F:\Medibot" 2>nul
307
- if exist "F:\Medibot" (
308
- echo [OK] Successfully created F:\Medibot directory
309
- ) else (
310
- echo [ERROR] FAILED to create F:\Medibot directory
311
- echo [ERROR] Permission denied or F: drive is read-only
312
- )
313
- )
314
-
315
- ) else (
316
- echo [ERROR] F: drive is NOT accessible
317
- echo [ERROR] F: drive may be:
318
- echo - Disconnected network drive
319
- echo - Unmounted USB/external drive
320
- echo - Mapped drive that's no longer available
321
- echo - Security policy blocking access
322
-
323
- :: Check what drives are actually available
324
- echo [DIAGNOSTIC] Available drives on this system:
325
- wmic logicaldisk get size,freespace,caption 2>nul || echo [!] Cannot enumerate drives
326
- )
327
-
328
- echo.
329
- echo ==========================================
330
- echo END F: DRIVE DIAGNOSTICS
331
- echo ==========================================
332
- echo.
333
-
334
- :: Continue with existing logic but with enhanced error reporting
335
- :: First check if we already have it locally
336
- if exist "%upgrade_medicafe_local%" (
337
- echo Found update_medicafe.py in local directory. No action needed.
338
- ping -n 2 127.0.0.1 >nul
339
- ) else if exist "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" (
340
- echo Found update_medicafe.py in site-packages. Copying to local directory...
341
- ping -n 2 127.0.0.1 >nul
342
- :: Ensure MediBot directory exists
343
- if not exist "MediBot" mkdir "MediBot"
344
- copy "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" "%upgrade_medicafe_local%" >nul 2>&1
345
- if %errorlevel% neq 0 (
346
- echo Copy to local directory failed. Error code: %errorlevel%
347
- echo [DIAGNOSTIC] Attempting copy to F: drive (with detailed error reporting)...
348
- ping -n 2 127.0.0.1 >nul
349
- :: Ensure F:\Medibot directory exists (only if F: drive is accessible)
350
- if exist "F:\" (
351
- if not exist "F:\Medibot" (
352
- echo [DIAGNOSTIC] Creating F:\Medibot directory...
353
- mkdir "F:\Medibot" 2>nul
354
- if not exist "F:\Medibot" (
355
- echo [ERROR] Failed to create F:\Medibot - Permission denied or read-only drive
356
- )
357
- )
358
- if exist "F:\Medibot" (
359
- echo [DIAGNOSTIC] Attempting file copy to F:\Medibot...
360
- copy "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" "%upgrade_medicafe_legacy%" 2>nul
361
- if %errorlevel% neq 0 (
362
- echo [ERROR] Copy to F:\Medibot failed with error code: %errorlevel%
363
- echo [ERROR] Possible causes:
364
- echo - Permission denied (insufficient write access)
365
- echo - Disk full
366
- echo - File locked by another process
367
- echo - Antivirus blocking the operation
368
- ) else (
369
- echo [SUCCESS] File copied to F:\Medibot successfully
370
- )
371
- )
372
- ) else (
373
- echo [ERROR] F: drive not accessible - skipping F: drive copy attempt
374
- )
375
- ) else (
376
- echo File copied to local directory successfully.
377
- ping -n 2 127.0.0.1 >nul
378
- )
379
- ) else if exist "%upgrade_medicafe_legacy%" (
380
- echo Found update_medicafe.py in legacy F: drive location.
381
- echo [DIAGNOSTIC] Verifying F: drive file accessibility...
382
- type "%upgrade_medicafe_legacy%" | find "#update_medicafe.py" >nul 2>&1
383
- if %errorlevel% equ 0 (
384
- echo [OK] F: drive file is accessible and readable
385
- ) else (
386
- echo [ERROR] F: drive file exists but cannot be read (permission/lock issue)
387
- )
388
- ping -n 2 127.0.0.1 >nul
389
- ) else (
390
- echo update_medicafe.py not detected in any known location.
391
- echo.
392
- echo Checked locations:
393
- echo - Site-packages: C:\Python34\Lib\site-packages\MediBot\update_medicafe.py
394
- echo - Local: %upgrade_medicafe_local%
395
- echo - Legacy: %upgrade_medicafe_legacy%
396
- echo.
397
- echo [DIAGNOSTIC] Current working directory:
398
- cd
399
- echo [DIAGNOSTIC] Current directory contents:
400
- dir /b
401
- echo.
402
- echo [DIAGNOSTIC] MediBot directory contents:
403
- dir /b MediBot\ 2>nul || echo MediBot directory not found
404
- echo.
405
- echo Continuing without update script...
406
- ping -n 2 127.0.0.1 >nul
407
- )
408
140
  )
409
141
 
410
142
  :: Main menu
411
143
  :main_menu
412
144
  cls
413
- echo Version: %medicafe_version%
414
- echo --------------------------------------------------------------
415
- echo .//* Welcome to MediCafe *\\.
416
- echo --------------------------------------------------------------
417
- echo.
418
-
419
- echo Please select an option:
420
145
  echo.
421
- if "!internet_available!"=="1" (
422
- echo 1. Update MediCafe
423
- echo.
424
- echo 2. Download Email de Carol
425
- echo.
426
- echo 3. MediLink Claims
427
- echo.
428
- echo 4. ^[United^] Claims Status
429
- echo.
430
- echo 5. ^[United^] Deductible
431
- echo.
432
- )
433
- echo 6. Run MediBot
434
- echo.
435
- echo 7. Troubleshooting: Open Log File
436
- echo.
437
- echo 8. Troubleshooting: Clear Python Cache
146
+ echo ========================================
147
+ echo MediBot Main Menu
148
+ echo ========================================
438
149
  echo.
439
- echo 9. Exit
150
+ echo 1. Check for MediCafe Updates
151
+ echo 2. Download Carol's Emails
152
+ echo 3. MediBot Flow
153
+ echo 4. MediLink Flow
154
+ echo 5. United Claims Status
155
+ echo 6. United Deductible
156
+ echo 7. Process CSV Files
157
+ echo 8. Clear Cache
158
+ echo 9. Open Latest Log
159
+ echo 0. Exit
440
160
  echo.
441
- set /p choice=Enter your choice:
442
161
 
443
- :: Update option numbers
444
- if "!choice!"=="9" goto end_script
445
- if "!choice!"=="8" goto clear_cache
446
- if "!choice!"=="7" goto open_latest_log
447
- if "!choice!"=="6" goto medibot_flow
448
- if "!choice!"=="5" goto united_deductible
449
- if "!choice!"=="4" goto united_claims_status
450
- if "!choice!"=="3" goto medilink_flow
451
- if "!choice!"=="2" goto download_emails
162
+ set /p choice="Enter your choice (0-9): "
163
+
452
164
  if "!choice!"=="1" goto check_updates
165
+ if "!choice!"=="2" goto download_emails
166
+ if "!choice!"=="3" goto medibot_flow
167
+ if "!choice!"=="4" goto medilink_flow
168
+ if "!choice!"=="5" goto united_claims_status
169
+ if "!choice!"=="6" goto united_deductible
170
+ if "!choice!"=="7" goto process_csvs
171
+ if "!choice!"=="8" goto clear_cache
172
+ if "!choice!"=="9" goto open_latest_log
173
+ if "!choice!"=="0" goto end_script
453
174
 
454
- :: Invalid choice - return to menu
455
175
  echo Invalid choice. Please try again.
456
176
  pause
457
177
  goto main_menu
@@ -459,611 +179,286 @@ goto main_menu
459
179
  :: Medicafe Update
460
180
  :check_updates
461
181
  if "!internet_available!"=="0" (
462
- echo No internet connection available.
182
+ echo [WARNING] No internet connection available.
463
183
  goto main_menu
464
184
  )
465
185
 
466
186
  echo ========================================
467
- echo DEBUG: Starting MediCafe Update Process
468
- echo ========================================
469
- echo.
470
- echo Current working directory: %CD%
471
- echo Package version: %package_version%
472
- echo Update script path: %upgrade_medicafe%
473
- echo.
474
- echo Press Enter to continue to step 1...
475
- pause >nul
476
-
477
- :: Step 1: Check if update_medicafe.py exists in expected location
478
- echo.
479
- echo ========================================
480
- echo DEBUG STEP 1: Checking for update script
481
- echo ========================================
482
- echo.
483
- echo Checking for update script (priority: local first, then legacy path)...
484
- if exist "%upgrade_medicafe_local%" (
485
- echo [SUCCESS] Found update script at: %upgrade_medicafe_local%
486
- echo File size:
487
- dir "%upgrade_medicafe_local%" | find "update_medicafe.py"
488
- set "upgrade_medicafe=%upgrade_medicafe_local%"
489
- ) else if exist "%upgrade_medicafe_legacy%" (
490
- echo [SUCCESS] Found update script at legacy location: %upgrade_medicafe_legacy%
491
- echo File size:
492
- dir "%upgrade_medicafe_legacy%" | find "update_medicafe.py"
493
- set "upgrade_medicafe=%upgrade_medicafe_legacy%"
494
- ) else (
495
- echo [FAILED] Update script not found in either location:
496
- echo - Local: %upgrade_medicafe_local%
497
- echo - Legacy: %upgrade_medicafe_legacy%
498
- echo.
499
- echo Available files in current directory:
500
- dir /b
501
- echo.
502
- echo Available files in MediBot directory:
503
- dir /b MediBot\ 2>nul || echo MediBot directory not found
504
- )
505
- )
506
- echo.
507
- echo Press Enter to continue to step 2...
508
- pause >nul
509
-
510
- :: Step 2: Verify Python installation and path
511
- echo.
512
- echo ========================================
513
- echo DEBUG STEP 2: Python Environment Check
514
- echo ========================================
515
- echo.
516
- echo Checking Python installation...
517
- python --version
518
- if %errorlevel% neq 0 (
519
- echo [ERROR] Python not found in PATH
520
- echo Current PATH: %PATH%
521
- ) else (
522
- echo [SUCCESS] Python found
523
- echo Python executable: %PYTHONPATH%
524
- echo Python version:
525
- python --version
526
- )
527
- echo.
528
- echo Checking pip installation...
529
- python -m pip --version
530
- if %errorlevel% neq 0 (
531
- echo [ERROR] pip not found
532
- ) else (
533
- echo [SUCCESS] pip found
534
- echo pip version:
535
- python -m pip --version
536
- )
537
- echo.
538
- echo Press Enter to continue to step 3...
539
- pause >nul
540
-
541
- :: Step 3: Check MediCafe package installation
542
- echo.
543
- echo ========================================
544
- echo DEBUG STEP 3: MediCafe Package Check
187
+ echo Starting MediCafe Update Process
545
188
  echo ========================================
546
189
  echo.
547
- echo Checking MediCafe package installation...
548
- python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2>nul
549
- if %errorlevel% neq 0 (
550
- echo [ERROR] MediCafe package not found or error accessing
551
- echo.
552
- echo Checking if MediCafe is importable...
553
- python -c "import MediCafe; print('MediCafe module found')" 2>nul
554
- if %errorlevel% neq 0 (
555
- echo [ERROR] MediCafe module not importable
556
- ) else (
557
- echo [SUCCESS] MediCafe module is importable
558
- )
559
- ) else (
560
- echo [SUCCESS] MediCafe package found
561
- echo Package version: %package_version%
562
- )
563
- echo.
564
- echo Press Enter to continue to step 4...
565
- pause >nul
566
190
 
567
- :: Step 4: Check internet connectivity
568
- echo.
569
- echo ========================================
570
- echo DEBUG STEP 4: Internet Connectivity
571
- echo ========================================
572
- echo.
573
- echo Testing internet connectivity...
574
- ping -n 1 google.com >nul 2>&1
575
- if %errorlevel% neq 0 (
576
- echo [ERROR] No internet connection detected
577
- echo Cannot proceed with update without internet
578
- echo.
579
- echo Press Enter to return to main menu...
580
- pause >nul
191
+ :: Verify update script exists
192
+ if not exist "%upgrade_medicafe%" (
193
+ echo [ERROR] Update script not found at: %upgrade_medicafe%
194
+ echo Please run in Debug Mode to diagnose file issues.
195
+ pause
581
196
  goto main_menu
582
- ) else (
583
- echo [SUCCESS] Internet connection detected
584
- echo Testing PyPI connectivity...
585
- python -c "import requests; print('PyPI accessible:', requests.get('https://pypi.org/pypi/medicafe/json', timeout=5).status_code)" 2>nul
586
- if %errorlevel% neq 0 (
587
- echo [WARNING] PyPI connectivity test failed
588
- ) else (
589
- echo [SUCCESS] PyPI connectivity confirmed
590
- )
591
197
  )
592
- echo.
593
- echo Press Enter to continue to step 5...
594
- pause >nul
595
198
 
596
- :: Step 5: Attempt update with detailed logging
597
- echo.
598
- echo ========================================
599
- echo DEBUG STEP 5: Starting Update Process
600
- echo ========================================
601
- echo.
602
199
  echo Starting update process...
200
+ echo Update script: %upgrade_medicafe%
603
201
  echo.
604
202
 
605
- :: Check if update_medicafe.py exists using the new priority system
606
- if exist "%upgrade_medicafe_local%" (
607
- echo [INFO] Using local update script at: %upgrade_medicafe_local%
608
- echo Command: python "%upgrade_medicafe_local%" %package_version%
609
-
610
- :: Pre-execution diagnostics
611
- echo.
612
- echo [DIAGNOSTIC] Pre-execution checks for local script:
613
- echo [DIAGNOSTIC] File size and permissions:
614
- dir "%upgrade_medicafe_local%" 2>nul || echo [!] Cannot read file details
615
- echo [DIAGNOSTIC] Testing Python access to file:
616
- python -c "import os; print('[OK] Python can access file') if os.path.exists('%upgrade_medicafe_local%') else print('[ERROR] Python cannot access file')" 2>nul || echo [!] Python test failed
617
-
618
- echo.
619
- echo Press Enter to execute update command...
620
- pause >nul
621
- echo.
622
- echo Executing update command...
623
- echo.
624
- echo The update window will open and show detailed progress.
625
- echo All output will be displayed on screen.
626
- echo.
627
- start "Medicafe Update" cmd /c "echo [DIAGNOSTIC] About to execute: python \"%upgrade_medicafe_local%\" %package_version% & echo. & python \"%upgrade_medicafe_local%\" %package_version% & echo. & echo [DIAGNOSTIC] Python exit code: %ERRORLEVEL% & echo Update process completed. Press any key to close... & pause >nul" && (
628
- echo %DATE% %TIME% Upgrade initiated successfully (local). >> "%temp_file%"
629
- echo [SUCCESS] Update process started successfully
630
- echo All output will be displayed in the update window.
631
- ) || (
632
- echo %DATE% %TIME% Update failed (local). >> "%temp_file%"
633
- echo [ERROR] Upgrade failed. Check the update window for details.
634
- echo [DIAGNOSTIC] Possible causes for local script failure:
635
- echo - Python not in PATH
636
- echo - Script syntax error
637
- echo - Missing Python dependencies
638
- echo - File corruption
639
- )
640
- ) else if exist "%upgrade_medicafe_legacy%" (
641
- echo [INFO] Using legacy update script at: %upgrade_medicafe_legacy%
642
- echo Command: python "%upgrade_medicafe_legacy%" %package_version%
643
-
644
- :: Pre-execution diagnostics for F: drive
645
- echo.
646
- echo [DIAGNOSTIC] Pre-execution checks for F: drive script:
647
- echo [DIAGNOSTIC] File size and permissions:
648
- dir "%upgrade_medicafe_legacy%" 2>nul || echo [!] Cannot read file details
649
- echo [DIAGNOSTIC] Testing Python access to F: drive file:
650
- python -c "import os; print('[OK] Python can access F: drive file') if os.path.exists('%upgrade_medicafe_legacy%') else print('[ERROR] Python cannot access F: drive file')" 2>nul || echo [!] Python F: drive test failed
651
- echo [DIAGNOSTIC] Testing file read permissions:
652
- type "%upgrade_medicafe_legacy%" | find "#update_medicafe.py" >nul 2>&1 && echo [OK] File content readable || echo [ERROR] Cannot read file content
653
-
654
- echo.
655
- echo Press Enter to execute update command...
656
- pause >nul
657
- echo.
658
- echo Executing update command...
659
- start "Medicafe Update" cmd /c "echo [DIAGNOSTIC] About to execute: python \"%upgrade_medicafe_legacy%\" %package_version% & echo [DIAGNOSTIC] F: drive accessibility test... & dir F:\ ^| find \"Directory of\" ^>nul 2^>^&1 ^&^& echo [OK] F: drive accessible ^|^| echo [ERROR] F: drive access lost & echo. & python \"%upgrade_medicafe_legacy%\" %package_version% & echo. & echo [DIAGNOSTIC] Python exit code: %ERRORLEVEL% & echo Update process completed. Press any key to close... & pause >nul" && (
660
- echo %DATE% %TIME% Upgrade initiated successfully (legacy). >> "%temp_file%"
661
- echo [SUCCESS] Update process started successfully
662
- echo All output will be displayed in the update window.
663
- ) || (
664
- echo %DATE% %TIME% Update failed (legacy). >> "%temp_file%"
665
- echo [ERROR] Upgrade failed. Check the update window for details.
666
- echo [DIAGNOSTIC] Possible causes for F: drive script failure:
667
- echo - F: drive disconnected during execution
668
- echo - Permission denied accessing F: drive
669
- echo - F: drive file locked by antivirus
670
- echo - Network drive timeout
671
- echo - Python cannot access network paths
672
- )
673
- ) else (
674
- echo [ERROR] update_medicafe.py not found in either location
675
- echo Expected locations:
676
- echo - Local: %upgrade_medicafe_local%
677
- echo - Legacy: %upgrade_medicafe_legacy%
678
- echo.
679
- echo Current directory contents:
680
- dir /b
681
- echo.
682
- echo MediBot directory contents:
683
- dir /b MediBot\ 2>nul || echo MediBot directory not found
684
- echo.
685
- echo %DATE% %TIME% Update failed - script not found. >> "%temp_file%"
686
- echo.
687
- echo Press Enter to return to main menu...
688
- pause >nul
689
- goto main_menu
203
+ start "Medicafe Update" cmd /c "python \"%upgrade_medicafe%\" %package_version% & echo. & echo Update process completed. Press any key to close... & pause >nul" && (
204
+ echo %DATE% %TIME% Upgrade initiated successfully. >> "%temp_file%"
205
+ echo [SUCCESS] Update process started successfully
206
+ ) || (
207
+ echo %DATE% %TIME% Update failed. >> "%temp_file%"
208
+ echo [ERROR] Upgrade failed. Check the update window for details.
690
209
  )
691
210
 
692
- echo.
693
- echo ========================================
694
- echo DEBUG: Update Process Complete
695
- echo ========================================
696
211
  echo.
697
212
  echo Update process has been initiated.
698
213
  echo All output will be displayed in the update window.
699
214
  echo.
700
- echo Press Enter to return to main menu...
701
- pause >nul
215
+ pause
702
216
  goto main_menu
703
217
 
704
- :: Download Carol's Emails - Using MediCafe entry point
218
+ :: Download Carol's Emails
705
219
  :download_emails
706
220
  if "!internet_available!"=="0" (
707
- echo No internet connection available.
221
+ echo [WARNING] No internet connection available.
708
222
  goto main_menu
709
223
  )
224
+
710
225
  call :process_csvs
711
226
  cls
712
227
  echo Starting email download via MediCafe...
713
228
  cd /d "%~dp0.."
714
229
  python -m MediCafe download_emails
715
230
  if errorlevel 1 (
716
- echo Failed to download emails.
231
+ echo [ERROR] Failed to download emails.
717
232
  pause
718
233
  )
234
+
235
+ pause
719
236
  goto main_menu
720
237
 
721
- :: Run MediBot Flow
238
+ :: MediBot Flow
722
239
  :medibot_flow
723
- call :process_csvs
724
240
  cls
725
- echo Starting MediBot via MediCafe...
241
+ echo Starting MediBot flow...
726
242
  cd /d "%~dp0.."
727
- python -m MediCafe medibot "%config_file%"
728
- if errorlevel 1 echo Failed to run MediBot.
243
+ python -m MediCafe medibot
244
+ if errorlevel 1 (
245
+ echo [ERROR] Failed to start MediBot flow.
246
+ pause
247
+ )
248
+
729
249
  pause
730
250
  goto main_menu
731
251
 
732
- :: Continue to MediLink
252
+ :: MediLink Flow
733
253
  :medilink_flow
734
- if "!internet_available!"=="0" (
735
- echo No internet connection available.
736
- goto main_menu
737
- )
738
- call :process_csvs
739
254
  cls
740
- :: move this path.
255
+ echo Starting MediLink flow...
741
256
  cd /d "%~dp0.."
742
257
  python -m MediCafe medilink
743
- if errorlevel 1 echo MediLink failed to execute.
258
+ if errorlevel 1 (
259
+ echo [ERROR] Failed to start MediLink flow.
260
+ pause
261
+ )
262
+
744
263
  pause
745
264
  goto main_menu
746
265
 
747
266
  :: United Claims Status
748
267
  :united_claims_status
749
- if "!internet_available!"=="0" (
750
- echo No internet connection available.
751
- goto main_menu
752
- )
753
268
  cls
754
- echo Loading United Claims Status...
269
+ echo Starting United Claims Status...
755
270
  cd /d "%~dp0.."
756
271
  python -m MediCafe claims_status
757
- if errorlevel 1 echo Failed to check United Claims Status.
272
+ if errorlevel 1 (
273
+ echo [ERROR] Failed to start United Claims Status.
274
+ pause
275
+ )
276
+
758
277
  pause
759
278
  goto main_menu
760
279
 
761
280
  :: United Deductible
762
281
  :united_deductible
763
- if "!internet_available!"=="0" (
764
- echo No internet connection available.
765
- goto main_menu
766
- )
767
282
  cls
768
- echo Loading United Deductible...
283
+ echo Starting United Deductible...
769
284
  cd /d "%~dp0.."
770
285
  python -m MediCafe deductible
771
- if errorlevel 1 echo Failed to check United Deductible.
286
+ if errorlevel 1 (
287
+ echo [ERROR] Failed to start United Deductible.
288
+ pause
289
+ )
290
+
772
291
  pause
773
292
  goto main_menu
774
293
 
775
- :: Process CSV Files and Validate Against Config
294
+ :: Process CSV Files
776
295
  :process_csvs
777
-
778
- :: Check if the Python script for JSON updates exists
779
- if not exist "%python_script%" (
780
- echo.
781
- echo Warning: Python script for JSON updates not found at: %python_script%
782
- echo.
783
- echo Would you like to provide an alternate path for the JSON update script?
784
- set /p provide_alt_json="Enter 'Y' to provide alternate path, or any other key to continue: "
785
- if /i "!provide_alt_json!"=="Y" (
786
- echo.
787
- echo Please enter the full path to your update_json.py file.
788
- echo Example: C:\MediBot\scripts\update_json.py
789
- echo Example with spaces: "G:\My Drive\MediBot\scripts\update_json.py"
790
- echo.
791
- echo Note: If your path contains spaces, please include quotes around the entire path.
792
- echo.
793
- set /p alt_json_path="Enter JSON update script path: "
794
- :: Remove any surrounding quotes from user input and re-add them for consistency
795
- set "alt_json_path=!alt_json_path:"=!"
796
- if exist "!alt_json_path!" (
797
- echo JSON update script found at: !alt_json_path!
798
- set "python_script=!alt_json_path!"
799
- ) else (
800
- echo JSON update script not found at: !alt_json_path!
801
- echo Continuing without JSON update script...
802
- )
803
- ) else (
804
- echo Continuing without JSON update script...
805
- )
296
+ if not exist "%source_folder%" (
297
+ echo [ERROR] Source folder not found at: %source_folder%
298
+ pause
299
+ goto main_menu
806
300
  )
807
301
 
808
- :: Move CSV files from local_storage_path to source_folder in case AK sends it unencrypted by accident.
809
- echo Checking for new CSV files in local storage...
810
- for %%f in ("%local_storage_path%\*.csv") do (
811
- echo WARNING: Found CSV files!
812
- echo Moving %%f to %source_folder%...
813
- move "%%f" "%source_folder%" >nul 2>&1
302
+ if not exist "%target_folder%" (
303
+ mkdir "%target_folder%" 2>nul
814
304
  if errorlevel 1 (
815
- echo Failed to move %%f. Check permissions or path.
816
- ) else (
817
- echo Moved %%f successfully.
305
+ echo [ERROR] Failed to create target folder
306
+ pause
307
+ goto main_menu
818
308
  )
819
309
  )
820
310
 
821
- :: Retrieve the current time and date to create a timestamp
822
- for /f "tokens=1-5 delims=/: " %%a in ('echo %time%') do (
823
- set "hour=%%a"
824
- set "minute=%%b"
825
- set "second=%%c"
826
- )
827
- for /f "tokens=2-4 delims=/ " %%a in ('echo %date%') do (
828
- set "day=%%a"
829
- set "month=%%b"
830
- set "year=%%c"
831
- )
832
- set "timestamp=!year!!month!!day!_!hour!!minute!"
833
-
834
- :: Search for the most recent CSV file in source folder
835
- set "latest_csv="
836
- for /f "delims=" %%a in ('dir /b /a-d /o-d "%source_folder%\*.csv" 2^>nul') do (
837
- set "latest_csv=%%a"
838
- echo Found New CSV Files...
839
- goto process_found_csv
840
- )
841
- goto :eof
842
-
843
- :process_found_csv
844
- echo Validating latest CSV with config file...
845
- :: Run Python script to get current CSV path from JSON
846
- for /f "delims=" %%a in ('python "%python_script%" "%config_file%"') do (
847
- set "current_csv=%%a"
848
- )
849
-
850
- :: Extract filenames from paths
851
- for %%f in ("!current_csv!") do set "current_csv_name=%%~nxf"
852
- for %%f in ("%target_folder%\!latest_csv!") do set "latest_csv_name=%%~nxf"
853
-
854
- :: Compare the paths and prompt user if necessary
855
- if not "!current_csv_name!"=="!latest_csv_name!" (
856
- echo.
857
- echo ALERT: Config file CSV path differs from the latest CSV. This can happen if a new CSV is downloaded.
858
- echo Current CSV: !current_csv_name!
859
- echo Latest CSV: !latest_csv_name!
860
- echo.
861
- set /p update_choice="Do you want to update to the latest CSV? (Y/N): "
862
- if /i "!update_choice!"=="Y" (
863
- echo Updating config file with latest CSV...
864
- py "%python_script%" "%config_file%" "%target_folder%\!latest_csv!"
865
- echo Config file updated.
866
- ) else (
867
- echo Using existing CSV path from config.
868
- )
869
- ) else (
870
- echo CSV path in config matches the latest CSV.
871
- )
872
-
873
- move "%source_folder%\!latest_csv!" "%target_folder%\SX_CSV_!timestamp!.csv"
874
- set "new_csv_path=%target_folder%\SX_CSV_!timestamp!.csv"
875
- echo Processing CSV...
876
- py "%python_script%" "%config_file%" "!new_csv_path!"
877
- echo CSV Processor Complete...
878
- goto :eof
879
-
880
- :: Clear Python Cache
881
- :clear_cache
882
- cls
883
- echo Clearing Python cache for MediCafe...
884
- echo.
885
- cd /d "%~dp0.."
886
-
887
- :: Check if update_medicafe.py exists using priority system (local first)
888
- if exist "%upgrade_medicafe_local%" (
889
- echo Found update_medicafe.py in local location - using relative path
890
- echo [DIAGNOSTIC] Cache clearing with local script:
891
- echo [DIAGNOSTIC] Command: python "%upgrade_medicafe_local%" --clear-cache
892
- python "%upgrade_medicafe_local%" --clear-cache
893
- if %errorlevel% neq 0 (
894
- echo [ERROR] Cache clearing failed with local script, error code: %errorlevel%
895
- echo [DIAGNOSTIC] Possible causes:
896
- echo - Python not in PATH
897
- echo - Script syntax error
898
- echo - Missing dependencies
899
- )
900
- ) else if exist "%upgrade_medicafe_legacy%" (
901
- echo Found update_medicafe.py in legacy location - using F: drive path
902
- echo [DIAGNOSTIC] Cache clearing with F: drive script:
903
- echo [DIAGNOSTIC] Command: python "%upgrade_medicafe_legacy%" --clear-cache
904
- echo [DIAGNOSTIC] Testing F: drive access before execution:
905
- dir "F:\Medibot" >nul 2>&1 && echo [OK] F: drive accessible || echo [ERROR] F: drive access issue
906
- python "%upgrade_medicafe_legacy%" --clear-cache
907
- if %errorlevel% neq 0 (
908
- echo [ERROR] Cache clearing failed with F: drive script, error code: %errorlevel%
909
- echo [DIAGNOSTIC] Possible causes:
910
- echo - F: drive disconnected during execution
911
- echo - Permission denied accessing F: drive file
912
- echo - F: drive file locked
913
- echo - Python cannot access network paths
914
- )
915
- ) else (
916
- echo ERROR: update_medicafe.py not found in either location
917
- echo Expected locations:
918
- echo - Local: %upgrade_medicafe_local%
919
- echo - Legacy: %upgrade_medicafe_legacy%
920
- pause
921
- goto main_menu
922
- )
923
-
311
+ copy "%source_folder%\*.csv" "%target_folder%\" >nul 2>&1
924
312
  if errorlevel 1 (
925
- echo Cache clearing failed.
313
+ echo [ERROR] Failed to copy CSV files
926
314
  pause
315
+ goto main_menu
927
316
  ) else (
928
- echo Cache clearing completed successfully.
929
- pause
317
+ echo [SUCCESS] Successfully copied CSV files
930
318
  )
319
+
320
+ pause
931
321
  goto main_menu
932
322
 
933
- :: Exit Script
934
- :end_script
935
- echo Exiting MediCafe.
323
+ :: Clear Cache
324
+ :clear_cache
325
+ echo Clearing Python cache...
326
+ python -Bc "import compileall; compileall.compile_dir('.', force=True)" 2>nul
327
+ for /d /r . %%d in (__pycache__) do @if exist "%%d" rd /s /q "%%d" 2>nul
328
+ echo [SUCCESS] Cache cleared successfully
329
+
936
330
  pause
937
- exit /b
331
+ goto main_menu
938
332
 
939
333
  :: Open Latest Log
940
334
  :open_latest_log
941
- echo Opening the latest log file...
942
- set "latest_log="
943
-
944
- :: Attempt to find any files in the directory
945
- echo Attempting to locate files in %local_storage_path%...
946
-
947
- :: Method 1: Check for any files
948
- echo Attempt #1: Checking for any files...
949
- dir "%local_storage_path%\*" >nul 2>&1
950
- if %errorlevel% == 0 (
951
- echo Files found in %local_storage_path%.
952
- ) else (
953
- echo No files found in %local_storage_path%.
954
- pause
335
+ for /f "delims=" %%i in ('dir /b /o-d *.log 2^>nul') do (
336
+ start notepad "%%i"
955
337
  goto main_menu
956
338
  )
339
+ echo [WARNING] No log files found
340
+ pause
341
+ goto main_menu
957
342
 
958
- :: Method 2: Check for .log files specifically
959
- echo Attempt #2: Checking for .log files...
960
- dir "%local_storage_path%\*.log" >nul 2>&1
961
- if %errorlevel% == 0 (
962
- echo .log files found in %local_storage_path%.
343
+ :: End Script
344
+ :end_script
345
+ echo Exiting MediBot
346
+ exit /b 0
347
+
348
+ :: Full Debug Mode - Automated checks with no user interaction
349
+ :full_debug_mode
350
+ echo [DEBUG] ========================================
351
+ echo [DEBUG] FULL DEBUG MODE - AUTOMATED CHECKS
352
+ echo [DEBUG] ========================================
353
+ echo [DEBUG] Running all diagnostic checks automatically...
354
+ echo [DEBUG] No user interaction required - results will be displayed.
355
+ echo.
356
+
357
+ :: Step 1: F: Drive Diagnostic (automated)
358
+ echo [DEBUG] Step 1: F: Drive Diagnostic
359
+ echo [DEBUG] ========================================
360
+ call "f_drive_diagnostic.bat" >nul 2>&1
361
+ if errorlevel 1 (
362
+ echo [DEBUG] F: Drive Diagnostic completed with issues
963
363
  ) else (
964
- echo No .log files found in %local_storage_path%.
364
+ echo [DEBUG] F: Drive Diagnostic completed successfully
965
365
  )
366
+ echo.
966
367
 
967
- :: Method 3: Check for .txt files as a fallback
968
- echo Attempt #3: Checking for .txt files...
969
- dir "%local_storage_path%\*.txt" >nul 2>&1
970
- if %errorlevel% == 0 (
971
- echo .txt files found in %local_storage_path%. This indicates that files are present.
368
+ :: Step 2: Crash Diagnostic (automated)
369
+ echo [DEBUG] Step 2: Crash Diagnostic
370
+ echo [DEBUG] ========================================
371
+ call "crash_diagnostic.bat" >nul 2>&1
372
+ if errorlevel 1 (
373
+ echo [DEBUG] Crash Diagnostic completed with issues
972
374
  ) else (
973
- echo No .txt files found in %local_storage_path%.
375
+ echo [DEBUG] Crash Diagnostic completed successfully
974
376
  )
377
+ echo.
975
378
 
976
- :: Method 4: List all files with detailed output
977
- echo Attempt #4: Listing all files in %local_storage_path%...
978
- dir "%local_storage_path%"
979
- pause
980
-
981
- :: Now attempt to find the latest .log file
982
- echo Attempting to find the latest .log file...
983
- set "latest_log="
984
- for /f "delims=" %%a in ('dir /b /a-d /o-d "%local_storage_path%\*.log" 2^>nul') do (
985
- set "latest_log=%%a"
986
- goto open_log_found
379
+ :: Step 3: Basic Debug (automated)
380
+ echo [DEBUG] Step 3: Basic Debug
381
+ echo [DEBUG] ========================================
382
+ call "MediBot_debug.bat" >nul 2>&1
383
+ if errorlevel 1 (
384
+ echo [DEBUG] Basic Debug completed with issues
385
+ ) else (
386
+ echo [DEBUG] Basic Debug completed successfully
987
387
  )
388
+ echo.
988
389
 
989
- echo No log files found in %local_storage_path%. Please ensure that log files are present.
990
- pause
991
- goto main_menu
992
-
993
- :open_log_found
994
- echo Found log file: %latest_log%
995
- pause
996
-
997
- :: Method 1: Attempt to open with Notepad
998
- echo Attempt #1: Opening with Notepad...
999
- notepad "%local_storage_path%\%latest_log%"
1000
- if %errorlevel% == 0 (
1001
- echo Successfully opened the log file with Notepad.
1002
- pause
1003
- goto main_menu
390
+ :: Step 4: Fixed Version Test (automated)
391
+ echo [DEBUG] Step 4: Fixed Version Test
392
+ echo [DEBUG] ========================================
393
+ call "MediBot_fixed.bat" >nul 2>&1
394
+ if errorlevel 1 (
395
+ echo [DEBUG] Fixed Version Test completed with issues
1004
396
  ) else (
1005
- echo Attempt #1 Failed: Could not open with Notepad.
1006
- pause
397
+ echo [DEBUG] Fixed Version Test completed successfully
1007
398
  )
399
+ echo.
1008
400
 
1009
- :: Method 2: Attempt to open with WordPad
1010
- echo Attempt #2: Opening with WordPad...
1011
- write "%local_storage_path%\%latest_log%"
1012
- if %errorlevel% == 0 (
1013
- echo Successfully opened the log file with WordPad.
1014
- pause
1015
- goto main_menu
401
+ :: Step 5: Additional automated checks
402
+ echo [DEBUG] Step 5: Additional System Checks
403
+ echo [DEBUG] ========================================
404
+
405
+ :: Check Python installation
406
+ echo [DEBUG] Checking Python installation...
407
+ python --version >nul 2>&1
408
+ if errorlevel 1 (
409
+ echo [ERROR] Python not found in PATH
1016
410
  ) else (
1017
- echo Attempt #2 Failed: Could not open with WordPad.
1018
- pause
411
+ echo [OK] Python found and accessible
1019
412
  )
1020
413
 
1021
- :: Method 3: Display contents using the TYPE command
1022
- echo Attempt #3: Displaying log file contents with TYPE command...
1023
- type "%local_storage_path%\%latest_log%"
1024
- if %errorlevel% == 0 (
1025
- echo Successfully displayed the log file contents.
1026
- pause
1027
- goto main_menu
414
+ :: Check MediCafe package
415
+ echo [DEBUG] Checking MediCafe package...
416
+ python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" >nul 2>&1
417
+ if errorlevel 1 (
418
+ echo [ERROR] MediCafe package not found
1028
419
  ) else (
1029
- echo Attempt #3 Failed: Could not display contents with TYPE.
1030
- pause
420
+ echo [OK] MediCafe package found
1031
421
  )
1032
422
 
1033
- :: Method 4: Display the last 30 lines of the log file
1034
- echo Attempt #4: Displaying the last 30 lines of the log file...
1035
- call :tail "%local_storage_path%\%latest_log%" 30
1036
- if %errorlevel% == 0 (
1037
- echo Successfully displayed the last 30 lines of the log file.
423
+ :: Check internet connectivity
424
+ echo [DEBUG] Checking internet connectivity...
425
+ ping -n 1 google.com >nul 2>&1
426
+ if errorlevel 1 (
427
+ echo [ERROR] No internet connection
1038
428
  ) else (
1039
- echo Attempt #4 Failed: Could not display the last 30 lines.
429
+ echo [OK] Internet connection available
1040
430
  )
1041
- pause
1042
- goto main_menu
1043
431
 
1044
- :: Subroutine to display the last N lines of a file
1045
- :tail
1046
- :: Usage: call :tail filename number_of_lines
1047
- setlocal enabledelayedexpansion
1048
- set "file=%~1"
1049
- set /a lines=%~2
1050
- set "count=0"
1051
- set "output="
1052
-
1053
- for /f "usebackq delims=" %%x in ("%file%") do (
1054
- set /a count+=1
1055
- set "line[!count!]=%%x"
432
+ :: Check local update script
433
+ echo [DEBUG] Checking local update script...
434
+ if exist "MediBot\update_medicafe.py" (
435
+ echo [OK] Local update script found
436
+ ) else (
437
+ echo [ERROR] Local update script not found
1056
438
  )
1057
439
 
1058
- if %count% LSS %lines% (
1059
- set "start=1"
440
+ :: Check F: drive accessibility
441
+ echo [DEBUG] Checking F: drive accessibility...
442
+ if exist "F:\" (
443
+ echo [OK] F: drive accessible
444
+ if exist "F:\Medibot\update_medicafe.py" (
445
+ echo [OK] F: drive update script found
446
+ ) else (
447
+ echo [WARNING] F: drive update script not found
448
+ )
1060
449
  ) else (
1061
- set /a start=%count% - %lines% + 1
450
+ echo [ERROR] F: drive not accessible
1062
451
  )
1063
452
 
1064
- for /l %%i in (%start%,1,%count%) do (
1065
- echo !line[%%i]!
1066
- )
453
+ echo.
454
+ echo [DEBUG] ========================================
455
+ echo [DEBUG] ALL AUTOMATED CHECKS COMPLETED
456
+ echo [DEBUG] ========================================
457
+ echo [DEBUG] Review the output above for any issues.
458
+ echo [DEBUG] The system will continue to normal mode.
459
+ echo.
460
+ echo [DEBUG] Press Enter to continue to normal mode...
461
+ pause >nul
1067
462
 
1068
- endlocal
1069
- goto :eof
463
+ :: Continue to normal mode after debug
464
+ goto normal_mode