This guide walks you through cloning the repository, installing all Python and Node.js dependencies, launching the FastAPI + Socket.IO backend, starting the React dashboard, and sending your first test events — all without needing a trained YOLO model or a physical camera. By the end you will have a live inventory feed running in your browser.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/elzackarias/Hackaton3B-Reto1/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following are available on your machine:- Python 3.10+ — required for FastAPI, Ultralytics, and all backend modules
- Node.js 18+ — required for the Vite-based React frontend
- A USB camera or RTSP stream — needed for live inference; mock endpoints work without one
- git — to clone the repository
Clone the repository
Open a terminal and run:This clones the full monorepo containing
backend/, frontend/, scripts/, and assets/.Install all dependencies
A single setup script handles both the Python virtual environment (under The script runs in two stages: PASO 1/2 installs Python dependencies from
backend/.venv) and the Node.js packages (under frontend/node_modules). Run the variant matching your OS:backend/requirements.txt into the virtual environment, and PASO 2/2 runs npm install in the frontend/ directory.Start the backend server
Activate the virtual environment and launch Uvicorn. The ASGI app exported from On startup the backend will:
main.py is called combined_app — it wraps both FastAPI and the Socket.IO server into a single ASGI application:- Initialize all engine instances (
InventoryEngine,PredictionEngine,HeatmapEngine,NarrativeEngine). - Register observer callbacks so M6, M7, and M8 react to every inventory event.
- Attempt to start the camera pipeline in a background thread (auto-retries with exponential backoff if no camera is found).
- Expose the Swagger UI at
http://localhost:8000/docs.
The first inference call after startup is noticeably slower than subsequent ones. This is expected:
DetectionEngine.__init__ deliberately runs 3 dummy inferences on a blank 640×640 frame to warm up the YOLO model and CUDA/CPU kernels before any real video is processed.Start the React dashboard
In a second terminal, from the project root:Vite starts the development server. The project’s
vite.config.ts sets the port to 3000 — open http://localhost:3000 in your browser.Verify both services are running
| URL | What you should see |
|---|---|
http://localhost:3000 | React dashboard with live Socket.IO connection indicator |
http://localhost:8000/docs | Swagger UI listing all REST endpoints |
http://localhost:8000/api/health | {"status": "ok", "uptime": <seconds>} |
http://localhost:8000/dashboard | Embedded HTML inventory dashboard |
Trigger a test event via the mock endpoint
The A successful response looks like this:If you have the React dashboard open you will see the stock card for the chosen SKU decrement in real time — the event travels through
/api/mock/event endpoint picks a random SKU and injects a RETIRO (removal) event into the inventory engine — no camera or YOLO model needed:InventoryEngine → observer callbacks → Socket.IO broadcast → React state update.If stock for the randomly chosen SKU is already at 0, the endpoint returns
{"status": "ignored", "message": "Evento ignorado (stock en 0 o duplicado)"} — this is expected behaviour, not an error. Use POST /api/inventory/reset to restore all stocks to 8 before re-running.Simulate a specific product removal
Use You can also simulate a return — for example, putting a product back on the shelf:Both requests return the resulting
POST /api/events to inject an event for a named SKU and event type. The event_type field accepts "retiro" (removal) or "devolucion" (return):InventoryEvent object and simultaneously push an inventory_update Socket.IO message to all connected dashboard clients.What Happens Next
Once both services are running and events are flowing, the dashboard updates in real time across all connected tabs:- Stock cards turn yellow (≤ 50 %) or red (≤ 20 %) as units are removed.
- Narrative panel shows auto-generated Spanish messages such as “Nachos Naturasol retirado del slot 4. Stock: 7”.
- Predictions panel displays estimated minutes to depletion once at least 2 removal events have occurred for a SKU.
- Heatmap highlights the most-interacted slots within the configured time window (default: last 5 minutes).