medicafe 0.250806.12__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,332 +1,177 @@
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
- :: Define paths
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
+
42
+ :: Define paths with local fallbacks for F: drive dependencies
6
43
  set "source_folder=C:\MEDIANSI\MediCare"
7
- set "local_storage_path=F:\Medibot\DOWNLOADS"
8
44
  set "target_folder=C:\MEDIANSI\MediCare\CSV"
9
- set "config_file=F:\Medibot\json\config.json"
10
45
  set "python_script=C:\Python34\Lib\site-packages\MediBot\update_json.py"
11
46
  set "python_script2=C:\Python34\Lib\site-packages\MediBot\Medibot.py"
12
47
  set "medicafe_package=medicafe"
13
- set upgrade_medicafe=F:\Medibot\update_medicafe.py
14
- set "temp_file=F:\Medibot\last_update_timestamp.txt"
48
+
49
+ :: Priority order: 1) Local relative path, 2) F: drive path (legacy)
50
+ set "upgrade_medicafe_local=MediBot\update_medicafe.py"
51
+ set "upgrade_medicafe_legacy=F:\Medibot\update_medicafe.py"
52
+
53
+ :: Storage and config paths with local fallbacks
54
+ set "local_storage_legacy=F:\Medibot\DOWNLOADS"
55
+ set "local_storage_local=MediBot\DOWNLOADS"
56
+ set "config_file_legacy=F:\Medibot\json\config.json"
57
+ set "config_file_local=MediBot\json\config.json"
58
+ set "temp_file_legacy=F:\Medibot\last_update_timestamp.txt"
59
+ set "temp_file_local=MediBot\last_update_timestamp.txt"
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
+
69
+ :: Determine which paths to use based on availability
70
+ if exist "F:\Medibot" (
71
+ set "local_storage_path=%local_storage_legacy%"
72
+ set "config_file=%config_file_legacy%"
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
+ )
81
+ ) else (
82
+ set "local_storage_path=%local_storage_local%"
83
+ set "config_file=%config_file_local%"
84
+ set "temp_file=%temp_file_local%"
85
+ :: Ensure local directories exist
86
+ if not exist "MediBot\json" mkdir "MediBot\json" 2>nul
87
+ if not exist "MediBot\DOWNLOADS" mkdir "MediBot\DOWNLOADS" 2>nul
88
+ )
89
+
15
90
  set "firefox_path=C:\Program Files\Mozilla Firefox\firefox.exe"
16
91
  set "claims_status_script=..\MediLink\MediLink_ClaimStatus.py"
17
92
  set "deductible_script=..\MediLink\MediLink_Deductible.py"
18
93
  set "package_version="
19
94
  set PYTHONWARNINGS=ignore
20
95
 
21
- :: Check if Python is installed and the path is correctly set
96
+ :: Check if Python is installed
22
97
  python --version >nul 2>&1
23
98
  if %errorlevel% neq 0 (
24
- echo Python is not installed or not added to PATH.
25
- 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
26
103
  )
27
104
 
28
105
  :: Check if critical directories exist
29
106
  if not exist "%source_folder%" (
30
- echo.
31
- echo Warning: Source folder not found at: %source_folder%
32
- echo.
33
- echo Would you like to provide an alternate path for the source folder?
107
+ echo [WARNING] Source folder not found at: %source_folder%
34
108
  set /p provide_alt_source="Enter 'Y' to provide alternate path, or any other key to continue: "
35
109
  if /i "!provide_alt_source!"=="Y" (
36
- echo.
37
- echo Please enter the full path to your source folder.
38
- echo Example: C:\MediCare\Data
39
- echo Example with spaces: "G:\My Drive\MediCare\Data"
40
- echo.
41
- echo Note: If your path contains spaces, please include quotes around the entire path.
42
- echo.
43
- set /p alt_source_path="Enter source folder path: "
44
- :: Remove any surrounding quotes from user input and re-add them for consistency
45
- set "alt_source_path=!alt_source_path:"=!"
46
- if exist "!alt_source_path!" (
47
- echo Source folder found at: !alt_source_path!
48
- set "source_folder=!alt_source_path!"
49
- ) else (
50
- echo Source folder not found at: !alt_source_path!
51
- echo Continuing with default path...
52
- )
53
- ) else (
54
- echo Continuing with default path...
55
- )
56
- )
57
-
58
- if not exist "%local_storage_path%" (
59
- echo.
60
- echo Warning: Local storage path not found at: %local_storage_path%
61
- echo.
62
- echo Would you like to provide an alternate path for the local storage?
63
- set /p provide_alt_storage="Enter 'Y' to provide alternate path, or any other key to continue: "
64
- if /i "!provide_alt_storage!"=="Y" (
65
- echo.
66
- echo Please enter the full path to your local storage folder.
67
- echo Example: C:\MediBot\Downloads
68
- echo Example with spaces: "G:\My Drive\MediBot\Downloads"
69
- echo.
70
- echo Note: If your path contains spaces, please include quotes around the entire path.
71
- echo.
72
- set /p alt_storage_path="Enter local storage path: "
73
- :: Remove any surrounding quotes from user input and re-add them for consistency
74
- set "alt_storage_path=!alt_storage_path:"=!"
75
- if exist "!alt_storage_path!" (
76
- echo Local storage folder found at: !alt_storage_path!
77
- set "local_storage_path=!alt_storage_path!"
78
- ) else (
79
- echo Local storage folder not found at: !alt_storage_path!
80
- echo Continuing with default path...
81
- )
82
- ) else (
83
- 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!"
84
112
  )
85
113
  )
