medicafe 0.250810.0__tar.gz → 0.250810.2__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.
Files changed (74) hide show
  1. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot.bat +93 -162
  2. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/update_medicafe.py +153 -96
  3. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_837p_encoder.py +14 -0
  4. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_837p_encoder_library.py +25 -9
  5. {medicafe-0.250810.0/medicafe.egg-info → medicafe-0.250810.2}/PKG-INFO +1 -1
  6. {medicafe-0.250810.0 → medicafe-0.250810.2/medicafe.egg-info}/PKG-INFO +1 -1
  7. {medicafe-0.250810.0 → medicafe-0.250810.2}/setup.py +1 -1
  8. {medicafe-0.250810.0 → medicafe-0.250810.2}/LICENSE +0 -0
  9. {medicafe-0.250810.0 → medicafe-0.250810.2}/MANIFEST.in +0 -0
  10. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot.py +0 -0
  11. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Charges.py +0 -0
  12. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Crosswalk_Library.py +0 -0
  13. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Crosswalk_Utils.py +0 -0
  14. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Post.py +0 -0
  15. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Preprocessor.py +0 -0
  16. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_Preprocessor_lib.py +0 -0
  17. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_UI.py +0 -0
  18. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_dataformat_library.py +0 -0
  19. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_docx_decoder.py +0 -0
  20. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/MediBot_smart_import.py +0 -0
  21. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/__init__.py +0 -0
  22. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/get_medicafe_version.py +0 -0
  23. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediBot/update_json.py +0 -0
  24. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/MediLink_ConfigLoader.py +0 -0
  25. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/__init__.py +0 -0
  26. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/__main__.py +0 -0
  27. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/api_core.py +0 -0
  28. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/api_core_backup.py +0 -0
  29. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/api_factory.py +0 -0
  30. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/api_utils.py +0 -0
  31. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/core_utils.py +0 -0
  32. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/graphql_utils.py +0 -0
  33. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/logging_config.py +0 -0
  34. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/logging_demo.py +0 -0
  35. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/migration_helpers.py +0 -0
  36. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediCafe/smart_import.py +0 -0
  37. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_837p_cob_library.py +0 -0
  38. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_837p_utilities.py +0 -0
  39. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_API_Generator.py +0 -0
  40. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Azure.py +0 -0
  41. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_ClaimStatus.py +0 -0
  42. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_DataMgmt.py +0 -0
  43. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Decoder.py +0 -0
  44. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Deductible.py +0 -0
  45. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Deductible_Validator.py +0 -0
  46. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Display_Utils.py +0 -0
  47. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Down.py +0 -0
  48. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Gmail.py +0 -0
  49. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Mailer.py +0 -0
  50. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Parser.py +0 -0
  51. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_PatientProcessor.py +0 -0
  52. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Scan.py +0 -0
  53. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Scheduler.py +0 -0
  54. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_UI.py +0 -0
  55. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_Up.py +0 -0
  56. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_insurance_utils.py +0 -0
  57. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_main.py +0 -0
  58. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/MediLink_smart_import.py +0 -0
  59. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/Soumit_api.py +0 -0
  60. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/__init__.py +0 -0
  61. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/insurance_type_integration_test.py +0 -0
  62. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/openssl.cnf +0 -0
  63. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/test.py +0 -0
  64. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/test_cob_library.py +0 -0
  65. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/test_timing.py +0 -0
  66. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/test_validation.py +0 -0
  67. {medicafe-0.250810.0 → medicafe-0.250810.2}/MediLink/webapp.html +0 -0
  68. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/SOURCES.txt +0 -0
  69. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/dependency_links.txt +0 -0
  70. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/entry_points.txt +0 -0
  71. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/not-zip-safe +0 -0
  72. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/requires.txt +0 -0
  73. {medicafe-0.250810.0 → medicafe-0.250810.2}/medicafe.egg-info/top_level.txt +0 -0
  74. {medicafe-0.250810.0 → medicafe-0.250810.2}/setup.cfg +0 -0
@@ -378,221 +378,152 @@ goto main_menu
378
378
  :: Medicafe Update
379
379
  :check_updates
380
380
  if "!internet_available!"=="0" (
381
- echo [WARNING] No internet connection available.
381
+ echo ========================================
382
+ echo UPDATE ERROR
383
+ echo ========================================
384
+ echo.
385
+ echo [ERROR] No internet connection available.
386
+ echo.
387
+ echo MediCafe updates require an internet connection.
388
+ echo Please check your network connection and try again.
389
+ echo.
390
+ echo Press Enter to return to main menu...
391
+ pause >nul
382
392
  goto main_menu
383
393
  )
384
394
 
385
395
  echo ========================================
386
- echo Starting MediCafe Update Process
396
+ echo MediCafe Update Process
387
397
  echo ========================================
388
398
  echo.
389
-
390
- :: Step 1: Check if update_medicafe.py exists in expected location
399
+ echo Checking system requirements...
391
400
  echo.
