Demo app — all sample data is fictional.
DocuSift

About this project

DocuSift is a portfolio piece by Uriel Papa, built to show an AI document-automation workflow end to end.

The problem

Philippine SMEs, bookkeepers and accounts-payable teams still key in sales invoices and official receipts by hand — vendor TINs, VAT breakdowns and line items — for BIR compliance and expense reporting.

A clerk typically spends 3–5 minutes per document, and typos in a TIN or VAT amount cause rework, failed reconciliations and audit risk. At a few hundred documents a month, that is days of skilled time spent copying numbers.

The approach

A vision model reads the document image and returns structured output against a fixed schema, with a confidence score per field. Arithmetic and format checks are then computed deterministically in code — the model is never trusted to grade its own math.

This is the human-in-the-loop pattern: anything low-confidence or rule-breaking is routed to a reviewer, every correction is recorded, and those corrections become a field-level accuracy report that shows exactly where the AI can be trusted to auto-approve.

Architecture

Browser (React + TanStack Start)
  └─ renders PDF page 1 / SVG sample → JPEG (pdf.js, canvas)
       ↓ server functions (edge runtime)
  createDocument → Cloud storage "uploads" + documents row
  extractDocument → Lovable AI vision model (structured output)
                  → validation rules in code → status
  saveDocument / deleteDocument / setAutoApprove / resetDemo
       ↓
Lovable Cloud database (Postgres, RLS on)
  • Tables: documents (image, extracted values, reviewed values, confidence, changed fields, timing, status) and app_settings (auto-approve flag). Both are read-only to the public; all writes go through server functions.
  • Functions: createDocument, extractDocument, saveDocument, deleteDocument, setAutoApprove, resetDemo, plus a reset_demo() database function that restores the seed state.
  • Validation: line items vs. sales, totals reconcile, VAT = 12%, TIN format, valid non-future date — each ±₱1.00.

What I'd do next in a real deployment

  • Authentication with per-company workspaces and reviewer roles; audit trail of who approved what.
  • Multi-page PDFs, email/Drive ingestion and a background queue for batch uploads.
  • Vendor master data: match TINs to known suppliers and flag new or mismatched vendors.
  • Push approved data to Xero, QuickBooks or an ERP instead of CSV; per-field auto-approve thresholds tuned from the accuracy report.
  • An evaluation set of real (redacted) documents to compare models and prompts before each change.

Author

Uriel Papa