86
114
 
87
115
  if not exist "%target_folder%" (
88
- echo.
89
- echo Warning: Target folder not found at: %target_folder%
90
- echo.
91
- echo Would you like to provide an alternate path for the target folder?
92
- set /p provide_alt_target="Enter 'Y' to provide alternate path, or any other key to continue: "
93
- if /i "!provide_alt_target!"=="Y" (
94
- echo.
95
- echo Please enter the full path to your target folder.
96
- echo Example: C:\MediCare\CSV
97
- echo Example with spaces: "G:\My Drive\MediCare\CSV"
98
- echo.
99
- echo Note: If your path contains spaces, please include quotes around the entire path.
100
- echo.
101
- set /p alt_target_path="Enter target folder path: "
102
- :: Remove any surrounding quotes from user input and re-add them for consistency
103
- set "alt_target_path=!alt_target_path:"=!"
104
- if exist "!alt_target_path!" (
105
- echo Target folder found at: !alt_target_path!
106
- set "target_folder=!alt_target_path!"
107
- ) else (
108
- echo Target folder not found at: !alt_target_path!
109
- echo Continuing with default path...
110
- )
111
- ) else (
112
- echo Continuing with default path...
113
- )
114
- )
115
-
116
- :: Check if the MediCafe package is installed and retrieve its version
117
- echo Checking for installed MediCafe package version...
118
- python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" > temp.txt 2>nul
119
- set /p package_version=<temp.txt
120
- del temp.txt
121
-
122
- if not defined package_version (
123
- echo MediCafe package version not detected or MediCafe not installed. Consider manual re-install.
124
- exit /b
116
+ mkdir "%target_folder%" 2>nul
125
117
  )
126
118
 
127
- :: Extract version number and display it
128
- for /f "tokens=2 delims==" %%a in ("%package_version%") do (
129
- set "medicafe_version=%%a"
130
- )
131
-
132
- if not defined medicafe_version (
133
- 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
+ )
134
130
  ) else (
135
- echo Detected MediCafe version: %medicafe_version%
136
- 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"
137
132
  )
138
133
 
139
134
  :: Check for internet connectivity
