Validation checks

 

 

Each Invoice object comes with a set of validations checks. it can be accessed under the attribute Invoice.checklist.

 

Example:

 

from mindee import Client

mindee_client = Client(
    invoice_token="your_invoices_api_token_here",
    raise_on_error=True
)

parsed_data = mindee_client.parse_invoice("/path/to/file")

print(parsed_data.invoice.checklist)

 

 

This sample code should print something like:

 

{'taxes_match_total_incl': True, 'taxes_match_total_excl': False, 'taxes_plus_total_excl_match_total_incl': True}

 

 

taxes_match_total_incl: Try to reconstruct the total amount including taxes with taxes line details and compare the result against the extracted total_incl field.

 

taxes_match_total_excl: Try to reconstruct the total amount excluding taxes with taxes line details and compare the result against the extracted total_excl field.

 

taxes_match_total_incl: Try to reconstruct the total amount including taxes as the sum of taxes line details amount and the total exluding taxes and compare the result against the extracted total_incl field. 

 

 

 

Interpretation: True checks

 

Mindee's algorithms extract all fields independantly, whatever the type of document. For example, they don't use the extracted taxes to reconstruct the total amounts. This way, when trying to reconstruct some fields from others with post-processing and comparing them to raw extracted fields, it's very unlikely to get a matching reconstruction although the predictions were wrong.

 

 

from mindee import Client

mindee_client = Client(invoice_token="your_invoices_api_token_here")

invoice_data = mindee_client.parse_invoice(open("./sample.pdf", 'rb'), input_type="file")

if invoice_data.invoice.checklist["taxes_match_total_incl"] is True:
    # We are sure that taxes and total_incl fields were extracted correctly
    pass

if invoice_data.invoice.checklist["taxes_match_total_excl"] is True:
    # We are sure that taxes and total_excl fields were extracted correctly
    pass

if invoice_data.invoice.checklist["taxes_plus_total_excl_match_total_incl"] is True:
    # We are sure that taxes, total_incl and total_excl fields were extracted correctly
    pass

 

 

The mindee library will enforce probabilities to 1 for each field involved in validated check.

 

 

Interpretation: False checks

 

The validation checks were done in order to give the user easy way of ensuring maximum precision, but it doesn't necessarily mean that a False check implies wrong predictions for the involved fields. Here are a few examples leading to impossible checks:

 

  • Taxes line details are not always written in invoices, or sometimes they don't include the tax rate (for example "City Tax"). In this case, as there is no rate extracted by the API and it makes this check impossible to compute.

  • Extra fees with no corresponding taxes are sometimes in the sub-total of the invoice, making this validation impossible.

  • Post total fees (shipping cost ou delivery fees for instance) are excluding from taxes calculation, making the total including impossible to validate.