haileyhalimj@gmail.com
π Reorganize project structure: Move UI files to dedicated directory
51b84b9 | """ | |
| Supply Roster Optimization Tool - Streamlit App | |
| Simplified version with configuration and optimization results | |
| """ | |
| import streamlit as st | |
| import sys | |
| import os | |
| from ui.pages.config_page import render_config_page | |
| from ui.pages.optimization_results import display_optimization_results | |
| from src.demand_validation_viz import display_demand_validation | |
| # Add src directory to path for imports | |
| sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'src')) | |
| # Set page config | |
| st.set_page_config( | |
| page_title="Supply Roster Optimization Tool", | |
| page_icon="π¦", | |
| layout="wide", | |
| initial_sidebar_state="expanded" | |
| ) | |
| # Sidebar navigation | |
| st.sidebar.title("π¦ Supply Roster Tool") | |
| st.sidebar.markdown("---") | |
| # Navigation | |
| page = st.sidebar.selectbox( | |
| "Navigate to:", | |
| ["βοΈ Settings", "π Optimization Results", "π Demand Validation"], | |
| index=0 | |
| ) | |
| # Main app content | |
| if page == "βοΈ Settings": | |
| # Import and render the config page | |
| st.title("π¦ Supply Roster Optimization Tool") | |
| st.markdown("---") | |
| render_config_page() | |
| elif page == "π Optimization Results": | |
| # Import and render the optimization results page | |
| # Check if we have results in session state | |
| if 'optimization_results' in st.session_state and st.session_state.optimization_results: | |
| display_optimization_results(st.session_state.optimization_results) | |
| else: | |
| st.title("π Optimization Results") | |
| st.info("π No optimization results available yet.") | |
| st.markdown("Please run an optimization from the **βοΈ Settings** page first to see results here.") | |
| # Add helpful instructions | |
| st.markdown("### π How to Get Results:") | |
| st.markdown("1. Go to **βοΈ Settings** page") | |
| st.markdown("2. Configure your optimization parameters") | |
| st.markdown("3. Click **π Optimize Schedule**") | |
| st.markdown("4. Return here to view detailed results and input data inspection") | |
| elif page == "π Demand Validation": | |
| # Import and render the demand validation page | |
| try: | |
| st.title("π Demand Data Validation") | |
| st.markdown("---") | |
| display_demand_validation() | |
| except ImportError as e: | |
| st.error(f"β Error loading demand validation module: {str(e)}") | |
| st.info("π‘ Please ensure the demand validation module is properly installed.") | |
| except Exception as e: | |
| st.error(f"β Error in demand validation: {str(e)}") | |
| st.info("π‘ Please check the data files and configuration.") | |