# cywhale/glodap architecture

> Architecture diagram of the GitHub repository cywhale/glodap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cywhale/glodap
- Repository: https://github.com/cywhale/glodap

## Overview

##### Project type and purpose
- From the README (“GLODAP Open API”) and file tree, this is a data-centric web API service written in Python. Its purpose is to expose GLODAP (Global Ocean Data Analysis Project) version 2.2023 data via a RESTful interface.
- It ingests raw JSON/CSV data (in `data/`), transforms/stores it (dev scripts and possibly a Postgres backend), and serves it through `glodap_app.py` (the main application), with supporting library code under `src/`.

##### File structure
Top‐level and key directories:
- `glodap_app.py` – the entry point for the API service (likely using Flask or FastAPI).
- `src/` – application modules (e.g., `cruise_metadata.py`).
- `data/` – source datasets (JSON and CSV).
- `dev/` – development/ETL scripts (`cruise2table.py`, `glodap2postgres.ipynb`) to load or prepare data.
- `conf/` – deployment/configuration:
– `ecosystem.config.js` (PM2 or similar process manager config)
– `simu.sh` (simulation or startup script).
- `requirements.txt` – Python dependencies.
Patterns & components:
- ETL layer (scripts under `dev/`)
- Data storage (implied PostgreSQL or similar, given the notebook)
- API application (Python service)
- Deployment/config (PM2, shell scripts)

##### README for additional insights
- Under construction, but attribution section confirms data source and suggests read-only, queryable dataset.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Raw Data Layer
    subgraph "Raw Data Storage"
        RD["Raw Data Storage\ndata/"]:::storage
    end

    %% ETL Layer
    subgraph "ETL/Transformation Layer"
        E1["cruise2table.py"]:::etl
        E2["glodap2postgres.ipynb"]:::etl
    end

    %% Database
    DB["PostgreSQL"]:::db

    %% API Application
    subgraph "API Application"
        A1["glodap_app.py"]:::api
        A2["cruise_metadata.py\n(src/)"]:::api
    end

    %% Configuration & Deployment
    subgraph "Configuration & Deployment"
        C1["ecosystem.config.js"]:::config
        C2["simu.sh"]:::config
        C3["requirements.txt"]:::config
    end

    %% External Clients
    CL["External Clients"]:::client

    %% Data Flow
    RD --> E1
    RD --> E2
    E1 --> DB
    E2 --> DB
    DB --> A1
    A1 --> A2
    A1 --> CL

    %% Deployment Flow
    C2 --> C1
    C1 --> A1
    C3 --> A1

    %% Click Events
    click RD "https://github.com/cywhale/glodap/tree/main/data/"
    click E1 "https://github.com/cywhale/glodap/blob/main/dev/cruise2table.py"
    click E2 "https://github.com/cywhale/glodap/blob/main/dev/glodap2postgres.ipynb"
    click A1 "https://github.com/cywhale/glodap/blob/main/glodap_app.py"
    click A2 "https://github.com/cywhale/glodap/blob/main/src/cruise_metadata.py"
    click C1 "https://github.com/cywhale/glodap/blob/main/conf/ecosystem.config.js"
    click C2 "https://github.com/cywhale/glodap/blob/main/conf/simu.sh"
    click C3 "https://github.com/cywhale/glodap/blob/main/requirements.txt"

    %% Styles
    classDef storage fill:#BBDEFB,stroke:#1E88E5,color:#0D47A1;
    classDef etl fill:#C8E6C9,stroke:#388E3C,color:#1B5E20;
    classDef db fill:#90CAF9,stroke:#1976D2,color:#0D47A1;
    classDef api fill:#FFE0B2,stroke:#FB8C00,color:#E65100;
    classDef config fill:#E0E0E0,stroke:#757575,color:#424242;
    classDef client fill:#FFCCBC,stroke:#E64A19,color:#BF360C;
```
