Inspiration

Accounting teams still spend too much time turning semi-structured business documents into data they can actually trust.

AI extraction can read a document, but extraction alone is not enough for accounting workflows. A document should not become “trusted” just because an AI model produced a value.

DocFlow AI was built around a different idea:

AI extracts the data, deterministic rules verify the numbers, and a human explicitly approves the final result.

The goal is to turn messy accounting documents into traceable, reviewable, ERP-ready data without hiding uncertainty.

What it does

DocFlow AI demonstrates an end-to-end accounting document verification workflow.

The current hackathon demo uses a checked-in real extraction fixture so the complete review lifecycle can be demonstrated without external credentials or network dependencies.

The workflow is:

  1. A demo accounting document is loaded into the review workspace.
  2. Structured fields and line items are mapped into a canonical document model.
  3. Deterministic normalization converts dates, quantities, identifiers, and monetary values into safe typed values.
  4. The Validation Engine checks required fields, line arithmetic, document totals, VAT totals, tax identifiers, and accounting consistency rules.
  5. Documents with inconsistencies are routed to REVIEW.
  6. A human can correct a problematic raw value.
  7. The corrected document is normalized and validated again automatically.
  8. When validation passes, the document moves to PASS.
  9. PASS is not the same as trusted: explicit human approval is still required.
  10. After approval, the document becomes VERIFIED.
  11. Every important lifecycle event is recorded in an immutable audit trail.
  12. Only VERIFIED documents can be exported as canonical JSON or flat CSV.

The demo intentionally contains an accounting inconsistency so the complete human-in-the-loop workflow can be shown:

REVIEW → correction → PASS → Verify → VERIFIED → export

How we built it

DocFlow AI uses:

  • Python
  • FastAPI
  • Next.js
  • React
  • TypeScript
  • Nutrient Document Web Services as the document extraction layer
  • schema-based AI extraction
  • Decimal-safe normalization
  • deterministic accounting validation
  • human review state management
  • append-only audit events
  • JSON and CSV export
  • pytest
  • Ruff

The backend owns all accounting decisions and state transitions.

The frontend does not contain accounting validation rules. It renders backend state and submits explicit user actions such as correction and verification.

This separation keeps the system deterministic, testable, and auditable.

Why this is different

DocFlow AI does not treat AI extraction as the final answer.

The system deliberately separates:

Extraction → Normalization → Validation → Human Review → Approval → Verified Export

This means:

  • extracted values are not silently trusted;
  • monetary values use Decimal, not floating-point arithmetic;
  • validation decisions are deterministic;
  • corrections are recorded with old and new values;
  • machine PASS and human VERIFIED are separate states;
  • exports are blocked until explicit verification;
  • the complete lifecycle is traceable through the audit trail.

This is especially important for accounting and ERP workflows where traceability matters as much as automation.

Challenges we faced

One of the biggest challenges was avoiding the temptation to let AI make accounting decisions.

Instead, we designed clear boundaries:

  • AI is responsible for extraction;
  • deterministic Python logic is responsible for normalization and validation;
  • humans are responsible for final approval.

We also had to make the demo self-contained and reliable for judging, so the current Demo UI uses a real checked-in extraction response rather than requiring live provider credentials during the presentation.

Another challenge was preserving exact raw correction values while still producing normalized typed data for downstream validation and export.

Accomplishments that we're proud of

We built a complete working review lifecycle rather than only an extraction prototype.

The current project includes:

  • structured document mapping;
  • line-item processing;
  • deterministic normalization;
  • accounting validation;
  • human corrections;
  • explicit approval;
  • immutable audit history;
  • VERIFIED-only JSON export;
  • VERIFIED-only CSV export;
  • FastAPI Demo API;
  • Next.js review interface;
  • resettable credential-free demo mode.

The backend currently has 209 passing tests.

What we learned

The biggest lesson was that reliable document automation is not only an AI problem.

For financial documents, the strongest architecture combines:

AI for perception + deterministic rules for trust + humans for accountability.

We also learned that preserving raw source values and audit history from the beginning makes later review and integration much safer.

What's next for DocFlow AI

The current hackathon version focuses on a reliable single-document verification lifecycle.

Next steps include:

  • live PDF/JPG/PNG processing through Nutrient DWS;
  • multi-document workspace;
  • persistent storage;
  • user authentication and permissions;
  • richer confidence signals;
  • additional accounting document types;
  • ERP / 1C integrations;
  • XLSX export;
  • production audit persistence;
  • configurable validation rules;
  • organization-level review workflows.

The long-term goal is to make DocFlow AI a trusted document operations layer between unstructured business documents and accounting systems.

Built With

  • ai
  • api
  • data
  • document
  • dws
  • extraction
  • httpx
  • json
  • nutrient
  • ocr
  • pytest
  • python
  • schema
Share this project:

Updates

Submission history