Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,14 +2,14 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
|
4 |
# Placeholder data structures (replace with actual data sources)
|
5 |
-
if 'drivers' not in st.session_state:
|
6 |
st.session_state.drivers = pd.DataFrame(columns=["driver_id", "name", "location", "status"])
|
7 |
if 'orders' not in st.session_state:
|
8 |
st.session_state.orders = pd.DataFrame(columns=["order_id", "pickup_location", "dropoff_location", "status"])
|
9 |
if 'zone_pressure' not in st.session_state:
|
10 |
st.session_state.zone_pressure = pd.DataFrame(columns=['zone_id', 'pressure_level'])
|
11 |
-
if '
|
12 |
-
st.session_state.
|
13 |
|
14 |
# Basic UI structure
|
15 |
st.title("Dispatch Call Scheduler")
|
@@ -27,8 +27,8 @@ with st.sidebar:
|
|
27 |
# Order Management page
|
28 |
if selected_page == "Order Management":
|
29 |
st.subheader("Order Management")
|
30 |
-
|
31 |
-
# Add new order
|
32 |
with st.form("add_order_form"):
|
33 |
st.write("Add New Order")
|
34 |
order_id = st.text_input("Order ID")
|
@@ -37,10 +37,8 @@ if selected_page == "Order Management":
|
|
37 |
status = st.selectbox("Status", ["Pending", "In Progress", "Completed"])
|
38 |
submitted = st.form_submit_button("Add Order")
|
39 |
if submitted:
|
40 |
-
new_order = pd.DataFrame({"order_id":[order_id],
|
41 |
-
"
|
42 |
-
"dropoff_location":[dropoff_location],
|
43 |
-
"status":[status]})
|
44 |
st.session_state.orders = pd.concat([st.session_state.orders, new_order], ignore_index=True)
|
45 |
|
46 |
# Display order list
|
@@ -49,8 +47,8 @@ if selected_page == "Order Management":
|
|
49 |
# Driver Management page
|
50 |
elif selected_page == "Driver Management":
|
51 |
st.subheader("Driver Management")
|
52 |
-
|
53 |
-
# Add new driver
|
54 |
with st.form("add_driver_form"):
|
55 |
st.write("Add New Driver")
|
56 |
driver_id = st.text_input("Driver ID")
|
@@ -59,37 +57,35 @@ elif selected_page == "Driver Management":
|
|
59 |
status = st.selectbox("Status", ["Available", "On Duty", "Offline"])
|
60 |
submitted = st.form_submit_button("Add Driver")
|
61 |
if submitted:
|
62 |
-
new_driver = pd.DataFrame({"driver_id":[driver_id],
|
63 |
-
"
|
64 |
-
"location":[location],
|
65 |
-
"status":[status]})
|
66 |
st.session_state.drivers = pd.concat([st.session_state.drivers, new_driver], ignore_index=True)
|
67 |
|
68 |
# Display driver list
|
69 |
st.write(st.session_state.drivers)
|
70 |
|
71 |
-
# Zone
|
72 |
elif selected_page == "Zone Pressure":
|
73 |
st.subheader("Dynamic Zone Pressure Monitoring")
|
74 |
|
75 |
-
# Add new zone
|
76 |
-
with st.form("
|
77 |
-
st.write("Add
|
78 |
zone_id = st.text_input("Zone ID")
|
79 |
pressure_level = st.number_input("Pressure Level", min_value=0, max_value=10, value=0)
|
80 |
-
submitted = st.form_submit_button("Add Zone")
|
81 |
if submitted:
|
82 |
-
|
83 |
-
st.session_state.zone_pressure = pd.concat([st.session_state.zone_pressure,
|
84 |
|
85 |
-
# Display zone pressure
|
86 |
st.write(st.session_state.zone_pressure)
|
87 |
|
88 |
# Analytics Dashboard page
|
89 |
elif selected_page == "Analytics":
|
90 |
st.subheader("Analytics Dashboard")
|
91 |
|
92 |
-
# Add analytics information
|
93 |
with st.form("add_analytics_form"):
|
94 |
st.write("Add Analytics Information")
|
95 |
performance_indicators = st.text_input("Performance Indicators")
|
@@ -97,14 +93,14 @@ elif selected_page == "Analytics":
|
|
97 |
delivery_times = st.text_input("Delivery Times")
|
98 |
delivery_delay = st.text_input("Delivery Delay")
|
99 |
customer_satisfaction = st.text_input("Customer Satisfaction")
|
100 |
-
submitted = st.form_submit_button("Add Analytics")
|
101 |
if submitted:
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
st.session_state.
|
108 |
|
109 |
# Display analytics information
|
110 |
-
st.write(st.session_state.
|
|
|
2 |
import pandas as pd
|
3 |
|
4 |
# Placeholder data structures (replace with actual data sources)
|
5 |
+
if 'drivers' not in st.session_state: # Initialize if not already in session state
|
6 |
st.session_state.drivers = pd.DataFrame(columns=["driver_id", "name", "location", "status"])
|
7 |
if 'orders' not in st.session_state:
|
8 |
st.session_state.orders = pd.DataFrame(columns=["order_id", "pickup_location", "dropoff_location", "status"])
|
9 |
if 'zone_pressure' not in st.session_state:
|
10 |
st.session_state.zone_pressure = pd.DataFrame(columns=['zone_id', 'pressure_level'])
|
11 |
+
if 'analytics' not in st.session_state:
|
12 |
+
st.session_state.analytics = pd.DataFrame(columns=['performance_indicators', 'drivers_trips', 'delivery_times', 'delivery_delay', 'customer_satisfaction'])
|
13 |
|
14 |
# Basic UI structure
|
15 |
st.title("Dispatch Call Scheduler")
|
|
|
27 |
# Order Management page
|
28 |
if selected_page == "Order Management":
|
29 |
st.subheader("Order Management")
|
30 |
+
|
31 |
+
# Add new order
|
32 |
with st.form("add_order_form"):
|
33 |
st.write("Add New Order")
|
34 |
order_id = st.text_input("Order ID")
|
|
|
37 |
status = st.selectbox("Status", ["Pending", "In Progress", "Completed"])
|
38 |
submitted = st.form_submit_button("Add Order")
|
39 |
if submitted:
|
40 |
+
new_order = pd.DataFrame({"order_id": [order_id], "pickup_location": [pickup_location],
|
41 |
+
"dropoff_location": [dropoff_location], "status": [status]})
|
|
|
|
|
42 |
st.session_state.orders = pd.concat([st.session_state.orders, new_order], ignore_index=True)
|
43 |
|
44 |
# Display order list
|
|
|
47 |
# Driver Management page
|
48 |
elif selected_page == "Driver Management":
|
49 |
st.subheader("Driver Management")
|
50 |
+
|
51 |
+
# Add new driver
|
52 |
with st.form("add_driver_form"):
|
53 |
st.write("Add New Driver")
|
54 |
driver_id = st.text_input("Driver ID")
|
|
|
57 |
status = st.selectbox("Status", ["Available", "On Duty", "Offline"])
|
58 |
submitted = st.form_submit_button("Add Driver")
|
59 |
if submitted:
|
60 |
+
new_driver = pd.DataFrame({"driver_id": [driver_id], "name": [name],
|
61 |
+
"location": [location], "status": [status]})
|
|
|
|
|
62 |
st.session_state.drivers = pd.concat([st.session_state.drivers, new_driver], ignore_index=True)
|
63 |
|
64 |
# Display driver list
|
65 |
st.write(st.session_state.drivers)
|
66 |
|
67 |
+
# Zone Pressure page
|
68 |
elif selected_page == "Zone Pressure":
|
69 |
st.subheader("Dynamic Zone Pressure Monitoring")
|
70 |
|
71 |
+
# Add new zone pressure data
|
72 |
+
with st.form("add_zone_pressure_form"):
|
73 |
+
st.write("Add Zone Pressure Data")
|
74 |
zone_id = st.text_input("Zone ID")
|
75 |
pressure_level = st.number_input("Pressure Level", min_value=0, max_value=10, value=0)
|
76 |
+
submitted = st.form_submit_button("Add Zone Data")
|
77 |
if submitted:
|
78 |
+
new_zone_data = pd.DataFrame({"zone_id": [zone_id], "pressure_level": [pressure_level]})
|
79 |
+
st.session_state.zone_pressure = pd.concat([st.session_state.zone_pressure, new_zone_data], ignore_index=True)
|
80 |
|
81 |
+
# Display zone pressure data
|
82 |
st.write(st.session_state.zone_pressure)
|
83 |
|
84 |
# Analytics Dashboard page
|
85 |
elif selected_page == "Analytics":
|
86 |
st.subheader("Analytics Dashboard")
|
87 |
|
88 |
+
# Add analytics information (consider using a more structured input method)
|
89 |
with st.form("add_analytics_form"):
|
90 |
st.write("Add Analytics Information")
|
91 |
performance_indicators = st.text_input("Performance Indicators")
|
|
|
93 |
delivery_times = st.text_input("Delivery Times")
|
94 |
delivery_delay = st.text_input("Delivery Delay")
|
95 |
customer_satisfaction = st.text_input("Customer Satisfaction")
|
96 |
+
submitted = st.form_submit_button("Add Analytics Data")
|
97 |
if submitted:
|
98 |
+
new_analytics_data = pd.DataFrame({"performance_indicators": [performance_indicators],
|
99 |
+
"drivers_trips": [drivers_trips],
|
100 |
+
"delivery_times": [delivery_times],
|
101 |
+
"delivery_delay": [delivery_delay],
|
102 |
+
"customer_satisfaction": [customer_satisfaction]})
|
103 |
+
st.session_state.analytics = pd.concat([st.session_state.analytics, new_analytics_data], ignore_index=True)
|
104 |
|
105 |
# Display analytics information
|
106 |
+
st.write(st.session_state.analytics)
|