Session 26 Migration Summary¶
Date: 2026-03-31 Migration ID: f8a9b1c2d3e4 Branch: feat/doctors-schema
New Tables¶
doctors— 8 seed rows, 8 doctors across 6 providersdoctor_procedures— 8 seed rows, 1 procedure per doctor
New Columns¶
providers.language_services— JSONB, interpreter/coordinator/document language data (6 providers updated)provider_procedures.lead_surgeon_id— UUID reference to lead doctor (1 row linked: Dr. Patel → Apollo TKR)
New Files¶
app/models/doctor.py— Doctor SQLAlchemy modelapp/models/doctor_procedure.py— DoctorProcedure SQLAlchemy modelapp/schemas/doctor.py— Pydantic schemas for CRUD + search + match resultsapp/services/doctor_service.py— CRUD + search serviceapp/services/data_completeness.py— 7-category weighted completeness calculatorapp/services/language_concordance.py— 6-tier language scoringapp/services/weight_redistribution.py— Proportional weight redistributionapp/routers/doctors.py— 8 API endpoints under /api/v1/doctors/app/seed_doctors.py— Seed script for 8 doctors + language services + Neo4jtests/test_doctors.py— 15 tests
New API Endpoints¶
GET /api/v1/doctors/— List doctors (paginated)GET /api/v1/doctors/search— Search by specialty, procedure, language, genderGET /api/v1/doctors/{id}— Get doctor by IDGET /api/v1/doctors/slug/{slug}— Get doctor by slugPOST /api/v1/doctors/— Create doctor (admin)PATCH /api/v1/doctors/{id}— Update doctor (admin)GET /api/v1/doctors/{id}/procedures— List doctor's proceduresPOST /api/v1/doctors/{id}/procedures— Add procedure to doctor (admin)GET /api/v1/providers/{id}/doctors— List doctors at a provider
Neo4j Changes¶
- New node type:
Doctor(8 nodes) - New node type:
Specialty,Language - New relationships:
AFFILIATED_WITH,PERFORMS,SPECIALIZES_IN,SPEAKS
Matching Engine Changes¶
ScoredProvidernow includesdoctorandlanguage_supportfields- Doctor-level scoring behind
DOCTORS_IN_MATCHINGfeature flag - Match confidence = provider_score × data_completeness_score
Feature Flags¶
DOCTORS_IN_MATCHING— When ON, match results include doctor data