392
- echo ========================================
393
- echo DEBUG STEP 1: Checking for update script
394
- echo ========================================
401
+
402
+ :: Step 1: Verify Python installation
403
+ echo [1/5] Checking Python installation...
404
+ python --version >nul 2>&1
405
+ if %errorlevel% neq 0 (
406
+ echo [ERROR] Python is not installed or not in PATH.
407
+ echo Please install Python 3.4 or later and try again.
408
+ echo.
409
+ echo Press Enter to return to main menu...
410
+ pause >nul
411
+ goto main_menu
412
+ )
413
+ echo [OK] Python found
395
414
  echo.
396
- echo Checking for update script - priority: local first, then legacy path
415
+
416
+ :: Step 2: Check if update script exists
417
+ echo [2/5] Locating update script...
397
418
  if exist "%upgrade_medicafe_local%" (
398
- echo [SUCCESS] Found update script at: %upgrade_medicafe_local%
399
- echo File size:
400
- dir "%upgrade_medicafe_local%" | find "update_medicafe.py"
401
419
  set "upgrade_medicafe=%upgrade_medicafe_local%"
420
+ echo [OK] Found local update script
402
421
  ) else (
403
422
  if exist "%upgrade_medicafe_legacy%" (
404
- echo [SUCCESS] Found update script at legacy location: %upgrade_medicafe_legacy%
405
- echo File size:
406
- dir "%upgrade_medicafe_legacy%" | find "update_medicafe.py"
407
423
  set "upgrade_medicafe=%upgrade_medicafe_legacy%"
424
+ echo [OK] Found legacy update script
408
425
  ) else (
409
- echo [FAILED] Update script not found in either location:
426
+ echo [ERROR] Update script not found
427
+ echo.
428
+ echo Expected locations:
410
429
  echo - Local: %upgrade_medicafe_local%
411
430
  echo - Legacy: %upgrade_medicafe_legacy%
412
431
  echo.
413
- echo Available files in current directory:
414
- dir /b
432
+ echo Please ensure the update script is available.
415
433
  echo.
416
- echo Available files in MediBot directory:
417
- dir /b MediBot\ 2>nul || echo MediBot directory not found
434
+ echo Press Enter to return to main menu...
435
+ pause >nul
436
+ goto main_menu
418
437
  )
419
438
  )
420
439
  echo.
421
- echo Press Enter to continue to step 2...
422
- pause >nul
423
440
 
424
- :: Step 2: Verify Python installation and path
425
- echo.
426
- echo ========================================
427
- echo DEBUG STEP 2: Python Environment Check
428
- echo ========================================
429
- echo.
430
- echo Checking Python installation...
431
- python --version
441
+ :: Step 3: Check MediCafe package
442
+ echo [3/5] Checking MediCafe installation...
443
+ python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" >nul 2>&1
432
444
  if %errorlevel% neq 0 (
433
- echo [ERROR] Python not found in PATH
434
- echo Current PATH: %PATH%
445
+ echo [WARNING] MediCafe package not found
446
+ echo Will attempt to install during update process
435
447
  ) else (
436
- echo [SUCCESS] Python found
437
- echo Python executable:
438
- python -c "import sys; print(sys.executable)"
439
- echo Python version:
440
- python --version
448
+ echo [OK] MediCafe package found
441
449
  )
442
450
  echo.
443
- echo Checking pip installation...
444
- python -m pip --version
445
- if %errorlevel% neq 0 (
446
- echo [ERROR] pip not found
447
- ) else (
448
- echo [SUCCESS] pip found
449
- echo pip version:
450
- python -m pip --version
451
- )
452
- echo.
453
- echo Press Enter to continue to step 3...
454
- pause >nul
455
451
 
456
- :: Step 3: Check MediCafe package installation
457
- echo.
458
- echo ========================================
459
- echo DEBUG STEP 3: MediCafe Package Check
460
- echo ========================================
461
- echo.
462
- echo Checking MediCafe package installation...
463
- python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2>nul
452
+ :: Step 4: Verify internet connectivity
453
+ echo [4/5] Testing internet connection...
454
+ ping -n 1 google.com >nul 2>&1
464
455
  if %errorlevel% neq 0 (
465
- echo [ERROR] MediCafe package not found or error accessing
456
+ echo [ERROR] Internet connection test failed
457
+ echo Please check your network connection and try again.
466
458
  echo.
467
- echo Checking if MediCafe is importable...
468
- python -c "import MediCafe; print('MediCafe module found')" 2>nul
469
- if %errorlevel% neq 0 (
470
- echo [ERROR] MediCafe module not importable
471
- ) else (
472
- echo [SUCCESS] MediCafe module is importable
473
- )
474
- ) else (
475
- echo [SUCCESS] MediCafe package found
476
- echo Package version: %package_version%
459
+ echo Press Enter to return to main menu...
460
+ pause >nul
461
+ goto main_menu
477
462
  )
463
+ echo [OK] Internet connection available
478
464
  echo.
479
- echo Press Enter to continue to step 4...
480
- pause >nul
481
465
 
482
- :: Step 4: Check internet connectivity
466
+ :: Step 5: Start update process
467
+ echo [5/5] Starting update process...
483
468
  echo.
484
469
  echo ========================================
485
- echo DEBUG STEP 4: Internet Connectivity
470
+ echo UPDATE WINDOW
486
471
  echo ========================================
472
+ echo The update process will open in a new window.
473
+ echo Please wait for it to complete.
487
474
  echo.
