How jainyash0614/ai-doctor-appointment-assistant works
Project Type and Purpose
• This is a full-stack AI-powered doctor appointment booking system.
• Frontend: React/TypeScript SPA for patient & doctor portals.
• Backend: FastAPI service handling chat, booking logic, Google OAuth, and database operations.
• Database: PostgreSQL via SQLAlchemy.
• External services: Mistral AI for natural-language processing, Google Calendar & Gmail APIs for scheduling & notifications.
Main Components
• User Interface
• React App (App.tsx, pages, Chat component)
• Routes: Landing, PatientChat, DoctorChat
• API Layer (Backend)
• FastAPI application (main.py)
• Authentication module (auth.py)
• Chat endpoints & conversation flow (/chat, /doctors, /appointments, /health)
• Business Logic / Tool Server
• MCP Server (mcp_server.py): implements booking/checking logic
• Mistral AI clients (mistral_client.py, simple_mistral_client.py)
• Data Layer
• Database module (database.py)
• SQLAlchemy models (models.py)
• PostgreSQL instance (local or Docker)
• External Integrations
• Mistral AI API
• Google Calendar API
• Gmail API
• Infrastructure / Deployment
• Dockerfiles (frontend, backend)
• Optional docker-compose.yml for PostgreSQL
Relationships & Data Flows
1. User → interacts with React UI in browser
2. React uses Axios → FastAPI frontend endpoints
3. FastAPI hands off to Mistral client for NLP intent detection
4. MCP Server executes domain logic (availability checks, booking)
5. Database reads/writes appointment & doctor data
6. Google Calendar & Gmail APIs create events & send confirmations
7. FastAPI returns natural-language response to React → User
Architectural Patterns & Design Principles
• Layered Architecture: UI, API, business logic, data, external services
• Separation of Concerns: distinct modules for auth, chat, data access, AI clients
• Tool Integration (MCP Protocol): treat booking logic as a microservice within backend
• API‐First Design: Swagger docs auto-generated by FastAPI (/docs)
• Dockerized Components: repeatable dev & prod environments
Key Technologies & Frameworks
• Frontend: React 18, TypeScript, React Router, Axios
• Backend: FastAPI, Uvicorn, SQLAlchemy
• Database: PostgreSQL
• AI: Mistral API (via custom client)
• External APIs: Google Calendar & Gmail (via OAuth)
• DevOps: Docker, (optional) docker-compose