ProjectBuild an AI Voice Receptionist: the explanation · Module 7: Doctors, slots and safe booking · part 9 of 23
Part 9 · Module 7: Doctors, slots and safe booking

Module 7: Doctors, slots and safe booking

24 min read·
About 45 minutes · Needs: Module 5 (the data model and migrations), Module 6 (roles and the audit log) · Code: backend/app/services/clinic_service.py, backend/app/models/clinic.py, backend/app/services/seed.py, backend/app/api/routes/appointments.py

Where this fits

WHERE THIS FITS The Medilane voice receptionist this module CLIENT React API LAYER FastAPI SAFETY SPEECH IN BRAIN LangGraph SPEECH OUT KNOWLEDGE AND DATA pgvector OPERATIONS Langfuse, Prometheus Caller app browser mic Staff app desk and admin REST API staff, sessions Voice socket audio both ways Auth + RBAC staff roles, voice tokens Guardrails emergency, PII VAD Silero, turns Whisper speech to text Language en, hi, Hinglish Agent tools, confirm Open models Groq: gpt-oss, Qwen Kokoro TTS en + hi voices Retrieval multilingual Ingestion clinic documents PostgreSQL clinic, calls, vectors Redis events, limits Front desk live events, hand-offs Observability traces, metrics Evaluation WER, safety, latency
The clinic service (blue: this module) sits under both the agent's tools and the staff app, and owns the diary in PostgreSQL.

When Rahul Verma asks for Dr. Mehta tomorrow morning, the agent's booking tools do not touch the database themselves. They call the clinic service in this module, and so does the staff Appointments page. The service turns each doctor's weekly hours into free slots and books, moves or cancels appointments in PostgreSQL. Every rule that protects the diary lives here, so neither the model nor a front-end bug can break it.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan