Receipt V5
Sample Code:
#
# Install the Python client library by running:
# pip install mindee
#
from mindee.v1 import Client, product, AsyncPredictResponse
from mindee import PathInput
# Init a new client
mindee_client = Client(api_key="my-api-key")
# Load a file from disk
input_doc = PathInput("/path/to/the/file.ext")
# Load a file from disk and enqueue it.
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
product.ReceiptV5,
input_doc,
)
# Print a brief summary of the parsed data
print(result.document)
- class ReceiptV5(raw_prediction)
Receipt API version 5 inference prediction.
- Parameters:
raw_prediction (dict[str, Any])
- static get_endpoint_info(klass)
Retrieves the endpoint information for an Inference.
Should never retrieve info for CustomV1, as a custom endpoint should be created to use CustomV1.
- Parameters:
klass (
type[Inference]) – product subclass to access endpoint information.- Return type:
dict[str,str]
- endpoint_name: str | None = 'expense_receipts'
Name of the endpoint.
- endpoint_version: str | None = '5'
Version of the endpoint.
- is_rotation_applied: bool | None
Whether the document has had any rotation applied to it.
- page_id: int | None
Optional page id for page-level predictions.
- pages: list[Page[ReceiptV5Document]]
Page-level prediction(s).
- prediction: ReceiptV5Document
Document-level prediction.
- class ReceiptV5Document(raw_prediction, page_id=None)
Receipt API version 5.4 document data.
- Parameters:
raw_prediction (dict[str, Any])
page_id (int | None)
- category: ClassificationField
The purchase category of the receipt.
- document_type: ClassificationField
The type of receipt: EXPENSE RECEIPT or CREDIT CARD RECEIPT.
- line_items: list[ReceiptV5LineItem]
List of all line items on the receipt.
- locale: LocaleField
The locale of the document.
- receipt_number: StringField
The receipt number or identifier.
- subcategory: ClassificationField
The purchase subcategory of the receipt for transport and food.
- supplier_address: StringField
The address of the supplier or merchant.
- supplier_company_registrations: list[CompanyRegistrationField]
List of company registration numbers associated to the supplier.
- supplier_name: StringField
The name of the supplier or merchant.
- supplier_phone_number: StringField
The phone number of the supplier or merchant.
- time: StringField
The time the purchase was made.
- tip: AmountField
The total amount of tip and gratuity.
- total_amount: AmountField
The total amount paid: includes taxes, discounts, fees, tips, and gratuity.
- total_net: AmountField
The net amount paid: does not include taxes, fees, and discounts.
- total_tax: AmountField
The sum of all taxes.
- class ReceiptV5LineItem(raw_prediction, page_id=None)
List of all line items on the receipt.
- Parameters:
raw_prediction (dict[str, Any])
page_id (int | None)
- to_table_line()
Output in a format suitable for inclusion in an rST table.
- Return type:
str
- bounding_box: Quadrilateral | None
A right rectangle containing the word in the document.
- confidence: float
The confidence score.
- description: str | None
The item description.
- page_n: int
The document page on which the information was found.
- quantity: float | None
The item quantity.
- total_amount: float | None
The item total amount.
- unit_price: float | None
The item unit price.