# franckinani/maritime-edge-ai-intel-platform architecture

> Architecture diagram of the GitHub repository franckinani/maritime-edge-ai-intel-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/franckinani/maritime-edge-ai-intel-platform
- Repository: https://github.com/franckinani/maritime-edge-ai-intel-platform

## Overview

#### Purpose and Runtime Topology
This is a containerized Python 3.11+ microservice platform for detecting maritime vessels in real Sentinel-1 SAR imagery. Six services expose FastAPI endpoints (except the Streamlit dashboard), coordinated through Docker Compose and Redis. Primary composition and deployment boundaries are `docker-compose.yml`, `docker-compose.demo.yml`, and `docker/base/Dockerfile`.

#### Shared Contracts and Configuration
Cross-service payload contracts, notably detection events and related geospatial/TLE models, are centralized in `shared/schemas/events.py`. Shared constants and secret validation live in `shared/config/constants.py` and `shared/config/secrets_validator.py`. Model artifacts are expected under `shared/models/` but are not versioned. This shared layer is the compatibility boundary between preprocessing, inference, enrichment, and UI.

#### Scene Discovery and Ingestion
The ingestion API searches Copernicus Data Space Ecosystem (CDSE) for Sentinel-1 products using geographic/date criteria; downloading/job endpoints remain explicitly incomplete. Its entry point and CDSE-facing logic are `services/data_ingestor/main.py` and `services/data_ingestor/sentinel_fetcher.py`. Raw scenes are exchanged downstream through the Compose-managed scenes volume, rather than embedded in API events.

#### SAR Preprocessing and Georeferencing
The preprocessing service transforms `.SAFE` radar products into 512×512 NumPy tiles. It supports raw through calibrated, Lee-filtered, dB-converted, and MVSSD-enhanced pipelines, then associates tiles with GCP-derived pixel-to-lat/lon mapping. The API orchestration is `services/sentinel_preprocessor/main.py`; core SAR operations are in `services/sentinel_preprocessor/sar_preprocessing_module.py` and `services/sentinel_preprocessor/tools/apply_mvssd_ops.py`. Tile files form the boundary to model inference via the shared tiles volume.

#### Detection and Event Production
The detector loads an INT8 YOLOv8 ONNX model, accepts a tile by path or base64, performs input preparation, inference, NMS, and priority assignment, and emits the shared detection-event shape. Its service boundary is `services/detector/main.py`; model storage is `shared/models/`. Detector output is metadata/event-oriented, while large imagery remains filesystem/volume-backed.

#### Satellite Context and External Resilience
Satellite tracking independently retrieves and caches TLE data, computes SGP4 positions, and supplies satellite context for detections. `services/satellite_monitor/main.py` implements a source hierarchy: SatNOGS primary, Celestrak fallback, then stale cache. This isolates unreliable external orbital-data access from image-processing and event-persistence paths.

#### Enrichment, Persistence, and Operator Access
The aggregator receives detection events, computes maritime zone classification (territorial waters, EEZ, high seas), matches Global Fishing Watch AIS data for vessel/dark-vessel context, and persists/query-aggregates events through SQLite or Postgres. Its boundary is `services/aggregator/main.py`. `services/ground_dashboard/app.py` is the Streamlit operator entry point: upload flows invoke preprocessing/detection, satellite queries call the monitor, and continuous monitoring reads aggregator events/stats.

#### Infrastructure and Research Boundary
`docker-compose.yml` provides service startup ordering, health checks, Redis shared cache, and shared scene/tile volumes. All service images build from `docker/base/Dockerfile`. Credentials for CDSE and GFW are environment-provided via `.env.example`. Offline/reproducibility and model-development workflows are deliberately separated under `research/scripts/` and `research/notebooks/`, rather than part of the operational request path.

