medicafe 0.250806.12__tar.gz → 0.250806.14__tar.gz

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.

Files changed (75) hide show
  1. medicafe-0.250806.14/MediBot/MediBot.bat +464 -0
  2. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Crosswalk_Library.py +22 -3
  3. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Crosswalk_Utils.py +20 -1
  4. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/api_core.py +42 -7
  5. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/api_factory.py +17 -1
  6. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_837p_encoder_library.py +26 -3
  7. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_PatientProcessor.py +34 -4
  8. {medicafe-0.250806.12 → medicafe-0.250806.14}/PKG-INFO +1 -1
  9. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/PKG-INFO +1 -1
  10. {medicafe-0.250806.12 → medicafe-0.250806.14}/setup.py +1 -1
  11. medicafe-0.250806.12/MediBot/MediBot.bat +0 -892
  12. {medicafe-0.250806.12 → medicafe-0.250806.14}/LICENSE +0 -0
  13. {medicafe-0.250806.12 → medicafe-0.250806.14}/MANIFEST.in +0 -0
  14. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot.py +0 -0
  15. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Charges.py +0 -0
  16. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Post.py +0 -0
  17. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Preprocessor.py +0 -0
  18. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_Preprocessor_lib.py +0 -0
  19. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_UI.py +0 -0
  20. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_dataformat_library.py +0 -0
  21. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_docx_decoder.py +0 -0
  22. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/MediBot_smart_import.py +0 -0
  23. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/__init__.py +0 -0
  24. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/get_medicafe_version.py +0 -0
  25. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/update_json.py +0 -0
  26. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediBot/update_medicafe.py +0 -0
  27. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/MediLink_ConfigLoader.py +0 -0
  28. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/__init__.py +0 -0
  29. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/__main__.py +0 -0
  30. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/api_core_backup.py +0 -0
  31. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/api_utils.py +0 -0
  32. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/core_utils.py +0 -0
  33. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/graphql_utils.py +0 -0
  34. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/logging_config.py +0 -0
  35. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/logging_demo.py +0 -0
  36. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/migration_helpers.py +0 -0
  37. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediCafe/smart_import.py +0 -0
  38. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_837p_cob_library.py +0 -0
  39. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_837p_encoder.py +0 -0
  40. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_837p_utilities.py +0 -0
  41. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_API_Generator.py +0 -0
  42. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Azure.py +0 -0
  43. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_ClaimStatus.py +0 -0
  44. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_DataMgmt.py +0 -0
  45. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Decoder.py +0 -0
  46. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Deductible.py +0 -0
  47. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Deductible_Validator.py +0 -0
  48. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Display_Utils.py +0 -0
  49. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Down.py +0 -0
  50. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Gmail.py +0 -0
  51. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Mailer.py +0 -0
  52. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Parser.py +0 -0
  53. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Scan.py +0 -0
  54. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Scheduler.py +0 -0
  55. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_UI.py +0 -0
  56. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_Up.py +0 -0
  57. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_insurance_utils.py +0 -0
  58. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_main.py +0 -0
  59. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/MediLink_smart_import.py +0 -0
  60. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/Soumit_api.py +0 -0
  61. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/__init__.py +0 -0
  62. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/insurance_type_integration_test.py +0 -0
  63. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/openssl.cnf +0 -0
  64. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/test.py +0 -0
  65. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/test_cob_library.py +0 -0
  66. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/test_timing.py +0 -0
  67. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/test_validation.py +0 -0
  68. {medicafe-0.250806.12 → medicafe-0.250806.14}/MediLink/webapp.html +0 -0
  69. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/SOURCES.txt +0 -0
  70. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/dependency_links.txt +0 -0
  71. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/entry_points.txt +0 -0
  72. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/not-zip-safe +0 -0
  73. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/requires.txt +0 -0
  74. {medicafe-0.250806.12 → medicafe-0.250806.14}/medicafe.egg-info/top_level.txt +0 -0
  75. {medicafe-0.250806.12 → medicafe-0.250806.14}/setup.cfg +0 -0
