Rathapoom commited on
Commit
392d9ef
·
verified ·
1 Parent(s): 05f0c46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -3
app.py CHANGED
@@ -119,14 +119,40 @@ def main():
119
  format="%.3f"
120
  )
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  # Load constants and medication data
123
  medication_data = load_medication_data()
124
  constants = REGRESSION_CONSTANTS.get(selected_site, {})
125
 
126
- # Generate and display predictions
127
  if st.button("Predict"):
128
- predictions = generate_predictions(medication_data, site, bmd_patient, constants['mu'], constants['sigma'])
129
- display_results(predictions, selected_site)
 
 
 
 
 
130
 
131
  if __name__ == "__main__":
132
  main()
 
119
  format="%.3f"
120
  )
121
 
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"],
128
+ ["Zoledronate", "Ibandronate IV (3mg)"],
129
+ ["Denosumab", "Denosumab + Teriparatide"],
130
+ ["Teriparatide", "Teriparatide + Denosumab"],
131
+ ["Romosozumab", "Romosozumab + Denosumab", "Romosozumab + Alendronate"],
132
+ ["Romosozumab + Ibandronate", "Romosozumab + Zoledronate"]
133
+ ]
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()
145
  constants = REGRESSION_CONSTANTS.get(selected_site, {})
146
 
147
+ # Generate and display predictions for selected medications
148
  if st.button("Predict"):
149
+ all_predictions = generate_predictions(medication_data, site, bmd_patient, constants['mu'], constants['sigma'])
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
 
157
  if __name__ == "__main__":
158
  main()