Skip to content

Commit f01fc0a

Browse files
committed
fix: PDF Download and Admin UI cleanup
1 parent 655dc30 commit f01fc0a

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

backend/pdf_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ def generate_medical_report(user_name: str, report_type: str, prediction: str, d
7878
pdf.set_text_color(100)
7979
pdf.multi_cell(0, 5, "DISCLAIMER: This report is generated by an automated analysis system for informational purposes only. It is NOT a substitute for a diagnosis by a Registered Medical Practitioner (RMP). Please consult a doctor for official medical advice.")
8080

81+
# Return bytes directly
8182
return bytes(pdf.output())

frontend/views/admin_view.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,30 @@ def render_admin_page():
117117
filtered_appts = [a for a in appointments if status_filter == "All" or a['status'] == status_filter]
118118

119119
if filtered_appts:
120+
# Pre-fetch user map for speed
121+
u_ids = list(set([a['user_id'] for a in appointments]))
122+
123+
# Manual fetch (or in real app, JOIN)
124+
# Currently we just show ID, let's try to fetch if we have the cache or just show ID
125+
120126
for appt in filtered_appts:
121127
date_str = appt['date_time'].replace("T", " ")[:16]
122128
color = "#34D399" if appt['status'] in ['Scheduled', 'Rescheduled'] else "#94A3B8"
123129

124-
with st.expander(f"{date_str} | {appt['specialist']} (ID: {appt['id']})"):
125-
c_a, c_b = st.columns([3, 1])
126-
with c_a:
127-
st.markdown(f"**Patient ID:** `{appt['user_id']}`")
128-
st.markdown(f"**Status:** <span style='color:{color}'>{appt['status']}</span>", unsafe_allow_html=True)
129-
st.markdown(f"**Reason:** {appt['reason']}")
130-
131-
with c_b:
132-
if st.button("🗑️ Delete", key=f"del_apt_{appt['id']}"):
133-
if api.delete_appointment(appt['id']):
134-
st.success("Deleted!")
135-
st.rerun()
130+
# Better Header
131+
header = f"📅 {date_str} | 👨‍⚕️ {appt['specialist']} | Patient ID: {appt['user_id']}"
132+
133+
with st.expander(header):
134+
c_a, c_b = st.columns([3, 1])
135+
with c_a:
136+
st.markdown(f"**Reason:** {appt['reason']}")
137+
st.markdown(f"**Status:** <span style='color:{color}'>{appt['status']}</span>", unsafe_allow_html=True)
138+
139+
with c_b:
140+
if st.button("🗑️ Delete", key=f"del_apt_{appt['id']}"):
141+
if api.delete_appointment(appt['id']):
142+
st.success("Deleted!")
143+
st.rerun()
136144
else:
137145
st.info(f"No {status_filter} appointments found.")
138146
else:

0 commit comments

Comments
 (0)