@@ -0,0 +1,464 @@
1
+ ::MediBot.bat - Streamlined version with coordinated debug system
2
+ @echo off
3
+ setlocal enabledelayedexpansion
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
+
42
+ :: Define paths with local fallbacks for F: drive dependencies
43
+ set "source_folder=C:\MEDIANSI\MediCare"
44
+ set "target_folder=C:\MEDIANSI\MediCare\CSV"
45
+ set "python_script=C:\Python34\Lib\site-packages\MediBot\update_json.py"
46
+ set "python_script2=C:\Python34\Lib\site-packages\MediBot\Medibot.py"
47
+ set "medicafe_package=medicafe"
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
+
90
+ set "firefox_path=C:\Program Files\Mozilla Firefox\firefox.exe"
91
+ set "claims_status_script=..\MediLink\MediLink_ClaimStatus.py"
92
+ set "deductible_script=..\MediLink\MediLink_Deductible.py"
93
+ set "package_version="
94
+ set PYTHONWARNINGS=ignore
95
+
96
+ :: Check if Python is installed
97
+ python --version >nul 2>&1
98
+ if %errorlevel% neq 0 (
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
103
+ )
104
+
105
+ :: Check if critical directories exist
106
+ if not exist "%source_folder%" (
107
+ echo [WARNING] Source folder not found at: %source_folder%
108
+ set /p provide_alt_source="Enter 'Y' to provide alternate path, or any other key to continue: "
109
+ if /i "!provide_alt_source!"=="Y" (
110
+ set /p alt_source_folder="Enter the alternate source folder path: "
111
+ if not "!alt_source_folder!"=="" set "source_folder=!alt_source_folder!"
112
+ )
113
+ )
114
+
115
+ if not exist "%target_folder%" (
116
+ mkdir "%target_folder%" 2>nul
117
+ )
118
+
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
+ )
130
+ ) else (
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"
132
+ )
133
+
134
+ :: Check for internet connectivity
135
+ ping -n 1 google.com >nul 2>&1
136
+ if errorlevel 1 (
137
+ set "internet_available=0"
138
+ ) else (
139
+ set "internet_available=1"
140
+ )
141
+
142
+ :: Main menu
143
+ :main_menu
144
+ cls
145
+ echo.
146
+ echo ========================================
147
+ echo MediBot Main Menu
148
+ echo ========================================
149
+ echo.
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
160
+ echo.
161
+
162
+ set /p choice="Enter your choice (0-9): "
163
+
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
174
+
175
+ echo Invalid choice. Please try again.
176
+ pause
177
+ goto main_menu
178
+
179
+ :: Medicafe Update
180
+ :check_updates
181
+ if "!internet_available!"=="0" (
182
+ echo [WARNING] No internet connection available.
183
+ goto main_menu
184
+ )
185
+
186
+ echo ========================================
187
+ echo Starting MediCafe Update Process
188
+ echo ========================================
189
+ echo.
190
+
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
196
+ goto main_menu
197
+ )
198
+
199
+ echo Starting update process...
200
+ echo Update script: %upgrade_medicafe%
201
+ echo.
202
+
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.
209
+ )
210
+
211
+ echo.
212
+ echo Update process has been initiated.
213
+ echo All output will be displayed in the update window.
214
+ echo.
215
+ pause
216
+ goto main_menu
217
+
218
+ :: Download Carol's Emails
219
+ :download_emails
220
+ if "!internet_available!"=="0" (
221
+ echo [WARNING] No internet connection available.
222
+ goto main_menu
223
+ )
224
+
225
+ call :process_csvs
226
+ cls
227
+ echo Starting email download via MediCafe...
228
+ cd /d "%~dp0.."
229
+ python -m MediCafe download_emails
230
+ if errorlevel 1 (
231
+ echo [ERROR] Failed to download emails.
232
+ pause
233
+ )
234
+
235
+ pause
236
+ goto main_menu
237
+
238
+ :: MediBot Flow
239
+ :medibot_flow
240
+ cls
241
+ echo Starting MediBot flow...
242
+ cd /d "%~dp0.."
243
+ python -m MediCafe medibot
244
+ if errorlevel 1 (
245
+ echo [ERROR] Failed to start MediBot flow.
246
+ pause
247
+ )
248
+
249
+ pause
250
+ goto main_menu
251
+
252
+ :: MediLink Flow
253
+ :medilink_flow
254
+ cls
255
+ echo Starting MediLink flow...
256
+ cd /d "%~dp0.."
257
+ python -m MediCafe medilink
258
+ if errorlevel 1 (
259
+ echo [ERROR] Failed to start MediLink flow.
260
+ pause
261
+ )
262
+
263
+ pause
264
+ goto main_menu
265
+
266
+ :: United Claims Status
267
+ :united_claims_status
268
+ cls
269
+ echo Starting United Claims Status...
270
+ cd /d "%~dp0.."
271
+ python -m MediCafe claims_status
272
+ if errorlevel 1 (
273
+ echo [ERROR] Failed to start United Claims Status.
274
+ pause
275
+ )
276
+
277
+ pause
278
+ goto main_menu
279
+
280
+ :: United Deductible
281
+ :united_deductible
282
+ cls
283
+ echo Starting United Deductible...
284
+ cd /d "%~dp0.."
285
+ python -m MediCafe deductible
286
+ if errorlevel 1 (
287
+ echo [ERROR] Failed to start United Deductible.
288
+ pause
289
+ )
290
+
291
+ pause
292
+ goto main_menu
293
+
294
+ :: Process CSV Files
295
+ :process_csvs
296
+ if not exist "%source_folder%" (
297
+ echo [ERROR] Source folder not found at: %source_folder%
298
+ pause
299
+ goto main_menu
300
+ )
301
+
302
+ if not exist "%target_folder%" (
303
+ mkdir "%target_folder%" 2>nul
304
+ if errorlevel 1 (
305
+ echo [ERROR] Failed to create target folder
306
+ pause
307
+ goto main_menu
308
+ )
309
+ )
310
+
311
+ copy "%source_folder%\*.csv" "%target_folder%\" >nul 2>&1
312
+ if errorlevel 1 (
313
+ echo [ERROR] Failed to copy CSV files
314
+ pause
315
+ goto main_menu
316
+ ) else (
317
+ echo [SUCCESS] Successfully copied CSV files
318
+ )
319
+
320
+ pause
321
+ goto main_menu
322
+
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
+
330
+ pause
331
+ goto main_menu
332
+
333
+ :: Open Latest Log
334
+ :open_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
342
+
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
363
+ ) else (
364
+ echo [DEBUG] F: Drive Diagnostic completed successfully
365
+ )
366
+ echo.
367
+
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
374
+ ) else (
375
+ echo [DEBUG] Crash Diagnostic completed successfully
376
+ )
377
+ echo.
378
+
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
387
+ )
388
+ echo.
389
+
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
398
+ )
399
+ echo.
400
+
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
410
+ ) else (
411
+ echo [OK] Python found and accessible
412
+ )
413
+
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
419
+ ) else (
420
+ echo [OK] MediCafe package found
421
+ )
422
+
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
428
+ ) else (
429
+ echo [OK] Internet connection available
430
+ )
431
+
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
438
+ )
439
+
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
+ )
449
+ ) else (
450
+ echo [ERROR] F: drive not accessible
451
+ )
452
+
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
462
+
463
+ :: Continue to normal mode after debug
464
+ goto normal_mode
@@ -256,14 +256,33 @@ def crosswalk_update(client, config, crosswalk): # Upstream of this is only Medi
256
256
  api_cache = {}
