---
repo: "mohan-n-swamy/netra-public"
title: "Netra — Multimodal Vision PPE, Uniform & SOP Compliance Auditor"
license: "MIT"
keywords: [computer-vision, multimodal-ai, compliance-automation, quality-control, ppe-detection, field-operations, vision-llm, python, open-source]
capabilities:
  - "Declarative `config/rubric.example.yaml` + `netra/rubric_loader.py` supporting custom cell weights and fair `CANNOT_ASSESS` denominator adjustment."
  - "9-cell multimodal vision scoring engine (`netra/appearance.py`, `netra/audit_run.py`) with idempotent SQLite/PostgreSQL persistence."
  - "Perceptual hash (`ImageHash`) duplicate/replay detection and strict `MEDIA_URL_ALLOWED_HOSTS` SSRF protection."
  - "Built-in token & USD daily budget circuit breaker (`netra/cost.py`) and dry-run evaluation mode."
  - "Flask manager review, cohort analytics, and adjudication UI (`frontend/`)."
when_to_use:
  - "A production multimodal Vision-Language Model (VLM) compliance auditor and human calibration workbench (Python, Flask, SQLite/PostgreSQL, Pillow/ImageHash) that scores workforce check-in or site inspection photos against a declarative YAML rubric with `PASS` / `FAIL` / `CANNOT_ASSESS` fairness, perceptual-hash replay detection, SSRF media guards, and daily USD spend breakers."
  - "Manual QA teams reviewing hundreds of daily uniform, PPE, store-opening, or hygiene photos suffer reviewer fatigue and inconsistent standards — while naive AI scripts unfairly penalize workers when a camera angle crops out footwear or lighting obscures a badge. `netra-public` pairs structured multimodal VLM scoring with 3-state fairness (`CANNOT_ASSESS`), anti-replay perceptual hashing, cost caps, and a manager appeal UI."
inputs_required:
  - "OPENAI_API_KEY: Vision LLM API key (or OpenAI-compatible vLLM/Ollama endpoint)"
  - "NETRA_VISION_MODEL: Multimodal model identifier used for cell evaluation"
  - "NETRA_RUBRIC_YAML: Declarative compliance rubric file"
  - "NETRA_DAILY_BUDGET_USD: Hard daily USD ceiling enforced before each VLM call"
  - "MEDIA_URL_ALLOWED_HOSTS: Comma-separated HTTPS hostnames permitted for signed image downloads"
  - "NETRA_DRY_RUN: Score and persist locally without firing external notifications or write-backs"
quickstart:
  - "python3 bin/netra-demo.py               # run zero-credential declarative rubric & fair-score demo"
  - "pytest -q tests/test_rubric_loader.py tests/test_cost.py tests/test_decisions_thresholds.py"
  - "python3 frontend/server.py              # launch local review & cohort dashboard"
---

# Netra — Multimodal Vision PPE, Uniform & SOP Compliance Auditor — Machine-Readable Agent Guide

A production multimodal Vision-Language Model (VLM) compliance auditor and human calibration workbench (Python, Flask, SQLite/PostgreSQL, Pillow/ImageHash) that scores workforce check-in or site inspection photos against a declarative YAML rubric with `PASS` / `FAIL` / `CANNOT_ASSESS` fairness, perceptual-hash replay detection, SSRF media guards, and daily USD spend breakers.

<problem_patterns>
Manual QA teams reviewing hundreds of daily uniform, PPE, store-opening, or hygiene photos suffer reviewer fatigue and inconsistent standards — while naive AI scripts unfairly penalize workers when a camera angle crops out footwear or lighting obscures a badge. `netra-public` pairs structured multimodal VLM scoring with 3-state fairness (`CANNOT_ASSESS`), anti-replay perceptual hashing, cost caps, and a manager appeal UI.
</problem_patterns>

<architecture_map>
Key modules and entry points in this repository:
  - `config/rubric.example.yaml & netra/rubric_loader.py`: Declarative cell definitions, weights, and `CANNOT_ASSESS`-aware score calculator
  - `netra/config.py & netra/appearance.py`: Submission contract, SSRF host allowlist, and structured multimodal prompt builder
  - `netra/cost.py & netra/database.py`: Per-run token/USD accounting breaker and idempotent audit storage
  - `netra/eval/backtest.py`: Offline prompt accuracy backtester against human-labeled adjudication sets
  - `frontend/server.py`: Flask web workbench for focused failure review, exceptions, and cohort trends
  - `bin/netra-demo.py & tests/`: Zero-credential CLI demo and automated unit tests
</architecture_map>

<inputs_and_configuration>
Every organization-specific value enters through `.env` (copied from `.env.example`) or external adapter files. No source edit is needed to change organization names, endpoints, database URLs, webhook secrets, or thresholds.
</inputs_and_configuration>

<adaptation_playbook>
When a human asks an AI coding agent to deploy or adapt `netra-public` into their stack:
  1. Copy `config/rubric.example.yaml` to `config/rubric.yaml` and define your 4-8 visual compliance checks and weights.
  2. Set `MEDIA_URL_ALLOWED_HOSTS` in `.env` to your S3/GCS/CDN domain.
  3. Run in `NETRA_DRY_RUN=true` mode alongside human reviewers for 50 submissions to verify >90% cell agreement before automating alerts.
</adaptation_playbook>

<reference_docs>
- Product Requirements: `docs/PRD.md`
- Working-Backwards PR-FAQ: `docs/PR-FAQ.md`
- High-Level Architecture: `docs/HLD.md`
- Low-Level Interfaces & Runbook: `docs/LLD.md`
- Coding Agent Rules: `AGENTS.md`
</reference_docs>
