Skip to content

KaranDevda/queue-cure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Queue Cure

Real-time clinic queue management system. Replace paper tokens with live visibility into waiting times for both reception staff and patients.

Features

Receptionist Dashboard

  • Add patients with auto-generated daily token numbers
  • View the live waiting queue (FIFO)
  • Call Next — completes current consultation and advances the queue
  • Configure average consultation time for ETA calculations
  • Live statistics: current token, patients waiting, completed today, avg. consultation time

Patient Waiting Room

  • Enter token number to track position
  • See current token being served
  • Patients ahead and estimated wait time
  • Instant updates via Socket.IO (no page refresh)

Technical Highlights

  • FIFO queue with single active consultation
  • Real-time sync across all connected clients
  • Duplicate patient detection (same name already waiting)
  • Debounced Call Next to prevent rapid double-clicks
  • Automatic socket reconnection
  • Empty queue handling
  • Loading and error states throughout

Tech Stack

Layer Technologies
Frontend React, Vite, Tailwind CSS, Socket.IO Client, React Router
Backend Flask, Flask-SocketIO, SQLite

Project Structure

queue-cure/
├── backend/
│   ├── app.py                 # Flask + SocketIO entry point
│   ├── config.py              # Environment configuration
│   ├── extensions.py          # Shared SocketIO instance
│   ├── requirements.txt
│   ├── models/
│   │   └── database.py        # SQLite schema & connection
│   ├── routes/
│   │   └── api.py             # REST API endpoints
│   ├── services/
│   │   └── queue_service.py   # Queue business logic
│   └── socket_events/
│       └── handlers.py        # WebSocket event handlers
├── frontend/
│   ├── src/
│   │   ├── api/               # HTTP client
│   │   ├── components/        # UI components
│   │   ├── hooks/             # useSocket, useQueue
│   │   ├── pages/             # Dashboard, WaitingRoom
│   │   └── utils/             # Formatting helpers
│   ├── package.json
│   └── vite.config.js
└── README.md

Installation

Prerequisites

  • Python 3.10+
  • Node.js 18+

Backend Setup

cd backend
python3 -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py

The API and WebSocket server start at http://localhost:5001.

Frontend Setup

In a separate terminal:

cd frontend
npm install
npm run dev

The app opens at http://localhost:5173.

API Reference

Method Endpoint Description
GET /api/health Health check
GET /api/queue Full queue state + stats
POST /api/patients Add patient { patient_name }
POST /api/queue/call-next Advance queue
GET /api/settings Get consultation time setting
PUT /api/settings Update { average_consultation_time }
GET /api/patients/:token/status Patient-specific wait info

Socket Events

Event Direction Payload
connect Server → Client Initial queue state
request_queue_state Client → Server Request fresh state
queue_update Server → Client Full queue snapshot

Environment Variables

Backend

Variable Default Description
PORT 5001 Server port
DATABASE_PATH ./queue_cure.db SQLite file path
DEFAULT_CONSULTATION_TIME 15 Default avg. minutes
CORS_ORIGINS http://localhost:5173 Comma-separated origins

Frontend

Variable Default Description
VITE_API_URL `` (uses Vite proxy) REST API base URL
VITE_SOCKET_URL http://localhost:5001 Socket.IO server

Usage Flow

  1. Reception opens the dashboard and sets average consultation time (e.g. 15 min).
  2. Add patients as they arrive — each gets a daily token number.
  3. Click Call Next when the doctor is ready — the first waiting patient moves to consultation.
  4. Patients open the Waiting Room, enter their token, and watch live updates.
  5. When the doctor finishes, click Call Next again — current patient is marked completed and the next patient is called.

License

MIT — built for hackathons and demos.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors