IronMiner is a construction site dashboard for superintendents. It turns site walkthrough footage into zone-by-zone safety violations, congestion scores, and short written briefings, and adds live worker video, alerts, and crew assignment. It was built as a team project at the UMD x IronSite 2026 hackathon and is a prototype, not a production system.
- Safety Agent (
app/agents/safety_agent.py): rule checks based on OSHA 29 CFR 1926 for PPE, fall protection, crane loads, hot work, blocked egress, and trade proximity. Detection is deterministic Python; an LLM only writes the summary. - Productivity Agent (
app/agents/productivity_agent.py): scores congestion 1 to 5 per zone from worker density and trade count, flags trade overlaps, and generates rule-based suggestions plus an LLM-written briefing. - Team planner (
app/agents/team_planner_agent.py): asks Claude to propose assignments of unassigned workers to teams, returned as JSON. - Live mode: LiveKit tokens and rooms for manager and worker video, WebSocket channels for alerts and pipeline progress, a browser worker simulator at
/worker, and an Android headset client inheadset-client/. - React dashboard with Review, Live, Teams, and Crew views and a 3D zone layout built with three.js.
- The Video Agent does not analyze uploaded video. It returns zone data from a matching JSON file in
demo_assets/if one exists, otherwise a fixed set of five hand-written zones based on a cached Twelve Labs Pegasus summary (app/summarizer/summary.txt). The upload is only used to cut thumbnail chunks. - Vast.ai GPU inference (
app/services/vastai_client.py,scripts/remote_inference.py) is not wired into the upload pipeline. - Team benchmark evaluation uses embedding similarity if
sentence-transformersis installed, and otherwise falls back to keyword (Jaccard) overlap inapp/agents/keyword_evaluator.py. - The frontend falls back to mock data in
gui/src/utils/mockData.tswhen API calls fail, and several components read from it directly. - Single-frame safety analysis and live feed scanning return HTTP 501.
- Without Supabase, data is held in memory and lost on restart.
app/services/storage.pyand the tests importapp/data/mock_video_results.py, which is excluded by.gitignoreand is not in the repository. The backend and tests will not start from a fresh clone until that module is restored.
- Backend: Python 3.11, FastAPI, WebSockets, Pydantic
- LLM: Ollama (default) or the Claude API for summaries; Claude for team planning
- Frontend: React 18, TypeScript, Vite, three.js via react-three-fiber, dnd-kit
- Realtime video: LiveKit (server in Docker, client SDKs in web and Android)
- Storage: Supabase (optional) with in-memory fallback
- Android headset client: Kotlin, LiveKit Android SDK
Prerequisites: Python 3.11, Node 20, Docker, and either Ollama or an Anthropic API key.
Environment variables are listed in .env.example (backend) and gui/.env.example (frontend). Copy them to .env and gui/.env.
- Backend:
ANTHROPIC_API_KEY,LIVEKIT_API_KEY,LIVEKIT_API_SECRET,LIVEKIT_HOST,LIVEKIT_PUBLIC_WS_URL,LLM_PROVIDER,OLLAMA_BASE_URL,OLLAMA_MODEL,SUPABASE_URL,SUPABASE_KEY,VASTAI_API_KEY,VASTAI_BASE_URL,VASTAI_INSTANCE_ID,VASTAI_MODEL_ID - Frontend:
VITE_API_URL,VITE_LIVEKIT_URL,VITE_SUPABASE_URL,VITE_SUPABASE_KEY
Install:
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cd gui && npm installrequirements.txt does not list every package the code imports. Depending on which features you use you may also need anthropic, supabase, av, numpy, pytest, and for the optional paths tenacity, vastai-sdk, and sentence-transformers.
Run everything (LiveKit, Redis, and Ollama via docker-compose.yml, then the backend on port 8000 and Vite on port 5173):
./scripts/dev.shOr run the pieces yourself:
docker-compose up -d
uvicorn app.main:app --reload --port 8000
cd gui && npm run devAPI docs are served at http://localhost:8000/docs.
Tests (deterministic Safety Agent rule checks, no network or LLM):
pytest app/testsWith the backend on port 8000, upload a walkthrough video. The response is a VideoJob; the Video, Safety, and Productivity agents then run in the background.
curl -F "file=@site_walkthrough.mp4" -F "site_id=s1" http://localhost:8000/api/video/uploadNaming the file site_walkthrough.mp4 makes the Video Agent load demo_assets/site_walkthrough.json. Then read the reports for that site:
curl http://localhost:8000/api/safety/report/s1
curl "http://localhost:8000/api/safety/report/s1/violations?severity=high"
curl http://localhost:8000/api/productivity/report/s1/zonesAsk Claude to fill empty teams for a site (requires ANTHROPIC_API_KEY):
curl -X POST "http://localhost:8000/api/teams/auto-assign?site_id=s1"In the browser, open http://localhost:5173 for the dashboard and http://localhost:5173/worker for the worker simulator.
POST /api/video/upload(app/routers/video.py) saves the file and runs the Video Agent, which produces aVideoProcessingResultof zones, workers, PPE, hazards, and egress paths (see Current limitations for where that data comes from).- The Safety and Productivity agents run on that result. Each does its analysis in plain Python, then calls
app/services/llm_client.py(Ollama CLI or Claude, chosen byLLM_PROVIDER) for a short summary. If the LLM call fails, a templated summary is used. - Progress and alerts are pushed to the dashboard over WebSockets (
app/ws/manager.py,app/routers/streaming.py). app/services/db.pyreads and writes Supabase when configured and falls back to in-memory dicts inapp/services/storage.py. Workers and teams persist to JSON files underdata/(app/services/team_service.py).app/services/livekit_service.pyissues LiveKit access tokens for managers and workers.
app/
agents/ video, safety, productivity, team planner, evaluators
routers/ sites, video, safety, productivity, alerts, streaming, workers, teams
services/ LLM clients, LiveKit, Supabase, storage, Vast.ai, job queue
models/ Pydantic schemas
summarizer/ Twelve Labs Pegasus script and cached summary
tests/ pytest tests for the Safety Agent
gui/src/
views/ Review, Live, Teams, Crew, WorkerSimulator
components/ panels, BIM zone view, team board, live stream grid
api/ backend client functions
headset-client/ Android app that streams a worker's camera to LiveKit
demo_assets/ canned zone JSON for demo uploads
scripts/ dev.sh, Supabase seeding, remote inference
Issues and pull requests are welcome. Before opening a PR, run pytest app/tests and npm run build in gui/. CI (.github/workflows/ci.yml) installs requirements.txt and builds the frontend.
MIT, see LICENSE.