140
- ping -n 1 google.com > nul 2>&1
141
- if %ERRORLEVEL% neq 0 (
135
+ ping -n 1 google.com >nul 2>&1
136
+ if errorlevel 1 (
142
137
  set "internet_available=0"
143
- echo No internet connection detected.
144
138
  ) else (
145
139
  set "internet_available=1"
146
- echo Internet connection detected.
147
- )
148
-
149
- :: Common pre-menu setup
150
- echo Setting up the environment...
151
- if not exist "%config_file%" (
152
- echo Configuration file missing.
153
- echo.
154
- echo Expected configuration file path: %config_file%
155
- echo.
156
- echo Would you like to provide an alternate path for the configuration file?
157
- set /p provide_alt="Enter 'Y' to provide alternate path, or any other key to exit: "
158
- if /i "!provide_alt!"=="Y" (
159
- echo.
160
- echo Please enter the full path to your configuration file.
161
- echo Example: C:\MediBot\config\config.json
162
- echo Example with spaces: "G:\My Drive\MediBot\config\config.json"
163
- echo.
164
- echo Note: If your path contains spaces, please include quotes around the entire path.
165
- echo.
166
- set /p alt_config_path="Enter configuration file path: "
167
- :: Remove any surrounding quotes from user input and re-add them for consistency
168
- set "alt_config_path=!alt_config_path:"=!"
169
- if exist "!alt_config_path!" (
170
- echo Configuration file found at: !alt_config_path!
171
- set "config_file=!alt_config_path!"
172
- goto config_check_complete
173
- ) else (
174
- echo Configuration file not found at: !alt_config_path!
175
- echo.
176
- set /p retry="Would you like to try another path? (Y/N): "
177
- if /i "!retry!"=="Y" (
178
- goto retry_config_path
179
- ) else (
180
- goto end_script
181
- )
182
- )
183
- ) else (
184
- goto end_script
185
- )
186
- ) else (
187
- goto config_check_complete
188
- )
189
-
190
- :retry_config_path
191
- echo.
192
- echo Please enter the full path to your configuration file.
193
- echo Example: C:\MediBot\config\config.json
194
- echo Example with spaces: "G:\My Drive\MediBot\config\config.json"
195
- echo.
196
- echo Note: If your path contains spaces, please include quotes around the entire path.
197
- echo.
198
- set /p alt_config_path="Enter configuration file path: "
199
- :: Remove any surrounding quotes from user input and re-add them for consistency
200
- set "alt_config_path=!alt_config_path:"=!"
201
- if exist "!alt_config_path!" (
202
- echo Configuration file found at: !alt_config_path!
203
- set "config_file=!alt_config_path!"
204
- ) else (
205
- echo Configuration file not found at: !alt_config_path!
206
- echo.
207
- set /p retry="Would you like to try another path? (Y/N): "
208
- if /i "!retry!"=="Y" (
209
- goto retry_config_path
210
- ) else (
211
- goto end_script
212
- )
213
- )
214
-
215
- :config_check_complete
216
-
217
- :: Check if the file exists and attempt to move it
218
- :: Implementing a check with copy as a fallback if move fails
219
- echo Checking for the update script...
220
- ping -n 2 127.0.0.1 >nul
221
- if exist "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" (
222
- echo Found update_medicafe.py. Attempting to move...
223
- ping -n 2 127.0.0.1 >nul
224
- move "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" "F:\Medibot\update_medicafe.py" >nul 2>&1
225
- if %errorlevel% neq 0 (
226
- echo Move failed. Attempting copy and delete as fallback...
227
- ping -n 2 127.0.0.1 >nul
228
- copy "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" "F:\Medibot\update_medicafe.py" >nul 2>&1
229
- if %errorlevel% neq 0 (
230
- echo Copy failed. Error Level: %errorlevel%
231
- ping -n 2 127.0.0.1 >nul
232
- ) else (
233
- del "C:\Python34\Lib\site-packages\MediBot\update_medicafe.py" >nul 2>&1
234
- if %errorlevel% neq 0 (
235
- echo Delete failed. Manual cleanup may be required.
236
- ping -n 2 127.0.0.1 >nul
237
- ) else (
238
- echo File copied and original deleted successfully.
239
- ping -n 2 127.0.0.1 >nul
240
- )
241
- )
242
- ) else (
243
- echo File moved successfully.
244
- ping -n 2 127.0.0.1 >nul
245
- )
246
- ) else (
247
- echo update_medicafe.py not detected. Checking for existing update_medicafe.py in F:\Medibot...
248
- ping -n 2 127.0.0.1 >nul
249
- if exist "F:\Medibot\update_medicafe.py" (
250
- echo update_medicafe.py already exists in F:\Medibot. No action needed.
251
- ping -n 2 127.0.0.1 >nul
252
- ) else (
253
- echo update_medicafe.py not detected in either location. Check path and filename.
254
- echo.
255
- echo Expected update script path: F:\Medibot\update_medicafe.py
256
- echo.
257
- echo Would you like to provide an alternate path for the update script?
258
- set /p provide_alt_update="Enter 'Y' to provide alternate path, or any other key to continue: "
259
- if /i "!provide_alt_update!"=="Y" (
260
- echo.
261
- echo Please enter the full path to your update_medicafe.py file.
262
- echo Example: C:\MediBot\scripts\update_medicafe.py
263
- echo Example with spaces: "G:\My Drive\MediBot\scripts\update_medicafe.py"
264
- echo.
265
- echo Note: If your path contains spaces, please include quotes around the entire path.
266
- echo.
267
- set /p alt_update_path="Enter update script path: "
268
- :: Remove any surrounding quotes from user input and re-add them for consistency
269
- set "alt_update_path=!alt_update_path:"=!"
270
- if exist "!alt_update_path!" (
271
- echo Update script found at: !alt_update_path!
272
- set upgrade_medicafe=!alt_update_path!
273
- ) else (
274
- echo Update script not found at: !alt_update_path!
275
- echo Continuing without update script...
276
- ping -n 2 127.0.0.1 >nul
277
- )
278
- ) else (
279
- echo Continuing without update script...
280
- ping -n 2 127.0.0.1 >nul
281
- )
282
- )
283
140
  )
284
141
 
285
142
  :: Main menu
286
143
  :main_menu
287
144
  cls
288
- echo Version: %medicafe_version%
289
- echo --------------------------------------------------------------
290
- echo .//* Welcome to MediCafe *\\.
291
- echo --------------------------------------------------------------
292
- echo.
293
-
294
- echo Please select an option:
295
145
  echo.
296
- if "!internet_available!"=="1" (
297
- echo 1. Update MediCafe
298
- echo.
299
- echo 2. Download Email de Carol
300
- echo.
301
- echo 3. MediLink Claims
302
- echo.
303
- echo 4. ^[United^] Claims Status
304
- echo.
305
- echo 5. ^[United^] Deductible
306
- echo.
307
- )
308
- echo 6. Run MediBot
309
- echo.
310
- echo 7. Troubleshooting: Open Log File
311
- echo.
312
- echo 8. Troubleshooting: Clear Python Cache
146
+ echo ========================================
147
+ echo MediBot Main Menu
148
+ echo ========================================
313
149
  echo.
314
- 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
315
160
  echo.
316
- set /p choice=Enter your choice:
317
161
 
318
- :: Update option numbers
319
- if "!choice!"=="9" goto end_script
320
- if "!choice!"=="8" goto clear_cache
321
- if "!choice!"=="7" goto open_latest_log
322
- if "!choice!"=="6" goto medibot_flow
323
- if "!choice!"=="5" goto united_deductible
324
- if "!choice!"=="4" goto united_claims_status
325
- if "!choice!"=="3" goto medilink_flow
326
- if "!choice!"=="2" goto download_emails
162
+ set /p choice="Enter your choice (0-9): "
163
+
327
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
328
174
 
329
- :: Invalid choice - return to menu
330
175
  echo Invalid choice. Please try again.
331
176
  pause
332
177
  goto main_menu
@@ -334,559 +179,286 @@ goto main_menu
334
179
  :: Medicafe Update
335
180
  :check_updates
336
181
  if "!internet_available!"=="0" (
337
- echo No internet connection available.
182
+ echo [WARNING] No internet connection available.
338
183
  goto main_menu
339
184
  )
340
185
 
341
186
  echo ========================================
342
- echo DEBUG: Starting MediCafe Update Process
343
- echo ========================================
344
- echo.
345
- echo Current working directory: %CD%
346
- echo Package version: %package_version%
347
- echo Update script path: %upgrade_medicafe%
348
- echo.
349
- echo Press Enter to continue to step 1...
350
- pause >nul
351
-
352
- :: Step 1: Check if update_medicafe.py exists in expected location
353
- echo.
354
- echo ========================================
355
- echo DEBUG STEP 1: Checking for update script
356
- echo ========================================
357
- echo.
358
- echo Checking if update script exists at: %upgrade_medicafe%
359
- if exist "%upgrade_medicafe%" (
360
- echo [SUCCESS] Found update script at: %upgrade_medicafe%
361
- echo File size:
362
- dir "%upgrade_medicafe%" | find "update_medicafe.py"
363
- ) else (
364
- echo [FAILED] Update script not found at: %upgrade_medicafe%
365
- echo.
366
- echo Checking alternative location: MediBot\update_medicafe.py
367
- if exist "MediBot\update_medicafe.py" (
368
- echo [SUCCESS] Found update script at: MediBot\update_medicafe.py
369
- echo File size:
370
- dir "MediBot\update_medicafe.py" | find "update_medicafe.py"
371
- ) else (
372
- echo [FAILED] Update script not found at: MediBot\update_medicafe.py
373
- echo.
374
- echo Available files in current directory:
375
- dir /b
376
- echo.
377
- echo Available files in MediBot directory:
378
- dir /b MediBot\ 2>nul || echo MediBot directory not found
379
- )
380
- )
381
- echo.
382
- echo Press Enter to continue to step 2...
383
- pause >nul
384
-
385
- :: Step 2: Verify Python installation and path
386
- echo.
387
- echo ========================================
388
- echo DEBUG STEP 2: Python Environment Check
389
- echo ========================================
390
- echo.
391
- echo Checking Python installation...
392
- python --version
393
- if %errorlevel% neq 0 (
394
- echo [ERROR] Python not found in PATH
395
- echo Current PATH: %PATH%
396
- ) else (
397
- echo [SUCCESS] Python found
398
- echo Python executable: %PYTHONPATH%
399
- echo Python version:
400
- python --version
401
- )
402
- echo.
403
- echo Checking pip installation...
404
- python -m pip --version
405
- if %errorlevel% neq 0 (
406
- echo [ERROR] pip not found
407
- ) else (
408
- echo [SUCCESS] pip found
409
- echo pip version:
410
- python -m pip --version
411
- )
412
- echo.
413
- echo Press Enter to continue to step 3...
414
- pause >nul
415
-
416
- :: Step 3: Check MediCafe package installation
417
- echo.
418
- echo ========================================
419
- echo DEBUG STEP 3: MediCafe Package Check
187
+ echo Starting MediCafe Update Process
420
188
  echo ========================================
421
189
  echo.
422
- echo Checking MediCafe package installation...
423
- python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2>nul
424
- if %errorlevel% neq 0 (
425
- echo [ERROR] MediCafe package not found or error accessing
426
- echo.
427
- echo Checking if MediCafe is importable...
428
- python -c "import MediCafe; print('MediCafe module found')" 2>nul
429
- if %errorlevel% neq 0 (
430
- echo [ERROR] MediCafe module not importable
431
- ) else (
432
- echo [SUCCESS] MediCafe module is importable
433
- )
434
- ) else (
435
- echo [SUCCESS] MediCafe package found
436
- echo Package version: %package_version%
437
- )
438
- echo.
439
- echo Press Enter to continue to step 4...
440
- pause >nul
441
190
 
442
- :: Step 4: Check internet connectivity
443
- echo.
444
- echo ========================================
445
- echo DEBUG STEP 4: Internet Connectivity
446
- echo ========================================
447
- echo.
448
- echo Testing internet connectivity...
449
- ping -n 1 google.com >nul 2>&1
450
- if %errorlevel% neq 0 (
451
- echo [ERROR] No internet connection detected
452
- echo Cannot proceed with update without internet
453
- echo.
454
- echo Press Enter to return to main menu...
455
- 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
456
196
  goto main_menu
457
- ) else (
458
- echo [SUCCESS] Internet connection detected
459
- echo Testing PyPI connectivity...
460
- python -c "import requests; print('PyPI accessible:', requests.get('https://pypi.org/pypi/medicafe/json', timeout=5).status_code)" 2>nul
461
- if %errorlevel% neq 0 (
462
- echo [WARNING] PyPI connectivity test failed
463
- ) else (
464
- echo [SUCCESS] PyPI connectivity confirmed
465
- )
466
197
  )
467
- echo.
468
- echo Press Enter to continue to step 5...
469
- pause >nul
470
198
 
471
- :: Step 5: Attempt update with detailed logging
472
- echo.
473
- echo ========================================
474
- echo DEBUG STEP 5: Starting Update Process
475
- echo ========================================
476
- echo.
477
199
  echo Starting update process...
200
+ echo Update script: %upgrade_medicafe%
478
201
  echo.
479
202
 
480
- :: Check if update_medicafe.py exists in the expected location, with fallback
481
- if exist "%upgrade_medicafe%" (
482
- echo [INFO] Using update script at: %upgrade_medicafe%
483
- echo Command: python "%upgrade_medicafe%" %package_version%
484
- echo.
485
- echo Press Enter to execute update command...
486
- pause >nul
487
- echo.
488
- echo Executing update command...
489
- start "Medicafe Update" cmd /c "python \"%upgrade_medicafe%\" %package_version% & echo. & echo Update process completed. Press any key to close... & pause >nul" && (
490
- echo %DATE% %TIME% Upgrade initiated successfully. >> "%temp_file%"
491
- echo [SUCCESS] Update process started successfully
492
- echo All output will be displayed in the update window.
493
- ) || (
494
- echo %DATE% %TIME% Update failed. >> "%temp_file%"
495
- echo [ERROR] Upgrade failed. Check the update window for details.
496
- )
497
- ) else if exist "MediBot\update_medicafe.py" (
498
- echo [INFO] Using update script at: MediBot\update_medicafe.py
499
- echo Command: python "MediBot\update_medicafe.py" %package_version%
500
- echo.
501
- echo Press Enter to execute update command...
502
- pause >nul
503
- echo.
504
- echo Executing update command...
505
- echo.
506
- echo The update window will open and show detailed progress.
507
- echo All output will be displayed on screen.
508
- echo.
509
- start "Medicafe Update" cmd /c "python \"MediBot\update_medicafe.py\" %package_version% & echo. & echo Update process completed. Press any key to close... & pause >nul" && (
510
- echo %DATE% %TIME% Upgrade initiated successfully. >> "%temp_file%"
511
- echo [SUCCESS] Update process started successfully
512
- echo All output will be displayed in the update window.
513
- ) || (
514
- echo %DATE% %TIME% Update failed. >> "%temp_file%"
515
- echo [ERROR] Upgrade failed. Check the update window for details.
516
- )
517
- ) else (
518
- echo [ERROR] update_medicafe.py not found in either location
519
- echo Expected locations:
520
- echo - %upgrade_medicafe%
521
- echo - MediBot\update_medicafe.py
522
- echo.
523
- echo Current directory contents:
524
- dir /b
525
- echo.
526
- echo MediBot directory contents:
527
- dir /b MediBot\ 2>nul || echo MediBot directory not found
528
- echo.
529
- echo %DATE% %TIME% Update failed - script not found. >> "%temp_file%"
530
- echo.
531
- echo Press Enter to return to main menu...
532
- pause >nul
533
- 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.
534
209
  )
535
210
 
536
- echo.
537
- echo ========================================
538
- echo DEBUG: Update Process Complete
539
- echo ========================================
540
211
  echo.
541
212
  echo Update process has been initiated.
542
213
  echo All output will be displayed in the update window.
543
214
  echo.
544
- echo Press Enter to return to main menu...
545
- pause >nul
215
+ pause
546
216
  goto main_menu
547
217
 
548
- :: Download Carol's Emails - Using MediCafe entry point
218
+ :: Download Carol's Emails
549
219
  :download_emails
550
220
  if "!internet_available!"=="0" (
551
- echo No internet connection available.
221
+ echo [WARNING] No internet connection available.
552
222
  goto main_menu
553
223
  )
224
+
554
225
  call :process_csvs
555
226
  cls
556
227
  echo Starting email download via MediCafe...
557
228
  cd /d "%~dp0.."
558
229
  python -m MediCafe download_emails
559
230
  if errorlevel 1 (
560
- echo Failed to download emails.
231
+ echo [ERROR] Failed to download emails.
561
232
  pause
562
233
  )
234
+
235
+ pause
563
236
  goto main_menu
564
237
 
565
- :: Run MediBot Flow
238
+ :: MediBot Flow
566
239
  :medibot_flow
567
- call :process_csvs
568
240
  cls
569
- echo Starting MediBot via MediCafe...
241
+ echo Starting MediBot flow...
570
242
  cd /d "%~dp0.."
571
- python -m MediCafe medibot "%config_file%"
572
- 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
+
573
249
  pause
574
250
  goto main_menu
575
251
 
576
- :: Continue to MediLink
252
+ :: MediLink Flow
577
253
  :medilink_flow
578
- if "!internet_available!"=="0" (
579
- echo No internet connection available.
580
- goto main_menu
581
- )
582
- call :process_csvs
583
254
  cls
584
- :: move this path.
255
+ echo Starting MediLink flow...
585
256
  cd /d "%~dp0.."
586
257
  python -m MediCafe medilink
587
- if errorlevel 1 echo MediLink failed to execute.
258
+ if errorlevel 1 (
259
+ echo [ERROR] Failed to start MediLink flow.
260
+ pause
261
+ )
262
+
588
263
  pause
589
264
  goto main_menu
590
265
 
591
266
  :: United Claims Status
592
267
  :united_claims_status
593
- if "!internet_available!"=="0" (
594
- echo No internet connection available.
595
- goto main_menu
596
- )
597
268
  cls
598
- echo Loading United Claims Status...
269
+ echo Starting United Claims Status...
599
270
  cd /d "%~dp0.."
600
271
  python -m MediCafe claims_status
601
- 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
+
602
277
  pause
603
278
  goto main_menu
604
279
 
605
280
  :: United Deductible
606
281
  :united_deductible
607
- if "!internet_available!"=="0" (
608
- echo No internet connection available.
609
- goto main_menu
610
- )
611
282
  cls
612
- echo Loading United Deductible...
283
+ echo Starting United Deductible...
613
284
  cd /d "%~dp0.."
614
285
  python -m MediCafe deductible
615
- 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
+
616
291
  pause
617
292
  goto main_menu
618
293
 
619
- :: Process CSV Files and Validate Against Config
294
+ :: Process CSV Files
620
295
  :process_csvs
621
-
622
- :: Check if the Python script for JSON updates exists
623
- if not exist "%python_script%" (
624
- echo.
625
- echo Warning: Python script for JSON updates not found at: %python_script%
626
- echo.
627
- echo Would you like to provide an alternate path for the JSON update script?
628
- set /p provide_alt_json="Enter 'Y' to provide alternate path, or any other key to continue: "
629
- if /i "!provide_alt_json!"=="Y" (
630
- echo.
631
- echo Please enter the full path to your update_json.py file.
632
- echo Example: C:\MediBot\scripts\update_json.py
633
- echo Example with spaces: "G:\My Drive\MediBot\scripts\update_json.py"
634
- echo.
635
- echo Note: If your path contains spaces, please include quotes around the entire path.
636
- echo.
637
- set /p alt_json_path="Enter JSON update script path: "
638
- :: Remove any surrounding quotes from user input and re-add them for consistency
639
- set "alt_json_path=!alt_json_path:"=!"
640
- if exist "!alt_json_path!" (
641
- echo JSON update script found at: !alt_json_path!
642
- set "python_script=!alt_json_path!"
643
- ) else (
644
- echo JSON update script not found at: !alt_json_path!
645
- echo Continuing without JSON update script...
646
- )
647
- ) else (
648
- echo Continuing without JSON update script...
649
- )
296
+ if not exist "%source_folder%" (
297
+ echo [ERROR] Source folder not found at: %source_folder%
298
+ pause
299
+ goto main_menu
650
300
  )
651
301
 
652
- :: Move CSV files from local_storage_path to source_folder in case AK sends it unencrypted by accident.
653
- echo Checking for new CSV files in local storage...
654
- for %%f in ("%local_storage_path%\*.csv") do (
655
- echo WARNING: Found CSV files!
656
- echo Moving %%f to %source_folder%...
657
- move "%%f" "%source_folder%" >nul 2>&1
302
+ if not exist "%target_folder%" (
303
+ mkdir "%target_folder%" 2>nul
658
304
  if errorlevel 1 (
659
- echo Failed to move %%f. Check permissions or path.
660
- ) else (
661
- echo Moved %%f successfully.
662
- )
663
- )
664
-
665
- :: Retrieve the current time and date to create a timestamp
666
- for /f "tokens=1-5 delims=/: " %%a in ('echo %time%') do (
667
- set "hour=%%a"
668
- set "minute=%%b"
669
- set "second=%%c"
670
- )
671
- for /f "tokens=2-4 delims=/ " %%a in ('echo %date%') do (
672
- set "day=%%a"
673
- set "month=%%b"
674
- set "year=%%c"
675
- )
676
- set "timestamp=!year!!month!!day!_!hour!!minute!"
677
-
678
- :: Search for the most recent CSV file in source folder
679
- set "latest_csv="
680
- for /f "delims=" %%a in ('dir /b /a-d /o-d "%source_folder%\*.csv" 2^>nul') do (
681
- set "latest_csv=%%a"
682
- echo Found New CSV Files...
683
- goto process_found_csv
684
- )
685
- goto :eof
686
-
687
- :process_found_csv
688
- echo Validating latest CSV with config file...
689
- :: Run Python script to get current CSV path from JSON
690
- for /f "delims=" %%a in ('python "%python_script%" "%config_file%"') do (
691
- set "current_csv=%%a"
692
- )
693
-
694
- :: Extract filenames from paths
695
- for %%f in ("!current_csv!") do set "current_csv_name=%%~nxf"
696
- for %%f in ("%target_folder%\!latest_csv!") do set "latest_csv_name=%%~nxf"
697
-
698
- :: Compare the paths and prompt user if necessary
699
- if not "!current_csv_name!"=="!latest_csv_name!" (
700
- echo.
701
- echo ALERT: Config file CSV path differs from the latest CSV. This can happen if a new CSV is downloaded.
702
- echo Current CSV: !current_csv_name!
703
- echo Latest CSV: !latest_csv_name!
704
- echo.
705
- set /p update_choice="Do you want to update to the latest CSV? (Y/N): "
706
- if /i "!update_choice!"=="Y" (
707
- echo Updating config file with latest CSV...
708
- py "%python_script%" "%config_file%" "%target_folder%\!latest_csv!"
709
- echo Config file updated.
710
- ) else (
711
- echo Using existing CSV path from config.
305
+ echo [ERROR] Failed to create target folder
306
+ pause
307
+ goto main_menu
712
308
  )
713
- ) else (
714
- echo CSV path in config matches the latest CSV.
715
- )
716
-
717
- move "%source_folder%\!latest_csv!" "%target_folder%\SX_CSV_!timestamp!.csv"
718
- set "new_csv_path=%target_folder%\SX_CSV_!timestamp!.csv"
719
- echo Processing CSV...
720
- py "%python_script%" "%config_file%" "!new_csv_path!"
721
- echo CSV Processor Complete...
722
- goto :eof
723
-
724
- :: Clear Python Cache
725
- :clear_cache
726
- cls
727
- echo Clearing Python cache for MediCafe...
728
- echo.
729
- cd /d "%~dp0.."
730
-
731
- :: Check if update_medicafe.py exists in the moved location first
732
- if exist "F:\Medibot\update_medicafe.py" (
733
- echo Found update_medicafe.py in F:\Medibot\ - using moved location
734
- python "F:\Medibot\update_medicafe.py" --clear-cache
735
- ) else if exist "MediBot\update_medicafe.py" (
736
- echo Found update_medicafe.py in original location - using relative path
737
- python "MediBot\update_medicafe.py" --clear-cache
738
- ) else (
739
- echo ERROR: update_medicafe.py not found in either location
740
- echo Expected locations:
741
- echo - F:\Medibot\update_medicafe.py
742
- echo - MediBot\update_medicafe.py
743
- pause
744
- goto main_menu
745
309
  )
746
310
 
311
+ copy "%source_folder%\*.csv" "%target_folder%\" >nul 2>&1
747
312
  if errorlevel 1 (
748
- echo Cache clearing failed.
313
+ echo [ERROR] Failed to copy CSV files
749
314
  pause
315
+ goto main_menu
750
316
  ) else (
751
- echo Cache clearing completed successfully.
752
- pause
317
+ echo [SUCCESS] Successfully copied CSV files
753
318
  )
319
+
320
+ pause
754
321
  goto main_menu
755
322
 
756
- :: Exit Script
757
- :end_script
758
- 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
+
759
330
  pause
760
- exit /b
331
+ goto main_menu
761
332
 
762
333
  :: Open Latest Log
763
334
  :open_latest_log
764
- echo Opening the latest log file...
765
- set "latest_log="
335
+ for /f "delims=" %%i in ('dir /b /o-d *.log 2^>nul') do (
336
+ start notepad "%%i"
337
+ goto main_menu
338
+ )
339
+ echo [WARNING] No log files found
340
+ pause
341
+ goto main_menu
766
342
 
767
- :: Attempt to find any files in the directory
768
- echo Attempting to locate files 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.
769
356
 
770
- :: Method 1: Check for any files
771
- echo Attempt #1: Checking for any files...
772
- dir "%local_storage_path%\*" >nul 2>&1
773
- if %errorlevel% == 0 (
774
- echo Files found in %local_storage_path%.
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
775
363
  ) else (
776
- echo No files found in %local_storage_path%.
777
- pause
778
- goto main_menu
364
+ echo [DEBUG] F: Drive Diagnostic completed successfully
779
365
  )
366
+ echo.
780
367
 
781
- :: Method 2: Check for .log files specifically
782
- echo Attempt #2: Checking for .log files...
783
- dir "%local_storage_path%\*.log" >nul 2>&1
784
- if %errorlevel% == 0 (
785
- echo .log files found in %local_storage_path%.
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
786
374
  ) else (
787
- echo No .log files found in %local_storage_path%.
375
+ echo [DEBUG] Crash Diagnostic completed successfully
788
376
  )
377
+ echo.
789
378
 
790
- :: Method 3: Check for .txt files as a fallback
791
- echo Attempt #3: Checking for .txt files...
792
- dir "%local_storage_path%\*.txt" >nul 2>&1
793
- if %errorlevel% == 0 (
794
- echo .txt files found in %local_storage_path%. This indicates that files are present.
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
795
385
  ) else (
796
- echo No .txt files found in %local_storage_path%.
386
+ echo [DEBUG] Basic Debug completed successfully
797
387
  )
388
+ echo.
798
389
 
799
- :: Method 4: List all files with detailed output
800
- echo Attempt #4: Listing all files in %local_storage_path%...
801
- dir "%local_storage_path%"
802
- pause
803
-
804
- :: Now attempt to find the latest .log file
805
- echo Attempting to find the latest .log file...
806
- set "latest_log="
807
- for /f "delims=" %%a in ('dir /b /a-d /o-d "%local_storage_path%\*.log" 2^>nul') do (
808
- set "latest_log=%%a"
809
- goto open_log_found
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
396
+ ) else (
397
+ echo [DEBUG] Fixed Version Test completed successfully
810
398
  )
399
+ echo.
811
400
 
812
- echo No log files found in %local_storage_path%. Please ensure that log files are present.
813
- pause
814
- goto main_menu
815
-
816
- :open_log_found
817
- echo Found log file: %latest_log%
818
- pause
401
+ :: Step 5: Additional automated checks
402
+ echo [DEBUG] Step 5: Additional System Checks
403
+ echo [DEBUG] ========================================
819
404
 
820
- :: Method 1: Attempt to open with Notepad
821
- echo Attempt #1: Opening with Notepad...
822
- notepad "%local_storage_path%\%latest_log%"
823
- if %errorlevel% == 0 (
824
- echo Successfully opened the log file with Notepad.
825
- pause
826
- goto main_menu
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
827
410
  ) else (
828
- echo Attempt #1 Failed: Could not open with Notepad.
829
- pause
411
+ echo [OK] Python found and accessible
830
412
  )
831
413
 
832
- :: Method 2: Attempt to open with WordPad
833
- echo Attempt #2: Opening with WordPad...
834
- write "%local_storage_path%\%latest_log%"
835
- if %errorlevel% == 0 (
836
- echo Successfully opened the log file with WordPad.
837
- pause
838
- 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
839
419
  ) else (
840
- echo Attempt #2 Failed: Could not open with WordPad.
841
- pause
420
+ echo [OK] MediCafe package found
842
421
  )
843
422
 
844
- :: Method 3: Display contents using the TYPE command
845
- echo Attempt #3: Displaying log file contents with TYPE command...
846
- type "%local_storage_path%\%latest_log%"
847
- if %errorlevel% == 0 (
848
- echo Successfully displayed the log file contents.
849
- pause
850
- goto main_menu
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
851
428
  ) else (
852
- echo Attempt #3 Failed: Could not display contents with TYPE.
853
- pause
429
+ echo [OK] Internet connection available
854
430
  )
855
431
 
856
- :: Method 4: Display the last 30 lines of the log file
857
- echo Attempt #4: Displaying the last 30 lines of the log file...
858
- call :tail "%local_storage_path%\%latest_log%" 30
859
- if %errorlevel% == 0 (
860
- echo Successfully displayed the last 30 lines of the log file.
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
861
436
  ) else (
862
- echo Attempt #4 Failed: Could not display the last 30 lines.
863
- )
864
- pause
865
- goto main_menu
866
-
867
- :: Subroutine to display the last N lines of a file
868
- :tail
869
- :: Usage: call :tail filename number_of_lines
870
- setlocal enabledelayedexpansion
871
- set "file=%~1"
872
- set /a lines=%~2
873
- set "count=0"
874
- set "output="
875
-
876
- for /f "usebackq delims=" %%x in ("%file%") do (
877
- set /a count+=1
878
- set "line[!count!]=%%x"
437
+ echo [ERROR] Local update script not found
879
438
  )
880
439
 
881
- if %count% LSS %lines% (
882
- 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
+ )
883
449
  ) else (
884
- set /a start=%count% - %lines% + 1
450
+ echo [ERROR] F: drive not accessible
885
451
  )
886
452
 
887
- for /l %%i in (%start%,1,%count%) do (
888
- echo !line[%%i]!
889
- )
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
890
462
 
891
- endlocal
892
- goto :eof
463
+ :: Continue to normal mode after debug
464
+ goto normal_mode