How rohitjg13/stupid-apple works
Intelligent Retail Analytics is an offline-first, edge-camera retail analytics product. Its main user workflow is uploading overhead and shelf clips in the web wizard, generating a clipset, starting a run, and viewing dashboard results. At runtime, sources feed interchangeable detectors; shopper, shelf, and queue analytics publish events that are persisted and aggregated for the API. The README documents additional POS and multi-store/cloud-aggregate capabilities. Connections for those documented but unsampled integrations are shown only where supported; unsampled implementation details are not inferred.
Main entry points: main.py Analytics runner · shopper/pipeline.py Shopper analytics · shelf/pipeline.py Shelf analytics · server.py Run server
Components 32
Operator experience
- Wizard and dashboard
web/src/App.svelte - Web API client
web/src/lib/api.js - Run server
server.py - Clipset generation
tools/autoconfig.py
Capture and inference
- Clipset configuration
core/config.py - Analytics runner
main.py - Video sources
sources - Frame contract
pl/contract.py - Reference detector
pl/reference.py - YOLO detector
pl/yolo.py
Store analytics
- Shopper analytics
shopper/pipeline.py - Shopper tracking
shopper/tracker.py - Entry and exit counts
shopper/tripwire.py - Dwell and visits
shopper/visits.py - Movement heatmaps
shopper/heatmap.py - Shelf analytics
shelf/pipeline.py - Shelf fill monitor
shelf/fill.py - Stockout detection
shelf/stockout.py - Planogram compliance
shelf/planogram.py - Inventory tracking
shelf/inventory_tracker.py - Queue and POS events
backend/pipeline.py - Queue estimates
backend/queue_model.py - Staffing advice
backend/staffing.py
Events and reporting
- Event bus
core/bus.py - Event contract
core/events.py - Event persistence
backend/sink.py - SQLite store
backend/db.py - KPI aggregation
backend/aggregates.py - Analytics API
backend/api.py - Aggregate cloud sync
backend/cloud_sync.py - POS CSV integration
backend/pos_csv.py
Other components
- Store operator
Connections 36
- Store operator → Wizard and dashboard: uploads clips
- Wizard and dashboard → Web API client: requests data
web/src/App.svelte - Web API client → Run server: calls endpoints
- Run server → Clipset generation: generates clipset
server.py - Run server → Clipset configuration: loads settings
server.py - Run server → Analytics runner: starts run
server.py - Analytics runner → Video sources: builds sources
main.py - Video sources → Frame contract: yields frames
sources/sim.py - Analytics runner → Reference detector: selects backend
main.py - Analytics runner → YOLO detector: selects backend
main.py - Reference detector → Frame contract: emits results
pl/reference.py - YOLO detector → Frame contract: emits results
pl/yolo.py - Analytics runner → Shopper analytics: processes overhead
main.py - Analytics runner → Shelf analytics: processes shelf
main.py - Analytics runner → Queue and POS events: processes queue cells
backend/pipeline.py - Shopper analytics → Shopper tracking: tracks people
shopper/pipeline.py - Shopper analytics → Entry and exit counts: counts crossings
shopper/pipeline.py - Shopper analytics → Dwell and visits: measures dwell
shopper/pipeline.py - Shopper analytics → Movement heatmaps: builds heatmap
shopper/pipeline.py - Shelf analytics → Shelf fill monitor: measures fill
shelf/pipeline.py - Shelf analytics → Stockout detection: tracks stockouts
shelf/pipeline.py - Shelf analytics → Planogram compliance: audits layout
shelf/pipeline.py - Shelf analytics → Inventory tracking: tracks inventory
shelf/pipeline.py - Queue and POS events → Queue estimates: estimates queues
backend/pipeline.py - Queue and POS events → Staffing advice: requests advice
backend/pipeline.py - Shopper analytics → Event bus: publishes events
shopper/pipeline.py - Shelf analytics → Event bus: publishes events
shelf/pipeline.py - Queue and POS events → Event bus: publishes events
backend/pipeline.py - Event bus → Event contract: uses envelope
- Event bus → Event persistence: delivers events
main.py - Event persistence → SQLite store: writes events
backend/sink.py - Run server → Analytics API: serves endpoints
server.py - Analytics API → KPI aggregation: provides KPIs
- KPI aggregation → SQLite store: reads history
- Queue and POS events → POS CSV integration: optional POS input
- KPI aggregation → Aggregate cloud sync: optional aggregate sync