# anoushka1405/sagardrishti architecture

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

- Interactive diagram: https://gitdiagram.com/anoushka1405/sagardrishti
- Repository: https://github.com/anoushka1405/sagardrishti

## Overview

SagarDrishti detects oil slicks in Sentinel-1 SAR imagery, estimates spill age and origin through drift modeling, then attributes likely vessels using AIS trajectories and behavior. Users can run forensic analysis, inspect GIS and vessel evidence, and use a separate proactive watchlist for vessels in sensitive zones; the browser UI reaches analysis through the FastAPI backend, while a Streamlit dashboard also invokes the pipeline. The graph preserves documented capabilities, but unsampled implementation details and some UI-to-API routes are not expanded beyond the evidence shown.

Main entry points: [`src/pipeline/run_pipeline.py`](https://github.com/anoushka1405/sagardrishti/blob/main/src/pipeline/run_pipeline.py) (Pipeline Orchestrator), [`frontend/src/App.jsx`](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/App.jsx) (Browser UI), [`src/api/main.py`](https://github.com/anoushka1405/sagardrishti/blob/main/src/api/main.py) (FastAPI Service), [`src/scoring/proactive_risk.py`](https://github.com/anoushka1405/sagardrishti/blob/main/src/scoring/proactive_risk.py) (Proactive Risk Watchlist)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_browser["Browser UI<br/>[App.jsx]"]
  node_forensic["Forensic View<br/>[ForensicTab.jsx]"]
  node_proactive_ui["Proactive View<br/>[ProactiveTab.jsx]"]
  node_sandbox["Analysis Sandbox<br/>[SandboxTab.jsx]"]
  node_fallback["Fallback Data<br/>[defaultData.js]"]
  node_streamlit["Streamlit Dashboard<br/>[app.py]"]
end

subgraph group_service["API and Orchestration"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_pipeline["Pipeline Orchestrator<br/>[run_pipeline.py]"]
end

subgraph group_analysis["Spill Analysis"]
  node_loaders["SAR and Metocean Loading<br/>[loaders.py]"]
  node_segmentation["SAR Segmentation"]
  node_detection["Detection and Geometry"]
  node_age["Spill Age Estimation<br/>[age_model.py]"]
  node_drift["Drift and Hindcast"]
end

subgraph group_attribution["AIS and Attribution"]
  node_ais_data["AIS Data<br/>[synthetic_ais.py]"]
  node_ais_processing["AIS Trajectories and Features"]
  node_suspect_score["Suspect Ranking<br/>[suspect_scoring.py]"]
  node_proactive_score["Proactive Risk Watchlist<br/>[proactive_risk.py]"]
  node_geo["Geospatial Utilities<br/>[geo_utils.py]"]
end

node_analyst(("Analyst"))

node_analyst -->|"uses"| node_browser
node_analyst -->|"uses"| node_streamlit
node_browser -->|"renders"| node_forensic
node_browser -->|"renders"| node_proactive_ui
node_browser -->|"renders"| node_sandbox
node_browser -->|"loads fallback"| node_fallback
node_browser -->|"requests analysis"| node_api
node_streamlit -->|"runs"| node_pipeline
node_api -->|"invokes"| node_pipeline
node_pipeline -->|"loads inputs"| node_loaders
node_pipeline -->|"predicts mask"| node_segmentation
node_pipeline -->|"filters and extracts geometry"| node_detection
node_pipeline -->|"estimates age"| node_age
node_pipeline -->|"forecasts and hindcasts"| node_drift
node_pipeline -->|"loads demo vessels"| node_ais_data
node_pipeline -->|"reconstructs and analyzes"| node_ais_processing
node_pipeline -->|"ranks suspects"| node_suspect_score
node_api -->|"simulates drift"| node_drift
node_api -->|"serves watchlist"| node_proactive_score
node_proactive_score -->|"uses behavior features"| node_ais_processing
node_ais_processing -->|"uses distance utility"| node_geo
node_proactive_score -->|"checks zone distance"| node_geo

click node_browser "https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/App.jsx"
click node_forensic "https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/ForensicTab.jsx"
click node_proactive_ui "https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/ProactiveTab.jsx"
click node_sandbox "https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/SandboxTab.jsx"
click node_fallback "https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/data/defaultData.js"
click node_streamlit "https://github.com/anoushka1405/sagardrishti/blob/main/dashboard/app.py"
click node_api "https://github.com/anoushka1405/sagardrishti/blob/main/src/api/main.py"
click node_pipeline "https://github.com/anoushka1405/sagardrishti/blob/main/src/pipeline/run_pipeline.py"
click node_loaders "https://github.com/anoushka1405/sagardrishti/blob/main/src/data/loaders.py"
click node_segmentation "https://github.com/anoushka1405/sagardrishti/blob/main/src/detection/segmentation_model.py"
click node_detection "https://github.com/anoushka1405/sagardrishti/tree/main/src/detection"
click node_age "https://github.com/anoushka1405/sagardrishti/blob/main/src/age_estimation/age_model.py"
click node_drift "https://github.com/anoushka1405/sagardrishti/tree/main/src/drift"
click node_ais_data "https://github.com/anoushka1405/sagardrishti/blob/main/src/data/synthetic_ais.py"
click node_ais_processing "https://github.com/anoushka1405/sagardrishti/tree/main/src/ais"
click node_suspect_score "https://github.com/anoushka1405/sagardrishti/blob/main/src/scoring/suspect_scoring.py"
click node_proactive_score "https://github.com/anoushka1405/sagardrishti/blob/main/src/scoring/proactive_risk.py"
click node_geo "https://github.com/anoushka1405/sagardrishti/blob/main/src/utils/geo_utils.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_browser,node_forensic,node_proactive_ui,node_sandbox,node_fallback,node_streamlit toneBlue
class node_api,node_pipeline toneAmber
class node_loaders,node_segmentation,node_detection,node_age,node_drift toneMint
class node_ais_data,node_ais_processing,node_suspect_score,node_proactive_score,node_geo toneRose
class node_analyst toneIndigo
```

## Components

### User Interfaces

- [Browser UI](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Forensic View](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/ForensicTab.jsx): `frontend/src/components/ForensicTab.jsx`
- [Proactive View](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/ProactiveTab.jsx): `frontend/src/components/ProactiveTab.jsx`
- [Analysis Sandbox](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/components/SandboxTab.jsx): `frontend/src/components/SandboxTab.jsx`
- [Fallback Data](https://github.com/anoushka1405/sagardrishti/blob/main/frontend/src/data/defaultData.js): `frontend/src/data/defaultData.js`
- [Streamlit Dashboard](https://github.com/anoushka1405/sagardrishti/blob/main/dashboard/app.py): `dashboard/app.py`

### API and Orchestration

- [FastAPI Service](https://github.com/anoushka1405/sagardrishti/blob/main/src/api/main.py): `src/api/main.py`
- [Pipeline Orchestrator](https://github.com/anoushka1405/sagardrishti/blob/main/src/pipeline/run_pipeline.py): `src/pipeline/run_pipeline.py`

### Spill Analysis

- [SAR and Metocean Loading](https://github.com/anoushka1405/sagardrishti/blob/main/src/data/loaders.py): `src/data/loaders.py`
- [SAR Segmentation](https://github.com/anoushka1405/sagardrishti/blob/main/src/detection/segmentation_model.py): `src/detection/segmentation_model.py`
- [Detection and Geometry](https://github.com/anoushka1405/sagardrishti/tree/main/src/detection): `src/detection`
- [Spill Age Estimation](https://github.com/anoushka1405/sagardrishti/blob/main/src/age_estimation/age_model.py): `src/age_estimation/age_model.py`
- [Drift and Hindcast](https://github.com/anoushka1405/sagardrishti/tree/main/src/drift): `src/drift`

### AIS and Attribution

- [AIS Data](https://github.com/anoushka1405/sagardrishti/blob/main/src/data/synthetic_ais.py): `src/data/synthetic_ais.py`
- [AIS Trajectories and Features](https://github.com/anoushka1405/sagardrishti/tree/main/src/ais): `src/ais`
- [Suspect Ranking](https://github.com/anoushka1405/sagardrishti/blob/main/src/scoring/suspect_scoring.py): `src/scoring/suspect_scoring.py`
- [Proactive Risk Watchlist](https://github.com/anoushka1405/sagardrishti/blob/main/src/scoring/proactive_risk.py): `src/scoring/proactive_risk.py`
- [Geospatial Utilities](https://github.com/anoushka1405/sagardrishti/blob/main/src/utils/geo_utils.py): `src/utils/geo_utils.py`

### Other components

- **Analyst**

## Connections

- Analyst → Browser UI: uses
- Analyst → Streamlit Dashboard: uses
- Browser UI → Forensic View: renders (evidence: `frontend/src/App.jsx`)
- Browser UI → Proactive View: renders (evidence: `frontend/src/App.jsx`)
- Browser UI → Analysis Sandbox: renders (evidence: `frontend/src/App.jsx`)
- Browser UI → Fallback Data: loads fallback (evidence: `frontend/src/App.jsx`)
- Browser UI → FastAPI Service: requests analysis (evidence: `frontend/src/App.jsx`)
- Streamlit Dashboard → Pipeline Orchestrator: runs (evidence: `dashboard/app.py`)
- FastAPI Service → Pipeline Orchestrator: invokes (evidence: `src/api/main.py`)
- Pipeline Orchestrator → SAR and Metocean Loading: loads inputs (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → SAR Segmentation: predicts mask (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → Detection and Geometry: filters and extracts geometry (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → Spill Age Estimation: estimates age (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → Drift and Hindcast: forecasts and hindcasts (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → AIS Data: loads demo vessels (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → AIS Trajectories and Features: reconstructs and analyzes (evidence: `src/pipeline/run_pipeline.py`)
- Pipeline Orchestrator → Suspect Ranking: ranks suspects (evidence: `src/pipeline/run_pipeline.py`)
- FastAPI Service → Drift and Hindcast: simulates drift (evidence: `src/api/main.py`)
- FastAPI Service → Proactive Risk Watchlist: serves watchlist (evidence: `src/api/main.py`)
- Proactive Risk Watchlist → AIS Trajectories and Features: uses behavior features (evidence: `src/scoring/proactive_risk.py`)
- AIS Trajectories and Features → Geospatial Utilities: uses distance utility (evidence: `src/ais/behaviour_features.py`)
- Proactive Risk Watchlist → Geospatial Utilities: checks zone distance (evidence: `src/scoring/proactive_risk.py`)
