Spaces:
Sleeping
Sleeping
File size: 1,520 Bytes
b29925a 2912388 b29925a 2ba25dc b29925a be94b8c 2ba25dc b29925a 120a1a5 2912388 2ba25dc 2912388 2ba25dc 120a1a5 2912388 120a1a5 2912388 120a1a5 2912388 89b066e 2912388 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
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 |