|
|
""" |
|
|
Supply Roster Optimization Tool - Streamlit App |
|
|
Simplified version with configuration and optimization results |
|
|
""" |
|
|
|
|
|
import streamlit as st |
|
|
import sys |
|
|
import os |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
st.set_page_config( |
|
|
page_title="Supply Roster Optimization Tool", |
|
|
page_icon="π¦", |
|
|
layout="wide", |
|
|
initial_sidebar_state="expanded" |
|
|
) |
|
|
|
|
|
|
|
|
st.sidebar.title("π¦ Supply Roster Tool") |
|
|
st.sidebar.markdown("---") |
|
|
|
|
|
|
|
|
page = st.sidebar.selectbox( |
|
|
"Navigate to:", |
|
|
["βοΈ Settings", "π Optimization Results", "π Demand Validation"], |
|
|
index=0 |
|
|
) |
|
|
|
|
|
|
|
|
if page == "βοΈ Settings": |
|
|
|
|
|
st.title("π¦ Supply Roster Optimization Tool") |
|
|
st.markdown("---") |
|
|
render_config_page() |
|
|
|
|
|
elif page == "π Optimization Results": |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.") |
|
|
|
|
|
|
|
|
|
|
|
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": |
|
|
|
|
|
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.") |
|
|
|