Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ def display_results(predictions, site):
|
|
92 |
)))
|
93 |
|
94 |
# Generate summary of medications reaching the target T-score
|
95 |
-
def generate_goal_summary(predictions, target_tscore
|
96 |
goal_reached = []
|
97 |
|
98 |
for result in predictions:
|
@@ -100,9 +100,6 @@ def generate_goal_summary(predictions, target_tscore=2.4):
|
|
100 |
predictions_data = result['Predictions']
|
101 |
|
102 |
for year, tscore in zip(predictions_data['Year'], predictions_data['Predicted T-score']):
|
103 |
-
# Debugging to confirm T-score values
|
104 |
-
print(f"Checking {drug}: Year = {year}, T-score = {tscore}")
|
105 |
-
|
106 |
if tscore >= target_tscore: # Check against Predicted T-score
|
107 |
goal_reached.append({'Medication': drug, 'Year': int(year)})
|
108 |
break # Stop checking further years for this drug
|
@@ -113,7 +110,7 @@ def generate_goal_summary(predictions, target_tscore=2.4):
|
|
113 |
|
114 |
# Display summary of goal-reaching medications
|
115 |
def display_goal_summary(goal_summary):
|
116 |
-
st.subheader("Goal Treatment Summary (T-score ≥ 2.4)")
|
117 |
|
118 |
if not goal_summary:
|
119 |
st.info("No medications reach the target T-score.")
|
@@ -191,7 +188,7 @@ def main():
|
|
191 |
st.warning("No medications selected. Please select at least one medication or use the 'Show All' option.")
|
192 |
else:
|
193 |
# Generate and display goal treatment summary
|
194 |
-
goal_summary = generate_goal_summary(filtered_predictions, target_tscore
|
195 |
display_goal_summary(goal_summary)
|
196 |
|
197 |
# Display individual medication results
|
|
|
92 |
)))
|
93 |
|
94 |
# Generate summary of medications reaching the target T-score
|
95 |
+
def generate_goal_summary(predictions, target_tscore=-2.4):
|
96 |
goal_reached = []
|
97 |
|
98 |
for result in predictions:
|
|
|
100 |
predictions_data = result['Predictions']
|
101 |
|
102 |
for year, tscore in zip(predictions_data['Year'], predictions_data['Predicted T-score']):
|
|
|
|
|
|
|
103 |
if tscore >= target_tscore: # Check against Predicted T-score
|
104 |
goal_reached.append({'Medication': drug, 'Year': int(year)})
|
105 |
break # Stop checking further years for this drug
|
|
|
110 |
|
111 |
# Display summary of goal-reaching medications
|
112 |
def display_goal_summary(goal_summary):
|
113 |
+
st.subheader("Goal Treatment Summary (T-score ≥ -2.4)")
|
114 |
|
115 |
if not goal_summary:
|
116 |
st.info("No medications reach the target T-score.")
|
|
|
188 |
st.warning("No medications selected. Please select at least one medication or use the 'Show All' option.")
|
189 |
else:
|
190 |
# Generate and display goal treatment summary
|
191 |
+
goal_summary = generate_goal_summary(filtered_predictions, target_tscore=-2.4)
|
192 |
display_goal_summary(goal_summary)
|
193 |
|
194 |
# Display individual medication results
|