Audience: engineers and power users who want to know how an emailed invoice becomes a posted NetSuite Vendor Bill — the “magic” explained.

The pipeline at a glance

An invoice flows through a chain of small, independently-testable stages:

Email → Triage (classify) → Draft + vendor resolve → OCR (Textract) → Structure (Claude) → PO match → Item match → Vendor coding → Project coding → Validate → Review → Post (SuiteTalk)

Every stage writes its result onto one VendorBillDraft.draft JSON blob (header + lines + totals), so any stage is inspectable and re-runnable.

1. Ingest & triage

2. Draft creation & vendor resolution

NetsuiteBills::DraftInitiator:

3. OCR — AWS Textract

NetsuiteBills::OcrJob runs Textract (async start-then-poll), storing raw text + tables + blocks in BillOcrResult. Status → ocr_done → structuring.

4. Structuring — Claude with forced tool use

NetsuiteBills::BillStructurer is the heart: