# dovantohhieu/seoulbike-bigdata architecture

> Architecture diagram of the GitHub repository dovantohhieu/seoulbike-bigdata, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dovantohhieu/seoulbike-bigdata
- Repository: https://github.com/dovantohhieu/seoulbike-bigdata

## Overview

This repository is a Seoul bike-rental demand forecasting project, with a local Streamlit dashboard and notebook demo. The main workflow validates hourly source data, builds lag and calendar features, trains and evaluates time-split sklearn and Spark models, then supports one-hour forecasts and result exploration. A separate Spark lab demonstrates quality checks, partitioned Parquet, SQL, and execution plans; ETL benchmarks compare pandas and Spark. The graph preserves these documented branches, but some orchestration and dashboard internals were not sampled, so uncertain links are omitted.

Main entry points: [`src/data.py`](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/data.py) (Data validation and features), [`src/common.py`](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/common.py) (Project conventions), [`src/spark_pipeline.py`](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/spark_pipeline.py) (Spark model pipeline), [`app.py`](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/app.py) (Streamlit dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_shared["Project conventions<br/>[common.py]"]
  node_pandas_data["Data validation and features<br/>[data.py]"]
  node_spark_data["Spark data validation<br/>[spark_data.py]"]
end

subgraph group_model["Forecasting"]
  node_training["Model training<br/>[train.py]"]
  node_spark_pipeline["Spark model pipeline<br/>[spark_pipeline.py]"]
  node_prediction["Forecast inference<br/>[predict.py]"]
  node_metrics["Regression metrics<br/>[metrics.py]"]
  node_analysis["Evaluation and analysis<br/>[analyze.py]"]
end

subgraph group_bigdata["Spark and ETL lab"]
  node_spark_lab["Spark SQL lab<br/>[bigdata_lab.py]"]
  node_benchmark["ETL benchmark<br/>[benchmark.py]"]
  node_benchmark_worker["Benchmark worker"]
end

subgraph group_delivery["User-facing results"]
  node_notebook["Notebook demo<br/>[Demo_BigData.ipynb]"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_offline["Offline results page<br/>[offline.py]"]
end

node_user(("Project user"))
node_uci[("UCI dataset")]

node_user -->|"runs demo"| node_notebook
node_user -->|"opens dashboard"| node_dashboard
node_uci -->|"provides CSV"| node_pandas_data
node_notebook -.->|"runs training"| node_training
node_notebook -.->|"runs lab"| node_spark_lab
node_notebook -.->|"measures ETL"| node_benchmark
node_dashboard -->|"uses conventions"| node_shared
node_dashboard -->|"loads data"| node_pandas_data
node_dashboard -->|"requests forecasts"| node_prediction
node_dashboard -->|"launches lab"| node_spark_lab
node_pandas_data -->|"uses constants"| node_shared
node_spark_data -->|"uses source path"| node_shared
node_spark_data -->|"reuses schema"| node_pandas_data
node_training -->|"uses splits"| node_shared
node_training -->|"loads features"| node_pandas_data
node_training -->|"scores models"| node_metrics
node_spark_pipeline -->|"uses settings"| node_shared
node_spark_pipeline -->|"reads source"| node_spark_data
node_spark_pipeline -->|"scores predictions"| node_metrics
node_prediction -->|"uses feature list"| node_shared
node_prediction -->|"builds next features"| node_pandas_data
node_prediction -->|"loads Spark model"| node_spark_pipeline
node_analysis -->|"loads data"| node_pandas_data
node_analysis -->|"computes scores"| node_metrics
node_analysis -->|"builds offline page"| node_offline
node_spark_lab -->|"loads data"| node_pandas_data
node_spark_lab -->|"validates CSV"| node_spark_data
node_spark_lab -->|"creates session"| node_spark_pipeline
node_benchmark_worker -->|"writes results"| node_shared
node_benchmark_worker -->|"creates Spark session"| node_spark_pipeline
node_benchmark -.->|"dispatches runs"| node_benchmark_worker

click node_notebook "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/notebooks/Demo_BigData.ipynb"
click node_dashboard "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/app.py"
click node_offline "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/offline.py"
click node_shared "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/common.py"
click node_pandas_data "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/data.py"
click node_spark_data "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/spark_data.py"
click node_training "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/train.py"
click node_spark_pipeline "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/spark_pipeline.py"
click node_prediction "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/predict.py"
click node_metrics "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/metrics.py"
click node_analysis "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/analyze.py"
click node_spark_lab "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/bigdata_lab.py"
click node_benchmark "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/benchmark.py"
click node_benchmark_worker "https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/benchmark_worker.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,node_pandas_data,node_spark_data,node_user toneBlue
class node_training,node_spark_pipeline,node_prediction,node_metrics,node_analysis,node_uci toneAmber
class node_spark_lab,node_benchmark,node_benchmark_worker toneMint
class node_notebook,node_dashboard,node_offline toneRose
```

## Components

### Data preparation

- [Project conventions](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/common.py): `src/common.py`
- [Data validation and features](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/data.py): `src/data.py`
- [Spark data validation](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/spark_data.py): `src/spark_data.py`

### Forecasting

- [Model training](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/train.py): `src/train.py`
- [Spark model pipeline](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/spark_pipeline.py): `src/spark_pipeline.py`
- [Forecast inference](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/predict.py): `src/predict.py`
- [Regression metrics](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/metrics.py): `src/metrics.py`
- [Evaluation and analysis](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/analyze.py): `src/analyze.py`

### Spark and ETL lab

- [Spark SQL lab](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/bigdata_lab.py): `src/bigdata_lab.py`
- [ETL benchmark](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/benchmark.py): `src/benchmark.py`
- [Benchmark worker](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/benchmark_worker.py): `src/benchmark_worker.py`

### User-facing results

- [Notebook demo](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/notebooks/Demo_BigData.ipynb): `notebooks/Demo_BigData.ipynb`
- [Streamlit dashboard](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/app.py): `app.py`
- [Offline results page](https://github.com/dovantohhieu/seoulbike-bigdata/blob/main/src/offline.py): `src/offline.py`

### Other components

- **Project user**
- **UCI dataset**

## Connections

- Project user → Notebook demo: runs demo (evidence: `README.md`)
- Project user → Streamlit dashboard: opens dashboard (evidence: `README.md`)
- UCI dataset → Data validation and features: provides CSV (evidence: `README.md`)
- Notebook demo → Model training: runs training
- Notebook demo → Spark SQL lab: runs lab
- Notebook demo → ETL benchmark: measures ETL
- Streamlit dashboard → Project conventions: uses conventions (evidence: `app.py`)
- Streamlit dashboard → Data validation and features: loads data (evidence: `app.py`)
- Streamlit dashboard → Forecast inference: requests forecasts (evidence: `app.py`)
- Streamlit dashboard → Spark SQL lab: launches lab (evidence: `app.py`)
- Data validation and features → Project conventions: uses constants (evidence: `src/data.py`)
- Spark data validation → Project conventions: uses source path (evidence: `src/spark_data.py`)
- Spark data validation → Data validation and features: reuses schema (evidence: `src/spark_data.py`)
- Model training → Project conventions: uses splits (evidence: `src/train.py`)
- Model training → Data validation and features: loads features (evidence: `src/train.py`)
- Model training → Regression metrics: scores models (evidence: `src/train.py`)
- Spark model pipeline → Project conventions: uses settings (evidence: `src/spark_pipeline.py`)
- Spark model pipeline → Spark data validation: reads source (evidence: `src/spark_pipeline.py`)
- Spark model pipeline → Regression metrics: scores predictions (evidence: `src/spark_pipeline.py`)
- Forecast inference → Project conventions: uses feature list (evidence: `src/predict.py`)
- Forecast inference → Data validation and features: builds next features (evidence: `src/predict.py`)
- Forecast inference → Spark model pipeline: loads Spark model (evidence: `src/predict.py`)
- Evaluation and analysis → Data validation and features: loads data (evidence: `src/analyze.py`)
- Evaluation and analysis → Regression metrics: computes scores (evidence: `src/analyze.py`)
- Evaluation and analysis → Offline results page: builds offline page (evidence: `src/analyze.py`)
- Spark SQL lab → Data validation and features: loads data (evidence: `src/bigdata_lab.py`)
- Spark SQL lab → Spark data validation: validates CSV (evidence: `src/bigdata_lab.py`)
- Spark SQL lab → Spark model pipeline: creates session (evidence: `src/bigdata_lab.py`)
- Benchmark worker → Project conventions: writes results (evidence: `src/benchmark_worker.py`)
- Benchmark worker → Spark model pipeline: creates Spark session (evidence: `src/benchmark_worker.py`)
- ETL benchmark → Benchmark worker: dispatches runs