488
- echo Testing internet connectivity...
489
- ping -n 1 google.com >nul 2>&1
490
- if %errorlevel% neq 0 (
491
- echo [ERROR] No internet connection detected
492
- echo Cannot proceed with update without internet
493
- echo.
494
- echo Press Enter to return to main menu...
495
- pause >nul
496
- goto main_menu
497
- )
498
-
499
- echo Starting update process...
500
475
  echo Update script: %upgrade_medicafe%
501
476
  echo.
502
477
 
503
- :: Check if update_medicafe.py exists using the new priority system
478
+ :: Execute the update script with better error handling
504
479
  if exist "%upgrade_medicafe_local%" (
505
- echo [INFO] Using local update script at: %upgrade_medicafe_local%
506
- echo Command: python "%upgrade_medicafe_local%" %package_version%
507
-
508
- :: Pre-execution diagnostics
509
- echo.
510
- echo [DIAGNOSTIC] Pre-execution checks for local script:
511
- echo [DIAGNOSTIC] File size and permissions:
512
- dir "%upgrade_medicafe_local%" 2>nul || echo [!] Cannot read file details
513
- echo [DIAGNOSTIC] Testing Python access to file:
514
- 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
515
-
516
- echo.
517
- echo Press Enter to execute update command...
518
- pause >nul
519
- echo.
520
- echo Executing update command...
521
- echo.
522
- echo The update window will open and show detailed progress.
523
- echo All output will be displayed on screen.
524
- echo.
525
- start "Medicafe Update" cmd /v:on /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" && (
480
+ echo Starting local update script...
481
+ start "MediCafe Update" cmd /v:on /c "python %upgrade_medicafe_local% %package_version% & echo. & echo Update process completed. Press any key to close... & pause >nul"
482
+ if %errorlevel% equ 0 (
526
483
  echo %DATE% %TIME% Upgrade initiated successfully - local. >> "%temp_file%"
527
484
  echo [SUCCESS] Update process started successfully
528
- echo All output will be displayed in the update window.
529
- ) || (
485
+ ) else (
530
486
  echo %DATE% %TIME% Update failed - local. >> "%temp_file%"
531
- echo [ERROR] Upgrade failed. Check the update window for details.
532
- echo [DIAGNOSTIC] Possible causes for local script failure:
533
- echo - Python not in PATH
534
- echo - Script syntax error
535
- echo - Missing Python dependencies
536
- echo - File corruption
487
+ echo [ERROR] Failed to start update process
488
+ echo Please check the update window for error details.
537
489
  )
538
490
  ) else (
539
491
  if exist "%upgrade_medicafe_legacy%" (
540
- echo [INFO] Using legacy update script at: %upgrade_medicafe_legacy%
541
- echo Command: python "%upgrade_medicafe_legacy%" %package_version%
542
-
543
- :: Pre-execution diagnostics for F: drive
544
- echo.
545
- echo [DIAGNOSTIC] Pre-execution checks for F: drive script:
546
- echo [DIAGNOSTIC] File size and permissions:
547
- dir "%upgrade_medicafe_legacy%" 2>nul || echo [!] Cannot read file details
548
- echo [DIAGNOSTIC] Testing Python access to F: drive file:
549
- 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
550
- echo [DIAGNOSTIC] Testing file read permissions:
551
- type "%upgrade_medicafe_legacy%" | find "#update_medicafe.py" >nul 2>&1 && echo [OK] File content readable || echo [ERROR] Cannot read file content
552
-
553
- echo.
554
- echo Press Enter to execute update command...
555
- pause >nul
556
- echo.
557
- echo Executing update command...
558
- start "Medicafe Update" cmd /v:on /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" && (
492
+ echo Starting legacy update script...
493
+ start "MediCafe Update" cmd /v:on /c "python %upgrade_medicafe_legacy% %package_version% & echo. & echo Update process completed. Press any key to close... & pause >nul"
494
+ if %errorlevel% equ 0 (
559
495
  echo %DATE% %TIME% Upgrade initiated successfully - legacy. >> "%temp_file%"
560
496
  echo [SUCCESS] Update process started successfully
561
- echo All output will be displayed in the update window.
562
- ) || (
563
- echo %DATE% %TIME% Update failed - legacy. >> "%temp_file%"
564
- echo [ERROR] Upgrade failed. Check the update window for details.
565
- echo [DIAGNOSTIC] Possible causes for F: drive script failure:
566
- echo - F: drive disconnected during execution
567
- echo - Permission denied accessing F: drive
568
- echo - F: drive file locked by antivirus
569
- echo - Network drive timeout
570
- echo - Python cannot access network paths
497
+ ) else (
498
+ echo %DATE% %TIME% Update failed - legacy. >> "%temp_file%"
499
+ echo [ERROR] Failed to start update process
500
+ echo Please check the update window for error details.
501
+ )
502
+ ) else (
503
+ echo [ERROR] Update script not found
504
+ echo Expected locations:
505
+ echo - Local: %upgrade_medicafe_local%
506
+ echo - Legacy: %upgrade_medicafe_legacy%
507
+ echo.
508
+ echo Press Enter to return to main menu...
509
+ pause >nul
510
+ goto main_menu
571
511
  )
572
- ) else (
573
- echo [ERROR] update_medicafe.py not found in either location
574
- echo Expected locations:
575
- echo - Local: %upgrade_medicafe_local%
576
- echo - Legacy: %upgrade_medicafe_legacy%
577
- echo.
578
- echo Current directory contents:
579
- dir /b
580
- echo.
581
- echo MediBot directory contents:
582
- dir /b MediBot\ 2>nul || echo MediBot directory not found
583
- echo.
584
- echo %DATE% %TIME% Update failed - script not found. >> "%temp_file%"
585
- echo.
586
- echo Press Enter to return to main menu...
587
- pause >nul
588
- goto main_menu
589
512
  )
