# singhrishikesh1/sahayak architecture

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

- Interactive diagram: https://gitdiagram.com/singhrishikesh1/sahayak
- Repository: https://github.com/singhrishikesh1/sahayak

## Overview

VajraWatch/SAHAYAK is a disaster-response intelligence platform for commanders and rescue personnel. The workflow is to submit hazard and telecom conditions through the API or dashboard, run blackout and physical-impact inference, synthesize compound threat and rescue priorities, then support evacuation and shelter redistribution decisions. The architecture also includes model explanation and training/feature layers. README-documented capabilities are retained, but source excerpts do not show every internal call; unsampled links are omitted rather than inferred.

Main entry points: [`api/main.py`](https://github.com/singhrishikesh1/sahayak/blob/main/api/main.py) (REST API), [`dashboard/app.py`](https://github.com/singhrishikesh1/sahayak/blob/main/dashboard/app.py) (Operations Dashboard), [`src/integrated_engine.py`](https://github.com/singhrishikesh1/sahayak/blob/main/src/integrated_engine.py) (Compound Threat Engine), [`models`](https://github.com/singhrishikesh1/sahayak/tree/main/models) (Model Artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Operations Interfaces"]
  node_api["REST API<br/>[main.py]"]
  node_dashboard["Operations Dashboard<br/>[app.py]"]
end

subgraph group_inference["Threat Intelligence"]
  node_silent_inference["Blackout Prediction<br/>[predict.py]"]
  node_integrated["Compound Threat Engine"]
  node_explanation["SHAP Explanations<br/>[explain_model.py]"]
  node_config["Risk Configuration<br/>[config.py]"]
end

subgraph group_response["Response Planning"]
  node_evacuation["Evacuation Router"]
  node_shelter["Shelter Resource Solver"]
end

subgraph group_data_models["Data and Models"]
  node_model_store[("Model Artifacts")]
  node_scenario_data[("Scenario Datasets")]
end

subgraph group_learning["Model Preparation"]
  node_preprocessing["Data Validation"]
  node_comm_features["Telecom Risk Features"]
  node_physics_features["Physics Features"]
  node_silent_training["Blackout Model Training<br/>[train_model.py]"]
  node_impact_training["Impact Model Training"]
end

node_commander(("Commanders"))
node_data_providers(("Disaster Data Sources"))
node_rescue_teams(("Rescue Teams"))

node_commander -->|"submits conditions"| node_api
node_commander -->|"sets parameters"| node_dashboard
node_data_providers -.->|"provides telemetry"| node_preprocessing
node_api -->|"requests inference"| node_integrated
node_api -->|"requests prediction"| node_silent_inference
node_api -->|"requests routes"| node_evacuation
node_api -->|"requests analysis"| node_shelter
node_dashboard -->|"requests assessment"| node_integrated
node_dashboard -->|"requests routes"| node_evacuation
node_dashboard -->|"requests redistribution"| node_shelter
node_dashboard -->|"requests attributions"| node_explanation
node_integrated -->|"uses blackout models"| node_silent_inference
node_silent_inference -->|"loads model"| node_model_store
node_integrated -.->|"loads impact models"| node_model_store
node_explanation -->|"loads model"| node_model_store
node_integrated -->|"uses thresholds"| node_config
node_silent_inference -->|"uses settings"| node_config
node_evacuation -.->|"provides routes"| node_rescue_teams
node_shelter -.->|"provides supply plans"| node_rescue_teams
node_preprocessing -.->|"reads datasets"| node_scenario_data
node_silent_training -->|"cleans training data"| node_preprocessing
node_silent_training -->|"builds pipeline"| node_comm_features
node_silent_training -->|"saves pipeline"| node_model_store
node_impact_training -->|"uses transformations"| node_physics_features
node_impact_training -.->|"saves model"| node_model_store

click node_api "https://github.com/singhrishikesh1/sahayak/blob/main/api/main.py"
click node_dashboard "https://github.com/singhrishikesh1/sahayak/blob/main/dashboard/app.py"
click node_preprocessing "https://github.com/singhrishikesh1/sahayak/blob/main/src/data_preprocessing.py"
click node_comm_features "https://github.com/singhrishikesh1/sahayak/blob/main/src/feature_engineering.py"
click node_physics_features "https://github.com/singhrishikesh1/sahayak/blob/main/src/feature_engineering_physics.py"
click node_silent_training "https://github.com/singhrishikesh1/sahayak/blob/main/src/train_model.py"
click node_impact_training "https://github.com/singhrishikesh1/sahayak/blob/main/src/train_impact_model.py"
click node_silent_inference "https://github.com/singhrishikesh1/sahayak/blob/main/src/predict.py"
click node_integrated "https://github.com/singhrishikesh1/sahayak/blob/main/src/integrated_engine.py"
click node_explanation "https://github.com/singhrishikesh1/sahayak/blob/main/src/explain_model.py"
click node_config "https://github.com/singhrishikesh1/sahayak/blob/main/src/config.py"
click node_evacuation "https://github.com/singhrishikesh1/sahayak/blob/main/src/evacuation_router.py"
click node_shelter "https://github.com/singhrishikesh1/sahayak/blob/main/src/shelter_resource_engine.py"
click node_model_store "https://github.com/singhrishikesh1/sahayak/tree/main/models"
click node_scenario_data "https://github.com/singhrishikesh1/sahayak/tree/main/data"

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_api,node_dashboard toneBlue
class node_silent_inference,node_integrated,node_explanation,node_config toneAmber
class node_evacuation,node_shelter toneMint
class node_model_store,node_scenario_data toneRose
class node_preprocessing,node_comm_features,node_physics_features,node_silent_training,node_impact_training,node_commander,node_data_providers,node_rescue_teams toneIndigo
```

## Components

### Operations Interfaces

- [REST API](https://github.com/singhrishikesh1/sahayak/blob/main/api/main.py): `api/main.py`
- [Operations Dashboard](https://github.com/singhrishikesh1/sahayak/blob/main/dashboard/app.py): `dashboard/app.py`

### Threat Intelligence

- [Blackout Prediction](https://github.com/singhrishikesh1/sahayak/blob/main/src/predict.py): `src/predict.py`
- [Compound Threat Engine](https://github.com/singhrishikesh1/sahayak/blob/main/src/integrated_engine.py): `src/integrated_engine.py`
- [SHAP Explanations](https://github.com/singhrishikesh1/sahayak/blob/main/src/explain_model.py): `src/explain_model.py`
- [Risk Configuration](https://github.com/singhrishikesh1/sahayak/blob/main/src/config.py): `src/config.py`

### Response Planning

- [Evacuation Router](https://github.com/singhrishikesh1/sahayak/blob/main/src/evacuation_router.py): `src/evacuation_router.py`
- [Shelter Resource Solver](https://github.com/singhrishikesh1/sahayak/blob/main/src/shelter_resource_engine.py): `src/shelter_resource_engine.py`

### Data and Models

- [Model Artifacts](https://github.com/singhrishikesh1/sahayak/tree/main/models): `models`
- [Scenario Datasets](https://github.com/singhrishikesh1/sahayak/tree/main/data): `data`

### Model Preparation

- [Data Validation](https://github.com/singhrishikesh1/sahayak/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`
- [Telecom Risk Features](https://github.com/singhrishikesh1/sahayak/blob/main/src/feature_engineering.py): `src/feature_engineering.py`
- [Physics Features](https://github.com/singhrishikesh1/sahayak/blob/main/src/feature_engineering_physics.py): `src/feature_engineering_physics.py`
- [Blackout Model Training](https://github.com/singhrishikesh1/sahayak/blob/main/src/train_model.py): `src/train_model.py`
- [Impact Model Training](https://github.com/singhrishikesh1/sahayak/blob/main/src/train_impact_model.py): `src/train_impact_model.py`

### Other components

- **Commanders**
- **Disaster Data Sources**
- **Rescue Teams**

## Connections

- Commanders → REST API: submits conditions (evidence: `README.md`)
- Commanders → Operations Dashboard: sets parameters (evidence: `README.md`)
- Disaster Data Sources → Data Validation: provides telemetry
- REST API → Compound Threat Engine: requests inference (evidence: `api/main.py`)
- REST API → Blackout Prediction: requests prediction (evidence: `api/main.py`)
- REST API → Evacuation Router: requests routes (evidence: `api/main.py`)
- REST API → Shelter Resource Solver: requests analysis (evidence: `api/main.py`)
- Operations Dashboard → Compound Threat Engine: requests assessment (evidence: `dashboard/app.py`)
- Operations Dashboard → Evacuation Router: requests routes (evidence: `dashboard/app.py`)
- Operations Dashboard → Shelter Resource Solver: requests redistribution (evidence: `dashboard/app.py`)
- Operations Dashboard → SHAP Explanations: requests attributions (evidence: `dashboard/app.py`)
- Compound Threat Engine → Blackout Prediction: uses blackout models (evidence: `src/integrated_engine.py`)
- Blackout Prediction → Model Artifacts: loads model (evidence: `src/predict.py`)
- Compound Threat Engine → Model Artifacts: loads impact models
- SHAP Explanations → Model Artifacts: loads model (evidence: `src/explain_model.py`)
- Compound Threat Engine → Risk Configuration: uses thresholds (evidence: `src/integrated_engine.py`)
- Blackout Prediction → Risk Configuration: uses settings (evidence: `src/predict.py`)
- Evacuation Router → Rescue Teams: provides routes
- Shelter Resource Solver → Rescue Teams: provides supply plans
- Data Validation → Scenario Datasets: reads datasets
- Blackout Model Training → Data Validation: cleans training data (evidence: `src/train_model.py`)
- Blackout Model Training → Telecom Risk Features: builds pipeline (evidence: `src/train_model.py`)
- Blackout Model Training → Model Artifacts: saves pipeline (evidence: `src/train_model.py`)
- Impact Model Training → Physics Features: uses transformations (evidence: `src/train_impact_model.py`)
- Impact Model Training → Model Artifacts: saves model
