Financial Document V1

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

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

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

Financial Document API version 1 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] = 'financial_document'

Name of the endpoint.

endpoint_version: Optional[str] = '1'

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

Page-level prediction(s).

prediction: FinancialDocumentV1Document

Document-level prediction.

product: Product

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

class FinancialDocumentV1Document(raw_prediction, page_id=None)

Financial Document API version 1.6 document data.

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

  • page_id (Optional[int]) –

billing_address: StringField

The customer’s address used for billing.

category: ClassificationField

The purchase category among predefined classes.

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.

date: DateField

The date the purchase was made.

document_type: ClassificationField

One of: ‘INVOICE’, ‘CREDIT NOTE’, ‘CREDIT CARD RECEIPT’, ‘EXPENSE RECEIPT’.

due_date: DateField

The date on which the payment is due.

invoice_number: StringField

The invoice number or identifier.

line_items: List[FinancialDocumentV1LineItem]

List of line item details.

locale: LocaleField

The locale detected on the document.

reference_numbers: List[StringField]

List of Reference numbers, including PO number.

shipping_address: StringField

The customer’s address used for shipping.

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_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 lines information.

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, tips, fees, and other charges.

total_net: AmountField

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

total_tax: AmountField

The total amount of taxes.

class FinancialDocumentV1LineItem(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_price: Optional[float]

The item unit price.