description: Commercial invoice with line items, vendor/customer, and totals priority: 50 match: any: - text_patterns: - "(?i)invoice" - "(?i)bill to" - "(?i)invoice #" - "(?i)invoice number" - "(?i)tax invoice" - text_patterns: - "(?i)due date" - "(?i)payment terms" - "(?i)purchase order" - "(?i)po #" - structural: - has_line_item_table: true page_count_hint: 1-5 profile_fields: invoice_number: type: string extraction: patterns: - "(?i)invoice\\s*[#:]?\\s*([A-Z0-9-]+)" - "(?i)bill\\s*invoice\\s*[#:]?\\s*([A-Z0-9-]+)" fallback: null vendor: type: string extraction: patterns: - "(?i)(?:from|vendor|supplier|company)\\s*:?\\s*([A-Z][A-Za-z0-9\\s&]+?)(?=\\n|\\r|$)" - "(?i)^([A-Z][A-Za-z0-9\\s&]+)\\s+(?:Inc|LLC|Ltd|Corp|GmbH)" fallback: null customer: type: string extraction: patterns: - "(?i)(?:bill\\s*to|customer|client)\\s*:?\\s*([A-Z][A-Za-z0-9\\s&]+?)(?=\\n|\\r|$)" fallback: null invoice_date: type: date extraction: patterns: - "(?i)invoice\\s*date\\s*:?\\s*([0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{2,4})" - "(?i)date\\s*:?\\s*([0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{2,4})" fallback: null due_date: type: date extraction: patterns: - "(?i)due\\s*date\\s*:?\\s*([0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{2,4})" - "(?i)payment\\s*due\\s*:?\\s*([0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{2,4})" fallback: null total: type: decimal extraction: patterns: - "(?i)total\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" - "(?i)amount\\s*due\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" fallback: null subtotal: type: decimal extraction: patterns: - "(?i)sub\\s*total\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" fallback: null tax: type: decimal extraction: patterns: - "(?i)tax\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" - "(?i)vat\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" - "(?i)gst\\s*[:=]?\\s*[\\$€£¥]?\\s*([0-9,]+\\.?[0-9]*)" fallback: null line_items: type: array extraction: table_region: "largest_table_or_bottom_half" schema: - name: description type: string required: true - name: quantity type: decimal required: false - name: unit_price type: decimal required: false - name: amount type: decimal required: false fallback: [] reading_order: line_dominant zone_filtering: exclude_headers_footers