Receipt V5
Sample Code:
from mindee import Client, PredictResponse, product
# Init a new client
mindee_client = Client(api_key="my-api-key")
# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
# Load a file from disk and parse it.
# The endpoint name must be specified since it cannot be determined from the class.
result: PredictResponse = mindee_client.parse(product.ReceiptV5, input_doc)
# Print a summary of the API result
print(result.document)
# Print the document-level summary
# print(result.document.inference.prediction)
- class ReceiptV5(raw_prediction)
Receipt API version 5 inference prediction.
- static get_endpoint_info(klass)
Retrives 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: Optional[str] = 'expense_receipts'
Name of the endpoint.
- endpoint_version: Optional[str] = '5'
Version of the endpoint.
- is_rotation_applied: Optional[bool]
Whether the document has had any rotation applied to it.
- page_id: Optional[int]
Optional page id for page-level predictions.
-
pages:
List
[Page
[ReceiptV5Document
]] Page-level prediction(s).
-
prediction:
ReceiptV5Document
Document-level prediction.
- product: Product
Name and version of a given product, as sent back by the API.
- class ReceiptV5Document(raw_prediction, page_id=None)
Receipt API version 5.3 document data.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
-
category:
ClassificationField
The purchase category among predefined classes.
-
document_type:
ClassificationField
One of: ‘CREDIT CARD RECEIPT’, ‘EXPENSE RECEIPT’.
-
line_items:
List
[ReceiptV5LineItem
] List of line item details.
-
locale:
LocaleField
The locale detected on the document.
-
receipt_number:
StringField
The receipt number or identifier.
-
subcategory:
ClassificationField
The purchase subcategory among predefined classes for transport and food.
-
supplier_address:
StringField
The address of the supplier or merchant.
-
supplier_company_registrations:
List
[CompanyRegistrationField
] List of company registrations 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 total amount of taxes.
- class ReceiptV5LineItem(raw_prediction, page_id=None)
List of line item details.
- Parameters:
raw_prediction (Dict[str, Any]) –
page_id (Optional[int]) –
- to_table_line()
Output in a format suitable for inclusion in an rST table.
- Return type:
str
- bounding_box: Optional[Quadrilateral]
A right rectangle containing the word in the document.
- confidence: float
The confidence score.
-
description:
Optional
[str
] The item description.
-
page_n:
int
The document page on which the information was found.
- polygon: Polygon
A polygon containing the word in the document.
-
quantity:
Optional
[float
] The item quantity.
-
total_amount:
Optional
[float
] The item total amount.
-
unit_price:
Optional
[float
] The item unit price.