Main entry points: [`services/detector/main.py`](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/detector/main.py) (Vessel detector), [`services/aggregator/main.py`](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/aggregator/main.py) (Event aggregator), [`docker-compose.yml`](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/docker-compose.yml) (Docker Compose), [`services/ground_dashboard/app.py`](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/ground_dashboard/app.py) (Ground dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared contracts"]
  node_shared_contracts["Event schemas<br/>shared contracts<br/>[events.py]"]
  node_shared_config["Constants and secrets<br/>shared config<br/>[constants.py]"]
  node_models[("Model artifacts<br/>model storage")]
end

subgraph group_services["Operational services"]
  node_compose{{"Docker Compose<br/>deployment<br/>[docker-compose.yml]"}}
  node_base_image["Base service image<br/>Dockerfile"]
  node_ingestor["Data ingestor<br/>FastAPI service<br/>[main.py]"]
  node_cdse_fetcher["CDSE fetcher<br/>ingestion adapter"]
  node_preprocessor["SAR preprocessor<br/>FastAPI service<br/>[main.py]"]
  node_sar_pipeline["SAR processing pipeline<br/>image processing"]
  node_detector["Vessel detector<br/>FastAPI service<br/>[main.py]"]
  node_satellite_monitor["Satellite monitor<br/>FastAPI service<br/>[main.py]"]
  node_aggregator["Event aggregator<br/>FastAPI service<br/>[main.py]"]
  node_dashboard["Ground dashboard<br/>Streamlit app<br/>[app.py]"]
end

subgraph group_storage["Compose-managed storage"]
  node_redis[("Redis cache<br/>shared cache")]
  node_scenes_volume[("Scenes volume<br/>shared volume")]
  node_tiles_volume[("Tiles volume<br/>shared volume")]
  node_event_store[("Event database<br/>SQLite or Postgres")]
end

subgraph group_external["External data sources"]
  node_cdse(("Copernicus Data Space<br/>external API"))
  node_orbital_sources(("SatNOGS / Celestrak<br/>external TLE APIs"))
  node_gfw(("Global Fishing Watch<br/>external AIS API"))
end

subgraph group_research["Research boundary"]
  node_research_workflows["Research workflows<br/>scripts and notebooks"]
end

node_compose -->|"builds services from"| node_base_image
node_compose -->|"provisions"| node_redis
node_compose -->|"mounts"| node_scenes_volume
node_compose -->|"mounts"| node_tiles_volume
node_ingestor -->|"uses"| node_cdse_fetcher
node_cdse_fetcher -->|"searches products"| node_cdse
node_ingestor -.->|"writes raw scenes"| node_scenes_volume
node_scenes_volume -->|"reads SAFE scenes"| node_preprocessor
node_preprocessor -->|"orchestrates"| node_sar_pipeline
node_preprocessor -->|"writes georeferenced tiles"| node_tiles_volume
node_tiles_volume -->|"supplies tiles"| node_detector
node_models -->|"loads ONNX model"| node_detector
node_detector -->|"emits events"| node_shared_contracts
node_detector -->|"sends detection events"| node_aggregator
node_satellite_monitor -->|"retrieves TLEs"| node_orbital_sources
node_satellite_monitor -->|"caches TLE data"| node_redis
node_satellite_monitor -->|"supplies satellite context"| node_shared_contracts
node_aggregator -->|"matches AIS context"| node_gfw
node_aggregator -->|"persists events"| node_event_store
node_dashboard -->|"invokes upload processing"| node_preprocessor
node_dashboard -->|"invokes detection"| node_detector
node_dashboard -->|"queries satellite context"| node_satellite_monitor
node_dashboard -->|"reads events and stats"| node_aggregator
node_shared_config -.->|"validates credentials"| node_ingestor
node_shared_config -.->|"validates credentials"| node_aggregator

click node_compose "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/docker-compose.yml"
click node_base_image "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/docker/base/Dockerfile"
click node_shared_contracts "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/shared/schemas/events.py"
click node_shared_config "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/shared/config/constants.py"
click node_ingestor "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/data_ingestor/main.py"
click node_cdse_fetcher "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/data_ingestor/sentinel_fetcher.py"
click node_preprocessor "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/sentinel_preprocessor/main.py"
click node_sar_pipeline "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/sentinel_preprocessor/sar_preprocessing_module.py"
click node_detector "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/detector/main.py"
click node_satellite_monitor "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/satellite_monitor/main.py"
click node_aggregator "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/aggregator/main.py"
click node_dashboard "https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/ground_dashboard/app.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_shared_contracts,node_shared_config,node_models toneBlue
class node_compose,node_base_image,node_ingestor,node_cdse_fetcher,node_preprocessor,node_sar_pipeline,node_detector,node_satellite_monitor,node_aggregator,node_dashboard toneAmber
class node_redis,node_scenes_volume,node_tiles_volume,node_event_store toneMint
class node_cdse,node_orbital_sources,node_gfw toneRose
class node_research_workflows toneIndigo
```

## Components

### Shared contracts

Compatibility boundary across services.

- [Event schemas](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/shared/schemas/events.py): shared contracts · Detection and geospatial/TLE payload models. · `shared/schemas/events.py`
- [Constants and secrets](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/shared/config/constants.py): shared config · `shared/config/constants.py`
- **Model artifacts**: model storage · Unversioned YOLO model artifacts.

### Operational services

- [Docker Compose](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/docker-compose.yml): deployment · Starts services, health checks, cache, and shared volumes. · `docker-compose.yml`
- [Base service image](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/docker/base/Dockerfile): Dockerfile · `docker/base/Dockerfile`
- [Data ingestor](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/data_ingestor/main.py): FastAPI service · Searches Sentinel-1 products; download jobs are incomplete. · `services/data_ingestor/main.py`
- [CDSE fetcher](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/data_ingestor/sentinel_fetcher.py): ingestion adapter · `services/data_ingestor/sentinel_fetcher.py`
- [SAR preprocessor](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/sentinel_preprocessor/main.py): FastAPI service · Converts SAFE products to georeferenced 512×512 tiles. · `services/sentinel_preprocessor/main.py`
- [SAR processing pipeline](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/sentinel_preprocessor/sar_preprocessing_module.py): image processing · Calibration, filtering, dB, MVSSD, and GCP mapping. · `services/sentinel_preprocessor/sar_preprocessing_module.py`
- [Vessel detector](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/detector/main.py): FastAPI service · INT8 YOLOv8 ONNX inference, NMS, and priority assignment. · `services/detector/main.py`
- [Satellite monitor](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/satellite_monitor/main.py): FastAPI service · TLE hierarchy, cache, and SGP4 satellite context. · `services/satellite_monitor/main.py`
- [Event aggregator](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/aggregator/main.py): FastAPI service · Enriches, persists, and queries detection events. · `services/aggregator/main.py`
- [Ground dashboard](https://github.com/franckinani/maritime-edge-ai-intel-platform/blob/main/services/ground_dashboard/app.py): Streamlit app · Operator upload, satellite-query, and monitoring interface. · `services/ground_dashboard/app.py`

### Compose-managed storage

- **Redis cache**: shared cache
- **Scenes volume**: shared volume · Raw Sentinel-1 scene exchange.
- **Tiles volume**: shared volume · Tile exchange between preprocessing and inference.
- **Event database**: SQLite or Postgres · Persistent detection-event store.

### External data sources

- **Copernicus Data Space**: external API
- **SatNOGS / Celestrak**: external TLE APIs · Primary and fallback orbital sources.
- **Global Fishing Watch**: external AIS API

### Research boundary

Offline and model-development workflows.

- **Research workflows**: scripts and notebooks · Separated from operational request paths.

## Connections

- Docker Compose → Base service image: builds services from
- Docker Compose → Redis cache: provisions
- Docker Compose → Scenes volume: mounts
- Docker Compose → Tiles volume: mounts
- Data ingestor → CDSE fetcher: uses
- CDSE fetcher → Copernicus Data Space: searches products
- Data ingestor → Scenes volume: writes raw scenes
- Scenes volume → SAR preprocessor: reads SAFE scenes
- SAR preprocessor → SAR processing pipeline: orchestrates
- SAR preprocessor → Tiles volume: writes georeferenced tiles
- Tiles volume → Vessel detector: supplies tiles
- Model artifacts → Vessel detector: loads ONNX model
- Vessel detector → Event schemas: emits events
- Vessel detector → Event aggregator: sends detection events
- Satellite monitor → SatNOGS / Celestrak: retrieves TLEs
- Satellite monitor → Redis cache: caches TLE data
- Satellite monitor → Event schemas: supplies satellite context
- Event aggregator → Global Fishing Watch: matches AIS context
- Event aggregator → Event database: persists events
- Ground dashboard → SAR preprocessor: invokes upload processing
- Ground dashboard → Vessel detector: invokes detection
- Ground dashboard → Satellite monitor: queries satellite context
- Ground dashboard → Event aggregator: reads events and stats
- Constants and secrets → Data ingestor: validates credentials
- Constants and secrets → Event aggregator: validates credentials
