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

# Print a summary of the API result
print(result.document)

# Print the document-level summary
# print(result.document.inference.prediction)
class InvoiceV4(raw_prediction)

Invoice API version 4 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] = 'invoices'

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

Page-level prediction(s).

prediction: InvoiceV4Document

Document-level prediction.

product: Product

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

class InvoiceV4Document(raw_prediction, page_id=None)

Invoice API version 4.9 document data.

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

  • page_id (Optional[int]) –

billing_address: StringField

The customer’s address used for billing.

customer_address: StringField

The address of the customer.

customer_company_registrations: List[CompanyRegistrationField]

List of company registrations associated to the customer.

customer_id: StringField

The customer account number or identifier from the supplier.

customer_name: StringField

The name of the customer or client.

date: DateField

The date the purchase was made.

document_type: ClassificationField

One of: ‘INVOICE’, ‘CREDIT NOTE’.

due_date: DateField

The date on which the payment is due.

invoice_number: StringField

The invoice number or identifier.

line_items: List[InvoiceV4LineItem]

List of line item details.

locale: LocaleField

The locale detected on the document.

payment_date: DateField

The date on which the payment is due/ was full-filled.

po_number: StringField

The purchase order number.

reference_numbers: List[StringField]

List of Reference numbers, including PO number.

shipping_address: StringField

Customer’s delivery address.

supplier_address: StringField

The address of the supplier or merchant.

supplier_company_registrations: List[CompanyRegistrationField]

List of company registrations associated to the supplier.

supplier_email: StringField

The email of the supplier or merchant.

supplier_name: StringField

The name of the supplier or merchant.

supplier_payment_details: List[PaymentDetailsField]

List of payment details associated to the supplier.

supplier_phone_number: StringField

The phone number of the supplier or merchant.

supplier_website: StringField

The website URL of the supplier or merchant.

taxes: Taxes

List of tax line details.

total_amount: AmountField

The total amount paid: includes taxes, tips, fees, and other charges.

total_net: AmountField

The net amount paid: does not include taxes, fees, and discounts.

total_tax: AmountField

The total tax: includes all the taxes paid for this invoice.

class InvoiceV4LineItem(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.

product_code: Optional[str]

The product code referring to the item.

quantity: Optional[float]

The item quantity

tax_amount: Optional[float]

The item tax amount.

tax_rate: Optional[float]

The item tax rate in percentage.

total_amount: Optional[float]

The item total amount.

unit_measure: Optional[str]

The item unit of measure.

unit_price: Optional[float]

The item unit price.