590
513
 
591
514
  echo.
592
- echo Update process has been initiated.
593
- echo All output will be displayed in the update window.
515
+ echo ========================================
516
+ echo UPDATE STATUS
517
+ echo ========================================
518
+ echo.
519
+ echo The update process has been initiated in a new window.
520
+ echo Please wait for it to complete before continuing.
594
521
  echo.
595
- pause
522
+ echo If the update window closes quickly, there may be an error.
523
+ echo Check the update window output for details.
524
+ echo.
525
+ echo Press Enter to return to main menu...
526
+ pause >nul
596
527
  goto main_menu
597
528
 
598
529
  :: Download Carol's Emails
@@ -27,14 +27,14 @@ print("="*60)
27
27
  DEBUG_MODE = False
28
28
 
29
29
  def debug_step(step_number, step_title, message=""):
30
- """Print step information. Pause only in debug mode."""
31
- print("\n" + "="*60)
32
- print("STEP {}: {}".format(step_number, step_title))
33
- print("="*60)
34
- if message:
35
- print(message)
36
-
30
+ """Print step information. Only show debug output in debug mode."""
37
31
  if DEBUG_MODE:
32
+ print("\n" + "="*60)
33
+ print("STEP {}: {}".format(step_number, step_title))
34
+ print("="*60)
35
+ if message:
36
+ print(message)
37
+
38
38
  # In debug mode, optionally pause for key steps
39
39
  if step_number in [1, 7, 8]:
40
40
  print("\nPress Enter to continue...")
@@ -45,8 +45,8 @@ def debug_step(step_number, step_title, message=""):
45
45
  else:
46
46
  print("\nContinuing...")
47
47
  else:
48
- # Streamlined mode: never pause
49
- print("\nContinuing...")
48
+ # Streamlined mode: no debug output, no pauses
49
+ pass
50
50
 
51
51
  def print_status(message, status_type="INFO"):
52
52
  """Print formatted status messages with ASCII-only visual indicators."""
@@ -114,11 +114,12 @@ def get_latest_version(package, retries=3, delay=1):
114
114
  data = response.json()
115
115
  latest_version = data['info']['version']
116
116
 
117
- # Print the version with attempt information
118
- if attempt == 1:
119
- print("Latest available version: {}".format(latest_version))
120
- else:
121
- print("Latest available version: {} ({} attempt)".format(latest_version, attempt))
117
+ # Print the version with attempt information (only in debug mode)
118
+ if DEBUG_MODE:
119
+ if attempt == 1:
120
+ print("Latest available version: {}".format(latest_version))
121
+ else:
122
+ print("Latest available version: {} ({} attempt)".format(latest_version, attempt))
122
123
 
123
124
  # Check if the latest version is different from the current version
124
125
  current_version = get_installed_version(package)
@@ -132,10 +133,11 @@ def get_latest_version(package, retries=3, delay=1):
132
133
 
133
134
  return latest_version # Return the version after the check
134
135
  except requests.RequestException as e:
135
- print("Attempt {}: Error fetching latest version: {}".format(attempt, e))
136
- if attempt < retries:
137
- print("Retrying in {} seconds...".format(delay))
138
- time.sleep(delay)
136
+ if DEBUG_MODE:
137
+ print("Attempt {}: Error fetching latest version: {}".format(attempt, e))
138
+ if attempt < retries:
139
+ print("Retrying in {} seconds...".format(delay))
140
+ time.sleep(delay)
139
141
  return None
140
142
 
141
143
  def check_internet_connection():
@@ -157,7 +159,8 @@ def clear_python_cache(workspace_path=None):
157
159
  bool: True if cache was cleared successfully, False otherwise