257
257
 
258
258
  # Load insurance data from MAINS (optional - continue if not available)
259
+ # XP/Python34 Compatibility: Enhanced error handling with verbose output
259
260
  insurance_name_to_id = {}
260
261
  try:
261
262
  MediLink_ConfigLoader.log("Attempting to load insurance data from MAINS...", config, level="DEBUG")
262
- insurance_name_to_id = MediBot_Preprocessor_lib.load_insurance_data_from_mains(config)
263
- MediLink_ConfigLoader.log("Loaded insurance data from MAINS with {} entries.".format(len(insurance_name_to_id)), config, level="INFO")
263
+
264
+ if MediBot_Preprocessor_lib and hasattr(MediBot_Preprocessor_lib, 'load_insurance_data_from_mains'):
265
+ insurance_name_to_id = MediBot_Preprocessor_lib.load_insurance_data_from_mains(config)
266
+ if insurance_name_to_id:
267
+ MediLink_ConfigLoader.log("Loaded insurance data from MAINS with {} entries.".format(len(insurance_name_to_id)), config, level="INFO")
268
+ else:
269
+ MediLink_ConfigLoader.log("load_insurance_data_from_mains returned empty data", config, level="WARNING")
270
+ else:
271
+ error_msg = "MediBot_Preprocessor_lib or load_insurance_data_from_mains not available"
272
+ MediLink_ConfigLoader.log(error_msg, config, level="WARNING")
273
+ print("Warning: {}".format(error_msg))
274
+
275
+ except AttributeError as e:
276
+ error_msg = "AttributeError accessing load_insurance_data_from_mains: {}".format(str(e))
277
+ MediLink_ConfigLoader.log(error_msg, config, level="WARNING")
278
+ print("Warning: {}. Some crosswalk features may be limited.".format(error_msg))
279
+ except ImportError as e:
280
+ error_msg = "ImportError with MediBot_Preprocessor_lib: {}".format(str(e))
281
+ MediLink_ConfigLoader.log(error_msg, config, level="WARNING")
282
+ print("Warning: {}. Some crosswalk features may be limited.".format(error_msg))
264
283
  except Exception as e:
