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.")