Receipt V4

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.ReceiptV4, input_doc)

# Print a brief summary of the parsed data
print(result.document)

# # Iterate over all the fields in the document
# for field_name, field_values in result.document.inference.prediction.fields.items():
#     print(field_name, "=", field_values)
class ReceiptV4(raw_prediction)

Inference prediction for Receipt, API version 4.

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] = '4'

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[ReceiptV4Document]]

Page-level prediction(s).

prediction: ReceiptV4Document

Document-level prediction.

product: Product

Name and version of a given product, as sent back by the API.

class ReceiptV4Document(raw_prediction, page_id=None)

Document data for Receipt, API version 4.

Parameters:
  • raw_prediction (Dict[str, Any]) –

  • page_id (Optional[int]) –

category: ClassificationField

The type, or service category, of the purchase.

date: DateField

Date the receipt was issued

document_type: ClassificationField

Whether the document is an expense receipt or a credit card receipt.

locale: LocaleField

locale information

subcategory: ClassificationField

The receipt sub category among predefined classes.

supplier: StringField

The merchant, or supplier, as found on the receipt.

taxes: Taxes

List of all taxes.

time: StringField

Time the receipt was issued, in HH: MM format.

tip: AmountField

Total amount of tip and gratuity.

total_amount: AmountField

Total including taxes

total_net: AmountField

Total amount of the purchase excluding taxes.

total_tax: AmountField

Total tax amount of the purchase.