# pruthil-21/netra architecture

> Architecture diagram of the GitHub repository pruthil-21/netra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pruthil-21/netra
- Repository: https://github.com/pruthil-21/netra

## Overview

DIGDHRISHTI is a camera-network vehicle-intelligence platform: officers view live operations, submit or search plate sightings, investigate traces, and act on watchlist alerts. The documented runtime path runs from cameras through streaming and ANPR inference to detections and alerts, then to officer-facing search and investigation. Separate branches cover registry/RBAC and reporting, continuous recording and playback, and cross-agency inventory federation. Edges reflect the README’s service map and sampled entrypoints; unsampled feature internals are represented at their existing service or directory paths.

Main entry points: [`streaming/recording`](https://github.com/pruthil-21/netra/tree/main/streaming/recording) (Live relay and recorder), [`frontend-map/app`](https://github.com/pruthil-21/netra/tree/main/frontend-map/app) (Operations dashboard), [`frontend-map/services`](https://github.com/pruthil-21/netra/tree/main/frontend-map/services) (API clients), [`frontend-map/components`](https://github.com/pruthil-21/netra/tree/main/frontend-map/components) (Live and archive views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_officer_ui["Officer interface"]
  node_frontend["Operations dashboard"]
  node_frontend_services["API clients"]
  node_stream_ui["Live and archive views"]
end

subgraph group_registry["Registry and access"]
  node_registry_api["Registry API<br/>[main.py]"]
  node_registry_routes["Accounts, cameras, reports"]
  node_registry_services["Registry services"]
  node_shared_db[("PostgreSQL / PostGIS")]
end

subgraph group_vehicle_intelligence["Vehicle intelligence"]
  node_watchlist_api["Watchlist API<br/>[main.py]"]
  node_watchlist_routes["Detection, alert, lookup routes"]
  node_watchlist_services["Detection and investigation"]
  node_ml_pipeline["ANPR inference pipeline<br/>[orchestrator.py]"]
  node_ml_detection["Plate detection and OCR<br/>[detection.py]"]
end

subgraph group_video["Video operations"]
  node_partner_cameras(("Agency cameras"))
  node_streaming["Live relay and recorder"]
  node_recording_api["Recording API<br/>[api.py]"]
  node_archive_storage[("Recording storage")]
end

subgraph group_federation["Agency federation"]
  node_federation_proxy["Registry federation proxy"]
  node_federation_gateway["Federation gateway<br/>[main.py]"]
  node_federation_sync["Inventory synchronization<br/>[sync.py]"]
end

node_officer(("Officer"))
node_partner_systems["Partner camera systems"]

node_officer -->|"uses"| node_frontend
node_frontend -->|"requests data"| node_frontend_services
node_frontend -->|"renders video"| node_stream_ui
node_frontend_services -->|"registry requests"| node_registry_api
node_frontend_services -->|"search and alert requests"| node_watchlist_api
node_stream_ui -->|"requests live video"| node_streaming
node_stream_ui -->|"requests playback"| node_recording_api
node_registry_api -->|"dispatches"| node_registry_routes
node_registry_routes -->|"calls"| node_registry_services
node_registry_services -->|"reads and writes"| node_shared_db
node_watchlist_api -->|"dispatches"| node_watchlist_routes
node_watchlist_routes -->|"calls"| node_watchlist_services
node_watchlist_services -->|"reads and writes"| node_shared_db
node_partner_cameras -->|"video feeds"| node_streaming
node_streaming -->|"sends frames"| node_ml_pipeline
node_ml_pipeline -->|"runs inference"| node_ml_detection
node_ml_pipeline -->|"reports confirmed reads"| node_watchlist_api
node_streaming -->|"serves recordings"| node_recording_api
node_streaming -->|"archives footage"| node_archive_storage
node_recording_api -->|"reads recordings"| node_archive_storage
node_registry_api -->|"mounts proxy"| node_federation_proxy
node_federation_proxy -->|"proxied requests"| node_federation_gateway
node_federation_gateway -->|"schedules sync"| node_federation_sync
node_federation_sync -->|"syncs inventory"| node_partner_systems

click node_frontend "https://github.com/pruthil-21/netra/tree/main/frontend-map/app"
click node_frontend_services "https://github.com/pruthil-21/netra/tree/main/frontend-map/services"
click node_stream_ui "https://github.com/pruthil-21/netra/tree/main/frontend-map/components"
click node_registry_api "https://github.com/pruthil-21/netra/blob/main/backend-registry/app/main.py"
click node_registry_routes "https://github.com/pruthil-21/netra/tree/main/backend-registry/app/routers"
click node_registry_services "https://github.com/pruthil-21/netra/tree/main/backend-registry/app/services"
click node_watchlist_api "https://github.com/pruthil-21/netra/blob/main/backend-watchlist/app/main.py"
click node_watchlist_routes "https://github.com/pruthil-21/netra/tree/main/backend-watchlist/app/routers"
click node_watchlist_services "https://github.com/pruthil-21/netra/tree/main/backend-watchlist/app/services"
click node_ml_pipeline "https://github.com/pruthil-21/netra/blob/main/ml-anpr/anpr/pipeline/orchestrator.py"
click node_ml_detection "https://github.com/pruthil-21/netra/blob/main/ml-anpr/anpr/detection.py"
click node_streaming "https://github.com/pruthil-21/netra/tree/main/streaming/recording"
click node_recording_api "https://github.com/pruthil-21/netra/blob/main/streaming/recording/api.py"
click node_federation_proxy "https://github.com/pruthil-21/netra/blob/main/backend-registry/app/federation_proxy.py"
click node_federation_gateway "https://github.com/pruthil-21/netra/blob/main/middleware/federation/main.py"
click node_federation_sync "https://github.com/pruthil-21/netra/blob/main/middleware/federation/sync.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_frontend_services,node_stream_ui toneBlue
class node_registry_api,node_registry_routes,node_registry_services,node_shared_db toneAmber
class node_watchlist_api,node_watchlist_routes,node_watchlist_services,node_ml_pipeline,node_ml_detection toneMint
class node_partner_cameras,node_streaming,node_recording_api,node_archive_storage toneRose
class node_federation_proxy,node_federation_gateway,node_federation_sync,node_officer,node_partner_systems toneIndigo
```

## Components

### Officer interface

- [Operations dashboard](https://github.com/pruthil-21/netra/tree/main/frontend-map/app): `frontend-map/app`
- [API clients](https://github.com/pruthil-21/netra/tree/main/frontend-map/services): `frontend-map/services`
- [Live and archive views](https://github.com/pruthil-21/netra/tree/main/frontend-map/components): `frontend-map/components`

### Registry and access

- [Registry API](https://github.com/pruthil-21/netra/blob/main/backend-registry/app/main.py): `backend-registry/app/main.py`
- [Accounts, cameras, reports](https://github.com/pruthil-21/netra/tree/main/backend-registry/app/routers): `backend-registry/app/routers`
- [Registry services](https://github.com/pruthil-21/netra/tree/main/backend-registry/app/services): `backend-registry/app/services`
- **PostgreSQL / PostGIS**

### Vehicle intelligence

- [Watchlist API](https://github.com/pruthil-21/netra/blob/main/backend-watchlist/app/main.py): `backend-watchlist/app/main.py`
- [Detection, alert, lookup routes](https://github.com/pruthil-21/netra/tree/main/backend-watchlist/app/routers): `backend-watchlist/app/routers`
- [Detection and investigation](https://github.com/pruthil-21/netra/tree/main/backend-watchlist/app/services): `backend-watchlist/app/services`
- [ANPR inference pipeline](https://github.com/pruthil-21/netra/blob/main/ml-anpr/anpr/pipeline/orchestrator.py): `ml-anpr/anpr/pipeline/orchestrator.py`
- [Plate detection and OCR](https://github.com/pruthil-21/netra/blob/main/ml-anpr/anpr/detection.py): `ml-anpr/anpr/detection.py`

### Video operations

- **Agency cameras**
- [Live relay and recorder](https://github.com/pruthil-21/netra/tree/main/streaming/recording): `streaming/recording`
- [Recording API](https://github.com/pruthil-21/netra/blob/main/streaming/recording/api.py): `streaming/recording/api.py`
- **Recording storage**

### Agency federation

- [Registry federation proxy](https://github.com/pruthil-21/netra/blob/main/backend-registry/app/federation_proxy.py): `backend-registry/app/federation_proxy.py`
- [Federation gateway](https://github.com/pruthil-21/netra/blob/main/middleware/federation/main.py): `middleware/federation/main.py`
- [Inventory synchronization](https://github.com/pruthil-21/netra/blob/main/middleware/federation/sync.py): `middleware/federation/sync.py`

### Other components

- **Officer**
- **Partner camera systems**

## Connections

- Officer → Operations dashboard: uses
- Operations dashboard → API clients: requests data
- Operations dashboard → Live and archive views: renders video
- API clients → Registry API: registry requests
- API clients → Watchlist API: search and alert requests
- Live and archive views → Live relay and recorder: requests live video
- Live and archive views → Recording API: requests playback
- Registry API → Accounts, cameras, reports: dispatches
- Accounts, cameras, reports → Registry services: calls
- Registry services → PostgreSQL / PostGIS: reads and writes
- Watchlist API → Detection, alert, lookup routes: dispatches
- Detection, alert, lookup routes → Detection and investigation: calls
- Detection and investigation → PostgreSQL / PostGIS: reads and writes
- Agency cameras → Live relay and recorder: video feeds
- Live relay and recorder → ANPR inference pipeline: sends frames
- ANPR inference pipeline → Plate detection and OCR: runs inference
- ANPR inference pipeline → Watchlist API: reports confirmed reads
- Live relay and recorder → Recording API: serves recordings
- Live relay and recorder → Recording storage: archives footage
- Recording API → Recording storage: reads recordings
- Registry API → Registry federation proxy: mounts proxy
- Registry federation proxy → Federation gateway: proxied requests
- Federation gateway → Inventory synchronization: schedules sync
- Inventory synchronization → Partner camera systems: syncs inventory
