Lerato photographs a Woolworths or Checkers till slip and items land in her pantry automatically. No manual entry required for a regular weekly shop.
Grace can scan a product barcode and add or increment a single item in under 4 taps.
Stories
ID
Story
Priority
CAP-001
Photograph till slip, auto-add items to pantry
High
CAP-002
Multi-section scanning for long receipts
Medium
CAP-003
Barcode scanning to log individual items
Medium
Architecture
Google Cloud Vision is called via a Supabase Edge Function to keep the API key server-side. The browser never touches the Vision API directly.
Scan Flow
Camera capture or file upload → Edge Function (Vision API + SA parsing) → Review screen (editable items) → Confirm → inventory_items + receipts
Edge Function
Supabase Edge Function at supabase/functions/scan-receipt. Validates JWT, calls Vision API, applies SA till slip parsing rules, returns structured items.
SA Receipt Parsing
Specific rules for Woolworths, Checkers, Pick n Pay, and Makro. Skips totals, VAT, discount lines. Handles quantity multipliers. Auto-assigns categories.
Barcode Scanning
ZXing (@zxing/browser) for real-time camera barcode scanning. Matches against existing inventory items or prompts manual entry.
Pre-Sprint Nav Fixes
Add Scan nav item to AuthLayout.jsx (between Inventory and Budget)
Fix Budget badge from "Sprint 3" to "Sprint 4"
Both changes deploy before any scanning story begins
New Routes
Route
Component
Story
/scan
ReceiptScan.jsx (replace stub)
CAP-001
/scan/barcode
BarcodeScan.jsx (new)
CAP-003
Integration Tests Planned
CAP-001-parse: Mock Vision response with known receipt text, verify parsing output
CAP-001-write: Confirm flow writes correct rows to inventory_items and receipts
CAP-003: Create test item with barcode, simulate scan match, verify quantity incremented
All 16 Sprint 2 tests must continue to pass.
Definition of Done
Real receipt scanned and items appear in inventory on pantry-app.tapfumamv.com
Multi-scan session merges items correctly
Barcode scan increments or creates item
All integration tests pass (16 existing + 3 new)
No broken layouts, no stale placeholder text anywhere in the app
Sprint report, retro, and backlog update all done before sprint is marked closed