-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_dashboard.py
More file actions
63 lines (49 loc) · 1.75 KB
/
Copy pathrun_dashboard.py
File metadata and controls
63 lines (49 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""Entry point to launch the clinical trial dashboard."""
import sys
import logging
from pathlib import Path
# Ensure src is in path
sys.path.insert(0, str(Path(__file__).parent))
from src.config import setup_logging
# Setup logging
setup_logging()
logger = logging.getLogger(__name__)
def main():
"""Launch the dashboard application."""
try:
logger.info("="*60)
logger.info("Clinical Trial Dashboard - Starting")
logger.info("="*60)
# Check database exists
db_path = Path("data/clinical_trial.db")
if not db_path.exists():
print("[ERROR] Database not found at data/clinical_trial.db")
print("\nPlease initialize the database first:")
print(" 1. python scripts/test_db_basic.py # Create schema")
print(" 2. python scripts/load_data_pandas.py # Load data")
print("\nThen run this script again.")
return 1
print("\n" + "="*60)
print("Starting Starting Clinical Trial Dashboard")
print("="*60)
print(f"\n[STATS] Database: {db_path.absolute()}")
print(f"URL: http://localhost:8050")
print("\nNote: Press Ctrl+C to stop the server\n")
print("="*60 + "\n")
# Import and run app
from dashboard.app import app
app.run(
debug=True,
host='0.0.0.0',
port=8050
)
return 0
except KeyboardInterrupt:
print("\n\n Dashboard stopped by user")
return 0
except Exception as e:
logger.error(f"Failed to start dashboard: {e}", exc_info=True)
print(f"\n[ERROR] Error: {e}")
return 1
if __name__ == "__main__":
sys.exit(main())