# ramansh-codes/end-to-end-customer-satisfaction-pipeline architecture

> Architecture diagram of the GitHub repository ramansh-codes/end-to-end-customer-satisfaction-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline
- Repository: https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline

## Overview

1. **What this repo is**
   - This is an end-to-end machine learning project for predicting e-commerce customer satisfaction scores.
   - The architecture is centered on **ZenML** for orchestration, **MLflow** for experiment tracking/model deployment, and a **Streamlit** app for interactive inference.

2. **Main architectural split**
   - The codebase has two major flows:
     - **Training / deployment pipeline**: ingests data, cleans it, trains models, evaluates them, and conditionally deploys the best model.
     - **Inference pipeline**: loads the deployed service and exposes predictions to clients such as the Streamlit app.

3. **Pipeline entrypoints**
   - `RunPipeline.py` is the training-oriented entrypoint.
   - `RunDeployment.py` is the deployment/inference entrypoint and is the main CLI for running the full ML lifecycle.
   - `StremLit.py` is the user-facing frontend that sends feature inputs to the serving layer.
   - `ServerModel.py` appears to provide the local model-serving alternative referenced in the README for Windows users.

4. **Data ingestion boundary**
   - `Steps/Ingest_data.py` is the ingestion step that brings raw order/customer data into the pipeline.
   - The dataset is described in the README as a CSV with order-level features such as payment details, product dimensions, and freight values.
   - This is the first boundary where raw data becomes a pipeline artifact managed by ZenML.

5. **Preprocessing / cleaning boundary**
   - `Steps/DataPre.py` performs the `clean_data` step.
   - The actual preprocessing logic lives in `src/ModelCleaning.py`, which likely handles cleaning, feature preparation, and train/test splitting.
   - This boundary separates raw ingested data from model-ready tabular features.

6. **Training subsystem**
   - `Steps/ModelTrain.py` is the `train_model` step.
   - `src/ModelDevelopment.py` contains the model training logic, and the README indicates tree-based regressors such as **LightGBM** and **XGBoost** are used.
   - This is where model candidates are fit and their outputs are converted into trackable ML artifacts.

7. **Evaluation subsystem**
   - `Steps/evaluation.py` runs model evaluation after training.
   - `src/ModelEvaluation.py` defines the metrics layer, including **MSE**, **RMSE**, and **R2**.
   - The evaluation step is the gatekeeper for deployment: model quality determines whether the pipeline continues to deployment.

8. **Deployment boundary**
   - The deployment flow uses ZenML’s **MLflow model deployer** integration.
   - The README shows a deployment-trigger style check using a minimum accuracy threshold before the model is promoted.
   - On non-Windows systems, the inference service is started via the deployment pipeline; on Windows, the repo falls back to a local Flask-style server.

9. **Inference path**
   - The inference pipeline is separate from training and is optimized for serving predictions.
   - The README describes the sequence as `dynamic_importer → prediction_service_loader → predictor`.
   - `StremLit.py` is a client of this inference path: it collects feature values and sends them to the serving endpoint for live scoring.

10. **Shared ML infrastructure**
   - `Materializer/CustomeMaterializer.py` is an important infrastructure component because it lets ZenML pass custom objects such as **pandas DataFrames** and trained models between steps.
   - `Steps/config.py` holds configuration classes used across the pipeline, keeping tunable model/pipeline settings out of the core logic.
   - This separation keeps orchestration concerns in `Steps/` and model logic in `src/`.

11. **Operational tooling**
   - **MLflow** is the experiment and model registry layer.
   - **ZenML** is the pipeline orchestrator and artifact manager.
   - **Streamlit** is the presentation layer for manual testing and demos.
   - The repo therefore has three distinct runtime concerns: offline training, online serving, and interactive UI.

12. **Diagram-friendly mental model**
   - Think of the system as:
     - raw CSV data in,
     - ZenML-managed preprocessing,
     - model training and metric evaluation,
     - conditional model deployment through MLflow,
     - a separate inference-serving path,
     - and a Streamlit frontend consuming that service.
   - The strongest architectural boundaries are between **data prep**, **model logic**, **orchestration**, and **user-facing inference**.