158
160
  """
159
161
  try:
160
- print_status("Clearing Python bytecode cache...", "INFO")
162
+ if DEBUG_MODE:
163
+ print_status("Clearing Python bytecode cache...", "INFO")
161
164
 
162
165
  # If no workspace path provided, try to detect it
163
166
  if not workspace_path:
@@ -178,10 +181,12 @@ def clear_python_cache(workspace_path=None):
178
181
  break
179
182
 
180
183
  if not workspace_path:
181
- print_status("Could not detect workspace path. Cache clearing skipped.", "WARNING")
184
+ if DEBUG_MODE:
185
+ print_status("Could not detect workspace path. Cache clearing skipped.", "WARNING")
182
186
  return False
183
187
 
184
- print("Workspace path: {}".format(workspace_path))
188
+ if DEBUG_MODE:
189
+ print("Workspace path: {}".format(workspace_path))
185
190
 
186
191
  # Directories to clear cache from
187
192
  cache_dirs = [
@@ -199,10 +204,12 @@ def clear_python_cache(workspace_path=None):
199
204
  if os.path.exists(pycache_path):
200
205
  try:
201
206
  shutil.rmtree(pycache_path)
202
- print("Cleared cache: {}".format(pycache_path))
207
+ if DEBUG_MODE:
208
+ print("Cleared cache: {}".format(pycache_path))
203
209
  cleared_count += 1
204
210
  except Exception as e:
205
- print("Warning: Could not clear cache at {}: {}".format(pycache_path, e))
211
+ if DEBUG_MODE:
212
+ print("Warning: Could not clear cache at {}: {}".format(pycache_path, e))
206
213
 
207
214
  # Remove .pyc files
208
215
  for root, dirs, files in os.walk(cache_dir):
@@ -210,20 +217,25 @@ def clear_python_cache(workspace_path=None):
210
217
  if file.endswith('.pyc'):
211
218
  try:
212
219
  os.remove(os.path.join(root, file))
213
- print("Removed .pyc file: {}".format(os.path.join(root, file)))
220
+ if DEBUG_MODE:
221
+ print("Removed .pyc file: {}".format(os.path.join(root, file)))
214
222
  cleared_count += 1
215
223
  except Exception as e:
216
- print("Warning: Could not remove .pyc file {}: {}".format(file, e))
224
+ if DEBUG_MODE:
225
+ print("Warning: Could not remove .pyc file {}: {}".format(file, e))
217
226
 
218
227
  if cleared_count > 0:
219
- print_status("Successfully cleared {} cache items".format(cleared_count), "SUCCESS")
228
+ if DEBUG_MODE:
229
+ print_status("Successfully cleared {} cache items".format(cleared_count), "SUCCESS")
220
230
  return True
221
231
  else:
222
- print_status("No cache files found to clear", "INFO")
232
+ if DEBUG_MODE:
233
+ print_status("No cache files found to clear", "INFO")
223
234
  return True
224
235
 
225
236
  except Exception as e:
226
- print_status("Error clearing cache: {}".format(e), "ERROR")
237
+ if DEBUG_MODE:
238
+ print_status("Error clearing cache: {}".format(e), "ERROR")
227
239
  return False
228
240
 
229
241
  def compare_versions(version1, version2):
@@ -240,7 +252,8 @@ def upgrade_package(package, retries=3, delay=2): # Updated retries to 3
240
252
  print_final_result(False, "No internet connection available")
241
253
 
242
254
  for attempt in range(1, retries + 1):
243
- print("Attempt {} to upgrade {}...".format(attempt, package))
255
+ if DEBUG_MODE:
256
+ print("Attempt {} to upgrade {}...".format(attempt, package))
244
257
  process = subprocess.Popen(
245
258
  [
246
259
  sys.executable, '-m', 'pip', 'install', '--upgrade',
@@ -253,7 +266,8 @@ def upgrade_package(package, retries=3, delay=2): # Updated retries to 3
253
266
  stdout, stderr = process.communicate()
254
267
 
255
268
  if process.returncode == 0:
256
- print(stdout.decode().strip())
269
+ if DEBUG_MODE:
270
+ print(stdout.decode().strip())
257
271
  new_version = get_installed_version(package) # Get new version after upgrade
258
272
  if compare_versions(new_version, get_latest_version(package)) >= 0: # Compare versions
259
273
  if attempt == 1:
@@ -265,13 +279,16 @@ def upgrade_package(package, retries=3, delay=2): # Updated retries to 3
265
279
  else:
266
280
  print_status("Upgrade failed. Current version remains: {}".format(new_version), "WARNING")
267
281
  if attempt < retries:
268
- print("Retrying in {} seconds...".format(delay))
282
+ if DEBUG_MODE:
283
+ print("Retrying in {} seconds...".format(delay))
269
284
  time.sleep(delay)
270
285
  else:
271
- print(stderr.decode().strip())
286
+ if DEBUG_MODE:
287
+ print(stderr.decode().strip())
272
288
  print_status("Attempt {}: Upgrade failed.".format(attempt), "WARNING")
273
289
  if attempt < retries:
274
- print("Retrying in {} seconds...".format(delay))
290
+ if DEBUG_MODE:
291
+ print("Retrying in {} seconds...".format(delay))
275
292
  time.sleep(delay)
276
293
 
277
294
  print_status("All upgrade attempts failed.", "ERROR")
@@ -385,130 +402,170 @@ def main():
385
402
  # Enable debug mode if requested via CLI or environment
386
403
  DEBUG_MODE = ('--debug' in sys.argv) or (os.environ.get('MEDICAFE_DEBUG', '0') in ['1', 'true', 'TRUE'])
387
404
 
388
- print_status("MediCafe Update Utility", "INFO")
389
- print("Starting update process...")
405
+ # Always show the header for user feedback
406
+ print("="*60)
407
+ print("MediCafe Update Utility")
408
+ print("="*60)
409
+ print("Timestamp: {}".format(time.strftime("%Y-%m-%d %H:%M:%S")))
410
+ print("Python Version: {}".format(sys.version.split()[0]))
411
+ print("Platform: {}".format(platform.system()))
412
+ print("="*60)
413
+ print()
390
414
 
391
- # STEP 1: Environment Information
392
- debug_step(1, "Environment Information",
393
- "Python version: {}\n"
394
- "Platform: {}\n"
395
- "Current working directory: {}\n"
396
- "Script location: {}\n"
397
- "sys.executable: {}".format(
398
- sys.version, platform.platform(), os.getcwd(),
399
- __file__, sys.executable))
415
+ # STEP 1: Environment Information (always show basic info)
416
+ print("STEP 1: Environment Check")
417
+ print("-" * 40)
418
+ print("Working Directory: {}".format(os.getcwd()))
419
+ print("Script Location: {}".format(os.path.basename(__file__)))
420
+ print("Python Executable: {}".format(sys.executable))
421
+ print()
400
422
 
401
- # STEP 2: Check Python and pip
402
- debug_step(2, "Python and pip Verification")
423
+ # STEP 2: Check Python and pip (always verify)
424
+ print("STEP 2: Python Environment")
425
+ print("-" * 40)
403
426
  print("Checking Python installation...")
404
427
  try:
405
428
  process = subprocess.Popen([sys.executable, '--version'],
406
429
  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
407
430
  stdout, stderr = process.communicate()
408
431
  if process.returncode == 0:
409
- print("Python version: {}".format(stdout.decode().strip()))
432
+ print("Python: {}".format(stdout.decode().strip()))
410
433
  else:
411
- print("Error checking Python: {}".format(stderr.decode().strip()))
434
+ print("Python: ERROR - {}".format(stderr.decode().strip()))
435
+ print_final_result(False, "Python installation check failed")
412
436
  except Exception as e:
413
- print("Error checking Python: {}".format(e))
437
+ print("Python: ERROR - {}".format(e))
438
+ print_final_result(False, "Python installation check failed")
414
439
 
415
- print("\nChecking pip installation...")
440
+ print("Checking pip installation...")
416
441
  try:
417
442
  process = subprocess.Popen([sys.executable, '-m', 'pip', '--version'],
418
443
  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
419
444
  stdout, stderr = process.communicate()
420
445
  if process.returncode == 0:
421
- print("pip version: {}".format(stdout.decode().strip()))
446
+ print("pip: {}".format(stdout.decode().strip()))
422
447
  else:
423
- print("Error checking pip: {}".format(stderr.decode().strip()))
448
+ print("pip: ERROR - {}".format(stderr.decode().strip()))
449
+ print_final_result(False, "pip installation check failed")
424
450
  except Exception as e:
425
- print("Error checking pip: {}".format(e))
451
+ print("pip: ERROR - {}".format(e))
452
+ print_final_result(False, "pip installation check failed")
453
+ print()
426
454
 
427
- # STEP 3: Check MediCafe package
428
- debug_step(3, "MediCafe Package Check")
455
+ # STEP 3: Check MediCafe package (always check)
456
+ print("STEP 3: MediCafe Package")
457
+ print("-" * 40)
429
458
  package = "medicafe"
430
459
  current_version = get_installed_version(package)
431
460
  if current_version:
432
- print("Current MediCafe version: {}".format(current_version))
461
+ print("Current Version: {}".format(current_version))
433
462
  else:
434
- print("MediCafe package not found or not accessible")
463
+ print("MediCafe: NOT INSTALLED")
464
+ print("Attempting to install MediCafe...")
465
+ if upgrade_package(package):
466
+ current_version = get_installed_version(package)
467
+ if current_version:
468
+ print("MediCafe installed successfully: {}".format(current_version))
469
+ else:
470
+ print_final_result(False, "Failed to install MediCafe")
471
+ else:
472
+ print_final_result(False, "Failed to install MediCafe")
473
+ print()
435
474
 
436
- # STEP 4: Internet connectivity
437
- debug_step(4, "Internet Connectivity Test")
475
+ # STEP 4: Internet connectivity (always check)
476
+ print("STEP 4: Internet Connection")
477
+ print("-" * 40)
478
+ print("Testing internet connectivity...")
438
479
  if check_internet_connection():
439
- print("Internet connection: OK")
440
- print("Testing PyPI connectivity...")
441
- try:
442
- response = requests.get("https://pypi.org/pypi/medicafe/json", timeout=10)
443
- print("PyPI connectivity: OK (Status: {})".format(response.status_code))
444
- except Exception as e:
445
- print("PyPI connectivity: FAILED - {}".format(e))
480
+ print("Internet: CONNECTED")
481
+ if DEBUG_MODE:
482
+ print("Testing PyPI connectivity...")
483
+ try:
484
+ response = requests.get("https://pypi.org/pypi/medicafe/json", timeout=10)
485
+ print("PyPI: CONNECTED (Status: {})".format(response.status_code))
486
+ except Exception as e:
487
+ print("PyPI: ERROR - {}".format(e))
446
488
  else:
447
- print("Internet connection: FAILED")
489
+ print("Internet: NOT CONNECTED")
448
490
  print_final_result(False, "No internet connection available")
491
+ print()
449
492
 
450
- # STEP 5: Check for updates
451
- debug_step(5, "Version Comparison")
493
+ # STEP 5: Check for updates (always check)
494
+ print("STEP 5: Version Check")
495
+ print("-" * 40)
452
496
  latest_version = get_latest_version(package)
453
497
  if latest_version:
454
- print("Latest available version: {}".format(latest_version))
498
+ print("Latest Available: {}".format(latest_version))
455
499
  if current_version:
456
500
  comparison = compare_versions(latest_version, current_version)
457
501
  if comparison > 0:
458
- print("Update needed: Current ({}) < Latest ({})".format(current_version, latest_version))
502
+ print("Status: UPDATE NEEDED")
503
+ print("Current: {} -> Latest: {}".format(current_version, latest_version))
459
504
  elif comparison == 0:
460
- print("Already up to date: Current ({}) = Latest ({})".format(current_version, latest_version))
505
+ print("Status: UP TO DATE")
506
+ print("Current: {} = Latest: {}".format(current_version, latest_version))
461
507
  else:
462
- print("Version mismatch: Current ({}) > Latest ({})".format(current_version, latest_version))
508
+ print("Status: VERSION MISMATCH")
509
+ print("Current: {} > Latest: {}".format(current_version, latest_version))
463
510
  else:
464
- print("Cannot compare versions - current version not available")
511
+ print("Status: CANNOT COMPARE")
512
+ print("Current version not available")
465
513
  else:
466
- print("Could not retrieve latest version information")
514
+ print("Status: ERROR")
515
+ print("Could not retrieve latest version")
467
516
  print_final_result(False, "Unable to fetch latest version")
517
+ print()
468
518
 
469
- # STEP 6: Dependencies check (skipped by default in streamlined mode)
470
- debug_step(6, "Dependencies Check")
519
+ # STEP 6: Dependencies check (only in debug mode)
471
520
  if DEBUG_MODE:
472
- response = input("Do you want to check dependencies? (yes/no, default/enter is no): ").strip().lower()
521
+ print("STEP 6: Dependencies Check")
522
+ print("-" * 40)
523
+ response = input("Check dependencies? (y/n, default=n): ").strip().lower()
473
524
  if response in ['yes', 'y']:
474
525
  ensure_dependencies()
475
526
  else:
476
- print_status("Skipping dependency check.", "INFO")
477
- else:
478
- print_status("Skipping dependency check (streamlined mode).", "INFO")
527
+ print("Skipping dependency check.")
528
+ print()
479
529
 
480
- # STEP 7: Perform update
481
- debug_step(7, "Update Execution")
530
+ # STEP 7: Perform update (always show progress)
531
+ print("STEP 7: Update Process")
532
+ print("-" * 40)
482
533
  if current_version and latest_version and compare_versions(latest_version, current_version) > 0:
483
- print_status("A newer version is available. Proceeding with upgrade.", "INFO")
484
- print("Current version: {}".format(current_version))
485
- print("Target version: {}".format(latest_version))
534
+ print("Starting update process...")
535
+ print("From: {} -> To: {}".format(current_version, latest_version))
536
+ print()
486
537
 
487
538
  if upgrade_package(package):
488
539
  # STEP 8: Verify upgrade
489
- debug_step(8, "Upgrade Verification")
540
+ print("STEP 8: Verification")
541
+ print("-" * 40)
490
542
  new_version = get_installed_version(package)
491
- print("New installed version: {}".format(new_version))
543
+ print("New Version: {}".format(new_version))
492
544
 
493
545
  if compare_versions(new_version, latest_version) >= 0:
494
- print_status("Upgrade successful. New version: {}".format(new_version), "SUCCESS")
546
+ print("Status: SUCCESS")
495
547
 
496
- # DEBUG STEP 9: Clear cache
497
- debug_step(9, "Cache Clearing")
498
- print_status("Clearing Python cache to prevent import issues...", "INFO")
548
+ # STEP 9: Clear cache (always do, minimal output)
549
+ print("STEP 9: Cache Cleanup")
550
+ print("-" * 40)
551
+ print("Clearing Python cache...")
499
552
  if clear_python_cache():
500
- print_status("Cache cleared successfully. Update complete.", "SUCCESS")
553
+ print("Cache: CLEARED")
501
554
  else:
502
- print_status("Cache clearing failed, but update was successful.", "WARNING")
555
+ print("Cache: WARNING - Some files could not be cleared")
503
556
 
504
557
  print_final_result(True, "Successfully upgraded to version {}".format(new_version))
505
558
  else:
506
- print_status("Upgrade failed. Current version remains: {}".format(new_version), "ERROR")
559
+ print("Status: FAILED")
560
+ print("Version verification failed")
507
561
  print_final_result(False, "Upgrade verification failed")
508
562
  else:
563
+ print("Status: FAILED")
564
+ print("Update process failed")
509
565
  print_final_result(False, "Upgrade process failed")
510
566
  else:
511
- print_status("You already have the latest version installed.", "SUCCESS")
567
+ print("Status: NO UPDATE NEEDED")
568
+ print("MediCafe is already up to date.")
512
569
  print_final_result(True, "Already running latest version")
513
570
 
514
571
  if __name__ == "__main__":
@@ -35,6 +35,11 @@ except ImportError:
35
35
  # TODO (COB ENHANCEMENT): Import COB library when implementing Medicare and secondary claim support
36
36
  # import MediLink_837p_cob_library
37
37
  #from tqdm import tqdm
38
+ # Optional COB library import for low-risk validation/logging
39
+ try:
40
+ import MediLink_837p_cob_library as COB
41
+ except (ImportError, SystemError):
42
+ COB = None
38
43
 
39
44
  def format_single_claim(patient_data, config, endpoint, transaction_set_control_number, crosswalk, client):
40
45
  """
