---
title: "Discussion on \"A validation layer for AI invoice extraction, in Python\" | Hashnode"
description: "Discussion on \"A validation layer for AI invoice extraction, in Python\". What to run after the model reads an invoice, in what order, and what each check caught in my test of 30 invoices."
url: "https://hashnode.com/posts/a-validation-layer-for-ai-invoice-extraction-in-python/6afb0a8d4c910ad7508227b7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [A validation layer for AI invoice extraction, in Python](https://madsalt.hashnode.dev/a-validation-layer-for-ai-invoice-extraction-in-python?utm_source=hashnode&utm_medium=feed)

What to run after the model reads an invoice, in what order, and what each check caught in my test of 30 invoices.

13h ago · 6 min read · madsalt.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#ai](https://hashnode.com/tag/ai)
-   [#automation](https://hashnode.com/tag/automation)
-   [#llm](https://hashnode.com/tag/llm)

## Written by

[Denys Zaichenko](https://hashnode.com/@madsalttech)

@madsalttech · Lisbon, Portugal

  
[View profile](https://hashnode.com/@madsalttech)

A senior full-stack developer specialising in multi-tenant SaaS apps and AI agents.

## Responses 1

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[6h ago](https://hashnode.com/posts/a-validation-layer-for-ai-invoice-extraction-in-python/6afb0a8d4c910ad7508227b7/comment/6afb71af91b1c666ea4e1e00)

The review sketch currently applies inv\['country'\] to both supplier and buyer VAT checks. I would give those identifiers their own country information, since an invoice can have a supplier and buyer in different countries. Otherwise a correctly extracted buyer identifier can be rejected by the supplier country's validator.

A useful next fixture would pair a domestic invoice with a cross-border one and preserve the original identifier text beside its normalized form. That would separate extraction mistakes from validation-routing mistakes before measuring how many of the 32 failed extractions the layer actually catches.