Main entry points: [`Steps/DataPre.py`](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/DataPre.py) (Clean data), [`Steps/ModelTrain.py`](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/ModelTrain.py) (Train model), [`Steps/evaluation.py`](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/evaluation.py) (Evaluate), [`RunDeployment.py`](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/RunDeployment.py) (RunDeployment.py)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entrypoints["Entry points"]
  node_run_pipeline["RunPipeline.py<br/>entrypoint<br/>[RunPipeline.py]"]
  node_run_deployment["RunDeployment.py<br/>entrypoint<br/>[RunDeployment.py]"]
end

subgraph group_pipeline["Training pipeline"]
  node_ingest_step["Ingest data<br/>zenml step<br/>[Ingest_data.py]"]
  node_clean_step["Clean data<br/>zenml step<br/>[DataPre.py]"]
  node_train_step["Train model<br/>zenml step<br/>[ModelTrain.py]"]
  node_eval_step["Evaluate<br/>zenml step<br/>[evaluation.py]"]
  node_config["config.py<br/>pipeline config<br/>[config.py]"]
  node_zenml(("ZenML<br/>orchestrator"))
end

subgraph group_modeling["Model logic"]
  node_cust_materializer["Custom materializer<br/>zenml materializer"]
  node_model_cleaning["ModelCleaning<br/>preprocess logic<br/>[ModelCleaning.py]"]
  node_model_dev["ModelDevelopment<br/>train logic"]
  node_model_eval["ModelEvaluation<br/>metrics logic<br/>[ModelEvaluation.py]"]
end

subgraph group_serving["Serving"]
  node_server_model["ServerModel.py<br/>[ServerModel.py]"]
  node_mlflow(("MLflow<br/>registry"))
  node_prediction_service["Prediction service<br/>inference api"]
  node_dynamic_importer["Dynamic import<br/>inference stage"]
  node_prediction_loader["Service loader<br/>inference stage"]
  node_predictor["Predictor<br/>inference stage"]
end

subgraph group_ui["User interface"]
  node_streamlit_app["StremLit.py<br/>ui<br/>[StremLit.py]"]
end

node_run_pipeline -->|"launches"| node_zenml
node_run_pipeline -->|"triggers"| node_ingest_step
node_ingest_step -->|"passes data"| node_clean_step
node_clean_step -->|"uses"| node_model_cleaning
node_clean_step -->|"materializes"| node_cust_materializer
node_clean_step -->|"feeds"| node_train_step
node_train_step -->|"uses"| node_model_dev
node_train_step -->|"materializes"| node_cust_materializer
node_train_step -->|"hands off"| node_eval_step
node_eval_step -->|"uses"| node_model_eval
node_eval_step -->|"tracks"| node_mlflow
node_eval_step -.->|"gates"| node_run_deployment
node_run_deployment -->|"starts"| node_prediction_service
node_run_deployment -->|"loads from"| node_mlflow
node_prediction_service -->|"starts with"| node_dynamic_importer
node_dynamic_importer -->|"resolves"| node_prediction_loader
node_prediction_loader -->|"invokes"| node_predictor
node_predictor -->|"served by"| node_server_model
node_streamlit_app -->|"calls"| node_prediction_service
node_config -.->|"configures"| node_run_pipeline
node_config -.->|"configures"| node_run_deployment