@@ -51,6 +56,15 @@ def format_single_claim(patient_data, config, endpoint, transaction_set_control_
51
56
  """
52
57
  # Pre-resolve and enrich with Payer Name and ID for special case handling like Florida Blue.
53
58
  patient_data = MediLink_837p_encoder_library.payer_id_to_payer_name(patient_data, config, endpoint, crosswalk, client)
59
+
60
+ # Low-risk: Log-only COB configuration validation for secondary claims (does not alter behavior)
61
+ if COB is not None and patient_data.get('claim_type') == 'secondary':
62
+ try:
63
+ is_valid, errors = COB.validate_cob_configuration(config)
64
+ if not is_valid:
65
+ MediLink_ConfigLoader.log("COB configuration incomplete: {}".format(errors), config, level="WARNING")
66
+ except Exception as e:
67
+ MediLink_ConfigLoader.log("COB validation check failed: {}".format(str(e)), config, level="WARNING")
54
68
 
55
69
  segments = []
56
70
 
@@ -72,6 +72,12 @@ except (ImportError, SystemError):
72
72
  except ImportError:
73
73
  MediLink_837p_utilities = None
74
74
 
75
+ # Safe import for COB helper library (optional)
76
+ try:
77
+ import MediLink_837p_cob_library as COB
78
+ except (ImportError, SystemError):
79
+ COB = None
80
+
75
81
  # Safe import for UI functions - works in multiple contexts
76
82
  try:
77
83
  import MediLink_UI
@@ -683,16 +689,19 @@ def create_sbr_segment(config, parsed_data, endpoint):
683
689
  # If the payer is not Medicare and is primary insurance, use 'P' (Primary)
684
690
  # If the payer is secondary insurance after Medicare, use 'S' (Secondary)
685
691
  # Assume everything is Primary for now.
686
- responsibility_code = 'P'
692
+ responsibility_code = 'S' if parsed_data.get('claim_type') == 'secondary' else 'P'
687
693
 
688
- # Insurance Type Code
694
+ # Insurance Type Code (SBR09)
689
695
  insurance_type_code = insurance_type_selection(parsed_data)
690
696
 
691
- # TODO (COB ENHANCEMENT): Enhanced SBR segment for Medicare and COB support
692
- # For Medicare Part B: SBR09 = "MB"
693
- # For Medicare Advantage: SBR09 = "MA"
694
- # For secondary claims: SBR01 = "S"
695
- # See MediLink_837p_cob_library.create_enhanced_sbr_segment() for implementation
697
+ # Prefer Medicare-specific type codes when determinable and COB helpers are available
698
+ if COB is not None:
699
+ try:
700
+ medicare_type = COB.determine_medicare_payer_type(parsed_data, config)
701
+ if medicare_type:
702
+ insurance_type_code = medicare_type # MB or MA
703
+ except Exception as e:
704
+ MediLink_ConfigLoader.log("COB determine_medicare_payer_type error: {}".format(str(e)), level="WARNING")
696
705
 
697
706
  # Construct the SBR segment using the determined codes
698
707
  sbr_segment = "SBR*{responsibility_code}*18*******{insurance_type_code}~".format(
@@ -763,6 +772,13 @@ def _original_insurance_type_selection_logic(parsed_data):
763
772
  # Retrieve insurance options with codes and descriptions
764
773
  config, _ = MediLink_ConfigLoader.load_configuration()
765
774
  insurance_options = config['MediLink_Config'].get('insurance_options')
775
+
776
+ # If COB library is available, augment options with Medicare codes (MB/MA/MC)
777
+ if COB is not None:
778
+ try:
779
+ insurance_options = COB.get_enhanced_insurance_options(config)
780
+ except Exception as e:
781
+ MediLink_ConfigLoader.log("COB get_enhanced_insurance_options error: {}".format(str(e)), level="WARNING")
766
782
 
767
783
  # TODO (COB ENHANCEMENT): Enhanced insurance options for Medicare support
768
784
  # See MediLink_837p_cob_library.get_enhanced_insurance_options() for Medicare codes:
@@ -796,8 +812,8 @@ def _original_insurance_type_selection_logic(parsed_data):
796
812
  insurance_type_code = user_input
797
813
  print("Selected: {} - {}".format(user_input, insurance_options[user_input]))
798
814
  else:
799
- # User wants to use a code not in config - confirm with them
800
- confirm = input("Code '{}' not found in configuration. Use it anyway? (y/n): ".format(user_input)).strip().lower()
815
+ # User wants to use a code not in options - confirm with them
816
+ confirm = input("Code '{}' not found in options. Use it anyway? (y/n): ".format(user_input)).strip().lower()
801
817
  if confirm in ['y', 'yes']:
802
818
  insurance_type_code = user_input
803
819
  print("Using code: {}".format(user_input))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250810.0
3
+ Version: 0.250810.2
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250810.0
3
+ Version: 0.250810.2
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='medicafe',
5
- version="0.250810.0",
5
+ version="0.250810.2",
6
6
  description='MediCafe',
7
7
  long_description="""
8
8
  # Project Overview: MediCafe
File without changes
File without changes
File without changes