# shirooni-01/indradhanu- architecture

> Architecture diagram of the GitHub repository shirooni-01/indradhanu-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shirooni-01/indradhanu-
- Repository: https://github.com/shirooni-01/indradhanu-

## Overview

Indradhanu is a wildlife early-warning system: edge camera nodes detect target animals, buffer events and snapshots locally, then synchronize them to a central server for verification, alerting, and dashboard monitoring. The graph separates edge capture/detection from central verification and siren policy/control, and includes the two storage tiers and documented SMS capability. Edges follow the sampled calls and README descriptions; several dashboard details and edge internals are represented only at the documented subsystem level.

Main entry points: [`edge/edge_daemon.py`](https://github.com/shirooni-01/indradhanu-/blob/main/edge/edge_daemon.py) (Edge Station), [`app.py`](https://github.com/shirooni-01/indradhanu-/blob/main/app.py) (Central Server), [`edge/services/sync_client.py`](https://github.com/shirooni-01/indradhanu-/blob/main/edge/services/sync_client.py) (Sync Client), [`services/siren_service.py`](https://github.com/shirooni-01/indradhanu-/blob/main/services/siren_service.py) (Siren Policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge Monitoring"]
  node_edge_daemon["Edge Station<br/>[edge_daemon.py]"]
  node_pir["PIR Sensor<br/>[pir_sensor.py]"]
  node_camera["Thermal Camera<br/>[thermal_camera.py]"]
  node_edge_ai["Edge Detector<br/>[detector.py]"]
  node_edge_store[("Edge Event Buffer<br/>[edge_db.py]")]
  node_edge_sync["Sync Client<br/>[sync_client.py]"]
end

subgraph group_central["Central Coordination"]
  node_central_app["Central Server<br/>[app.py]"]
  node_central_ai["Central Verification<br/>[verifier.py]"]
  node_central_detector["Spatial Detector<br/>[detector.py]"]
  node_central_store[("Central Event Store<br/>[db_manager.py]")]
  node_system_config["System Configuration<br/>[system_config.py]"]
end

subgraph group_alerts["Alerting and Siren"]
  node_sms["SMS Dispatch<br/>[sms_service.py]"]
  node_siren_policy["Siren Policy<br/>[siren_service.py]"]
  node_siren_controller["Siren Controller"]
  node_relay["GPIO Siren Relay"]
end

subgraph group_ops["Operations Dashboard"]
  node_dashboard["Web Dashboard<br/>[index.html]"]
end

node_field_user(("Field Operator"))
node_browser(("Dashboard User"))
node_sms_gateway["SMS Gateway"]
node_central_service["Central HTTP API"]

node_field_user -.->|"operates"| node_edge_daemon
node_edge_daemon -->|"captures frames"| node_camera
node_edge_daemon -->|"checks motion"| node_pir
node_edge_daemon -->|"runs inference"| node_edge_ai
node_edge_daemon -->|"stores events"| node_edge_store
node_edge_sync -->|"reads pending events"| node_edge_store
node_edge_daemon -->|"starts sync"| node_edge_sync
node_edge_sync -->|"uploads events"| node_central_service
node_central_service -->|"routes requests"| node_central_app
node_central_app -->|"persists events"| node_central_store
node_central_app -->|"verifies snapshots"| node_central_ai
node_central_ai -->|"uses detector"| node_central_detector
node_central_app -->|"requests alert decision"| node_siren_policy
node_siren_policy -->|"records alert"| node_central_store
node_siren_policy -->|"sends command"| node_siren_controller
node_siren_controller -->|"drives relay"| node_relay
node_central_app -->|"dispatches notifications"| node_sms
node_edge_daemon -->|"flushes queued SMS"| node_sms
node_sms -.->|"sends messages"| node_sms_gateway
node_central_app -->|"loads configuration"| node_system_config
node_browser -->|"views status"| node_dashboard
node_dashboard -.->|"uses dashboard routes"| node_central_app

click node_edge_daemon "https://github.com/shirooni-01/indradhanu-/blob/main/edge/edge_daemon.py"
click node_pir "https://github.com/shirooni-01/indradhanu-/blob/main/edge/hardware/pir_sensor.py"
click node_camera "https://github.com/shirooni-01/indradhanu-/blob/main/edge/hardware/thermal_camera.py"
click node_edge_ai "https://github.com/shirooni-01/indradhanu-/blob/main/edge/ml_engine/detector.py"
click node_edge_store "https://github.com/shirooni-01/indradhanu-/blob/main/edge/database/edge_db.py"
click node_edge_sync "https://github.com/shirooni-01/indradhanu-/blob/main/edge/services/sync_client.py"
click node_central_app "https://github.com/shirooni-01/indradhanu-/blob/main/app.py"
click node_central_ai "https://github.com/shirooni-01/indradhanu-/blob/main/ml_engine/verifier.py"
click node_central_detector "https://github.com/shirooni-01/indradhanu-/blob/main/ml_engine/detector.py"
click node_central_store "https://github.com/shirooni-01/indradhanu-/blob/main/database/db_manager.py"
click node_system_config "https://github.com/shirooni-01/indradhanu-/blob/main/database/system_config.py"
click node_sms "https://github.com/shirooni-01/indradhanu-/blob/main/edge/services/sms_service.py"
click node_siren_policy "https://github.com/shirooni-01/indradhanu-/blob/main/services/siren_service.py"
click node_siren_controller "https://github.com/shirooni-01/indradhanu-/blob/main/edge/siren_controller.py"
click node_dashboard "https://github.com/shirooni-01/indradhanu-/blob/main/templates/index.html"

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_edge_daemon,node_pir,node_camera,node_edge_ai,node_edge_store,node_edge_sync,node_browser toneBlue
class node_central_app,node_central_ai,node_central_detector,node_central_store,node_system_config toneAmber
class node_sms,node_siren_policy,node_siren_controller,node_relay,node_central_service toneMint
class node_dashboard toneRose
class node_field_user,node_sms_gateway toneIndigo
```

## Components

### Edge Monitoring

- [Edge Station](https://github.com/shirooni-01/indradhanu-/blob/main/edge/edge_daemon.py): `edge/edge_daemon.py`
- [PIR Sensor](https://github.com/shirooni-01/indradhanu-/blob/main/edge/hardware/pir_sensor.py): `edge/hardware/pir_sensor.py`
- [Thermal Camera](https://github.com/shirooni-01/indradhanu-/blob/main/edge/hardware/thermal_camera.py): `edge/hardware/thermal_camera.py`
- [Edge Detector](https://github.com/shirooni-01/indradhanu-/blob/main/edge/ml_engine/detector.py): `edge/ml_engine/detector.py`
- [Edge Event Buffer](https://github.com/shirooni-01/indradhanu-/blob/main/edge/database/edge_db.py): `edge/database/edge_db.py`
- [Sync Client](https://github.com/shirooni-01/indradhanu-/blob/main/edge/services/sync_client.py): `edge/services/sync_client.py`

### Central Coordination

- [Central Server](https://github.com/shirooni-01/indradhanu-/blob/main/app.py): `app.py`
- [Central Verification](https://github.com/shirooni-01/indradhanu-/blob/main/ml_engine/verifier.py): `ml_engine/verifier.py`
- [Spatial Detector](https://github.com/shirooni-01/indradhanu-/blob/main/ml_engine/detector.py): `ml_engine/detector.py`
- [Central Event Store](https://github.com/shirooni-01/indradhanu-/blob/main/database/db_manager.py): `database/db_manager.py`
- [System Configuration](https://github.com/shirooni-01/indradhanu-/blob/main/database/system_config.py): `database/system_config.py`

### Alerting and Siren

- [SMS Dispatch](https://github.com/shirooni-01/indradhanu-/blob/main/edge/services/sms_service.py): `edge/services/sms_service.py`
- [Siren Policy](https://github.com/shirooni-01/indradhanu-/blob/main/services/siren_service.py): `services/siren_service.py`
- [Siren Controller](https://github.com/shirooni-01/indradhanu-/blob/main/edge/siren_controller.py): `edge/siren_controller.py`
- **GPIO Siren Relay**

### Operations Dashboard

- [Web Dashboard](https://github.com/shirooni-01/indradhanu-/blob/main/templates/index.html): `templates/index.html`

### Other components

- **Field Operator**
- **Dashboard User**
- **SMS Gateway**
- **Central HTTP API**

## Connections

- Field Operator → Edge Station: operates (evidence: `README.md`)
- Edge Station → Thermal Camera: captures frames (evidence: `edge/edge_daemon.py`)
- Edge Station → PIR Sensor: checks motion (evidence: `edge/edge_daemon.py`)
- Edge Station → Edge Detector: runs inference (evidence: `edge/edge_daemon.py`)
- Edge Station → Edge Event Buffer: stores events (evidence: `edge/edge_daemon.py`)
- Sync Client → Edge Event Buffer: reads pending events (evidence: `edge/services/sync_client.py`)
- Edge Station → Sync Client: starts sync (evidence: `edge/edge_daemon.py`)
- Sync Client → Central HTTP API: uploads events (evidence: `edge/services/sync_client.py`)
- Central HTTP API → Central Server: routes requests (evidence: `README.md`)
- Central Server → Central Event Store: persists events (evidence: `app.py`)
- Central Server → Central Verification: verifies snapshots (evidence: `app.py`)
- Central Verification → Spatial Detector: uses detector (evidence: `ml_engine/verifier.py`)
- Central Server → Siren Policy: requests alert decision (evidence: `app.py`)
- Siren Policy → Central Event Store: records alert (evidence: `services/siren_service.py`)
- Siren Policy → Siren Controller: sends command (evidence: `services/siren_service.py`)
- Siren Controller → GPIO Siren Relay: drives relay (evidence: `README.md`)
- Central Server → SMS Dispatch: dispatches notifications (evidence: `app.py`)
- Edge Station → SMS Dispatch: flushes queued SMS (evidence: `edge/edge_daemon.py`)
- SMS Dispatch → SMS Gateway: sends messages (evidence: `edge/services/sms_service.py`)
- Central Server → System Configuration: loads configuration (evidence: `app.py`)
- Dashboard User → Web Dashboard: views status (evidence: `README.md`)
- Web Dashboard → Central Server: uses dashboard routes (evidence: `README.md`)
