Requirement EPIC
- Epic
- MVP1 · E5 · JSON review, metadata and CSV
- Goal
- clean, trustworthy outputs the user can preview before paying.
- Stories in this module
- 5
DOCFLOW-V1-E5-01 Final JSON with metadata
Size MDocFlow app
- AC1The JSON has
data (the invoice v1 schema with final values) and metadata: document_id, file_name, pages, model, prompt_version, extracted_at, reviewed_at, reviewed_by, fields_flagged, fields_corrected, and per-field confidence and corrected flags. - AC2The output is validated against a published JSON Schema in
schemas/invoice-v1.json. - AC3The JSON preview has syntax highlighting and folding, and works on mobile.
DOCFLOW-V1-E5-02 CSV export
Size SDocFlow app
- AC1One row per line item, with invoice-level columns repeated on each row; the header order is documented.
- AC2Quoting follows RFC 4180, with UTF-8 encoding and a BOM so Excel opens it correctly.
- AC3Cells starting with
=, +, -, @, tab or carriage return are prefixed with ' (CSV injection protection), with a unit test. - AC4An invoice with no line items gives one row with empty line columns.
DOCFLOW-V1-E5-03 Locked preview
Size SDocFlow app
- AC1Before payment, I can see a short preview of both outputs on screen: four fields (vendor, invoice number, date and total) and how many more fields and line items unlock after payment. Download buttons show "Pay to download". After payment I see everything. (Changed 22 Nov 2026, Nikhil: a full preview gave the results away before payment.)
- AC3The preview limit is enforced on the server, like the download lock, so the full results cannot be read through the API before payment.
- AC4Before payment, DocFlow's screens list only the flagged fields: after extraction, in the review and in the results page's Edit values. The fields read with high confidence stay hidden, with a line saying how many unlock after payment (Nikhil, 22 Nov 2026). The services enforce it too, through the hold in
DOCFLOW-V1-E5-05. - AC2The download endpoints return 402 until the order is paid, enforced on the server.
DOCFLOW-V1-E5-04 Build outputs on demand
Size SDocFlow app (values from Human Review, metadata from LLM Extraction)
- AC1
result.json and result.csv are never stored. Every preview and download builds them from Review's latest values and Extraction's metadata, so they always reflect the final document (Nikhil's decision on #45, ARCHITECTURE.md §12.8). - AC2The person can correct values on the results page, before or after paying. Corrections are saved in Review with their history, the checks re-run, and the next preview or download shows them. No new payment is asked for.
DOCFLOW-V1-E5-05 DocFlow holds results until payment
Size SDocFlow appPending
**Status: designed (#179), 23 Nov 2026 (Nikhil's decision; docs/services/shared/v1/DECISIONS.md).**
As the owner, I want the full results unreadable through any API until the person has paid, so the preview is the only thing given away (API first: preview, then payment, then full data).
- AC1DocFlow starts every extraction job and review task with
hold: true and a delegated token for the owner (act: service:docflow), so DocFlow is the holder (EXTRACTION-V1-E3-08, REVIEW-V1-E4-06). - AC2DocFlow reads results as the holder, with a delegated token, for the preview, the checks and the downloads; before payment its own API still returns only the four-field preview (
DOCFLOW-V1-E5-03 AC3). - AC3On
payment.order.paid, DocFlow releases the job and the task (each safe to repeat), then sets the document paid and asks Delivery for the email. If a release fails, the event is retried; the person is not blocked, because downloads are built by DocFlow as the holder. - AC4A test shows that, before payment, the owner's own token gets only the flagged fields from Extraction and Review, and four fields from DocFlow; after payment, every field everywhere.
All DocFlow V1 epics and stories on GitHub →