@@ -75,13 +75,24 @@ def main():
75
75
station_data_button = st .button ("Load Station Data" , type = "primary" )
76
76
77
77
if station_data_button :
78
- df_station_data = load_station_data (station )
79
- filtered_df = df_station_data [
80
- (df_station_data ["SAMPLE_TIMESTAMP" ].dt .day .isin (days )) & (df_station_data ["LANE" ].isin (lane ))
81
- ]
82
- st .dataframe (df_station_data , use_container_width = True )
83
- filtered_df_sorted = filtered_df .sort_values (by = "SAMPLE_TIMESTAMP" )
84
- plot_5_min_traffic_data (filtered_df_sorted , quantity , lane )
78
+ error_messages = []
79
+ if len (quantity ) == 0 or len (quantity ) > 2 :
80
+ error_messages .append ("- Please select one or two quantities to proceed." )
81
+ if not lane :
82
+ error_messages .append ("- Please select at least one lane to proceed." )
83
+ if not days :
84
+ error_messages .append ("- Please select at least one day to proceed." )
85
+ if error_messages :
86
+ full_error_message = "\n " .join (error_messages )
87
+ st .error (full_error_message )
88
+ else :
89
+ df_station_data = load_station_data (station )
90
+ filtered_df = df_station_data [
91
+ (df_station_data ["SAMPLE_TIMESTAMP" ].dt .day .isin (days )) & (df_station_data ["LANE" ].isin (lane ))
92
+ ]
93
+ st .dataframe (df_station_data , use_container_width = True )
94
+ filtered_df_sorted = filtered_df .sort_values (by = "SAMPLE_TIMESTAMP" )
95
+ plot_5_min_traffic_data (filtered_df_sorted , quantity , lane )
85
96
86
97
87
98
if __name__ == "__main__" :
0 commit comments