# kunalrpawar/aqua-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/kunalrpawar/aqua-sentinel
- Repository: https://github.com/kunalrpawar/aqua-sentinel

## Overview

This is an underwater image-restoration and monitoring web application. The principal workflow begins with an uploaded image or video, passes through enhancement and/or threat analysis, and presents processed results; the README also describes live streams, history, analytics, and reporting. The sampled Flask entry point imports the processing, metrics, video, database, alert, heatmap, and report subsystems. Several implementation files were not sampled, so links to those capabilities rely on the README or are left unverified.

Main entry points: [`webapp/app.py`](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/app.py) (Flask application), [`webapp/model_processor.py`](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/model_processor.py) (Model processor), [`threat_detection/detector.py`](https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/detector.py) (Threat detection), [`webapp/video_processor.py`](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/video_processor.py) (Video processor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Application interface"]
  node_flask["Flask application<br/>[app.py]"]
  node_electron["Desktop launcher<br/>[main.js]"]
end

subgraph group_processing["Image and video processing"]
  node_processor["Model processor<br/>[model_processor.py]"]
  node_video["Video processor<br/>[video_processor.py]"]
  node_physics["Physics restoration<br/>[physics_model.py]"]
end

subgraph group_analysis["Detection and analytics"]
  node_threat["Threat detection<br/>[detector.py]"]
  node_distance["Distance estimation"]
  node_explain["Detection explanations<br/>[explainability.py]"]
  node_visualizer["Detection visualization<br/>[visualizer.py]"]
  node_metrics["Metrics calculator"]
  node_alerts["Alert system<br/>[alert_system.py]"]
  node_heatmap["Heatmap generator"]
end

subgraph group_persistence["History and reporting"]
  node_database[("Result history<br/>[database_config.py]")]
  node_reports["PDF reports"]
end

subgraph group_models["Enhancement models"]
  node_euvp["EUVP enhancement<br/>[models.py]"]
  node_superres["Super-resolution"]
end

node_user(("User"))

node_user -->|"submits media"| node_flask
node_electron -->|"launches backend"| node_flask
node_flask -->|"invokes processing"| node_processor
node_flask -->|"requests metrics"| node_metrics
node_flask -->|"routes video"| node_video
node_flask -->|"uses storage"| node_database
node_flask -->|"generates reports"| node_reports
node_flask -->|"uses alerts"| node_alerts
node_flask -->|"uses heatmaps"| node_heatmap
node_processor -.->|"may apply restoration"| node_physics
node_processor -.->|"may select model"| node_euvp
node_user -.->|"provides live video"| node_video
node_flask -.->|"may request detection"| node_threat
node_threat -.->|"estimates distance"| node_distance
node_threat -.->|"may explain detections"| node_explain
node_threat -.->|"may visualize detections"| node_visualizer
node_processor -.->|"may upscale images"| node_superres
node_user -.->|"views history"| node_database
node_user -.->|"views analytics"| node_metrics

click node_flask "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/app.py"
click node_electron "https://github.com/kunalrpawar/aqua-sentinel/blob/main/electron/main.js"
click node_processor "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/model_processor.py"
click node_video "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/video_processor.py"
click node_physics "https://github.com/kunalrpawar/aqua-sentinel/blob/main/physics_enhancement/physics_model.py"
click node_threat "https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/detector.py"
click node_distance "https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/distance_estimator.py"
click node_explain "https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/explainability.py"
click node_visualizer "https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/visualizer.py"
click node_metrics "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/metrics_calculator.py"
click node_alerts "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/alert_system.py"
click node_heatmap "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/heatmap_generator.py"
click node_database "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/database_config.py"
click node_reports "https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/pdf_report_generator.py"
click node_euvp "https://github.com/kunalrpawar/aqua-sentinel/blob/main/uie_euvp/models.py"
click node_superres "https://github.com/kunalrpawar/aqua-sentinel/tree/main/super-resolution"

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_flask,node_electron,node_user toneBlue
class node_processor,node_video,node_physics toneAmber
class node_threat,node_distance,node_explain,node_visualizer,node_metrics,node_alerts,node_heatmap toneMint
class node_database,node_reports toneRose
class node_euvp,node_superres toneIndigo
```

## Components

### Application interface

- [Flask application](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/app.py): `webapp/app.py`
- [Desktop launcher](https://github.com/kunalrpawar/aqua-sentinel/blob/main/electron/main.js): `electron/main.js`

### Image and video processing

- [Model processor](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/model_processor.py): `webapp/model_processor.py`
- [Video processor](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/video_processor.py): `webapp/video_processor.py`
- [Physics restoration](https://github.com/kunalrpawar/aqua-sentinel/blob/main/physics_enhancement/physics_model.py): `physics_enhancement/physics_model.py`

### Detection and analytics

- [Threat detection](https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/detector.py): `threat_detection/detector.py`
- [Distance estimation](https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/distance_estimator.py): `threat_detection/distance_estimator.py`
- [Detection explanations](https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/explainability.py): `threat_detection/explainability.py`
- [Detection visualization](https://github.com/kunalrpawar/aqua-sentinel/blob/main/threat_detection/visualizer.py): `threat_detection/visualizer.py`
- [Metrics calculator](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/metrics_calculator.py): `webapp/metrics_calculator.py`
- [Alert system](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/alert_system.py): `webapp/alert_system.py`
- [Heatmap generator](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/heatmap_generator.py): `webapp/heatmap_generator.py`

### History and reporting

- [Result history](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/database_config.py): `webapp/database_config.py`
- [PDF reports](https://github.com/kunalrpawar/aqua-sentinel/blob/main/webapp/pdf_report_generator.py): `webapp/pdf_report_generator.py`

### Enhancement models

- [EUVP enhancement](https://github.com/kunalrpawar/aqua-sentinel/blob/main/uie_euvp/models.py): `uie_euvp/models.py`
- [Super-resolution](https://github.com/kunalrpawar/aqua-sentinel/tree/main/super-resolution): `super-resolution`

### Other components

- **User**

## Connections

- User → Flask application: submits media
- Desktop launcher → Flask application: launches backend (evidence: `electron/main.js`)
- Flask application → Model processor: invokes processing (evidence: `webapp/app.py`)
- Flask application → Metrics calculator: requests metrics (evidence: `webapp/app.py`)
- Flask application → Video processor: routes video (evidence: `webapp/app.py`)
- Flask application → Result history: uses storage (evidence: `webapp/app.py`)
- Flask application → PDF reports: generates reports (evidence: `webapp/app.py`)
- Flask application → Alert system: uses alerts (evidence: `webapp/app.py`)
- Flask application → Heatmap generator: uses heatmaps (evidence: `webapp/app.py`)
- Model processor → Physics restoration: may apply restoration
- Model processor → EUVP enhancement: may select model
- User → Video processor: provides live video
- Flask application → Threat detection: may request detection
- Threat detection → Distance estimation: estimates distance
- Threat detection → Detection explanations: may explain detections
- Threat detection → Detection visualization: may visualize detections
- Model processor → Super-resolution: may upscale images
- User → Result history: views history
- User → Metrics calculator: views analytics
