# tchaikovsky29/bicycle-demand-prediction architecture

> Architecture diagram of the GitHub repository tchaikovsky29/bicycle-demand-prediction, 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/tchaikovsky29/bicycle-demand-prediction
- Repository: https://github.com/tchaikovsky29/bicycle-demand-prediction

## Overview

Bicycle Demand Prediction is an end-to-end MLOps system for training, promoting, serving, and monitoring bike-demand models. Its primary workflow is a Kubeflow training pipeline: ingest MongoDB data, validate and clean it, transform and split it, train and evaluate a model, then conditionally promote it. A separate inference transformer and drift detector support production serving and retraining. The training-stage wiring is visible in the pipeline source; inference, drift, and monitoring relationships are summarized from the README, so their implementation details are not inferred beyond that documentation.

Main entry points: [`src/pipeline/training_pipeline.py`](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/pipeline/training_pipeline.py) (Kubeflow training), [`src/components/data_ingestion.py`](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_ingestion.py) (Data ingestion), [`src/components/data_transformation.py`](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_transformation.py) (Feature transformation), [`src/components/model_trainer.py`](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_trainer.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Training Pipeline"]
  node_pipeline["Kubeflow training"]
  node_ingestion["Data ingestion<br/>[data_ingestion.py]"]
  node_validation["Data validation<br/>[data_validation.py]"]
  node_cleaning["Data cleaning<br/>[data_cleaning.py]"]
  node_transformation["Feature transformation"]
  node_trainer["Model training<br/>[model_trainer.py]"]
  node_evaluation["Model evaluation"]
  node_pusher["Model promotion<br/>[model_pusher.py]"]
end

subgraph group_data["Data and Models"]
  node_dataaccess["Mongo data access<br/>[data.py]"]
  node_mongoclient["MongoDB connection"]
  node_s3client["Object storage access<br/>[aws_connection.py]"]
  node_configs["Stage configuration<br/>[config_entity.py]"]
  node_utilities["Shared utilities<br/>[main_utils.py]"]
end

subgraph group_serving["Serving and Drift"]
  node_inference["Inference transformer"]
  node_predictor["KServe predictor"]
  node_drift["Drift detection<br/>[drift_detector.py]"]
  node_evidently["Evidently"]
end

subgraph group_ops["Tracking and Monitoring"]
  node_mlflow["MLflow tracking"]
  node_monitoring["Prometheus and Grafana"]
end

node_user(("Pipeline operator"))
node_mongodb[("MongoDB")]
node_minio[("MinIO / S3")]

node_user -->|"runs"| node_pipeline
node_pipeline -->|"starts"| node_ingestion
node_pipeline -->|"passes metadata"| node_validation
node_pipeline -->|"passes dataset"| node_cleaning
node_pipeline -->|"passes cleaned data"| node_transformation
node_pipeline -->|"passes train data"| node_trainer
node_pipeline -->|"passes test and model"| node_evaluation
node_pipeline -->|"passes evaluation"| node_pusher
node_ingestion -->|"provides metadata"| node_validation
node_ingestion -->|"provides raw data"| node_cleaning
node_cleaning -->|"provides cleaned data"| node_transformation
node_transformation -->|"provides train split"| node_trainer
node_transformation -->|"provides test split"| node_evaluation
node_trainer -->|"provides model"| node_evaluation
node_evaluation -->|"provides acceptance"| node_pusher
node_ingestion -->|"reads collection"| node_dataaccess
node_dataaccess -->|"uses connection"| node_mongoclient
node_mongoclient -.->|"queries"| node_mongodb
node_ingestion -->|"uploads dataset"| node_s3client
node_transformation -->|"reads and writes"| node_s3client
node_trainer -->|"reads and writes"| node_s3client
node_evaluation -.->|"reads model data"| node_s3client
node_pusher -->|"promotes artifact"| node_s3client
node_s3client -.->|"accesses objects"| node_minio
node_ingestion -->|"uses settings"| node_configs
node_transformation -->|"uses settings"| node_configs
node_trainer -->|"uses settings"| node_configs
node_pusher -->|"uses settings"| node_configs
node_ingestion -->|"hashes data"| node_utilities
node_transformation -->|"logs experiment"| node_mlflow
node_trainer -->|"logs model"| node_mlflow
node_pusher -.->|"updates serving artifact"| node_inference
node_inference -->|"sends predictions"| node_predictor
node_inference -->|"loads config and logs"| node_minio
node_predictor -->|"exposes metrics"| node_monitoring
node_inference -->|"logs payloads"| node_drift
node_drift -->|"reads artifacts and logs"| node_minio
node_drift -->|"measures drift"| node_evidently
node_drift -->|"triggers retraining"| node_pipeline

click node_pipeline "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/pipeline/training_pipeline.py"
click node_ingestion "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_ingestion.py"
click node_validation "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_validation.py"
click node_cleaning "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_cleaning.py"
click node_transformation "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_transformation.py"
click node_trainer "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_trainer.py"
click node_evaluation "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_evaluation.py"
click node_pusher "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_pusher.py"
click node_dataaccess "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/data_access/data.py"
click node_mongoclient "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/configuration/mongo_db_connection.py"
click node_s3client "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/configuration/aws_connection.py"
click node_configs "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/entity/config_entity.py"
click node_utilities "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/utils/main_utils.py"
click node_inference "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/pipeline/inference_transformer.py"
click node_drift "https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/drift_detection/drift_detector.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_pipeline,node_ingestion,node_validation,node_cleaning,node_transformation,node_trainer,node_evaluation,node_pusher toneBlue
class node_dataaccess,node_mongoclient,node_s3client,node_configs,node_utilities,node_mongodb,node_minio toneAmber
class node_inference,node_predictor,node_drift,node_evidently toneMint
class node_mlflow,node_monitoring toneRose
class node_user toneIndigo
```

## Components

### Training Pipeline

- [Kubeflow training](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/pipeline/training_pipeline.py): `src/pipeline/training_pipeline.py`
- [Data ingestion](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_ingestion.py): `src/components/data_ingestion.py`
- [Data validation](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_validation.py): `src/components/data_validation.py`
- [Data cleaning](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_cleaning.py): `src/components/data_cleaning.py`
- [Feature transformation](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/data_transformation.py): `src/components/data_transformation.py`
- [Model training](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_trainer.py): `src/components/model_trainer.py`
- [Model evaluation](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_evaluation.py): `src/components/model_evaluation.py`
- [Model promotion](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/components/model_pusher.py): `src/components/model_pusher.py`

### Data and Models

- [Mongo data access](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/data_access/data.py): `src/data_access/data.py`
- [MongoDB connection](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/configuration/mongo_db_connection.py): `src/configuration/mongo_db_connection.py`
- [Object storage access](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/configuration/aws_connection.py): `src/configuration/aws_connection.py`
- [Stage configuration](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/entity/config_entity.py): `src/entity/config_entity.py`
- [Shared utilities](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/utils/main_utils.py): `src/utils/main_utils.py`

### Serving and Drift

- [Inference transformer](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/src/pipeline/inference_transformer.py): `src/pipeline/inference_transformer.py`
- **KServe predictor**
- [Drift detection](https://github.com/tchaikovsky29/bicycle-demand-prediction/blob/main/drift_detection/drift_detector.py): `drift_detection/drift_detector.py`
- **Evidently**

### Tracking and Monitoring

- **MLflow tracking**
- **Prometheus and Grafana**

### Other components

- **Pipeline operator**
- **MongoDB**
- **MinIO / S3**

## Connections

- Pipeline operator → Kubeflow training: runs (evidence: `README.md`)
- Kubeflow training → Data ingestion: starts (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Data validation: passes metadata (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Data cleaning: passes dataset (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Feature transformation: passes cleaned data (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Model training: passes train data (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Model evaluation: passes test and model (evidence: `src/pipeline/training_pipeline.py`)
- Kubeflow training → Model promotion: passes evaluation (evidence: `src/pipeline/training_pipeline.py`)
- Data ingestion → Data validation: provides metadata (evidence: `src/pipeline/training_pipeline.py`)
- Data ingestion → Data cleaning: provides raw data (evidence: `src/pipeline/training_pipeline.py`)
- Data cleaning → Feature transformation: provides cleaned data (evidence: `src/pipeline/training_pipeline.py`)
- Feature transformation → Model training: provides train split (evidence: `src/pipeline/training_pipeline.py`)
- Feature transformation → Model evaluation: provides test split (evidence: `src/pipeline/training_pipeline.py`)
- Model training → Model evaluation: provides model (evidence: `src/pipeline/training_pipeline.py`)
- Model evaluation → Model promotion: provides acceptance (evidence: `src/pipeline/training_pipeline.py`)
- Data ingestion → Mongo data access: reads collection (evidence: `src/components/data_ingestion.py`)
- Mongo data access → MongoDB connection: uses connection (evidence: `src/data_access/data.py`)
- MongoDB connection → MongoDB: queries
- Data ingestion → Object storage access: uploads dataset (evidence: `src/components/data_ingestion.py`)
- Feature transformation → Object storage access: reads and writes (evidence: `src/components/data_transformation.py`)
- Model training → Object storage access: reads and writes (evidence: `src/components/model_trainer.py`)
- Model evaluation → Object storage access: reads model data (evidence: `src/components/model_evaluation.py`)
- Model promotion → Object storage access: promotes artifact (evidence: `src/components/model_pusher.py`)
- Object storage access → MinIO / S3: accesses objects
- Data ingestion → Stage configuration: uses settings (evidence: `src/components/data_ingestion.py`)
- Feature transformation → Stage configuration: uses settings (evidence: `src/components/data_transformation.py`)
- Model training → Stage configuration: uses settings (evidence: `src/components/model_trainer.py`)
- Model promotion → Stage configuration: uses settings (evidence: `src/components/model_pusher.py`)
- Data ingestion → Shared utilities: hashes data (evidence: `src/components/data_ingestion.py`)
- Feature transformation → MLflow tracking: logs experiment (evidence: `src/components/data_transformation.py`)
- Model training → MLflow tracking: logs model (evidence: `src/components/model_trainer.py`)
- Model promotion → Inference transformer: updates serving artifact (evidence: `README.md`)
- Inference transformer → KServe predictor: sends predictions (evidence: `README.md`)
- Inference transformer → MinIO / S3: loads config and logs (evidence: `README.md`)
- KServe predictor → Prometheus and Grafana: exposes metrics (evidence: `README.md`)
- Inference transformer → Drift detection: logs payloads (evidence: `README.md`)
- Drift detection → MinIO / S3: reads artifacts and logs (evidence: `README.md`)
- Drift detection → Evidently: measures drift (evidence: `README.md`)
- Drift detection → Kubeflow training: triggers retraining (evidence: `README.md`)
