Spaces:
Runtime error
Runtime error
Create config.py
Browse files
config.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration and session state management for the Pharmaceutical Analytics app.
|
| 3 |
+
This module contains configuration settings, constants, and session state initialization.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import streamlit as st
|
| 7 |
+
import queue
|
| 8 |
+
|
| 9 |
+
def initialize_session_state():
|
| 10 |
+
"""Initialize all session state variables"""
|
| 11 |
+
if "workflow_state" not in st.session_state:
|
| 12 |
+
st.session_state.workflow_state = None
|
| 13 |
+
|
| 14 |
+
if "workflow_thread" not in st.session_state:
|
| 15 |
+
st.session_state.workflow_thread = None
|
| 16 |
+
|
| 17 |
+
if "status_queue" not in st.session_state:
|
| 18 |
+
st.session_state.status_queue = queue.Queue()
|
| 19 |
+
|
| 20 |
+
if "logs" not in st.session_state:
|
| 21 |
+
st.session_state.logs = []
|
| 22 |
+
|
| 23 |
+
if "error_details" not in st.session_state:
|
| 24 |
+
st.session_state.error_details = []
|
| 25 |
+
|
| 26 |
+
if "current_step" not in st.session_state:
|
| 27 |
+
st.session_state.current_step = None
|
| 28 |
+
|
| 29 |
+
if "alert_submitted" not in st.session_state:
|
| 30 |
+
st.session_state.alert_submitted = False
|
| 31 |
+
|
| 32 |
+
if "show_sql" not in st.session_state:
|
| 33 |
+
st.session_state.show_sql = False
|
| 34 |
+
|
| 35 |
+
if "show_code" not in st.session_state:
|
| 36 |
+
st.session_state.show_code = False
|
| 37 |
+
|
| 38 |
+
if "environment_ready" not in st.session_state:
|
| 39 |
+
st.session_state.environment_ready = False
|
| 40 |
+
|
| 41 |
+
if "agents_loaded" not in st.session_state:
|
| 42 |
+
st.session_state.agents_loaded = False
|
| 43 |
+
|
| 44 |
+
if "initialization_attempted" not in st.session_state:
|
| 45 |
+
st.session_state.initialization_attempted = False
|
| 46 |
+
|
| 47 |
+
# Constants
|
| 48 |
+
STEPS = ["planning", "data_collection", "analysis", "validation", "insights", "complete"]
|
| 49 |
+
|
| 50 |
+
# Alert templates
|
| 51 |
+
ALERT_TEMPLATES = {
|
| 52 |
+
"Sales Decline": "Sales of DrugX down 15% in Northeast region over past 30 days compared to forecast.",
|
| 53 |
+
"Market Share Loss": "Market share of DrugX decreased by 8 percentage points in the Southeast region over the last quarter.",
|
| 54 |
+
"Inventory Issue": "Multiple stockouts of DrugX reported in Midwest distribution centers affecting 25% of pharmacies.",
|
| 55 |
+
"Competitor Launch": "Competitor MedCorp launched similar product at 20% lower price point in Western territories.",
|
| 56 |
+
"Custom Alert": ""
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
# Database path
|
| 60 |
+
DB_PATH = "data/pharma_db.sqlite"
|
| 61 |
+
|
| 62 |
+
# Required directories
|
| 63 |
+
REQUIRED_DIRS = ["data", "agents", "workflows", "utils", "ui"]
|
| 64 |
+
|
| 65 |
+
# Agent animation settings
|
| 66 |
+
THINKING_MESSAGES = [
|
| 67 |
+
"Identifying required data sources...",
|
| 68 |
+
"Determining appropriate analytical approaches...",
|
| 69 |
+
"Creating task dependency graph...",
|
| 70 |
+
"Designing validation strategy..."
|
| 71 |
+
]
|
| 72 |
+
|
| 73 |
+
# Visualization settings
|
| 74 |
+
CHART_COLORS = {
|
| 75 |
+
"primary": "blue",
|
| 76 |
+
"secondary": "green",
|
| 77 |
+
"warning": "red",
|
| 78 |
+
"neutral": "gray"
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
# Priority colors for action items
|
| 82 |
+
PRIORITY_COLORS = {
|
| 83 |
+
"High": "red",
|
| 84 |
+
"Medium": "orange",
|
| 85 |
+
"Low": "blue"
|
| 86 |
+
}
|