# bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn architecture

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

- Interactive diagram: https://gitdiagram.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn
- Repository: https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn

## Overview

This is an end-to-end customer-churn MLOps platform: it prepares data, trains and evaluates models, manages production model artifacts, and serves churn predictions through a FastAPI API. The main user workflow is a customer submitting features to the API and receiving a probability and threshold-based churn classification. The README also documents AWS/Kubernetes deployment and Prometheus/Grafana monitoring. Training and serving calls are grounded in sampled code; broader registry, infrastructure, deployment, and monitoring links rely on README descriptions because those implementations were not sampled.

Main entry points: [`ml/api/app.py`](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/api/app.py) (FastAPI endpoints), [`ml/features/feature_engineering.py`](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/features/feature_engineering.py) (Feature engineering), [`ml/preprocessing/preprocess.py`](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/preprocessing/preprocess.py) (Data preparation), [`ml/models/champion_model.joblib`](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/models/champion_model.joblib) (Champion model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ml["ML lifecycle"]
  node_dataset["Churn dataset<br/>[customer_churn.csv]"]
  node_preprocess["Data preparation<br/>[preprocess.py]"]
  node_features["Feature engineering"]
  node_training["Model training<br/>[train.py]"]
  node_tuning["Hyperparameter tuning<br/>[tune_model.py]"]
  node_comparison["Model comparison"]
  node_evaluation["Model evaluation"]
  node_threshold["Threshold optimization"]
  node_registry[("MLflow registry<br/>[register_model.py]")]
  node_model["Champion model"]
  node_threshold_config["Threshold config"]
end

subgraph group_serving["Prediction service"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_inference["Standalone inference<br/>[predict.py]"]
end

subgraph group_deployment["Deployment platform"]
  node_container["Container image"]
  node_ecr[("Amazon ECR")]
  node_aws["AWS infrastructure"]
  node_kubernetes["Kubernetes deployment"]
  node_ec2["EC2 deployment"]
end

subgraph group_observability["Monitoring"]
  node_prometheus["Prometheus"]
  node_grafana["Grafana dashboard"]
end

node_developer(("Developer"))
node_customer(("API consumer"))

node_developer -.->|"supplies data"| node_dataset
node_dataset -->|"loads and validates"| node_preprocess
node_preprocess -->|"prepares features"| node_features
node_training -->|"uses preparation"| node_preprocess
node_training -->|"uses features"| node_features
node_tuning -->|"uses preparation"| node_preprocess
node_tuning -->|"uses features"| node_features
node_comparison -->|"uses preparation"| node_preprocess
node_comparison -->|"uses features"| node_features
node_evaluation -->|"evaluates"| node_model
node_threshold -->|"optimizes for"| node_model
node_threshold -->|"writes threshold"| node_threshold_config
node_tuning -->|"saves champion"| node_model
node_training -->|"tracks model"| node_registry
node_registry -.->|"provides production model"| node_api
node_customer -->|"submits request"| node_api
node_api -->|"adds features"| node_features
node_api -->|"loads and predicts"| node_model
node_api -->|"loads threshold"| node_threshold_config
node_api -->|"returns prediction"| node_customer
node_inference -->|"adds features"| node_features
node_inference -->|"loads and predicts"| node_model
node_inference -->|"loads threshold"| node_threshold_config
node_api -->|"packaged as"| node_container
node_container -->|"pushed to"| node_ecr
node_ecr -->|"deploys image"| node_kubernetes
node_ecr -->|"pulls image"| node_ec2
node_aws -->|"provisions"| node_ec2
node_api -->|"exposes metrics"| node_prometheus
node_prometheus -->|"feeds dashboards"| node_grafana

click node_dataset "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/data/customer_churn.csv"
click node_preprocess "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/preprocessing/preprocess.py"
click node_features "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/features/feature_engineering.py"
click node_training "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/train.py"
click node_tuning "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/tune_model.py"
click node_comparison "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/model_comparison.py"
click node_evaluation "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/production_evaluation.py"
click node_threshold "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/optimize_threshold.py"
click node_registry "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/register_model.py"
click node_model "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/models/champion_model.joblib"
click node_threshold_config "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/models/optimal_threshold.json"
click node_api "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/api/app.py"
click node_inference "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/inference/predict.py"
click node_container "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/Dockerfile"
click node_aws "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/terraform/environments/dev"
click node_kubernetes "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/helm/customer-churn-api"
click node_ec2 "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/terraform/modules/ec2"
click node_prometheus "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/monitoring/prometheus/customer-churn-alerts.yaml"
click node_grafana "https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/monitoring/grafana/customer-churn-dashboard.json"

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_dataset,node_preprocess,node_features,node_training,node_tuning,node_comparison,node_evaluation,node_threshold,node_registry,node_model,node_threshold_config toneBlue
class node_api,node_inference toneAmber
class node_container,node_ecr,node_aws,node_kubernetes,node_ec2,node_customer toneMint
class node_prometheus,node_grafana toneRose
class node_developer toneIndigo
```

## Components

### ML lifecycle

- [Churn dataset](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/data/customer_churn.csv): `ml/data/customer_churn.csv`
- [Data preparation](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/preprocessing/preprocess.py): `ml/preprocessing/preprocess.py`
- [Feature engineering](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/features/feature_engineering.py): `ml/features/feature_engineering.py`
- [Model training](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/train.py): `ml/training/train.py`
- [Hyperparameter tuning](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/tune_model.py): `ml/training/tune_model.py`
- [Model comparison](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/model_comparison.py): `ml/training/model_comparison.py`
- [Model evaluation](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/production_evaluation.py): `ml/training/production_evaluation.py`
- [Threshold optimization](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/training/optimize_threshold.py): `ml/training/optimize_threshold.py`
- [MLflow registry](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/register_model.py): `register_model.py`
- [Champion model](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/models/champion_model.joblib): `ml/models/champion_model.joblib`
- [Threshold config](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/models/optimal_threshold.json): `ml/models/optimal_threshold.json`

### Prediction service

- [FastAPI endpoints](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/api/app.py): `ml/api/app.py`
- [Standalone inference](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/ml/inference/predict.py): `ml/inference/predict.py`

### Deployment platform

- [Container image](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/Dockerfile): `Dockerfile`
- **Amazon ECR**
- [AWS infrastructure](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/terraform/environments/dev): `terraform/environments/dev`
- [Kubernetes deployment](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/helm/customer-churn-api): `helm/customer-churn-api`
- [EC2 deployment](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/tree/main/terraform/modules/ec2): `terraform/modules/ec2`

### Monitoring

- [Prometheus](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/monitoring/prometheus/customer-churn-alerts.yaml): `monitoring/prometheus/customer-churn-alerts.yaml`
- [Grafana dashboard](https://github.com/bavajanmasunuri539-hue/enterprise-ai-mlops-customer-churn/blob/main/monitoring/grafana/customer-churn-dashboard.json): `monitoring/grafana/customer-churn-dashboard.json`

### Other components

- **Developer**
- **API consumer**

## Connections

- Developer → Churn dataset: supplies data (evidence: `README.md`)
- Churn dataset → Data preparation: loads and validates (evidence: `ml/preprocessing/preprocess.py`)
- Data preparation → Feature engineering: prepares features (evidence: `README.md`)
- Model training → Data preparation: uses preparation (evidence: `ml/training/train.py`)
- Model training → Feature engineering: uses features (evidence: `ml/training/train.py`)
- Hyperparameter tuning → Data preparation: uses preparation (evidence: `ml/training/tune_model.py`)
- Hyperparameter tuning → Feature engineering: uses features (evidence: `ml/training/tune_model.py`)
- Model comparison → Data preparation: uses preparation (evidence: `ml/training/model_comparison.py`)
- Model comparison → Feature engineering: uses features (evidence: `ml/training/model_comparison.py`)
- Model evaluation → Champion model: evaluates (evidence: `README.md`)
- Threshold optimization → Champion model: optimizes for (evidence: `ml/training/optimize_threshold.py`)
- Threshold optimization → Threshold config: writes threshold (evidence: `ml/training/optimize_threshold.py`)
- Hyperparameter tuning → Champion model: saves champion (evidence: `ml/training/tune_model.py`)
- Model training → MLflow registry: tracks model (evidence: `README.md`)
- MLflow registry → FastAPI endpoints: provides production model (evidence: `README.md`)
- API consumer → FastAPI endpoints: submits request (evidence: `README.md`)
- FastAPI endpoints → Feature engineering: adds features (evidence: `ml/api/app.py`)
- FastAPI endpoints → Champion model: loads and predicts (evidence: `ml/api/app.py`)
- FastAPI endpoints → Threshold config: loads threshold (evidence: `ml/api/app.py`)
- FastAPI endpoints → API consumer: returns prediction (evidence: `ml/api/app.py`)
- Standalone inference → Feature engineering: adds features (evidence: `ml/inference/predict.py`)
- Standalone inference → Champion model: loads and predicts (evidence: `ml/inference/predict.py`)
- Standalone inference → Threshold config: loads threshold (evidence: `ml/inference/predict.py`)
- FastAPI endpoints → Container image: packaged as (evidence: `README.md`)
- Container image → Amazon ECR: pushed to (evidence: `README.md`)
- Amazon ECR → Kubernetes deployment: deploys image (evidence: `README.md`)
- Amazon ECR → EC2 deployment: pulls image (evidence: `README.md`)
- AWS infrastructure → EC2 deployment: provisions (evidence: `README.md`)
- FastAPI endpoints → Prometheus: exposes metrics (evidence: `README.md`)
- Prometheus → Grafana dashboard: feeds dashboards (evidence: `README.md`)
