Rathapoom commited on
Commit
9141e76
·
verified ·
1 Parent(s): 094d1d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -10
app.py CHANGED
@@ -127,6 +127,52 @@ def display_goal_summary(goal_summary):
127
  summary_table = pd.DataFrame(goal_summary)
128
  st.table(summary_table)
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  # Streamlit UI
131
  # Main function
132
  def main():
@@ -173,16 +219,7 @@ def main():
173
  ]
174
 
175
  # Create checkboxes for each row
176
- selected_medications = []
177
- if not show_all:
178
- for row in medication_rows:
179
- cols = st.columns(len(row))
180
- for col, med in zip(cols, row):
181
- if col.checkbox(med):
182
- selected_medications.append(med)
183
- else:
184
- # If "Show All" is checked, include all medications
185
- selected_medications = [med for row in medication_rows for med in row]
186
 
187
  # Load constants and medication data
188
  medication_data = load_medication_data()
 
127
  summary_table = pd.DataFrame(goal_summary)
128
  st.table(summary_table)
129
 
130
+ # Medication Selection with Collapsible Categories
131
+ def select_medications():
132
+ st.subheader("Select Medications to Display")
133
+ show_all = st.checkbox("Show All Medications")
134
+
135
+ selected_medications = []
136
+ if not show_all:
137
+ # Define categories and medications
138
+ categories = {
139
+ "Bisphosphonates": [
140
+ "Alendronate", "Risedronate", "Ibandronate oral",
141
+ "Zoledronate", "Ibandronate IV (3mg)"
142
+ ],
143
+ "RANK Ligand Inhibitors": [
144
+ "Denosumab", "Denosumab + Teriparatide"
145
+ ],
146
+ "Anabolic Agents": [
147
+ "Teriparatide", "Teriparatide + Denosumab"
148
+ ],
149
+ "Sclerostin Inhibitors": [
150
+ "Romosozumab", "Romosozumab + Denosumab",
151
+ "Romosozumab + Alendronate", "Romosozumab + Ibandronate",
152
+ "Romosozumab + Zoledronate"
153
+ ]
154
+ }
155
+
156
+ # Create collapsible sections
157
+ for category, medications in categories.items():
158
+ with st.expander(category):
159
+ for med in medications:
160
+ if st.checkbox(med):
161
+ selected_medications.append(med)
162
+ else:
163
+ # Include all medications if "Show All" is selected
164
+ selected_medications = [
165
+ "Alendronate", "Risedronate", "Ibandronate oral",
166
+ "Zoledronate", "Ibandronate IV (3mg)", "Denosumab",
167
+ "Denosumab + Teriparatide", "Teriparatide",
168
+ "Teriparatide + Denosumab", "Romosozumab",
169
+ "Romosozumab + Denosumab", "Romosozumab + Alendronate",
170
+ "Romosozumab + Ibandronate", "Romosozumab + Zoledronate"
171
+ ]
172
+
173
+ return selected_medications
174
+
175
+
176
  # Streamlit UI
177
  # Main function
178
  def main():
 
219
  ]
220
 
221
  # Create checkboxes for each row
222
+ selected_medications = select_medications()
 
 
 
 
 
 
 
 
 
223
 
224
  # Load constants and medication data
225
  medication_data = load_medication_data()