Skip to content

Commit 508e027

Browse files
committed
chore(5-min-viz): improve layout of UI
1 parent 8bdd12b commit 508e027

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

pems_streamlit/src/pems_streamlit/apps/districts/app_stations.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,23 @@ def main():
5353

5454
df_station_metadata = load_station_metadata(district_number)
5555

56-
map_placeholder = st.empty()
56+
col1, col2 = st.columns([0.25, 0.75])
5757

58-
station = st.selectbox("Station", df_station_metadata["STATION_ID"], index=None)
59-
60-
quantity = st.multiselect("Quantity", ["VOLUME_SUM", "OCCUPANCY_AVG", "SPEED_FIVE_MINS"])
61-
62-
if station:
63-
num_lanes = int(df_station_metadata[df_station_metadata["STATION_ID"] == station]["PHYSICAL_LANES"].iloc[0])
64-
lane = st.multiselect(
65-
"Lane",
66-
list(range(1, num_lanes + 1)),
67-
)
58+
with col1:
59+
station = st.selectbox("Station", df_station_metadata["STATION_ID"], index=None)
60+
lane = None
61+
if station:
62+
num_lanes = int(df_station_metadata[df_station_metadata["STATION_ID"] == station]["PHYSICAL_LANES"].iloc[0])
63+
lane = st.multiselect(
64+
"Lane",
65+
list(range(1, num_lanes + 1)),
66+
)
67+
quantity = st.multiselect("Quantity", ["VOLUME_SUM", "OCCUPANCY_AVG", "SPEED_FIVE_MINS"])
68+
days = st.multiselect("Days", get_available_days())
69+
station_data_button = st.button("Load Station Data", type="primary")
70+
71+
with col2:
72+
map_placeholder = st.empty()
6873

6974
with map_placeholder:
7075
if station:
@@ -73,15 +78,13 @@ def main():
7378
else:
7479
map_district_summary(df_station_metadata)
7580

76-
days = st.multiselect("Days", get_available_days())
77-
78-
station_data_button = st.button("Load Station Data", type="primary")
79-
8081
error_placeholder = st.empty()
8182
plot_placeholder = st.empty()
8283

8384
if station_data_button:
8485
error_messages = []
86+
if not station:
87+
error_messages.append("- Please select a station to proceed.")
8588
if len(quantity) == 0 or len(quantity) > 2:
8689
error_messages.append("- Please select one or two quantities to proceed.")
8790
if not lane:

0 commit comments

Comments
 (0)