AI Output Validation with Python (Synthetic Demo) by Markus MeighanAI Output Validation with Python (Synthetic Demo) by Markus Meighan

AI Output Validation with Python (Synthetic Demo)

Portfolio project
Markus Meighan
AI outputs need checks before they enter a spreadsheet or database. This synthetic demonstration shows a small Python validation layer for invoice-like JSON records. It is a self-directed portfolio example, not paid client work or a live AI integration.
THE TASK Check structured outputs without silently guessing dates or correcting uncertain amounts. Eight deliberately constructed records cover valid entries and common failure cases. No client documents, paid APIs or external services were used.
THE APPROACH Parse JSON; check required fields and string types; require unambiguous ISO dates; validate currency against an agreed allowlist; and check net + tax = total using decimal arithmetic. Preserve each original input and return specific issues for human review. Zero values remain valid.
TESTED RESULTS Four of eight records passed. Four were flagged: one ambiguous date, one inconsistent total, one missing tax field, and one malformed JSON record. Additional assertions checked invalid calendar dates, unsupported currencies, wrong types, negative amounts, excessive decimal precision and non-finite numbers. All assertions passed.
EXAMPLE Net 100.00 + tax 19.00 with total 120.00 produces total_mismatch. A date of 03/04/2026 is flagged rather than interpreted as either March 4 or April 3.
DELIVERABLES A reproducible Python script and a JSON report containing record status, issue codes and unchanged source text. Runs with Python standard-library tools.
LIMITS This checks structure and internal consistency; it does not establish that an extracted value matches an original invoice. Source-document reconciliation and tax-rule validation would require a separately agreed scope.

0 likes · 2 views · Nov 4, 2026

Synthetic Python demo: 8 JSON records checked, 4 accepted and 4 flagged. Validates structure, dates and decimal totals while preserving original inputs.

Tags