schemas.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. receipt_ref_no: Optional[str] = Field(default=None, description="The reference number or invoice number on the receipt.")
  20. clinic_reg_no: Optional[str] = Field(default=None, description="The clinic's official registration number (SSM/MOH).")
  21. claim_category: Optional[str] = Field(default=None, description="Category: General, Dental, Optical, Specialist.")
  22. diagnosis_brief: Optional[str] = Field(default=None, description="A very short summary of the diagnosis or items seen.")
  23. class ClaimSubmission(BaseModel):
  24. provider_name: str = Field(description="The name of the clinic or hospital.")
  25. visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
  26. amount_spent: float = Field(description="The manual or validated total amount spent.")
  27. currency: str = Field(description="3-letter currency code (e.g. USD, MYR).")
  28. treatment_type: str = Field(description="Type of treatment (Outpatient, Dental, etc.).")
  29. cost_center: str = Field(description="Internal cost center code.")
  30. declaration_signed: bool = Field(description="Whether the user signed the compliance declaration.")
  31. extraction_data: Optional[ExtractionResponse] = Field(default=None, description="Optional AI extraction data if used.")
  32. class ClaimRecord(BaseModel):
  33. id: str = Field(description="Unique identifier for the claim record.")
  34. timestamp: str = Field(description="ISO format timestamp of submission.")
  35. submitted_by: str = Field(description="Name of the user who submitted the claim.")
  36. department: str = Field(description="Department of the user.")
  37. amount_spent: float = Field(description="The raw total amount from the form/receipt.")
  38. amount_claimed: float = Field(description="The actual amount credited after policy capping.")
  39. provider_name: str = Field(description="The name of the clinic or hospital.")
  40. visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
  41. treatment_type: str = Field(description="Type of treatment.")
  42. cost_center: str = Field(description="Internal cost center code.")
  43. declaration_signed: bool = Field(description="Whether the user signed the compliance declaration.")
  44. extraction_data: Optional[ExtractionResponse] = Field(default=None, description="The optional AI-extracted data for this claim.")