# reefsupport/marine-data architecture

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

- Interactive diagram: https://gitdiagram.com/reefsupport/marine-data
- Repository: https://github.com/reefsupport/marine-data

## Overview

marine-data is a marine-dataset registry, ingestion toolkit, and dataset builder. The principal user workflow is to query sources against a task and licence profile, then use eligible data in published datasets; developers can also ingest source data, normalize and stage it, and release datasets. The graph preserves documented label mapping, task layers, and evaluation/quality capabilities. Edges reflect README statements or shown source references; where runtime wiring is not shown, relationships are omitted or marked unverified.

Main entry points: [`src/marinedata/builder.py`](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/builder.py) (Dataset builder), [`src/marinedata/registry.py`](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/registry.py) (Source registry), [`src/marinedata/ingest_source.py`](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/ingest_source.py) (Source ingestion), [`src/marinedata/adapters/__init__.py`](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/adapters/__init__.py) (Source adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_governance["Registry &amp; Licensing"]
  node_registry[("Source registry<br/>[registry.py]")]
  node_models["Registry models<br/>[models.py]"]
  node_licence["Licence rules<br/>[licence_class.py]"]
  node_gate["Licence gate<br/>[gate.py]"]
end

subgraph group_ingestion["Source Ingestion"]
  node_adapters["Source adapters<br/>[__init__.py]"]
  node_decode["Format decoding<br/>[decode.py]"]
  node_ingest_source["Source ingestion<br/>[ingest_source.py]"]
  node_stream["Stream staging<br/>[ingest_stream.py]"]
  node_s3["S3 upload<br/>[s3_upload.py]"]
  node_checksums["Checksums<br/>[checksums.py]"]
end

subgraph group_datasets["Dataset Production"]
  node_schema["Dataset schema<br/>[schema.py]"]
  node_tables["Staged tables<br/>[tables.py]"]
  node_task_layers["Task layers<br/>[boxes_table.py]"]
  node_keyed["Keyed S3 data<br/>[s3_keyed.py]"]
  node_builder["Dataset builder<br/>[builder.py]"]
  node_release["Release pipeline<br/>[release.py]"]
end

subgraph group_use["Dataset Use"]
  node_pandas["Pandas integration<br/>[pandas.py]"]
  node_labels["Label mapping<br/>[labels.py]"]
  node_quality["Label quality<br/>[pipeline.py]"]
  node_evaluation["Model evaluation<br/>[cli.py]"]
end

node_user(("Data user"))
node_hf[("Hugging Face datasets")]

node_user -->|"queries sources"| node_registry
node_registry -.->|"checks eligibility"| node_gate
node_registry -->|"validates entries"| node_models
node_licence -->|"reads licence data"| node_registry
node_ingest_source -->|"uses adapters"| node_adapters
node_adapters -->|"decodes formats"| node_decode
node_ingest_source -->|"stages stream"| node_stream
node_stream -->|"uploads objects"| node_s3
node_ingest_source -->|"records digests"| node_checksums
node_tables -->|"writes digests"| node_checksums
node_builder -->|"uses schema"| node_schema
node_builder -->|"supports conversion"| node_pandas
node_task_layers -->|"uses keyed data"| node_keyed
node_user -->|"loads published data"| node_hf
node_hf -->|"remaps labels"| node_labels
node_user -->|"builds dataset"| node_builder
node_builder -.->|"feeds release"| node_release
node_user -.->|"checks annotations"| node_quality
node_user -.->|"evaluates models"| node_evaluation

click node_registry "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/registry.py"
click node_models "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/models.py"
click node_licence "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/licence_class.py"
click node_gate "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/gate.py"
click node_adapters "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/adapters/__init__.py"
click node_decode "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/adapters/decode.py"
click node_ingest_source "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/ingest_source.py"
click node_stream "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/ingest_stream.py"
click node_s3 "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/s3_upload.py"
click node_checksums "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/checksums.py"
click node_schema "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/schema.py"
click node_tables "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/tables.py"
click node_task_layers "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/task_layers/boxes_table.py"
click node_keyed "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/task_layers/s3_keyed.py"
click node_builder "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/builder.py"
click node_release "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/release.py"
click node_pandas "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/integrations/pandas.py"
click node_labels "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/labels.py"
click node_quality "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/labelquality/pipeline.py"
click node_evaluation "https://github.com/reefsupport/marine-data/blob/main/src/marinedata/eval/cli.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_registry,node_models,node_licence,node_gate,node_user toneBlue
class node_adapters,node_decode,node_ingest_source,node_stream,node_s3,node_checksums,node_hf toneAmber
class node_schema,node_tables,node_task_layers,node_keyed,node_builder,node_release toneMint
class node_pandas,node_labels,node_quality,node_evaluation toneRose
```

## Components

### Registry & Licensing

- [Source registry](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/registry.py): `src/marinedata/registry.py`
- [Registry models](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/models.py): `src/marinedata/models.py`
- [Licence rules](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/licence_class.py): `src/marinedata/licence_class.py`
- [Licence gate](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/gate.py): `src/marinedata/gate.py`

### Source Ingestion

- [Source adapters](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/adapters/__init__.py): `src/marinedata/adapters/__init__.py`
- [Format decoding](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/adapters/decode.py): `src/marinedata/adapters/decode.py`
- [Source ingestion](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/ingest_source.py): `src/marinedata/ingest_source.py`
- [Stream staging](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/ingest_stream.py): `src/marinedata/ingest_stream.py`
- [S3 upload](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/s3_upload.py): `src/marinedata/s3_upload.py`
- [Checksums](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/checksums.py): `src/marinedata/checksums.py`

### Dataset Production

- [Dataset schema](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/schema.py): `src/marinedata/schema.py`
- [Staged tables](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/tables.py): `src/marinedata/tables.py`
- [Task layers](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/task_layers/boxes_table.py): `src/marinedata/task_layers/boxes_table.py`
- [Keyed S3 data](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/task_layers/s3_keyed.py): `src/marinedata/task_layers/s3_keyed.py`
- [Dataset builder](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/builder.py): `src/marinedata/builder.py`
- [Release pipeline](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/release.py): `src/marinedata/release.py`

### Dataset Use

- [Pandas integration](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/integrations/pandas.py): `src/marinedata/integrations/pandas.py`
- [Label mapping](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/labels.py): `src/marinedata/labels.py`
- [Label quality](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/labelquality/pipeline.py): `src/marinedata/labelquality/pipeline.py`
- [Model evaluation](https://github.com/reefsupport/marine-data/blob/main/src/marinedata/eval/cli.py): `src/marinedata/eval/cli.py`

### Other components

- **Data user**
- **Hugging Face datasets**

## Connections

- Data user → Source registry: queries sources (evidence: `README.md`)
- Source registry → Licence gate: checks eligibility
- Source registry → Registry models: validates entries (evidence: `src/marinedata/registry.py`)
- Licence rules → Source registry: reads licence data (evidence: `src/marinedata/licence_class.py`)
- Source ingestion → Source adapters: uses adapters (evidence: `src/marinedata/ingest_source.py`)
- Source adapters → Format decoding: decodes formats (evidence: `src/marinedata/adapters/__init__.py`)
- Source ingestion → Stream staging: stages stream (evidence: `src/marinedata/ingest_source.py`)
- Stream staging → S3 upload: uploads objects (evidence: `src/marinedata/ingest_stream.py`)
- Source ingestion → Checksums: records digests (evidence: `src/marinedata/ingest_source.py`)
- Staged tables → Checksums: writes digests (evidence: `src/marinedata/tables.py`)
- Dataset builder → Dataset schema: uses schema (evidence: `src/marinedata/integrations/pandas.py`)
- Dataset builder → Pandas integration: supports conversion (evidence: `src/marinedata/integrations/pandas.py`)
- Task layers → Keyed S3 data: uses keyed data (evidence: `src/marinedata/task_layers/boxes_table.py`)
- Data user → Hugging Face datasets: loads published data (evidence: `README.md`)
- Hugging Face datasets → Label mapping: remaps labels (evidence: `README.md`)
- Data user → Dataset builder: builds dataset (evidence: `README.md`)
- Dataset builder → Release pipeline: feeds release
- Data user → Label quality: checks annotations
- Data user → Model evaluation: evaluates models
