# 5hraddhab/customer-churn-ml-system architecture

> Architecture diagram of the GitHub repository 5hraddhab/customer-churn-ml-system, 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/5hraddhab/customer-churn-ml-system
- Repository: https://github.com/5hraddhab/customer-churn-ml-system

## Overview

This is a Streamlit customer-churn analysis and retention application. Users load a customer dataset, map its churn target, inspect data quality, train and compare classifiers, then score individual customers or batches and review risk drivers and retention actions. The README also documents adaptive visual analytics and industry-specific recommendations. The graph follows documented module responsibilities and shown calls; where application wiring is documented but its relevant source lines were not excerpted, edges cite the README rather than implying the source was inspected.

Main entry points: [`app.py`](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/app.py) (Streamlit Dashboard), [`src/predict.py`](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/predict.py) (Customer Scoring), [`src/train_model.py`](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/train_model.py) (Model Training), [`src/data_loader.py`](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_loader.py) (Dataset Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Application"]
  node_dashboard["Streamlit Dashboard<br/>[app.py]"]
end

subgraph group_data["Data Preparation"]
  node_dataset["Customer Dataset<br/>[train.csv]"]
  node_loader["Dataset Loader<br/>[data_loader.py]"]
  node_audit["Quality Audit<br/>[data_loader.py]"]
  node_preprocess["Preprocessing Pipeline"]
end

subgraph group_modeling["Modeling and Inference"]
  node_trainer["Model Training<br/>[train_model.py]"]
  node_model[("Trained Model Bundle<br/>[best_model.joblib]")]
  node_predict["Customer Scoring<br/>[predict.py]"]
  node_risk["Risk Tiers and Drivers<br/>[predict.py]"]
end

subgraph group_insights["Insights and Retention"]
  node_analytics["Visual Analytics<br/>[analytics.py]"]
  node_recommendations["Retention Playbooks<br/>[recommendations.py]"]
end

node_user(("Business User"))

node_user -->|"uses"| node_dashboard
node_dashboard -->|"loads data"| node_loader
node_dataset -->|"provides data"| node_loader
node_dashboard -->|"requests audit"| node_audit
node_dashboard -->|"starts training"| node_trainer
node_trainer -->|"fits and transforms"| node_preprocess
node_trainer -->|"saves bundle"| node_model
node_dashboard -->|"requests scoring"| node_predict
node_predict -->|"transforms inputs"| node_preprocess
node_predict -->|"scores with"| node_model
node_predict -->|"derives risk and drivers"| node_risk
node_dashboard -->|"renders visualizations"| node_analytics
node_dashboard -->|"requests actions"| node_recommendations
node_risk -->|"informs actions"| node_recommendations

click node_dashboard "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/app.py"
click node_dataset "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/Data/train.csv"
click node_loader "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_loader.py"
click node_audit "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_loader.py"
click node_preprocess "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_preprocessing.py"
click node_trainer "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/train_model.py"
click node_model "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/models/best_model.joblib"
click node_predict "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/predict.py"
click node_risk "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/predict.py"
click node_analytics "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/analytics.py"
click node_recommendations "https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/recommendations.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_dashboard,node_user toneBlue
class node_dataset,node_loader,node_audit,node_preprocess toneAmber
class node_trainer,node_model,node_predict,node_risk toneMint
class node_analytics,node_recommendations toneRose
```

## Components

### User Application

- [Streamlit Dashboard](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/app.py): `app.py`

### Data Preparation

- [Customer Dataset](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/Data/train.csv): `Data/train.csv`
- [Dataset Loader](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_loader.py): `src/data_loader.py`
- [Quality Audit](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_loader.py): `src/data_loader.py`
- [Preprocessing Pipeline](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`

### Modeling and Inference

- [Model Training](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/train_model.py): `src/train_model.py`
- [Trained Model Bundle](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/models/best_model.joblib): `models/best_model.joblib`
- [Customer Scoring](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/predict.py): `src/predict.py`
- [Risk Tiers and Drivers](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/predict.py): `src/predict.py`

### Insights and Retention

- [Visual Analytics](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/analytics.py): `src/analytics.py`
- [Retention Playbooks](https://github.com/5hraddhab/customer-churn-ml-system/blob/main/src/recommendations.py): `src/recommendations.py`

### Other components

- **Business User**

## Connections

- Business User → Streamlit Dashboard: uses (evidence: `README.md`)
- Streamlit Dashboard → Dataset Loader: loads data (evidence: `README.md`)
- Customer Dataset → Dataset Loader: provides data (evidence: `src/data_loader.py`)
- Streamlit Dashboard → Quality Audit: requests audit (evidence: `app.py`)
- Streamlit Dashboard → Model Training: starts training (evidence: `README.md`)
- Model Training → Preprocessing Pipeline: fits and transforms (evidence: `src/train_model.py`)
- Model Training → Trained Model Bundle: saves bundle (evidence: `README.md`)
- Streamlit Dashboard → Customer Scoring: requests scoring (evidence: `README.md`)
- Customer Scoring → Preprocessing Pipeline: transforms inputs (evidence: `src/predict.py`)
- Customer Scoring → Trained Model Bundle: scores with (evidence: `README.md`)
- Customer Scoring → Risk Tiers and Drivers: derives risk and drivers (evidence: `src/predict.py`)
- Streamlit Dashboard → Visual Analytics: renders visualizations (evidence: `README.md`)
- Streamlit Dashboard → Retention Playbooks: requests actions (evidence: `README.md`)
- Risk Tiers and Drivers → Retention Playbooks: informs actions (evidence: `README.md`)
