# harshith1158/churn-mvp-using-xgboost-model- architecture

> Architecture diagram of the GitHub repository harshith1158/churn-mvp-using-xgboost-model-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshith1158/churn-mvp-using-xgboost-model-
- Repository: https://github.com/harshith1158/churn-mvp-using-xgboost-model-

## Overview

ChurnEngine generates or accepts customer data, trains an XGBoost churn model, scores customer records, and presents churn probabilities and health scores in a Streamlit dashboard. The main user-facing workflow is opening the dashboard to inspect aggregate metrics, charts, and at-risk customers. The repository also includes synthetic-data generation, optional BigQuery upload, model training, and a BigQuery-backed scoring agent. The sampled files show these stages, but not a single automated pipeline connecting them; the dashboard reads a report independently.

Main entry points: [`dashboard/dashboard.py`](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard/dashboard.py) (Streamlit dashboard), [`agent/ai_agent.py`](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/agent/ai_agent.py) (Scoring agent), [`data_generator.py`](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data_generator.py) (Synthetic generator), [`train_model.py`](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/train_model.py) (Model trainer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_generator["Synthetic generator<br/>[data_generator.py]"]
  node_synthetic[("Training CSV")]
  node_bq_upload["BigQuery upload<br/>[data_generator.py]"]
end

subgraph group_model["Model training"]
  node_trainer["Model trainer<br/>[train_model.py]"]
  node_artifacts[("Model artifacts")]
end

subgraph group_scoring["Churn scoring"]
  node_agent["Scoring agent<br/>[ai_agent.py]"]
  node_report[("Churn report")]
end

subgraph group_ui["Dashboard"]
  node_dashboard["Streamlit dashboard<br/>[dashboard.py]"]
  node_entry["Root launcher<br/>[dashboard.py]"]
  node_charts["Metrics and charts<br/>[dashboard.py]"]
end

node_user(("Dashboard user"))
node_bigquery[("BigQuery")]

node_generator -->|"writes CSV"| node_synthetic
node_generator -.->|"uploads rows"| node_bigquery
node_bq_upload -->|"loads dataframe"| node_bigquery
node_trainer -->|"reads CSV"| node_synthetic
node_trainer -->|"saves model"| node_artifacts
node_agent -->|"queries records"| node_bigquery
node_agent -->|"loads model"| node_artifacts
node_agent -->|"writes predictions"| node_report
node_dashboard -->|"reads report"| node_report
node_dashboard -->|"renders metrics"| node_charts
node_user -->|"views"| node_dashboard
node_entry -->|"runs app"| node_dashboard

click node_generator "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data_generator.py"
click node_synthetic "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data/synthetic_churn_dataset.csv"
click node_bq_upload "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data_generator.py"
click node_trainer "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/train_model.py"
click node_artifacts "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/tree/main/models"
click node_agent "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/agent/ai_agent.py"
click node_report "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data/customer_churn_health_report.csv"
click node_dashboard "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard/dashboard.py"
click node_entry "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard.py"
click node_charts "https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard/dashboard.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_synthetic,node_bq_upload,node_user toneBlue
class node_trainer,node_artifacts,node_bigquery toneAmber
class node_agent,node_report toneMint
class node_dashboard,node_entry,node_charts toneRose
```

## Components

### Data preparation

- [Synthetic generator](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data_generator.py): `data_generator.py`
- [Training CSV](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data/synthetic_churn_dataset.csv): `data/synthetic_churn_dataset.csv`
- [BigQuery upload](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data_generator.py): `data_generator.py`

### Model training

- [Model trainer](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/train_model.py): `train_model.py`
- [Model artifacts](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/tree/main/models): `models`

### Churn scoring

- [Scoring agent](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/agent/ai_agent.py): `agent/ai_agent.py`
- [Churn report](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/data/customer_churn_health_report.csv): `data/customer_churn_health_report.csv`

### Dashboard

- [Streamlit dashboard](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard/dashboard.py): `dashboard/dashboard.py`
- [Root launcher](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard.py): `dashboard.py`
- [Metrics and charts](https://github.com/harshith1158/churn-mvp-using-xgboost-model-/blob/main/dashboard/dashboard.py): `dashboard/dashboard.py`

### Other components

- **Dashboard user**
- **BigQuery**

## Connections

- Synthetic generator → Training CSV: writes CSV (evidence: `data_generator.py`)
- Synthetic generator → BigQuery: uploads rows
- BigQuery upload → BigQuery: loads dataframe (evidence: `data_generator.py`)
- Model trainer → Training CSV: reads CSV (evidence: `train_model.py`)
- Model trainer → Model artifacts: saves model (evidence: `train_model.py`)
- Scoring agent → BigQuery: queries records (evidence: `agent/ai_agent.py`)
- Scoring agent → Model artifacts: loads model (evidence: `agent/ai_agent.py`)
- Scoring agent → Churn report: writes predictions (evidence: `agent/ai_agent.py`)
- Streamlit dashboard → Churn report: reads report (evidence: `dashboard/dashboard.py`)
- Streamlit dashboard → Metrics and charts: renders metrics (evidence: `dashboard/dashboard.py`)
- Dashboard user → Streamlit dashboard: views (evidence: `README.md`)
- Root launcher → Streamlit dashboard: runs app (evidence: `dashboard.py`)
