schemas.py 1.2 KB

1234567891011121314151617181920
  1. from pydantic import BaseModel, Field
  2. from typing import List, Optional
  3. from uuid import UUID
  4. from datetime import datetime
  5. class ExtractionResponse(BaseModel):
  6. provider_name: str = Field(description="The name of the clinic or hospital.")
  7. visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
  8. total_amount: float = Field(description="The total amount paid.")
  9. currency: str = Field(description="3-letter currency code (e.g. USD, SGD).")
  10. items: List[str] = Field(description="Simplified list of services (e.g. 'Consultation', 'Medicine').")
  11. confidence_score: float = Field(description="Model's confidence from 0.0 to 1.0.")
  12. needs_manual_review: bool = Field(description="Set to true if text is blurry or data is ambiguous.")
  13. class ClaimRecord(BaseModel):
  14. id: str = Field(description="Unique identifier for the claim record.")
  15. timestamp: str = Field(description="ISO format timestamp of submission.")
  16. submitted_by: str = Field(description="Name of the user who submitted the claim.")
  17. department: str = Field(description="Department of the user.")
  18. extraction_data: ExtractionResponse = Field(description="The AI-extracted data for this claim.")