# mihirj2002/customer-churn-prediction-ml-orchestration architecture

> Architecture diagram of the GitHub repository mihirj2002/customer-churn-prediction-ml-orchestration, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mihirj2002/customer-churn-prediction-ml-orchestration
- Repository: https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration

## Overview

This repository trains and compares churn classifiers through a Prefect-orchestrated workflow: load customer data, preprocess and split it, train several models, evaluate them, and log metrics to MLflow. A separate Streamlit interface currently accepts customer details but only displays a placeholder; it does not run predictions. Cross-validation model selection and model saving are implemented as standalone modules but are not called by the workflow. The included CSV is not the ingestion source shown in code, which fetches data from a remote URL.

Main entry points: [`src/workflow.py`](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py) (Prefect Workflow), [`app.py`](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/app.py) (Prediction Interface), [`src/data_ingestion.py`](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/data_ingestion.py) (CSV Loader), [`main.py`](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/main.py) (CLI Entry Point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_cli["CLI Entry Point<br/>[main.py]"]
  node_streamlit["Prediction Interface<br/>[app.py]"]
end

subgraph group_orchestration["Workflow Orchestration"]
  node_workflow["Prefect Workflow<br/>[workflow.py]"]
  node_ingestion_task["Ingestion Task<br/>[workflow.py]"]
  node_preprocessing_task["Preprocessing Task<br/>[workflow.py]"]
  node_training_task["Training Task<br/>[workflow.py]"]
  node_evaluation_task["Evaluation Task<br/>[workflow.py]"]
end

subgraph group_pipeline["Churn ML Pipeline"]
  node_data_loader["CSV Loader<br/>[data_ingestion.py]"]
  node_preprocessor["Feature Preprocessing"]
  node_trainer["Model Training<br/>[model_training.py]"]
  node_model_selection["Cross-Validation Selection<br/>[model_selection.py]"]
  node_evaluator["Metric Evaluation"]
  node_model_saving["Model Saving<br/>[model_saving.py]"]
end

subgraph group_tracking["Experiment Tracking"]
  node_mlflow["MLflow Tracking"]
  node_tracking_db[("MLflow SQLite Store")]
end

node_user(("User"))
node_remote_csv["Remote Churn CSV"]

node_user -->|"enters details"| node_streamlit
node_streamlit -->|"shows placeholder"| node_user
node_cli -->|"runs workflow"| node_workflow
node_workflow -->|"dispatches"| node_ingestion_task
node_workflow -->|"dispatches data"| node_preprocessing_task
node_workflow -->|"dispatches features"| node_training_task
node_workflow -->|"dispatches models"| node_evaluation_task
node_ingestion_task -->|"calls"| node_data_loader
node_data_loader -->|"fetches CSV"| node_remote_csv
node_preprocessing_task -->|"calls"| node_preprocessor
node_training_task -->|"calls"| node_trainer
node_evaluation_task -->|"evaluates models"| node_evaluator
node_evaluation_task -->|"logs metrics"| node_mlflow
node_workflow -->|"configures tracking"| node_mlflow
node_mlflow -->|"stores runs"| node_tracking_db

click node_cli "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/main.py"
click node_streamlit "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/app.py"
click node_workflow "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py"
click node_ingestion_task "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py"
click node_preprocessing_task "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py"
click node_training_task "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py"
click node_evaluation_task "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py"
click node_data_loader "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/data_ingestion.py"
click node_preprocessor "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/data_preprocessing.py"
click node_trainer "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_training.py"
click node_model_selection "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_selection.py"
click node_evaluator "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_evaluation.py"
click node_model_saving "https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_saving.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_cli,node_streamlit,node_user toneBlue
class node_workflow,node_ingestion_task,node_preprocessing_task,node_training_task,node_evaluation_task toneAmber
class node_data_loader,node_preprocessor,node_trainer,node_model_selection,node_evaluator,node_model_saving toneMint
class node_mlflow,node_tracking_db toneRose
class node_remote_csv toneIndigo
```

## Components

### User Interfaces

- [CLI Entry Point](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/main.py): `main.py`
- [Prediction Interface](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/app.py): `app.py`

### Workflow Orchestration

- [Prefect Workflow](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py): `src/workflow.py`
- [Ingestion Task](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py): `src/workflow.py`
- [Preprocessing Task](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py): `src/workflow.py`
- [Training Task](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py): `src/workflow.py`
- [Evaluation Task](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/workflow.py): `src/workflow.py`

### Churn ML Pipeline

- [CSV Loader](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/data_ingestion.py): `src/data_ingestion.py`
- [Feature Preprocessing](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`
- [Model Training](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_training.py): `src/model_training.py`
- [Cross-Validation Selection](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_selection.py): `src/model_selection.py`
- [Metric Evaluation](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_evaluation.py): `src/model_evaluation.py`
- [Model Saving](https://github.com/mihirj2002/customer-churn-prediction-ml-orchestration/blob/main/src/model_saving.py): `src/model_saving.py`

### Experiment Tracking

- **MLflow Tracking**
- **MLflow SQLite Store**

### Other components

- **User**
- **Remote Churn CSV**

## Connections

- User → Prediction Interface: enters details (evidence: `app.py`)
- Prediction Interface → User: shows placeholder (evidence: `app.py`)
- CLI Entry Point → Prefect Workflow: runs workflow (evidence: `main.py`)
- Prefect Workflow → Ingestion Task: dispatches (evidence: `src/workflow.py`)
- Prefect Workflow → Preprocessing Task: dispatches data (evidence: `src/workflow.py`)
- Prefect Workflow → Training Task: dispatches features (evidence: `src/workflow.py`)
- Prefect Workflow → Evaluation Task: dispatches models (evidence: `src/workflow.py`)
- Ingestion Task → CSV Loader: calls (evidence: `src/workflow.py`)
- CSV Loader → Remote Churn CSV: fetches CSV (evidence: `src/data_ingestion.py`)
- Preprocessing Task → Feature Preprocessing: calls (evidence: `src/workflow.py`)
- Training Task → Model Training: calls (evidence: `src/workflow.py`)
- Evaluation Task → Metric Evaluation: evaluates models (evidence: `src/workflow.py`)
- Evaluation Task → MLflow Tracking: logs metrics (evidence: `src/workflow.py`)
- Prefect Workflow → MLflow Tracking: configures tracking (evidence: `src/workflow.py`)
- MLflow Tracking → MLflow SQLite Store: stores runs
