HealthGuard-AI / check_debug_integration.py
kalyan9's picture
Upload 14 files
95e10ab verified
Raw History Blame Contribute Delete
4.87 kB
"""
Check if all debugging features are properly integrated.
"""
import os
import sys
import importlib.util
def check_file_exists(filename):
"""Check if a file exists."""
exists = os.path.isfile(filename)
status = "βœ“" if exists else "βœ—"
print(f"{status} {filename}: {'Found' if exists else 'Missing'}")
return exists
def check_import(module_name):
"""Check if a module can be imported."""
try:
spec = importlib.util.find_spec(module_name)
if spec is not None:
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
print(f"βœ“ {module_name}: Import successful")
return True
else:
print(f"βœ— {module_name}: Module not found")
return False
except Exception as e:
print(f"βœ— {module_name}: Import failed - {e}")
return False
def check_debug_routes():
"""Check if debug routes are properly integrated."""
try:
# Try to import the app and check for debug routes
spec = importlib.util.find_spec('app')
if spec is not None:
print("βœ“ app.py: Found")
# Check if debug_routes can be imported
if check_import('debug_routes'):
print("βœ“ Debug routes: Integration successful")
return True
else:
print("βœ— Debug routes: Integration failed")
return False
else:
print("βœ— app.py: Not found")
return False
except Exception as e:
print(f"βœ— Debug routes check failed: {e}")
return False
def check_logging_config():
"""Check if logging configuration is properly integrated."""
try:
if check_import('logging_config'):
print("βœ“ Logging configuration: Integration successful")
return True
else:
print("βœ— Logging configuration: Integration failed")
return False
except Exception as e:
print(f"βœ— Logging configuration check failed: {e}")
return False
def main():
"""Main function."""
print("HealthGuard-AI Debug Integration Check")
print("=" * 40)
# Required files
required_files = [
'app.py',
'debug_routes.py',
'logging_config.py',
'login_debug.py',
'test_login_flow.py',
'exact_login_test.py',
'simple_login_test.py',
'production_login_diagnostic.py',
'deployment_test.py',
'verify_deployment.py',
'run_diagnostics.py',
'post_deployment_test.py',
'start_debug.py'
]
print("Checking required files:")
missing_files = []
for filename in required_files:
if not check_file_exists(filename):
missing_files.append(filename)
print()
# Check imports
print("Checking module imports:")
modules_to_check = [
'debug_routes',
'logging_config',
'login_debug',
'verify_deployment'
]
failed_imports = []
for module in modules_to_check:
if not check_import(module):
failed_imports.append(module)
print()
# Check specific integrations
print("Checking specific integrations:")
debug_routes_ok = check_debug_routes()
logging_config_ok = check_logging_config()
print()
# Summary
print("INTEGRATION CHECK SUMMARY")
print("=" * 40)
total_checks = len(required_files) + len(modules_to_check) + 2 # +2 for debug routes and logging config
passed_checks = (len(required_files) - len(missing_files)) + (len(modules_to_check) - len(failed_imports)) + (1 if debug_routes_ok else 0) + (1 if logging_config_ok else 0)
print(f"Files: {len(required_files) - len(missing_files)}/{len(required_files)} present")
print(f"Imports: {len(modules_to_check) - len(failed_imports)}/{len(modules_to_check)} successful")
print(f"Integrations: {2 if (debug_routes_ok and logging_config_ok) else (1 if (debug_routes_ok or logging_config_ok) else 0)}/2 successful")
print(f"Overall: {passed_checks}/{total_checks} checks passed")
if missing_files:
print(f"\nMissing files: {', '.join(missing_files)}")
if failed_imports:
print(f"Failed imports: {', '.join(failed_imports)}")
if passed_checks == total_checks:
print("\nβœ“ All debugging features are properly integrated!")
return True
else:
print("\nβœ— Some debugging features are missing or not properly integrated.")
return False
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)