Rathapoom commited on
Commit
54d9d0f
·
verified ·
1 Parent(s): 392d9ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -122,6 +122,9 @@ def main():
122
  # Medication Selection with Checkboxes
123
  st.subheader("Select Medications to Display")
124
 
 
 
 
125
  # Define medications by rows
126
  medication_rows = [
127
  ["Alendronate", "Risedronate", "Ibandronate oral"],
@@ -134,11 +137,15 @@ def main():
134
 
135
  # Create checkboxes for each row
136
  selected_medications = []
137
- for row in medication_rows:
138
- cols = st.columns(len(row))
139
- for col, med in zip(cols, row):
140
- if col.checkbox(med):
141
- selected_medications.append(med)
 
 
 
 
142
 
143
  # Load constants and medication data
144
  medication_data = load_medication_data()
@@ -150,7 +157,7 @@ def main():
150
  filtered_predictions = [pred for pred in all_predictions if pred['Drug'] in selected_medications]
151
 
152
  if not filtered_predictions:
153
- st.warning("No medications selected. Please select at least one medication to display predictions.")
154
  else:
155
  display_results(filtered_predictions, selected_site)
156
 
 
122
  # Medication Selection with Checkboxes
123
  st.subheader("Select Medications to Display")
124
 
125
+ # Add "Show All" Option
126
+ show_all = st.checkbox("Show All Medications")
127
+
128
  # Define medications by rows
129
  medication_rows = [
130
  ["Alendronate", "Risedronate", "Ibandronate oral"],
 
137
 
138
  # Create checkboxes for each row
139
  selected_medications = []
140
+ if not show_all:
141
+ for row in medication_rows:
142
+ cols = st.columns(len(row))
143
+ for col, med in zip(cols, row):
144
+ if col.checkbox(med):
145
+ selected_medications.append(med)
146
+ else:
147
+ # If "Show All" is checked, include all medications
148
+ selected_medications = [med for row in medication_rows for med in row]
149
 
150
  # Load constants and medication data
151
  medication_data = load_medication_data()
 
157
  filtered_predictions = [pred for pred in all_predictions if pred['Drug'] in selected_medications]
158
 
159
  if not filtered_predictions:
160
+ st.warning("No medications selected. Please select at least one medication or use the 'Show All' option.")
161
  else:
162
  display_results(filtered_predictions, selected_site)
163