schemas.py 1.8 KB

1234567891011121314151617181920212223242526272829
  1. from pydantic import BaseModel, Field
  2. from typing import List, Optional
  3. from uuid import UUID
  4. from datetime import datetime
  5. class UserAccount(BaseModel):
  6. id: str = Field(description="Unique identifier for the user.")
  7. name: str = Field(description="Full name of the employee.")
  8. department: str = Field(description="Department name.")
  9. medical_allowance: float = Field(description="Remaining annual medical allowance in MYR.")
  10. class ExtractionResponse(BaseModel):
  11. provider_name: str = Field(description="The name of the clinic or hospital.")
  12. visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
  13. total_amount: float = Field(description="The total amount paid.")
  14. currency: str = Field(description="3-letter currency code (e.g. USD, SGD).")
  15. items: List[str] = Field(description="Simplified list of services (e.g. 'Consultation', 'Medicine').")
  16. confidence_score: float = Field(description="Model's confidence from 0.0 to 1.0.")
  17. needs_manual_review: bool = Field(description="Set to true if text is blurry or data is ambiguous.")
  18. ai_reasoning: str = Field(description="A brief explanation of how the data was identified.")
  19. class ClaimRecord(BaseModel):
  20. id: str = Field(description="Unique identifier for the claim record.")
  21. timestamp: str = Field(description="ISO format timestamp of submission.")
  22. submitted_by: str = Field(description="Name of the user who submitted the claim.")
  23. department: str = Field(description="Department of the user.")
  24. amount_spent: float = Field(description="The raw total amount from the receipt.")
  25. amount_claimed: float = Field(description="The actual amount credited after policy capping.")
  26. extraction_data: ExtractionResponse = Field(description="The AI-extracted data for this claim.")