# vnay0704/customer-churn-prediction-system architecture

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

- Interactive diagram: https://gitdiagram.com/vnay0704/customer-churn-prediction-system
- Repository: https://github.com/vnay0704/customer-churn-prediction-system

## Overview

This repository is a telecom customer-churn prediction service. The principal workflow accepts JSON through a FastAPI endpoint, prepares and aligns features, scores them with an XGBoost model, and returns a churn probability and thresholded prediction. The notebook is documented as the EDA and training environment. The API source and notebook were not excerpted, so their internal behavior is represented only where the README documents it; model artifact files are not present in the supplied tree.

Main entry points: [`api/app.py`](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/api/app.py) (FastAPI endpoint), [`src/predict.py`](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py) (One-hot encoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Prediction API"]
  node_api["FastAPI endpoint<br/>[app.py]"]
end

subgraph group_inference["Inference"]
  node_encoding["One-hot encoding<br/>[predict.py]"]
  node_alignment["Feature alignment<br/>[predict.py]"]
  node_scoring["XGBoost scoring<br/>[predict.py]"]
  node_threshold["Threshold and result<br/>[predict.py]"]
end

subgraph group_training["Model development"]
  node_eda["EDA and training<br/>[output.ipynb]"]
end

node_user(("API client"))

node_user -->|"submits JSON"| node_api
node_api -->|"requests prediction"| node_encoding
node_encoding -->|"encodes features"| node_alignment
node_alignment -->|"aligns columns"| node_scoring
node_scoring -->|"returns probability"| node_threshold
node_threshold -->|"returns result"| node_api
node_api -->|"responds with prediction"| node_user

click node_api "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/api/app.py"
click node_encoding "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py"
click node_alignment "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py"
click node_scoring "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py"
click node_threshold "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py"
click node_eda "https://github.com/vnay0704/customer-churn-prediction-system/blob/main/output.ipynb"

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_api,node_user toneBlue
class node_encoding,node_alignment,node_scoring,node_threshold toneAmber
class node_eda toneMint
```

## Components

### Prediction API

- [FastAPI endpoint](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/api/app.py): `api/app.py`

### Inference

- [One-hot encoding](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py): `src/predict.py`
- [Feature alignment](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py): `src/predict.py`
- [XGBoost scoring](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py): `src/predict.py`
- [Threshold and result](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/src/predict.py): `src/predict.py`

### Model development

- [EDA and training](https://github.com/vnay0704/customer-churn-prediction-system/blob/main/output.ipynb): `output.ipynb`

### Other components

- **API client**

## Connections

- API client → FastAPI endpoint: submits JSON (evidence: `readme.md`)
- FastAPI endpoint → One-hot encoding: requests prediction (evidence: `readme.md`)
- One-hot encoding → Feature alignment: encodes features (evidence: `src/predict.py`)
- Feature alignment → XGBoost scoring: aligns columns (evidence: `src/predict.py`)
- XGBoost scoring → Threshold and result: returns probability (evidence: `src/predict.py`)
- Threshold and result → FastAPI endpoint: returns result (evidence: `readme.md`)
- FastAPI endpoint → API client: responds with prediction (evidence: `readme.md`)
