What was wrong: Patient bookings weren't showing in admin panel
What we fixed: Updated booking form to use logged-in user's patient record
Result: Appointments now properly linked and visible to both patient and admin β
# 1. Reset database with test accounts
python seed_data.py
# 2. Start application
python run.py
# 3. Test as patient (http://localhost:5000)
# Login: test@patient.com / test123
# Book an appointment
# 4. Test as admin
# Login: admin@hospital.com / admin123
# Check appointments panel - you'll see "Test Patient"ADMIN:
Email: admin@hospital.com
Password: admin123
PATIENT:
Email: test@patient.com
Password: test123
Before: Asked for name, age, gender, phone After: Shows logged-in user's info, only asks for appointment details
Before: Appointments might not link correctly After: All appointments properly linked via User β Patient β Appointment
python test_connection.pyShould show:
β
Test User Found
β
Patient Record
β
ALL APPOINTMENTS PROPERLY LINKED!
app/templates/patient/book.html- Updated booking formapp/routes/patient_portal.py- Booking logic (already correct)seed_data.py- Creates test accountstest_connection.py- Verifies database connections
- Login as patient β Book appointment
- Check patient dashboard β See appointment
- Login as admin β Check appointments panel
- Verify patient name appears correctly
- Test check-in/cancel buttons
- Patient info comes from user account (no form fields needed)
- Appointments automatically linked to logged-in user
- Admin sees all patient details immediately
- Database properly maintains User β Patient β Appointment relationships
FIX_SUMMARY.md- Complete overviewPATIENT_BOOKING_FIX.md- Technical detailsTESTING_GUIDE.md- Step-by-step testing
Status: β FIXED | Date: Feb 25, 2026