# sujith-chowdary/bank-ml-production-pipeline architecture

> Architecture diagram of the GitHub repository sujith-chowdary/bank-ml-production-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sujith-chowdary/bank-ml-production-pipeline
- Repository: https://github.com/sujith-chowdary/bank-ml-production-pipeline

## Overview

This is a bank-customer churn prediction system. Cleaned customer data is split into files, then an Airflow ingestion DAG validates files, produces reports, records ingestion statistics, and separates valid from invalid data. A scheduled DAG submits valid files to the FastAPI prediction endpoint; the API preprocesses and scores them, stores predictions, and returns results. The Streamlit interface supports single, batch, and historical predictions. The README also documents drift monitoring and Grafana dashboards; their implementation is not present in the supplied tree. Edges reflect shown calls or documented workflow; unsampled subsystem details are omitted.

Main entry points: [`airflow/dags/data_ingestion_dag.py`](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/data_ingestion_dag.py) (Ingestion DAG), [`fastapi_app/main_api.py`](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/fastapi_app/main_api.py) (FastAPI Service), [`database/db.py`](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/database/db.py) (PostgreSQL Data), [`Data/split_dataset.py`](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/Data/split_dataset.py) (File Splitter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data_quality["Data Quality"]
  node_split["File Splitter<br/>[split_dataset.py]"]
  node_raw_files["Incoming Files"]
  node_ingestion["Ingestion DAG"]
  node_expectations["Quality Checks"]
  node_reports["Validation Reports"]
  node_good_data["Validated Files"]
  node_bad_data["Rejected Files"]
  node_archive["Archived Files"]
end

subgraph group_prediction["Prediction"]
  node_training["Model Training<br/>[model_training.py]"]
  node_inference["Model Inference<br/>[churn_model.py]"]
  node_prediction_dag["Scheduled Predictions<br/>[prediction_dag.py]"]
end

subgraph group_serving["Serving"]
  node_webapp["Prediction UI<br/>[main.py]"]
  node_api["FastAPI Service<br/>[main_api.py]"]
  node_database[("PostgreSQL Data<br/>[db.py]")]
end

subgraph group_operations["Monitoring"]
  node_alerts["Teams Alerts<br/>[send_alerts.py]"]
  node_grafana["Grafana Dashboards"]
end

node_customer(("Analyst"))
node_teams{{"Microsoft Teams"}}

node_customer -->|"prepares data"| node_split
node_split -->|"writes files"| node_raw_files
node_raw_files -->|"selects files"| node_ingestion
node_ingestion -->|"runs checks"| node_expectations
node_ingestion -->|"builds reports"| node_reports
node_ingestion -->|"writes valid rows"| node_good_data
node_ingestion -->|"writes invalid rows"| node_bad_data
node_ingestion -->|"archives files"| node_archive
node_ingestion -->|"records statistics"| node_database
node_ingestion -->|"invokes alert"| node_alerts
node_alerts -->|"posts alert"| node_teams
node_training -.->|"produces model artifacts"| node_inference
node_good_data -->|"provides files"| node_prediction_dag
node_prediction_dag -->|"posts batch data"| node_api
node_webapp -->|"requests predictions"| node_api
node_api -->|"runs inference"| node_inference
node_api -->|"stores and queries"| node_database
node_customer -.->|"submits requests"| node_webapp
node_database -.->|"feeds dashboards"| node_grafana

click node_split "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/Data/split_dataset.py"
click node_raw_files "https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/raw-data"
click node_ingestion "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/data_ingestion_dag.py"
click node_expectations "https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/great_expectations/gx/expectations"
click node_reports "https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/reports/data_docs"
click node_archive "https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/archive_raw"
click node_training "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/model/model_training.py"
click node_inference "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/fastapi_app/churn_model.py"
click node_prediction_dag "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/prediction_dag.py"
click node_webapp "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/webapp/main.py"
click node_api "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/fastapi_app/main_api.py"
click node_database "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/database/db.py"
click node_alerts "https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/send_alerts.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_split,node_raw_files,node_ingestion,node_expectations,node_reports,node_good_data,node_bad_data,node_archive toneBlue
class node_training,node_inference,node_prediction_dag toneAmber
class node_webapp,node_api,node_database toneMint
class node_alerts,node_grafana toneRose
class node_customer,node_teams toneIndigo
```

## Components

### Data Quality

- [File Splitter](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/Data/split_dataset.py): `Data/split_dataset.py`
- [Incoming Files](https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/raw-data): `Data/raw-data`
- [Ingestion DAG](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/data_ingestion_dag.py): `airflow/dags/data_ingestion_dag.py`
- [Quality Checks](https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/great_expectations/gx/expectations): `Data/great_expectations/gx/expectations`
- [Validation Reports](https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/reports/data_docs): `Data/reports/data_docs`
- **Validated Files**
- **Rejected Files**
- [Archived Files](https://github.com/sujith-chowdary/bank-ml-production-pipeline/tree/main/Data/archive_raw): `Data/archive_raw`

### Prediction

- [Model Training](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/model/model_training.py): `model/model_training.py`
- [Model Inference](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/fastapi_app/churn_model.py): `fastapi_app/churn_model.py`
- [Scheduled Predictions](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/prediction_dag.py): `airflow/dags/prediction_dag.py`

### Serving

- [Prediction UI](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/webapp/main.py): `webapp/main.py`
- [FastAPI Service](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/fastapi_app/main_api.py): `fastapi_app/main_api.py`
- [PostgreSQL Data](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/database/db.py): `database/db.py`

### Monitoring

- [Teams Alerts](https://github.com/sujith-chowdary/bank-ml-production-pipeline/blob/main/airflow/dags/send_alerts.py): `airflow/dags/send_alerts.py`
- **Grafana Dashboards**

### Other components

- **Analyst**
- **Microsoft Teams**

## Connections

- Analyst → File Splitter: prepares data (evidence: `README.md`)
- File Splitter → Incoming Files: writes files (evidence: `Data/split_dataset.py`)
- Incoming Files → Ingestion DAG: selects files (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Quality Checks: runs checks (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Validation Reports: builds reports (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Validated Files: writes valid rows (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Rejected Files: writes invalid rows (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Archived Files: archives files (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → PostgreSQL Data: records statistics (evidence: `airflow/dags/data_ingestion_dag.py`)
- Ingestion DAG → Teams Alerts: invokes alert (evidence: `airflow/dags/data_ingestion_dag.py`)
- Teams Alerts → Microsoft Teams: posts alert (evidence: `airflow/dags/send_alerts.py`)
- Model Training → Model Inference: produces model artifacts
- Validated Files → Scheduled Predictions: provides files (evidence: `airflow/dags/prediction_dag.py`)
- Scheduled Predictions → FastAPI Service: posts batch data (evidence: `airflow/dags/prediction_dag.py`)
- Prediction UI → FastAPI Service: requests predictions (evidence: `webapp/main.py`)
- FastAPI Service → Model Inference: runs inference (evidence: `fastapi_app/main_api.py`)
- FastAPI Service → PostgreSQL Data: stores and queries (evidence: `fastapi_app/main_api.py`)
- Analyst → Prediction UI: submits requests
- PostgreSQL Data → Grafana Dashboards: feeds dashboards
