Skip to content

Commit 8056254

Browse files
committed
fix: Admin crash, Telemedicine visibility, and PDF reports
1 parent f01fc0a commit 8056254

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

backend/report.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from fastapi import APIRouter, UploadFile, File, HTTPException
1111
from typing import Dict, Any
1212
import logging
13-
from . import vision_service
13+
import json
14+
from . import vision_service, database, auth, models, pdf_service
1415

1516
# --- Logging ---
1617
# logging.basicConfig(level=logging.INFO) # Handled in main.py
@@ -120,4 +121,6 @@ def download_health_report(
120121

121122
except Exception as e:
122123
logger.error(f"PDF Generation Failed: {e}")
123-
raise HTTPException(status_code=500, detail="Could not generate report")
124+
# Return a fallback PDF or 500 based on preference.
125+
# For now, let's try to return a simple error PDF if possible, or just raise 500
126+
raise HTTPException(status_code=500, detail=f"PDF Generation Error: {str(e)}")

backend/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AppointmentCreate(BaseModel):
7676

7777
class AppointmentResponse(BaseModel):
7878
id: int
79+
user_id: int # Vital for Admin/Doctor visibility
7980
doctor_id: Optional[int] = None
8081
specialist: str
8182
date_time: datetime

frontend/views/telemedicine_view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ def render_telemedicine_page():
8181
# Color code status
8282
status_color = "#34D399" if status in ["Scheduled", "Rescheduled"] else "#F87171"
8383

84-
with st.expander(f"**{appt['specialist']}** - {date_str}"):
84+
# Dynamic Header
85+
header_text = f"**{appt['specialist']}** - {date_str}"
86+
if st.session_state.get('role') in ['admin', 'doctor']:
87+
header_text += f" | 👤 Patient ID: {appt.get('user_id', '?')}"
88+
89+
with st.expander(header_text):
8590
st.write(f"**Status:** <span style='color:{status_color}'>{status}</span>", unsafe_allow_html=True)
8691
st.write(f"**Reason:** {appt['reason']}")
8792

0 commit comments

Comments
 (0)