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
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.