# mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer architecture

> Architecture diagram of the GitHub repository mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer
- Repository: https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer

## Overview

This is a Streamlit customer-retention dashboard backed by a synthetic-data ML pipeline. Users choose a test customer or enter features, trigger an inference run, and review segment, churn, LTV, and retention recommendations alongside visualizations and model metrics. The graph separates dataset generation and model preparation from the dashboard’s customer-level inference and presentation. Relationships among the documented training stages follow the README workflow; unsampled training implementation details are not expanded.

Main entry points: [`pipeline.py`](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py) (Preprocessing), [`app.py`](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py) (Customer inference), [`data/synthetic_customers.csv`](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/data/synthetic_customers.csv) (Customer dataset), [`models/pipeline_models.joblib`](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/models/pipeline_models.joblib) (Trained model bundle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Customer data"]
  node_generator["Synthetic generator<br/>[data_generator.py]"]
  node_dataset[("Customer dataset")]
end

subgraph group_ml["ML pipeline"]
  node_preprocess["Preprocessing<br/>[pipeline.py]"]
  node_segments["Customer segmentation<br/>[pipeline.py]"]
  node_churn["Churn prediction<br/>[pipeline.py]"]
  node_ltv["LTV prediction<br/>[pipeline.py]"]
  node_decision["Retention decisions<br/>[pipeline.py]"]
  node_bundle[("Trained model bundle")]
end

subgraph group_dash["Dashboard"]
  node_inputs["Customer selection<br/>[app.py]"]
  node_inference["Customer inference<br/>[app.py]"]
  node_visuals["Charts and metrics<br/>[app.py]"]
  node_feed["Pipeline progress feed<br/>[app.py]"]
end

node_user(("Dashboard user"))

node_user -->|"selects customer"| node_inputs
node_generator -->|"writes data"| node_dataset
node_dataset -->|"provides training data"| node_preprocess
node_preprocess -->|"feeds features"| node_segments
node_preprocess -->|"feeds features"| node_churn
node_preprocess -->|"feeds features"| node_ltv
node_segments -->|"provides segment"| node_decision
node_churn -->|"provides risk"| node_decision
node_ltv -->|"provides estimate"| node_visuals
node_decision -->|"provides action"| node_visuals
node_preprocess -->|"saves fitted models"| node_bundle
node_inputs -->|"submits features"| node_inference
node_inference -->|"renders results"| node_visuals
node_inference -->|"updates progress"| node_feed
node_bundle -->|"supplies fitted models"| node_inference

click node_generator "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/data_generator.py"
click node_dataset "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/data/synthetic_customers.csv"
click node_preprocess "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py"
click node_segments "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py"
click node_churn "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py"
click node_ltv "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py"
click node_decision "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py"
click node_bundle "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/models/pipeline_models.joblib"
click node_inputs "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py"
click node_inference "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py"
click node_visuals "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py"
click node_feed "https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.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_dataset,node_user toneBlue
class node_preprocess,node_segments,node_churn,node_ltv,node_decision,node_bundle toneAmber
class node_inputs,node_inference,node_visuals,node_feed toneMint
```

## Components

### Customer data

- [Synthetic generator](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/data_generator.py): `data_generator.py`
- [Customer dataset](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/data/synthetic_customers.csv): `data/synthetic_customers.csv`

### ML pipeline

- [Preprocessing](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py): `pipeline.py`
- [Customer segmentation](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py): `pipeline.py`
- [Churn prediction](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py): `pipeline.py`
- [LTV prediction](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py): `pipeline.py`
- [Retention decisions](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/pipeline.py): `pipeline.py`
- [Trained model bundle](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/models/pipeline_models.joblib): `models/pipeline_models.joblib`

### Dashboard

- [Customer selection](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py): `app.py`
- [Customer inference](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py): `app.py`
- [Charts and metrics](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py): `app.py`
- [Pipeline progress feed](https://github.com/mohith292005/e-commerce-retention-ltv-ml-pipeline-visualizer/blob/main/app.py): `app.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Customer selection: selects customer (evidence: `README.md`)
- Synthetic generator → Customer dataset: writes data (evidence: `data_generator.py`)
- Customer dataset → Preprocessing: provides training data (evidence: `README.md`)
- Preprocessing → Customer segmentation: feeds features (evidence: `README.md`)
- Preprocessing → Churn prediction: feeds features (evidence: `README.md`)
- Preprocessing → LTV prediction: feeds features (evidence: `README.md`)
- Customer segmentation → Retention decisions: provides segment (evidence: `README.md`)
- Churn prediction → Retention decisions: provides risk (evidence: `README.md`)
- LTV prediction → Charts and metrics: provides estimate (evidence: `README.md`)
- Retention decisions → Charts and metrics: provides action (evidence: `README.md`)
- Preprocessing → Trained model bundle: saves fitted models (evidence: `pipeline.py`)
- Customer selection → Customer inference: submits features (evidence: `app.py`)
- Customer inference → Charts and metrics: renders results (evidence: `README.md`)
- Customer inference → Pipeline progress feed: updates progress (evidence: `app.py`)
- Trained model bundle → Customer inference: supplies fitted models (evidence: `app.py`)
