# lvgalvao/one-billion-row-challenge-python architecture

> Architecture diagram of the GitHub repository lvgalvao/one-billion-row-challenge-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lvgalvao/one-billion-row-challenge-python
- Repository: https://github.com/lvgalvao/one-billion-row-challenge-python

## Overview

This repository is a set of alternative implementations of the One Billion Row weather-measurement challenge, plus scripts to generate sample data and clean up an optional Supabase copy. The principal workflow is to generate a semicolon-delimited measurements file, run one of the processors, and print station-level minimum, mean, and maximum temperatures in station order. The processors are independent alternatives, not stages in a shared processing pipeline. The README documents the Bash implementation, which was not sampled; its internal behavior is therefore not expanded here.

Main entry points: [`data`](https://github.com/lvgalvao/one-billion-row-challenge-python/tree/main/data) (Measurements file), [`src/create_measurements.py`](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements.py) (Measurement generator), [`src/create_measurements_1.py`](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements_1.py) (Temporary generator), [`src/supabase_cleanup.py`](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/supabase_cleanup.py) (Expiry cleanup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Data generation"]
  node_generator["Measurement generator"]
  node_generator_alt["Temporary generator"]
end

subgraph group_processing["Processing alternatives"]
  node_python["Python processor<br/>[using_python.py]"]
  node_python_old["Python list processor"]
  node_pandas["Pandas chunks<br/>[using_pandas.py]"]
  node_dask["Dask processor<br/>[using_dask.py]"]
  node_polars["Polars processor<br/>[using_polars.py]"]
  node_duckdb["DuckDB processor<br/>[using_duckdb.py]"]
  node_bash["Bash and awk"]
end

subgraph group_cleanup["Storage cleanup"]
  node_cleanup["Expiry cleanup"]
end

subgraph group_inputs["Data files"]
  node_station_data["Station samples"]
  node_measurements["Measurements file"]
end

node_user(("User"))
node_supabase[("Supabase Storage")]

node_user -->|"runs generator"| node_generator
node_user -->|"runs generator"| node_generator_alt
node_generator -->|"reads stations"| node_station_data
node_generator -->|"writes measurements"| node_measurements
node_generator_alt -->|"reads stations"| node_station_data
node_generator_alt -->|"writes measurements"| node_measurements
node_user -->|"runs processor"| node_python
node_user -.->|"runs processor"| node_python_old
node_user -->|"runs processor"| node_pandas
node_user -->|"runs processor"| node_dask
node_user -->|"runs processor"| node_polars
node_user -->|"runs processor"| node_duckdb
node_user -->|"runs script"| node_bash
node_python -->|"reads measurements"| node_measurements
node_python_old -->|"reads measurements"| node_measurements
node_pandas -->|"reads chunks"| node_measurements
node_dask -->|"reads measurements"| node_measurements
node_polars -->|"scans measurements"| node_measurements
node_duckdb -->|"queries measurements"| node_measurements
node_bash -->|"processes rows"| node_measurements
node_user -.->|"runs cleanup"| node_cleanup
node_cleanup -->|"downloads expiry"| node_supabase
node_cleanup -->|"removes expired files"| node_supabase

click node_generator "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements.py"
click node_generator_alt "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements_1.py"
click node_station_data "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/data/weather_stations.csv"
click node_measurements "https://github.com/lvgalvao/one-billion-row-challenge-python/tree/main/data"
click node_python "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_python.py"
click node_python_old "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_python_old.py"
click node_pandas "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_pandas.py"
click node_dask "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_dask.py"
click node_polars "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_polars.py"
click node_duckdb "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_duckdb.py"
click node_bash "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_bash_and_awk.sh"
click node_cleanup "https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/supabase_cleanup.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_generator,node_generator_alt,node_user toneBlue
class node_python,node_python_old,node_pandas,node_dask,node_polars,node_duckdb,node_bash,node_supabase toneAmber
class node_cleanup toneMint
class node_station_data,node_measurements toneRose
```

## Components

### Data generation

- [Measurement generator](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements.py): `src/create_measurements.py`
- [Temporary generator](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/create_measurements_1.py): `src/create_measurements_1.py`

### Processing alternatives

- [Python processor](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_python.py): `src/using_python.py`
- [Python list processor](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_python_old.py): `src/using_python_old.py`
- [Pandas chunks](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_pandas.py): `src/using_pandas.py`
- [Dask processor](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_dask.py): `src/using_dask.py`
- [Polars processor](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_polars.py): `src/using_polars.py`
- [DuckDB processor](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_duckdb.py): `src/using_duckdb.py`
- [Bash and awk](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/using_bash_and_awk.sh): `src/using_bash_and_awk.sh`

### Storage cleanup

- [Expiry cleanup](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/src/supabase_cleanup.py): `src/supabase_cleanup.py`

### Data files

- [Station samples](https://github.com/lvgalvao/one-billion-row-challenge-python/blob/main/data/weather_stations.csv): `data/weather_stations.csv`
- [Measurements file](https://github.com/lvgalvao/one-billion-row-challenge-python/tree/main/data): `data`

### Other components

- **User**
- **Supabase Storage**

## Connections

- User → Measurement generator: runs generator (evidence: `README.md`)
- User → Temporary generator: runs generator (evidence: `README.md`)
- Measurement generator → Station samples: reads stations (evidence: `src/create_measurements.py`)
- Measurement generator → Measurements file: writes measurements (evidence: `src/create_measurements.py`)
- Temporary generator → Station samples: reads stations (evidence: `src/create_measurements_1.py`)
- Temporary generator → Measurements file: writes measurements (evidence: `src/create_measurements_1.py`)
- User → Python processor: runs processor (evidence: `README.md`)
- User → Python list processor: runs processor
- User → Pandas chunks: runs processor (evidence: `README.md`)
- User → Dask processor: runs processor (evidence: `README.md`)
- User → Polars processor: runs processor (evidence: `README.md`)
- User → DuckDB processor: runs processor (evidence: `README.md`)
- User → Bash and awk: runs script (evidence: `README.md`)
- Python processor → Measurements file: reads measurements (evidence: `src/using_python.py`)
- Python list processor → Measurements file: reads measurements (evidence: `src/using_python_old.py`)
- Pandas chunks → Measurements file: reads chunks (evidence: `src/using_pandas.py`)
- Dask processor → Measurements file: reads measurements (evidence: `src/using_dask.py`)
- Polars processor → Measurements file: scans measurements (evidence: `src/using_polars.py`)
- DuckDB processor → Measurements file: queries measurements (evidence: `src/using_duckdb.py`)
- Bash and awk → Measurements file: processes rows (evidence: `README.md`)
- User → Expiry cleanup: runs cleanup
- Expiry cleanup → Supabase Storage: downloads expiry (evidence: `src/supabase_cleanup.py`)
- Expiry cleanup → Supabase Storage: removes expired files (evidence: `src/supabase_cleanup.py`)
