Skip to content

Latest commit

 

History

History
304 lines (253 loc) · 8.26 KB

File metadata and controls

304 lines (253 loc) · 8.26 KB

Deployment Checklist - Patient Booking Fix

✅ Local Testing (Complete These First)

1. Database Setup

  • Run python seed_data.py to create test data
  • Verify output shows:
    • ✅ Admin user created
    • ✅ Test user created
    • ✅ Departments, doctors, patients created
  • Run python test_connection.py to verify connections
  • Confirm output shows "ALL APPOINTMENTS PROPERLY LINKED!"

2. Application Testing

  • Start app with python run.py
  • Open browser to http://localhost:5000
  • Verify homepage loads without errors

3. Patient Flow Testing

  • Login as patient (test@patient.com / test123)
  • Navigate to "Book Appointment"
  • Verify form shows:
    • "Booking for: Test Patient" at top
    • Phone number displayed (not editable)
    • NO fields for name, age, gender
    • Fields for department, doctor, date, time, symptoms
  • Select appointment details:
    • Department: Any (e.g., General Medicine)
    • Doctor: Any available
    • Date: Tomorrow or later
    • Time: Any available slot
    • Symptoms: "Test booking"
  • Click "Confirm Booking"
  • Verify success message appears
  • Navigate to "My Dashboard"
  • Verify appointment appears in "Upcoming Appointments"
  • Note the appointment number (e.g., APT-20260226-001)

4. Admin Flow Testing

  • Logout from patient account
  • Login as admin (admin@hospital.com / admin123)
  • Navigate to "Appointments"
  • Set date filter to match your booking date
  • Verify appointment appears with:
    • Correct appointment number
    • Patient name: "Test Patient"
    • Phone: "+91-8888888888"
    • Status: "Scheduled"
    • Check-in and cancel buttons visible
  • Click check-in button (✓)
  • Verify status changes to "Checked In"
  • Refresh patient dashboard
  • Verify status updated there too

5. Multiple Bookings Test

  • Login as patient again
  • Book 2 more appointments (different dates/times)
  • Verify all 3 appear in patient dashboard
  • Login as admin
  • Verify all 3 appear in admin panel
  • Verify all show "Test Patient" as patient name

6. New User Registration Test

  • Logout from all accounts
  • Click "Register" (patient registration)
  • Create new account:
  • Login with new account
  • Book an appointment
  • Verify it appears in patient dashboard
  • Login as admin
  • Verify appointment shows your test name

🚀 Production Deployment

1. Code Preparation

  • All local tests passing
  • No console errors in browser
  • No Python errors in terminal
  • Database connections verified

2. Git Commit

git add .
git commit -m "Fix: Patient-admin appointment connection

- Updated patient booking form to use logged-in user info
- Removed redundant patient info fields from booking form
- Added test user account with linked patient record
- Created test scripts and documentation
- All appointments now properly linked and visible to admin"
git push origin main

3. Vercel Deployment

  • Push code to GitHub
  • Vercel auto-deploys from main branch
  • Check deployment logs for errors
  • Verify build succeeds

4. Database Setup (Production)

  • Add PostgreSQL database (Supabase recommended)
  • Add DATABASE_URL to Vercel environment variables
    • Go to Vercel dashboard
    • Project Settings → Environment Variables
    • Add: DATABASE_URL = postgresql://...
  • Redeploy to apply environment variables

5. Production Testing

  • Visit your Vercel URL
  • Register a new patient account
  • Book an appointment
  • Login as admin (create admin via database if needed)
  • Verify appointment appears in admin panel
  • Test check-in/cancel functionality

6. Admin Account Setup (Production)

If admin account doesn't exist in production:

# Create admin_setup.py
from app import create_app, db
from app.models.user import User

app = create_app()
with app.app_context():
    admin = User(
        name="Admin",
        email="admin@yourdomain.com",
        phone="+91-9999999999",
        role="admin",
        is_active=True,
        is_verified=True
    )
    admin.set_password("your-secure-password")
    db.session.add(admin)
    db.session.commit()
    print("Admin created!")

Run once on production database.


🔍 Verification Steps

Database Integrity Check

# Run on production (if possible)
python test_connection.py

Expected output:

✅ Test User Found
✅ Patient Record
✅ ALL APPOINTMENTS PROPERLY LINKED!

Manual Verification

  1. Create 3 test appointments as different patients
  2. Verify all appear in admin panel
  3. Verify patient names are correct
  4. Test check-in functionality
  5. Test cancel functionality
  6. Verify status updates appear in both views

📋 Post-Deployment Checklist

Functionality

  • Patient registration works
  • Patient login works
  • Patient can book appointments
  • Appointments appear in patient dashboard
  • Admin login works
  • Admin can see all appointments
  • Admin can check-in patients
  • Admin can cancel appointments
  • Status updates reflect in both views

Performance

  • Pages load in < 3 seconds
  • No database timeout errors
  • No 500 errors in logs
  • Forms submit successfully

Security

  • CSRF protection enabled (set WTF_CSRF_ENABLED = True in production)
  • Passwords are hashed
  • Admin routes protected with @admin_required
  • Patient routes protected with @user_required
  • No sensitive data in logs

User Experience

  • Success messages appear after actions
  • Error messages are clear
  • Navigation is intuitive
  • Mobile responsive (test on phone)

🐛 Troubleshooting

Issue: Appointments not showing in admin panel

Check:

  • Date filter matches appointment date
  • Department filter set to "All"
  • Status filter set to "All"
  • Database connection working
  • Run test_connection.py to verify links

Issue: "Please complete your profile first"

Solution:

  • User doesn't have linked patient record
  • This shouldn't happen with new registrations
  • Check User.patient_id is set correctly
  • Verify Patient record exists

Issue: Form validation errors

Check:

  • All required fields filled
  • Date is in future
  • Time slot is available
  • Doctor is available on selected date

Issue: Database errors

Solution:

  • Check DATABASE_URL is correct
  • Verify PostgreSQL is running
  • Check connection limits
  • Review Vercel logs

📊 Success Criteria

Must Have (Critical)

  • ✅ Patients can register and login
  • ✅ Patients can book appointments
  • ✅ Appointments appear in patient dashboard
  • ✅ Appointments appear in admin panel with patient names
  • ✅ Admin can check-in and cancel appointments

Should Have (Important)

  • ✅ SMS confirmations sent (if Twilio configured)
  • ✅ Appointment numbers generated correctly
  • ✅ Status updates reflect immediately
  • ✅ No duplicate bookings for same slot

Nice to Have (Optional)

  • ⭕ Email confirmations
  • ⭕ Appointment reminders
  • ⭕ Patient profile editing
  • ⭕ Booking for family members

📞 Support Resources

Documentation

  • FIX_SUMMARY.md - Complete overview
  • PATIENT_BOOKING_FIX.md - Technical details
  • TESTING_GUIDE.md - Testing instructions
  • ARCHITECTURE_DIAGRAM.md - System architecture
  • QUICK_FIX_REFERENCE.md - Quick reference

Test Scripts

  • test_connection.py - Verify database connections
  • seed_data.py - Create test data

Test Accounts (Local)

  • Admin: admin@hospital.com / admin123
  • Patient: test@patient.com / test123

✅ Final Sign-Off

  • All local tests passed
  • Code committed to Git
  • Deployed to production
  • Production database configured
  • Production testing completed
  • Admin account created
  • Documentation reviewed
  • Team notified of changes

Deployment Status: Ready for Production ✅ Last Updated: February 25, 2026 Tested By: _____________ Deployed By: _____________ Date: _____________