# saikumar-2210/marine_sight architecture

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

- Interactive diagram: https://gitdiagram.com/saikumar-2210/marine_sight
- Repository: https://github.com/saikumar-2210/marine_sight

## Overview

MarineSight turns Sentinel imagery into oil-spill detections, verifies likely slicks with optical and metocean evidence, attributes likely vessels, and presents scans in an operations map. Operators choose a date or request a rescan; the API serves stored results or starts a scan, persists job/results, and streams progress to the UI. The graph preserves the documented AIS, coverage/tiles, scheduling, and evidence-map capabilities. Pipeline calls and UI/API wiring are cited where shown; unsampled server and model internals are represented at their documented subsystem paths.

Main entry points: [`ml_service/marinesight/pipeline.py`](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/pipeline.py) (Date scan pipeline), [`server/app.js`](https://github.com/saikumar-2210/marine_sight/blob/main/server/app.js) (HTTP and event API), [`src/pages/OperationsDashboard.jsx`](https://github.com/saikumar-2210/marine_sight/blob/main/src/pages/OperationsDashboard.jsx) (Operations dashboard), [`server/scanJobs.js`](https://github.com/saikumar-2210/marine_sight/blob/main/server/scanJobs.js) (Scan job coordinator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ml["Detection pipeline"]
  node_pipeline["Date scan pipeline<br/>[pipeline.py]"]
  node_catalog["Sentinel scene catalog<br/>[cdse.py]"]
  node_raster["Geospatial raster grid<br/>[raster.py]"]
  node_segment["Slick segmentation<br/>[segment.py]"]
  node_unet["U-Net inference<br/>[unet.py]"]
  node_optical["Optical verification inputs<br/>[optical.py]"]
  node_metocean["MetOcean features<br/>[metocean.py]"]
  node_verifier["Oil probability verifier<br/>[verifier.py]"]
  node_attribution["AIS drift attribution<br/>[attribution.py]"]
  node_sarvessels["SAR vessel detection<br/>[vessels_sar.py]"]
end

subgraph group_backend["Scan services"]
  node_server["HTTP and event API<br/>[app.js]"]
  node_jobs["Scan job coordinator<br/>[scanJobs.js]"]
  node_scheduler["Daily scan scheduler<br/>[scheduler.js]"]
  node_store[("SQLite scan and AIS data<br/>[db.js]")]
  node_aisbackend["AIS feed and history<br/>[ais.js]"]
  node_coverage["Sentinel coverage"]
  node_tiles["Sentinel map tiles<br/>[sentinelTiles.js]"]
end

subgraph group_ui["Operations interface"]
  node_dashboard["Operations dashboard"]
  node_spillstate["Date and spill state<br/>[SpillContext.jsx]"]
  node_api["Marine API client<br/>[marineApi.js]"]
  node_events["Live scan events<br/>[useServerEvents.js]"]
  node_map["Map and evidence layers<br/>[MapContainer.jsx]"]
  node_inspector["Incident inspector"]
  node_aisui["AIS vessel display<br/>[VesselLayer.jsx]"]
  node_taxonomy["Vessel taxonomy<br/>[vesselTaxonomy.js]"]
end

subgraph group_train["Model development"]
  node_dataset["Training data builder<br/>[build_dataset.py]"]
  node_trainunet["U-Net training<br/>[train_unet.py]"]
  node_trainverifier["Verifier training<br/>[train_verifier.py]"]
end

node_operator(("Operator"))
node_cdse["Copernicus Data Space"]
node_aisfeed["AIS stream"]

node_operator -->|"uses"| node_dashboard
node_dashboard -->|"reads state"| node_spillstate
node_spillstate -->|"requests scans"| node_api
node_spillstate -->|"subscribes to"| node_events
node_dashboard -->|"renders"| node_map
node_dashboard -->|"renders"| node_inspector
node_map -->|"fetches vessel tracks"| node_api
node_aisui -->|"classifies with"| node_taxonomy
node_api -->|"HTTP requests"| node_server
node_events -.->|"WebSocket events"| node_server
node_server -->|"routes scan requests"| node_jobs
node_server -->|"queries results"| node_store
node_server -->|"serves AIS status"| node_aisbackend
node_server -->|"routes coverage"| node_coverage
node_server -->|"routes tiles"| node_tiles
node_scheduler -.->|"starts daily scans"| node_jobs
node_aisbackend -.->|"receives positions"| node_aisfeed
node_aisbackend -.->|"stores history"| node_store
node_jobs -.->|"spawns per date"| node_pipeline
node_jobs -.->|"persists scan results"| node_store
node_pipeline -->|"queries scenes"| node_catalog
node_catalog -.->|"requests imagery"| node_cdse
node_pipeline -->|"segments scenes"| node_segment
node_segment -->|"runs inference"| node_unet
node_segment -->|"uses grid operations"| node_raster
node_pipeline -->|"fetches verification inputs"| node_optical
node_pipeline -->|"fetches verification inputs"| node_metocean
node_pipeline -->|"scores candidates"| node_verifier
node_pipeline -->|"ranks likely culprit"| node_attribution
node_pipeline -->|"detects SAR vessels"| node_sarvessels
node_dataset -.->|"supplies training chips"| node_trainunet
node_trainverifier -.->|"produces model"| node_verifier
node_trainunet -.->|"produces weights"| node_unet
node_coverage -.->|"searches coverage"| node_cdse
node_tiles -.->|"loads imagery tiles"| node_cdse

click node_dashboard "https://github.com/saikumar-2210/marine_sight/blob/main/src/pages/OperationsDashboard.jsx"
click node_spillstate "https://github.com/saikumar-2210/marine_sight/blob/main/src/context/SpillContext.jsx"
click node_api "https://github.com/saikumar-2210/marine_sight/blob/main/src/services/marineApi.js"
click node_events "https://github.com/saikumar-2210/marine_sight/blob/main/src/hooks/useServerEvents.js"
click node_map "https://github.com/saikumar-2210/marine_sight/blob/main/src/components/map/MapContainer.jsx"
click node_inspector "https://github.com/saikumar-2210/marine_sight/blob/main/src/components/inspector/IncidentInspector.jsx"
click node_aisui "https://github.com/saikumar-2210/marine_sight/blob/main/src/components/map/VesselLayer.jsx"
click node_taxonomy "https://github.com/saikumar-2210/marine_sight/blob/main/src/utils/vesselTaxonomy.js"
click node_server "https://github.com/saikumar-2210/marine_sight/blob/main/server/app.js"
click node_jobs "https://github.com/saikumar-2210/marine_sight/blob/main/server/scanJobs.js"
click node_scheduler "https://github.com/saikumar-2210/marine_sight/blob/main/server/scheduler.js"
click node_store "https://github.com/saikumar-2210/marine_sight/blob/main/server/db.js"
click node_aisbackend "https://github.com/saikumar-2210/marine_sight/blob/main/server/ais.js"
click node_coverage "https://github.com/saikumar-2210/marine_sight/blob/main/server/sentinelCoverage.js"
click node_tiles "https://github.com/saikumar-2210/marine_sight/blob/main/server/sentinelTiles.js"
click node_pipeline "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/pipeline.py"
click node_catalog "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/cdse.py"
click node_raster "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/raster.py"
click node_segment "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/segment.py"
click node_unet "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/unet.py"
click node_optical "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/optical.py"
click node_metocean "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/metocean.py"
click node_verifier "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/verifier.py"
click node_attribution "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/attribution.py"
click node_sarvessels "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/vessels_sar.py"
click node_dataset "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/build_dataset.py"
click node_trainunet "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/train_unet.py"
click node_trainverifier "https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/train_verifier.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_pipeline,node_catalog,node_raster,node_segment,node_unet,node_optical,node_metocean,node_verifier,node_attribution,node_sarvessels toneBlue
class node_server,node_jobs,node_scheduler,node_store,node_aisbackend,node_coverage,node_tiles toneAmber
class node_dashboard,node_spillstate,node_api,node_events,node_map,node_inspector,node_aisui,node_taxonomy toneMint
class node_dataset,node_trainunet,node_trainverifier toneRose
class node_operator,node_cdse,node_aisfeed toneIndigo
```

## Components

### Detection pipeline

- [Date scan pipeline](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/pipeline.py): `ml_service/marinesight/pipeline.py`
- [Sentinel scene catalog](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/cdse.py): `ml_service/marinesight/cdse.py`
- [Geospatial raster grid](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/raster.py): `ml_service/marinesight/raster.py`
- [Slick segmentation](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/segment.py): `ml_service/marinesight/segment.py`
- [U-Net inference](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/unet.py): `ml_service/marinesight/unet.py`
- [Optical verification inputs](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/optical.py): `ml_service/marinesight/optical.py`
- [MetOcean features](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/metocean.py): `ml_service/marinesight/metocean.py`
- [Oil probability verifier](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/verifier.py): `ml_service/marinesight/verifier.py`
- [AIS drift attribution](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/attribution.py): `ml_service/marinesight/attribution.py`
- [SAR vessel detection](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/marinesight/vessels_sar.py): `ml_service/marinesight/vessels_sar.py`

### Scan services

- [HTTP and event API](https://github.com/saikumar-2210/marine_sight/blob/main/server/app.js): `server/app.js`
- [Scan job coordinator](https://github.com/saikumar-2210/marine_sight/blob/main/server/scanJobs.js): `server/scanJobs.js`
- [Daily scan scheduler](https://github.com/saikumar-2210/marine_sight/blob/main/server/scheduler.js): `server/scheduler.js`
- [SQLite scan and AIS data](https://github.com/saikumar-2210/marine_sight/blob/main/server/db.js): `server/db.js`
- [AIS feed and history](https://github.com/saikumar-2210/marine_sight/blob/main/server/ais.js): `server/ais.js`
- [Sentinel coverage](https://github.com/saikumar-2210/marine_sight/blob/main/server/sentinelCoverage.js): `server/sentinelCoverage.js`
- [Sentinel map tiles](https://github.com/saikumar-2210/marine_sight/blob/main/server/sentinelTiles.js): `server/sentinelTiles.js`

### Operations interface

- [Operations dashboard](https://github.com/saikumar-2210/marine_sight/blob/main/src/pages/OperationsDashboard.jsx): `src/pages/OperationsDashboard.jsx`
- [Date and spill state](https://github.com/saikumar-2210/marine_sight/blob/main/src/context/SpillContext.jsx): `src/context/SpillContext.jsx`
- [Marine API client](https://github.com/saikumar-2210/marine_sight/blob/main/src/services/marineApi.js): `src/services/marineApi.js`
- [Live scan events](https://github.com/saikumar-2210/marine_sight/blob/main/src/hooks/useServerEvents.js): `src/hooks/useServerEvents.js`
- [Map and evidence layers](https://github.com/saikumar-2210/marine_sight/blob/main/src/components/map/MapContainer.jsx): `src/components/map/MapContainer.jsx`
- [Incident inspector](https://github.com/saikumar-2210/marine_sight/blob/main/src/components/inspector/IncidentInspector.jsx): `src/components/inspector/IncidentInspector.jsx`
- [AIS vessel display](https://github.com/saikumar-2210/marine_sight/blob/main/src/components/map/VesselLayer.jsx): `src/components/map/VesselLayer.jsx`
- [Vessel taxonomy](https://github.com/saikumar-2210/marine_sight/blob/main/src/utils/vesselTaxonomy.js): `src/utils/vesselTaxonomy.js`

### Model development

- [Training data builder](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/build_dataset.py): `ml_service/training/build_dataset.py`
- [U-Net training](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/train_unet.py): `ml_service/training/train_unet.py`
- [Verifier training](https://github.com/saikumar-2210/marine_sight/blob/main/ml_service/training/train_verifier.py): `ml_service/training/train_verifier.py`

### Other components

- **Operator**
- **Copernicus Data Space**
- **AIS stream**

## Connections

- Operator → Operations dashboard: uses (evidence: `src/pages/OperationsDashboard.jsx`)
- Operations dashboard → Date and spill state: reads state (evidence: `src/pages/OperationsDashboard.jsx`)
- Date and spill state → Marine API client: requests scans (evidence: `src/context/SpillContext.jsx`)
- Date and spill state → Live scan events: subscribes to (evidence: `src/context/SpillContext.jsx`)
- Operations dashboard → Map and evidence layers: renders (evidence: `src/pages/OperationsDashboard.jsx`)
- Operations dashboard → Incident inspector: renders (evidence: `src/pages/OperationsDashboard.jsx`)
- Map and evidence layers → Marine API client: fetches vessel tracks (evidence: `src/components/map/MapContainer.jsx`)
- AIS vessel display → Vessel taxonomy: classifies with (evidence: `src/components/map/VesselLayer.jsx`)
- Marine API client → HTTP and event API: HTTP requests (evidence: `src/services/marineApi.js`)
- Live scan events → HTTP and event API: WebSocket events (evidence: `README.md`)
- HTTP and event API → Scan job coordinator: routes scan requests (evidence: `server/app.js`)
- HTTP and event API → SQLite scan and AIS data: queries results (evidence: `server/app.js`)
- HTTP and event API → AIS feed and history: serves AIS status (evidence: `server/app.js`)
- HTTP and event API → Sentinel coverage: routes coverage (evidence: `server/app.js`)
- HTTP and event API → Sentinel map tiles: routes tiles (evidence: `server/app.js`)
- Daily scan scheduler → Scan job coordinator: starts daily scans (evidence: `README.md`)
- AIS feed and history → AIS stream: receives positions (evidence: `README.md`)
- AIS feed and history → SQLite scan and AIS data: stores history (evidence: `README.md`)
- Scan job coordinator → Date scan pipeline: spawns per date (evidence: `README.md`)
- Scan job coordinator → SQLite scan and AIS data: persists scan results (evidence: `README.md`)
- Date scan pipeline → Sentinel scene catalog: queries scenes (evidence: `ml_service/marinesight/pipeline.py`)
- Sentinel scene catalog → Copernicus Data Space: requests imagery (evidence: `README.md`)
- Date scan pipeline → Slick segmentation: segments scenes (evidence: `ml_service/marinesight/pipeline.py`)
- Slick segmentation → U-Net inference: runs inference (evidence: `ml_service/marinesight/segment.py`)
- Slick segmentation → Geospatial raster grid: uses grid operations (evidence: `ml_service/marinesight/segment.py`)
- Date scan pipeline → Optical verification inputs: fetches verification inputs (evidence: `ml_service/marinesight/pipeline.py`)
- Date scan pipeline → MetOcean features: fetches verification inputs (evidence: `ml_service/marinesight/pipeline.py`)
- Date scan pipeline → Oil probability verifier: scores candidates (evidence: `ml_service/marinesight/pipeline.py`)
- Date scan pipeline → AIS drift attribution: ranks likely culprit (evidence: `ml_service/marinesight/pipeline.py`)
- Date scan pipeline → SAR vessel detection: detects SAR vessels (evidence: `ml_service/marinesight/pipeline.py`)
- Training data builder → U-Net training: supplies training chips (evidence: `README.md`)
- Verifier training → Oil probability verifier: produces model (evidence: `README.md`)
- U-Net training → U-Net inference: produces weights (evidence: `README.md`)
- Sentinel coverage → Copernicus Data Space: searches coverage (evidence: `README.md`)
- Sentinel map tiles → Copernicus Data Space: loads imagery tiles (evidence: `README.md`)
