Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,9 @@ 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 |
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
|
@@ -108,13 +111,12 @@ def generate_goal_summary(predictions, target_tscore=2.4):
|
|
108 |
goal_reached_sorted = sorted(goal_reached, key=lambda x: x['Year'])
|
109 |
return goal_reached_sorted
|
110 |
|
111 |
-
|
112 |
# Display summary of goal-reaching medications
|
113 |
def display_goal_summary(goal_summary):
|
114 |
-
st.subheader("Goal Treatment Summary (
|
115 |
|
116 |
if not goal_summary:
|
117 |
-
st.info("No medications reach the target
|
118 |
else:
|
119 |
summary_table = pd.DataFrame(goal_summary)
|
120 |
st.table(summary_table)
|
|
|
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
|
|
|
111 |
goal_reached_sorted = sorted(goal_reached, key=lambda x: x['Year'])
|
112 |
return goal_reached_sorted
|
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.")
|
120 |
else:
|
121 |
summary_table = pd.DataFrame(goal_summary)
|
122 |
st.table(summary_table)
|