Add new fields for tax and depreciation in receipt processing

- Introduced fields: receipt_location, calculated_tax, is_depreciable, cca_rate, useful_life, and residual_value in DBReceipt model.
- Updated process_document function to handle new receipt data attributes.
- Enhanced DocumentProcessResponse schema to include new fields.
- Updated document processing rules to incorporate tax calculation based on location and depreciation rules.
This commit is contained in:
bolade
2025-10-07 11:15:26 +01:00
parent 823c05f78d
commit d8315f13ac
5 changed files with 172 additions and 23 deletions
+14
View File
@@ -173,6 +173,20 @@ class DocumentProcessResponse(BaseModel):
confidence: Optional[float] = None
error: Optional[str] = None
receipt_currency: Optional[str] = "CAD"
receipt_location: Optional[str] = (
None # Location from receipt (e.g., "Ontario, Canada" or "California, USA")
)
calculated_tax: Optional[float] = None # Calculated sales tax if not clearly shown
is_depreciable: Optional[bool] = None # Whether item is a depreciable asset
cca_rate: Optional[float] = (
None # CCA rate for tax depreciation (e.g., 0.30 for 30%)
)
useful_life: Optional[int] = (
None # Useful life in years for straight-line depreciation
)
residual_value: Optional[float] = (
None # Residual value for straight-line depreciation
)
# New tax-related models