""" Configuration and session state management for the Pharmaceutical Analytics app. This module contains configuration settings, constants, and session state initialization. """ import streamlit as st import queue def initialize_session_state(): """Initialize all session state variables""" if "workflow_state" not in st.session_state: st.session_state.workflow_state = None if "workflow_thread" not in st.session_state: st.session_state.workflow_thread = None if "status_queue" not in st.session_state: st.session_state.status_queue = queue.Queue() if "logs" not in st.session_state: st.session_state.logs = [] if "error_details" not in st.session_state: st.session_state.error_details = [] if "current_step" not in st.session_state: st.session_state.current_step = None if "alert_submitted" not in st.session_state: st.session_state.alert_submitted = False if "show_sql" not in st.session_state: st.session_state.show_sql = False if "show_code" not in st.session_state: st.session_state.show_code = False if "environment_ready" not in st.session_state: st.session_state.environment_ready = False if "agents_loaded" not in st.session_state: st.session_state.agents_loaded = False if "initialization_attempted" not in st.session_state: st.session_state.initialization_attempted = False # Constants STEPS = ["planning", "data_collection", "analysis", "validation", "insights", "complete"] # Alert templates ALERT_TEMPLATES = { "Sales Decline": "Sales of DrugX down 15% in Northeast region over past 30 days compared to forecast.", "Market Share Loss": "Market share of DrugX decreased by 8 percentage points in the Southeast region over the last quarter.", "Inventory Issue": "Multiple stockouts of DrugX reported in Midwest distribution centers affecting 25% of pharmacies.", "Competitor Launch": "Competitor MedCorp launched similar product at 20% lower price point in Western territories.", "Custom Alert": "" } # Database path DB_PATH = "data/pharma_db.sqlite" # Required directories REQUIRED_DIRS = ["data", "agents", "workflows", "utils", "ui"] # Agent animation settings THINKING_MESSAGES = [ "Identifying required data sources...", "Determining appropriate analytical approaches...", "Creating task dependency graph...", "Designing validation strategy..." ] # Visualization settings CHART_COLORS = { "primary": "blue", "secondary": "green", "warning": "red", "neutral": "gray" } # Priority colors for action items PRIORITY_COLORS = { "High": "red", "Medium": "orange", "Low": "blue" }