File size: 2,697 Bytes
ac5a7da 4d36152 51b84b9 ac5a7da 3d08e0e ac5a7da 131af7c ac5a7da 3d08e0e 51b84b9 3d08e0e 709359a 3d08e0e 709359a 3d08e0e 709359a 3d08e0e 51b84b9 3d08e0e |
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
"""
Supply Roster Optimization Tool - Streamlit App
Simplified version with configuration and optimization results
"""
import streamlit as st
import sys
import os
# Add project root to path BEFORE imports
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
sys.path.insert(0, project_root)
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
# 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.")
|