feat: add receipt OCR pipeline (refs #69)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 32s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 31s
Deploy to Staging / Verify Staging (pull_request) Successful in 2m20s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped

Implement receipt-specific OCR extraction for fuel receipts:

- Pattern matching modules for date, currency, and fuel data extraction
- Receipt-optimized image preprocessing for thermal receipts
- POST /extract/receipt endpoint with field extraction
- Confidence scoring per extracted field
- Cross-validation of fuel receipt data
- Unit tests for all pattern matchers

Extracted fields: merchantName, transactionDate, totalAmount,
fuelQuantity, pricePerUnit, fuelGrade

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-01 20:43:30 -06:00
parent a2f0abb14c
commit 6319d50fb1
16 changed files with 2845 additions and 2 deletions

View File

@@ -93,3 +93,25 @@ class JobSubmitRequest(BaseModel):
callback_url: Optional[str] = Field(default=None, alias="callbackUrl")
model_config = {"populate_by_name": True}
class ReceiptExtractedField(BaseModel):
"""A single extracted field from a receipt with confidence."""
value: str | float
confidence: float = Field(ge=0.0, le=1.0)
class ReceiptExtractionResponse(BaseModel):
"""Response from receipt extraction endpoint."""
success: bool
receipt_type: str = Field(alias="receiptType")
extracted_fields: dict[str, ReceiptExtractedField] = Field(
default_factory=dict, alias="extractedFields"
)
raw_text: str = Field(alias="rawText")
processing_time_ms: int = Field(alias="processingTimeMs")
error: Optional[str] = None
model_config = {"populate_by_name": True}