Status: 📝 Planned
Constitution: §1.3 (Integration Patterns), §2.1 (Integration documentation)
Overview
FA-22 adds invoice scan/OCR, duplicate detection, and 3-way match automation. It integrates with PF-27 (Platform AI), FA-03/FA-04 (bills, POs, receipts), and FW-16 (workflow events).Integration Points (from spec)
Event Contracts (FW-16)
Channel:fa_events (or equivalent).Subscribers: FW-16 (Workflow Events) – register event_type values below for workflow triggers. Canonical event names use snake_case past-tense: fa_bill_scan_completed, fa_bill_duplicate_flagged. Full contracts: EVENT_CONTRACTS.md.
fa_bill_scan_completed
When: After invoice scan completes and result is stored in fa_invoice_scans. Payload schema (JSON):
Example payload:
fa_bill_duplicate_flagged
When: After duplicate detection creates a fa_duplicate_detection_log entry. Payload schema (JSON):
Example payload:
API / Edge Functions
- fa-scan-invoice: Invokes PF-27 for extraction; writes to fa_invoice_scans and storage bucket
fa-invoice-scans. No direct API contract with other cores; called from FA UI. - fa-detect-duplicates: Runs on bill insert or cron; writes fa_duplicate_detection_log. Internal to FA.
- fa-auto-match-3way: Returns suggested matches for PO-Receipt-Bill; internal to FA or called from FA UI.
Security & Tenant Isolation
- All FA-22 tables and storage bucket are scoped by
organization_id. - PF-27 calls use edge function only; no PHI in prompts (anonymized identifiers if needed).
- Event payloads include
organization_idfor subscriber filtering.