265
284
  MediLink_ConfigLoader.log("Error loading insurance data from MAINS: {}. Continuing without MAINS data.".format(e), config, level="WARNING")
266
- print("Warning: MAINS data not available. Some crosswalk features may be limited.")
285
+ print("Warning: MAINS data not available ({}). Some crosswalk features may be limited.".format(str(e)))
267
286
  # Continue without MAINS data - don't return False
268
287
 
269
288
  # Load historical payer to patient mappings (optional - continue if not available)
@@ -459,13 +459,32 @@ def update_crosswalk_with_new_payer_id(client, insurance_name, payer_id, config,
459
459
  return False
460
460
 
461
461
  # Load the Medisoft ID for the given insurance name
462
+ # XP/Python34 Compatibility: Enhanced error handling with verbose output
462
463
  try:
463
464
  # Note: MediBot_Preprocessor_lib is imported at module level
464
- medisoft_id = MediBot_Preprocessor_lib.load_insurance_data_from_mains(config).get(insurance_name)
465
+ if MediBot_Preprocessor_lib and hasattr(MediBot_Preprocessor_lib, 'load_insurance_data_from_mains'):
466
+ insurance_data = MediBot_Preprocessor_lib.load_insurance_data_from_mains(config)
467
+ medisoft_id = insurance_data.get(insurance_name) if insurance_data else None
468
+ MediLink_ConfigLoader.log("Successfully retrieved insurance data for {}".format(insurance_name), config, level="DEBUG")
469
+ else:
470
+ error_msg = "MediBot_Preprocessor_lib or load_insurance_data_from_mains not available"
471
+ MediLink_ConfigLoader.log(error_msg, config, level="WARNING")
472
+ print("Warning: {}".format(error_msg))
473
+ medisoft_id = None
474
+ except AttributeError as e:
475
+ error_msg = "AttributeError accessing load_insurance_data_from_mains: {}".format(str(e))
476
+ MediLink_ConfigLoader.log(error_msg, config, level="WARNING")
477
+ print("Warning: {}".format(error_msg))
478
+ medisoft_id = None
465
479
  except KeyError as e: # Handle KeyError for config
466
480
  MediLink_ConfigLoader.log("KeyError while loading Medisoft ID: {}".format(e), config, level="ERROR")
467
481
  print("KeyError while loading Medisoft ID for insurance name {}: {}".format(insurance_name, e))
468
482
  return False
483
+ except Exception as e:
484
+ error_msg = "Unexpected error loading insurance data: {}".format(str(e))
485
+ MediLink_ConfigLoader.log(error_msg, config, level="ERROR")
486
+ print("Error: {}".format(error_msg))
487
+ medisoft_id = None
469
488
 
470
489
  MediLink_ConfigLoader.log("Retrieved Medisoft ID for insurance name {}: {}.".format(insurance_name, medisoft_id), config, level="DEBUG")
471
490
 
@@ -138,24 +138,59 @@ class APIClient(BaseAPIClient):
138
138
  super().__init__(config)
139
139
 
140
140
  # Add enhanced features if available
141
+ # XP/Python34 Compatibility: Enhanced error handling with verbose output
141
142
  try:
142
143
  from MediCafe.api_utils import APICircuitBreaker, APICache, APIRateLimiter
144
+ MediLink_ConfigLoader.log("Successfully imported MediCafe.api_utils", level="DEBUG")
145
+ except ImportError as e:
146
+ MediLink_ConfigLoader.log("Warning: MediCafe.api_utils not available: {}".format(str(e)), level="WARNING")
147
+ print("Warning: MediCafe.api_utils import failed: {}".format(str(e)))
148
+ APICircuitBreaker = None
149
+ APICache = None
150
+ APIRateLimiter = None
151
+ except Exception as e:
152
+ MediLink_ConfigLoader.log("Unexpected error importing MediCafe.api_utils: {}".format(str(e)), level="ERROR")
153
+ print("Error: Unexpected MediCafe.api_utils import error: {}".format(str(e)))
154
+ APICircuitBreaker = None
155
+ APICache = None
156
+ APIRateLimiter = None
157
+
158
+ try:
143
159
  from MediLink.MediLink_insurance_utils import get_feature_flag
144
-
145
- # Initialize enhancements if enabled
160
+ MediLink_ConfigLoader.log("Successfully imported MediLink.MediLink_insurance_utils", level="DEBUG")
161
+ except ImportError as e:
162
+ MediLink_ConfigLoader.log("Warning: MediLink.MediLink_insurance_utils not available: {}".format(str(e)), level="WARNING")
163
+ print("Warning: MediLink.MediLink_insurance_utils import failed: {}".format(str(e)))
164
+ # Provide fallback function
165
+ def get_feature_flag(flag_name, default=False):
166
+ MediLink_ConfigLoader.log("Using fallback get_feature_flag for '{}', returning default: {}".format(flag_name, default), level="DEBUG")
167
+ return default
168
+ except Exception as e:
169
+ MediLink_ConfigLoader.log("Unexpected error importing MediLink.MediLink_insurance_utils: {}".format(str(e)), level="ERROR")
170
+ print("Error: Unexpected MediLink.MediLink_insurance_utils import error: {}".format(str(e)))
171
+ # Provide fallback function
172
+ def get_feature_flag(flag_name, default=False):
173
+ MediLink_ConfigLoader.log("Using fallback get_feature_flag for '{}', returning default: {}".format(flag_name, default), level="DEBUG")
174
+ return default
175
+
176
+ # Initialize enhancements with error handling
177
+ try:
146
178
  enable_circuit_breaker = get_feature_flag('api_circuit_breaker', default=False)
147
179
  enable_caching = get_feature_flag('api_caching', default=False)
148
180
  enable_rate_limiting = get_feature_flag('api_rate_limiting', default=False)
149
181
 
150
- self.circuit_breaker = APICircuitBreaker() if enable_circuit_breaker else None
151
- self.api_cache = APICache() if enable_caching else None
152
- self.rate_limiter = APIRateLimiter() if enable_rate_limiting else None
182
+ self.circuit_breaker = APICircuitBreaker() if (enable_circuit_breaker and APICircuitBreaker) else None
183
+ self.api_cache = APICache() if (enable_caching and APICache) else None
184
+ self.rate_limiter = APIRateLimiter() if (enable_rate_limiting and APIRateLimiter) else None
153
185
 
154
186
  if any([enable_circuit_breaker, enable_caching, enable_rate_limiting]):
155
187
  MediLink_ConfigLoader.log("Enhanced API client initialized with circuit_breaker={}, caching={}, rate_limiting={}".format(
156
188
  enable_circuit_breaker, enable_caching, enable_rate_limiting), level="INFO")
157
- except ImportError:
158
- MediLink_ConfigLoader.log("API enhancements not available, using standard client", level="DEBUG")
189
+ else:
190
+ MediLink_ConfigLoader.log("API enhancements disabled or not available, using standard client", level="DEBUG")
191
+ except Exception as e:
192
+ MediLink_ConfigLoader.log("Error initializing API enhancements: {}. Using standard client.".format(str(e)), level="WARNING")
193
+ print("Warning: API enhancement initialization failed: {}".format(str(e)))
159
194
  self.circuit_breaker = None
160
195
  self.api_cache = None
161
196
  self.rate_limiter = None
@@ -181,7 +181,23 @@ class APIClientFactory:
181
181
 
182
182
  return client
183
183
 
184
- return self.circuit_breaker.call(create_client)
184
+ # XP/Python34 Compatibility: Wrap circuit breaker call with error handling
185
+ try:
186
+ if self.circuit_breaker and hasattr(self.circuit_breaker, 'call'):
187
+ return self.circuit_breaker.call(create_client)
188
+ else:
189
+ MediLink_ConfigLoader.log("Circuit breaker not available, calling create_client directly", level="WARNING")
190
+ return create_client()
191
+ except Exception as e:
192
+ MediLink_ConfigLoader.log("Circuit breaker call failed: {}. Falling back to direct client creation.".format(str(e)), level="WARNING")
193
+ print("Warning: Circuit breaker error ({}), using fallback client creation".format(str(e)))
194
+ try:
195
+ return create_client()
196
+ except Exception as e2:
197
+ MediLink_ConfigLoader.log("Direct client creation also failed: {}".format(str(e2)), level="ERROR")
198
+ print("Error: Both circuit breaker and direct client creation failed: {}".format(str(e2)))
199
+ # Return a minimal fallback client
200
+ return ProductionAPIClient()
185
201
 
186
202
  @classmethod
187
203
  def get_shared_client(cls, **kwargs):
@@ -13,15 +13,29 @@ if project_dir not in sys.path:
13
13
  sys.path.append(project_dir)
14
14
 
15
15
  # Import MediBot modules conditionally to avoid circular imports
16
+ # XP/Python34 Compatibility: Enhanced error handling with verbose output
16
17
  MediBot_Preprocessor_lib = None
17
18
  load_insurance_data_from_mains = None
18
19
 
19
20
  try:
20
21
  from MediBot import MediBot_Preprocessor_lib
22
+ MediLink_ConfigLoader.log("Successfully imported MediBot_Preprocessor_lib", level="DEBUG")
23
+
21
24
  if hasattr(MediBot_Preprocessor_lib, 'load_insurance_data_from_mains'):
22
25
  load_insurance_data_from_mains = MediBot_Preprocessor_lib.load_insurance_data_from_mains
23
- except ImportError:
24
- pass
26
+ MediLink_ConfigLoader.log("Successfully accessed load_insurance_data_from_mains function", level="DEBUG")
27
+ else:
28
+ MediLink_ConfigLoader.log("Warning: MediBot_Preprocessor_lib found but load_insurance_data_from_mains attribute missing", level="WARNING")
29
+ print("Warning: MediBot_Preprocessor_lib missing load_insurance_data_from_mains attribute")
30
+ except ImportError as e:
31
+ MediLink_ConfigLoader.log("ImportError accessing MediBot_Preprocessor_lib: {}".format(str(e)), level="WARNING")
32
+ print("Warning: Cannot import MediBot_Preprocessor_lib: {}".format(str(e)))
33
+ except AttributeError as e:
34
+ MediLink_ConfigLoader.log("AttributeError accessing load_insurance_data_from_mains: {}".format(str(e)), level="WARNING")
35
+ print("Warning: AttributeError with load_insurance_data_from_mains: {}".format(str(e)))
36
+ except Exception as e:
37
+ MediLink_ConfigLoader.log("Unexpected error accessing MediBot_Preprocessor_lib: {}".format(str(e)), level="ERROR")
38
+ print("Error: Unexpected error with MediBot_Preprocessor_lib: {}".format(str(e)))
25
39
 
26
40
  # XP Compatibility: Add fallback function if import fails
27
41
  if load_insurance_data_from_mains is None:
@@ -30,6 +44,7 @@ if load_insurance_data_from_mains is None:
30
44
  Fallback function for load_insurance_data_from_mains when MediBot_Preprocessor_lib is not available.
31
45
  Returns empty dictionary to prevent AttributeError.
32
46
  """
47
+ MediLink_ConfigLoader.log("Using fallback load_insurance_data_from_mains function", level="WARNING")
33
48
  print("Warning: load_insurance_data_from_mains not available. Using empty insurance mapping.")
34
49
  return {}
35
50
 
@@ -83,9 +98,17 @@ except ImportError:
83
98
  update_crosswalk_with_new_payer_id = None
84
99
 
85
100
  # Import enhanced insurance selection with fallback
101
+ # XP/Python34 Compatibility: Enhanced error handling with verbose output
86
102
  try:
87
103
  from MediLink_insurance_utils import safe_insurance_type_selection
88
- except ImportError:
104
+ MediLink_ConfigLoader.log("Successfully imported safe_insurance_type_selection from MediLink_insurance_utils", level="DEBUG")
105
+ except ImportError as e:
106
+ MediLink_ConfigLoader.log("ImportError importing safe_insurance_type_selection: {}".format(str(e)), level="WARNING")
107
+ print("Warning: safe_insurance_type_selection not available: {}".format(str(e)))
108
+ safe_insurance_type_selection = None
109
+ except Exception as e:
110
+ MediLink_ConfigLoader.log("Unexpected error importing safe_insurance_type_selection: {}".format(str(e)), level="ERROR")
111
+ print("Error: Unexpected error importing safe_insurance_type_selection: {}".format(str(e)))
89
112
  safe_insurance_type_selection = None
90
113
 
91
114
  # Import display utilities