A mobile-first hospital queue management system with QR-based registration, department-based queue segmentation, waiting time prediction, and a publicly accessible live dashboard.
- QR-Based Registration: Patients scan a QR code at hospital entrance and register via mobile web interface
- Department-Based Queues: 5 separate queues for different hospital services
- Real-Time Updates: Live dashboard updates every 5 seconds, patient status updates every 10 seconds
- Waiting Time Prediction: Intelligent estimation based on queue position and average service time
- Crowd Level Monitoring: Color-coded indicators (Green/Yellow/Red) for department and hospital-wide crowd levels
- Mobile-First Design: Optimized for smartphones with touch-friendly buttons and responsive layout
- Medical Theme: Clean, professional design with blue, white, and green color scheme
- Backend: Python Flask with SQLAlchemy ORM
- Database: SQLite
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Real-Time Updates: AJAX polling
- Python 3.8 or higher
- pip (Python package manager)
-
Clone or navigate to the project directory:
cd Team-6-Project_Building -
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Access the application:
- Open your browser and navigate to:
http://localhost:5000 - For mobile testing on the same network:
http://[your-computer-ip]:5000
- Open your browser and navigate to:
To create a QR code for hospital entrance:
-
Generate QR Code pointing to your application URL:
- For local testing:
http://[your-computer-ip]:5000/ - For production:
https://yourdomain.com/
- For local testing:
-
QR Code Generation Options:
- Use online QR generators (e.g., qr-code-generator.com)
- Or use Python's qrcode library:
import qrcode qr = qrcode.make('http://your-url:5000/') qr.save('hospital_entrance_qr.png')
-
Print and Display the QR code at hospital entrance
Team-6-Project_Building/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── README.md # This file
├── hospital_queue.db # SQLite database (auto-created)
├── static/
│ └── css/
│ └── style.css # Responsive CSS with medical theme
└── templates/
├── base.html # Base template
├── landing.html # Landing page (QR entry point)
├── register.html # Queue registration form
├── status.html # Patient status tracker
└── dashboard.html # Live public dashboard
- 👨⚕️ Doctor Consultation (15 min avg service time)
- 💊 Pharmacy / Medicine Pickup (5 min avg service time)
- 🩸 Blood Test / Laboratory (10 min avg service time)
- 🔬 Radiology / Scanning (X-ray, MRI, CT) (20 min avg service time)
- 📄 Medical Report Collection (3 min avg service time)
GET /- Landing pageGET /register- Registration formPOST /register- Submit registrationGET /status/<user_id>- User status pageGET /dashboard- Live public dashboard
GET /api/department_status- Department-wise queue data (JSON)GET /api/hospital_overview- Hospital-wide metrics (JSON)GET /api/patient_status/<patient_id>- Individual patient status (JSON)GET /api/waiting_patients- List of all waiting patients (JSON)POST /api/leave_queue- Patient leaves/cancels queue registration (JSON)POST /api/mark_served- Mark patient as served (JSON)
- Scan QR Code at hospital entrance
- Enter Details: Name/Patient ID and select department
- Receive Queue Number with estimated waiting time
- Monitor Status: Auto-refreshing status page shows live position
- Get Notified: When position approaches, head to department
- View Dashboard: Monitor all department queues in real-time
- Track Crowd Levels: Color-coded indicators show busy departments
- Manage Flow: Use insights to allocate resources
- Low (Green): 0-10 patients
- Moderate (Yellow): 11-25 patients
- High (Red): 26+ patients
- Low (Green): 0-40 patients
- Moderate (Yellow): 41-80 patients
- High (Red): 81+ patients
Estimated Waiting Time = (Position in Queue - 1) × Average Service Time
Example: If you're 5th in line for Doctor Consultation (15 min avg):
Waiting Time = (5 - 1) × 15 = 60 minutes
- Register multiple patients in different departments
- Open dashboard in another tab to see live updates
- Monitor status page to see position changes
- Test on mobile device for responsive design
Use the API endpoint to simulate patient service:
curl -X POST http://localhost:5000/api/mark_served \
-H "Content-Type: application/json" \
-d '{"patient_id": 1}'Patients can leave the queue using the "Leave Queue" button on their status page, or via API:
curl -X POST http://localhost:5000/api/leave_queue \
-H "Content-Type: application/json" \
-d '{"patient_id": 1}'Patients are automatically removed from the queue if they don't show up within their estimated waiting time plus a grace period.
Configuration:
- Grace Period: 5 minutes (configurable in
app.pyasTIMEOUT_GRACE_PERIOD) - Calculation:
Registration Time + Estimated Wait Time + Grace Period - Status: Timed-out patients are marked as
'timeout'
Example:
- Patient registers at 14:00
- Estimated wait time: 15 minutes
- Grace period: 5 minutes
- Auto-removal time: 14:20 (14:00 + 15 + 5)
The timeout check runs automatically on every dashboard and API refresh.
- ✅ Responsive design (mobile-first approach)
- ✅ Touch-friendly buttons (minimum 48px height)
- ✅ Large, readable fonts
- ✅ High contrast for accessibility
- ✅ Fast loading with minimal dependencies
- ✅ Works offline after initial load (static assets cached)
- Chrome/Edge (recommended)
- Firefox
- Safari (iOS/macOS)
- Mobile browsers (Android/iOS)
- SMS/Email notifications when turn approaches
- Flask-SocketIO for WebSocket-based real-time updates
- Admin panel for managing departments and service times
- Patient history and analytics
- Multi-language support
- PWA (Progressive Web App) for offline functionality
- Integration with hospital management systems
If you encounter database errors, delete hospital_queue.db and restart the application. The database will be recreated automatically.
If port 5000 is already in use, modify the last line in app.py:
app.run(debug=True, host='0.0.0.0', port=5001) # Change port numberEnsure your mobile device is on the same network and firewall allows connections to port 5000.
This project is created for educational purposes.
For issues or questions, please refer to the implementation documentation.
Built with ❤️ for better hospital queue management