General fields structure
Each receipt object contains a set of different fields.
To access a receipt object, you need to create a
mindee.Client and call the
from mindee import Client # Instantiate your client mindee_client = Client(expense_receipts_token="your_token_here") # Call the Mindee expense receipts endpoint and parse the result receipt_data = mindee_client.parse_receipt("/path/to/my/file")
Whatever the field type, each of them contains the four following attributes:
- Value: (Str or Float depending on the field type), corresponds to the field value. Set to None if the field was not extracted.
- Probability: (Float), confidence score of the field prediction.
- bbox:(Array[Float]), contains the relative vertices coordinates of the bounding box containing the field in the image. If the field is not written, the bbox is an empty array.
- reconstructed: (Bool), True if the field was reconstructed using other fields.
Depending on the Field type, there can be extra attributes.
receipt.total_incl: Total amount including taxes
# To get the total amount including taxes value (float), ex: 14.24 total_incl = receipt_data.receipt.total_incl.value
receipt.total_excl: Total amount excluding taxes
# To get the total amount excluding taxes value (float), ex: 10.21 total_excl = receipt_data.receipt.total_excl.value
receipt.total_tax: Total tax value reconstructed from tax lines
# To get the total tax amount value (float), ex: 8.42 total_tax = receipt_data.receipt.total_tax.value
receipt.taxes: Array of Tax fields
Each of the tax field has two extra attributes:
- code: (String), Optional tax code. (HST, GST... for canadian; City Tax, State tax for US etc..)
- rate: (Float), Optional tax rate.
# To get the list of taxes taxes = receipt_data.receipt.taxes # Loop on each Tax field for tax in taxes: # To get the tax amount tax_amount = tax.value # To get the tax code for from a tax object tax_code = tax.code # To get the tax rate tax_rate = tax.rate
Each date field comes with an extra attribute:
- date_object: (Datetime), datetime object from python datetime.date library
receipt.date: Payment date related to the receipt
# To get the receipt date of issuance (string) receipt_date = receipt_data.receipt.value
receipt.supplier: Supplier name as written in the receipt (logo)
# To get the supplier name supplier_name = receipt_data.receipt.supplier.value
Locale and currency
locale: Language ISO code
Contains an extra attribute:
- currency: (String), ISO currency code
# To get the total language code language = receipt_data.receipt.locale.value # To get the receipt currency code currency = receipt_data.receipt.locale.currency
category: Receipt category among the list: toll, food, parking, transport, accommodation, gasoline, miscellaneous
# To get the category category = receipt_data.receipt.category.value
time: Time of purchase with 24 hours formatting (hh:mm)
# To get the category category = receipt_data.receipt.time.value