Spaces:
Sleeping
Sleeping
| from pydantic import BaseModel, EmailStr | |
| from typing import Optional, List, Literal | |
| from datetime import date, time | |
| # --- USER SCHEMAS --- | |
| class SignupForm(BaseModel): | |
| email: EmailStr | |
| password: str | |
| full_name: str | |
| role: Literal['admin', 'doctor', 'patient'] | |
| class TokenResponse(BaseModel): | |
| access_token: str | |
| token_type: str | |
| # --- DOCTOR CREATION SCHEMA (Admin use only) --- | |
| class DoctorCreate(BaseModel): | |
| matricule: str | |
| email: EmailStr | |
| password: str | |
| full_name: str | |
| specialty: str # ✅ added field | |
| # --- CONTACT INFO --- | |
| class ContactInfo(BaseModel): | |
| email: Optional[EmailStr] = None | |
| phone: Optional[str] = None | |
| # --- PATIENT SCHEMA --- | |
| class PatientCreate(BaseModel): | |
| full_name: str | |
| date_of_birth: date | |
| gender: str | |
| notes: Optional[str] = "" | |
| address: Optional[str] = None | |
| national_id: Optional[str] = None | |
| blood_type: Optional[str] = None | |
| allergies: Optional[List[str]] = [] | |
| chronic_conditions: Optional[List[str]] = [] | |
| medications: Optional[List[str]] = [] | |
| emergency_contact_name: Optional[str] = None | |
| emergency_contact_phone: Optional[str] = None | |
| insurance_provider: Optional[str] = None | |
| insurance_policy_number: Optional[str] = None | |
| contact: Optional[ContactInfo] = None | |
| # --- APPOINTMENT SCHEMA --- | |
| class AppointmentCreate(BaseModel): | |
| patient_id: str # MongoDB ObjectId as string | |
| doctor_id: str # MongoDB ObjectId as string | |
| date: date | |
| time: time | |
| reason: Optional[str] = None |