3b01efd8a6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
2.3 KiB
Plaintext
62 lines
2.3 KiB
Plaintext
Analyze this receipt image and extract structured data. Respond with a single JSON object matching this exact schema. Use JSON null (not the string "null") for missing values. Do not include comments in the JSON.
|
|
|
|
{
|
|
"merchant": "store name",
|
|
"receiptDate": "YYYY-MM-DD",
|
|
"dueDate": null,
|
|
"subtotal": 0.00,
|
|
"tax": 0.00,
|
|
"total": 0.00,
|
|
"confidence": 0.95,
|
|
"suggestedCategory": null,
|
|
"suggestedTransactionId": null,
|
|
"lineItems": [
|
|
{
|
|
"description": "item name",
|
|
"upc": null,
|
|
"quantity": 1.0,
|
|
"unitPrice": 0.00,
|
|
"lineTotal": 0.00,
|
|
"category": null,
|
|
"voided": false
|
|
}
|
|
]
|
|
}
|
|
|
|
FIELD TYPES (you must follow these exactly):
|
|
- merchant: string
|
|
- receiptDate: string "YYYY-MM-DD" or null
|
|
- dueDate: string "YYYY-MM-DD" or null (only for bills with a payment deadline)
|
|
- subtotal: number or null
|
|
- tax: number or null
|
|
- total: number
|
|
- confidence: number between 0 and 1
|
|
- suggestedCategory: string or null
|
|
- suggestedTransactionId: integer or null (MUST be a JSON number like 123, NEVER a string like "123")
|
|
- lineItems: array of objects
|
|
|
|
LINE ITEM FIELDS:
|
|
- description: string (the item or service name, include count/size info like "4CT" or "12 OZ")
|
|
- upc: string or null (UPC/barcode number if visible, usually 12-13 digits)
|
|
- quantity: number (default 1.0 for all retail products; null only for service fees or taxes)
|
|
- unitPrice: number or null (lineTotal divided by quantity; null only if quantity is null)
|
|
- lineTotal: number (the price shown on the receipt; 0.00 if voided)
|
|
- category: string or null
|
|
- voided: boolean
|
|
|
|
RULES FOR LINE ITEMS:
|
|
- Extract ALL line items from top to bottom - never stop early
|
|
- quantity is 1.0 for ALL physical retail items unless you see "2 @" or "QTY 3" etc.
|
|
- Do not confuse product descriptions (like "4CT BLUE MUF" = 4-count muffin package) with quantity
|
|
- UPC/barcode numbers are long numeric codes (12-13 digits) near the item
|
|
|
|
VOIDED ITEMS:
|
|
- When you see "** VOIDED ENTRY **" or similar, the item immediately after it is voided
|
|
- For voided items: set "voided": true and "lineTotal": 0.00
|
|
- For all other items: set "voided": false
|
|
- NEVER skip voided items - include them in the lineItems array
|
|
- CONTINUE reading ALL items after void markers
|
|
|
|
DUE DATE:
|
|
- Only for bills (utility, credit card, etc.) - extract the payment due date
|
|
- For regular store receipts, dueDate must be null |