| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- from pydantic import BaseModel, Field
- from typing import List, Optional, Union, Dict
- from uuid import UUID
- from datetime import datetime
- class UserAccount(BaseModel):
- id: str = Field(description="Unique identifier for the user.")
- name: str = Field(description="Full name of the employee.")
- department: str = Field(description="Department name.")
- medical_allowance: float = Field(description="Remaining annual medical allowance in MYR.")
- class ExtractionResponse(BaseModel):
- provider_name: str = Field(description="The name of the clinic or hospital.")
- visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
- total_amount: float = Field(description="The total amount paid.")
- currency: str = Field(description="3-letter currency code (e.g. USD, SGD).")
- items: List[str] = Field(description="Simplified list of services (e.g. 'Consultation', 'Medicine').")
- confidence_score: float = Field(description="Model's confidence from 0.0 to 1.0.")
- needs_manual_review: bool = Field(description="Set to true if text is blurry or data is ambiguous.")
- ai_reasoning: str = Field(description="A brief explanation of how the data was identified.")
- receipt_ref_no: Optional[str] = Field(default=None, description="The reference number or invoice number on the receipt.")
- clinic_reg_no: Optional[str] = Field(default=None, description="The clinic's official registration number (SSM/MOH).")
- claim_category: Optional[str] = Field(default=None, description="Category: General, Dental, Optical, Specialist.")
- diagnosis_brief: Optional[str] = Field(default=None, description="A very short summary of the diagnosis or items seen.")
- class ClaimSubmission(BaseModel):
- provider_name: str = Field(description="The name of the clinic or hospital.")
- visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
- amount_spent: float = Field(description="The manual or validated total amount spent.")
- currency: str = Field(description="3-letter currency code (e.g. USD, MYR).")
- treatment_type: str = Field(description="Type of treatment (Outpatient, Dental, etc.).")
- cost_center: str = Field(description="Internal cost center code.")
- declaration_signed: bool = Field(description="Whether the user signed the compliance declaration.")
- extraction_data: Optional[ExtractionResponse] = Field(default=None, description="Optional AI extraction data if used.")
- class ClaimRecord(BaseModel):
- id: str = Field(description="Unique identifier for the claim record.")
- timestamp: str = Field(description="ISO format timestamp of submission.")
- submitted_by: str = Field(description="Name of the user who submitted the claim.")
- department: str = Field(description="Department of the user.")
- amount_spent: float = Field(description="The raw total amount from the form/receipt.")
- amount_claimed: float = Field(description="The actual amount credited after policy capping.")
- provider_name: str = Field(description="The name of the clinic or hospital.")
- visit_date: str = Field(description="The date of service in YYYY-MM-DD format.")
- treatment_type: str = Field(description="Type of treatment.")
- cost_center: str = Field(description="Internal cost center code.")
- declaration_signed: bool = Field(description="Whether the user signed the compliance declaration.")
- extraction_data: Optional[ExtractionResponse] = Field(default=None, description="The optional AI-extracted data for this claim.")
- class V2TemplateRequest(BaseModel):
- template_fields: dict[str, str] = Field(description="Mapping of field keys to their descriptions/instructions.")
- user_name: Optional[str] = "Demo User"
- department: Optional[str] = "Operations"
- class V2Field(BaseModel):
- key: str = Field(description="The field name from the template.")
- value: Optional[Union[str, float]] = Field(description="The extracted value or null if not found.")
- class V2TemplateResponse(BaseModel):
- filled_data: List[V2Field] = Field(description="The list of filled form values where keys match the template.")
- unfilled_fields: List[str] = Field(description="Fields from the template that could not be found in the image.")
|