click node_run_pipeline "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/RunPipeline.py"
click node_run_deployment "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/RunDeployment.py"
click node_streamlit_app "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/StremLit.py"
click node_server_model "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/ServerModel.py"
click node_ingest_step "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/Ingest_data.py"
click node_clean_step "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/DataPre.py"
click node_train_step "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/ModelTrain.py"
click node_eval_step "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/evaluation.py"
click node_config "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/config.py"
click node_cust_materializer "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Materializer/CustomeMaterializer.py"
click node_model_cleaning "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelCleaning.py"
click node_model_dev "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelDevelopment.py"
click node_model_eval "https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelEvaluation.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_run_pipeline,node_run_deployment toneBlue
class node_ingest_step,node_clean_step,node_train_step,node_eval_step,node_config,node_zenml toneAmber
class node_cust_materializer,node_model_cleaning,node_model_dev,node_model_eval toneMint
class node_server_model,node_mlflow,node_prediction_service,node_dynamic_importer,node_prediction_loader,node_predictor toneRose
class node_streamlit_app toneIndigo
```

## Components

### Entry points

Pipeline and app launchers

- [RunPipeline.py](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/RunPipeline.py): entrypoint · Training-oriented pipeline launcher · `RunPipeline.py`
- [RunDeployment.py](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/RunDeployment.py): entrypoint · Deployment and inference launcher · `RunDeployment.py`

### Training pipeline

Ingestion, cleaning, training, and evaluation steps

- [Ingest data](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/Ingest_data.py): zenml step · Raw data ingestion boundary · `Steps/Ingest_data.py`
- [Clean data](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/DataPre.py): zenml step · Pipeline preprocessing step · `Steps/DataPre.py`
- [Train model](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/ModelTrain.py): zenml step · Pipeline training step · `Steps/ModelTrain.py`
- [Evaluate](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/evaluation.py): zenml step · Pipeline evaluation step · `Steps/evaluation.py`
- [config.py](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Steps/config.py): pipeline config · Shared pipeline configuration · `Steps/config.py`
- **ZenML**: orchestrator · Pipeline orchestration and artifact management

### Model logic

Core feature engineering, training, and metrics code

- [Custom materializer](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/Materializer/CustomeMaterializer.py): zenml materializer · Moves DataFrames and models between steps · `Materializer/CustomeMaterializer.py`
- [ModelCleaning](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelCleaning.py): preprocess logic · Data cleaning and feature preparation · `src/ModelCleaning.py`
- [ModelDevelopment](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelDevelopment.py): train logic · Model fitting and candidate training · `src/ModelDevelopment.py`
- [ModelEvaluation](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/src/ModelEvaluation.py): metrics logic · Regression metrics and scoring · `src/ModelEvaluation.py`

### Serving

Deployment and inference runtime

- [ServerModel.py](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/ServerModel.py): server · Local model-serving alternative · `ServerModel.py`
- **MLflow**: registry · Experiment tracking and model registry
- **Prediction service**: inference api · Loads deployed model and serves predictions
- **Dynamic import**: inference stage · Imports the serving model implementation
- **Service loader**: inference stage · Resolves the deployed prediction service
- **Predictor**: inference stage · Runs live scoring on feature payloads

### User interface

Interactive client

- [StremLit.py](https://github.com/ramansh-codes/end-to-end-customer-satisfaction-pipeline/blob/main/StremLit.py): ui · Interactive scoring frontend · `StremLit.py`

## Connections

- RunPipeline.py → ZenML: launches · Starts the training workflow
- RunPipeline.py → Ingest data: triggers · Builds the training pipeline
- Ingest data → Clean data: passes data · Raw data becomes pipeline artifact
- Clean data → ModelCleaning: uses · Cleaning logic is implemented in src
- Clean data → Custom materializer: materializes · Transfers tabular artifacts between steps
- Clean data → Train model: feeds · Produces model-ready features
- Train model → ModelDevelopment: uses · Fits model candidates
- Train model → Custom materializer: materializes · Persists trained models and arrays
- Train model → Evaluate: hands off · Sends trained model to evaluation
- Evaluate → ModelEvaluation: uses · Computes MSE, RMSE, and R2
- Evaluate → MLflow: tracks · Records metrics and model artifacts
- Evaluate → RunDeployment.py: gates · Deployment continues only if quality is good enough
- RunDeployment.py → Prediction service: starts · Launches the inference lifecycle
- RunDeployment.py → MLflow: loads from · Uses the deployed model registry entry
- Prediction service → Dynamic import: starts with · Begins runtime loading sequence
- Dynamic import → Service loader: resolves · Locates the serving model implementation
- Service loader → Predictor: invokes · Constructs the scoring callable
- Predictor → ServerModel.py: served by · Local serving alternative for Windows users
- StremLit.py → Prediction service: calls · Frontend sends feature inputs for live scoring
- config.py → RunPipeline.py: configures · Shares tunable pipeline settings
- config.py → RunDeployment.py: configures · Shares deployment settings
