A real-time appointment booking system using a FastAPI WebSocket backend and a React frontend, integrated with Twilio WhatsApp for confirmation and cancellation.
DocChat is a medical appointment booking application that allows users to:
- Interact with an AI-powered chatbot to book appointments with doctors based on symptoms.
- Receive booking details via WhatsApp, with options to confirm or cancel appointments by replying.
- View today’s appointments via a REST API endpoint (admin feature).
The backend is built with FastAPI, uses SQLAlchemy for database management, and integrates Google’s Gemini LLM for doctor selection. The frontend is a React-based chat interface communicating over WebSocket.
- Chatbot: Guides users through booking (name, phone, address, date, symptoms).
- Doctor Selection: AI-driven selection based on symptoms and availability.
- WhatsApp Integration: Sends booking details with confirmation/cancellation options.
- WebSocket: Real-time chat between frontend and backend.
- REST API: Endpoints for health checks, manual confirmation, and today’s appointments.
- Database: Stores appointments with confirmation and visit status.
- Python 3.9+: For the backend.
- Node.js 16+: For the frontend.
- Twilio Account: For WhatsApp messaging (Account SID, Auth Token, WhatsApp-enabled number).
- Google API Key: For Gemini LLM integration.
- Database: SQLite (default) or another SQLAlchemy-supported DB.
- Clone the Repository:
-
Navigate to client:
cd ../frontend
-
Install Dependencies:
npm install
-
Run the Frontend:
npm start
Opens at http://localhost:3000.
The backend auto-creates tables (Base.metadata.create_all) in SQLite by default. However, when using PostgreSQL, ensure the database is properly initialized. With Docker, PostgreSQL is pre-configured.
To run the backend with Docker, use the docker-compose.yml
file located in the server
directory.
-
Navigate to the server directory:
cd server
-
Run Docker Compose:
docker compose up --build
This will start the FastAPI backend, PostgreSQL database, and PgAdmin for database management.
Follow the chatbot prompts, receive appointment details via WhatsApp, and confirm/cancel appointments by replying.