# kcmchandramouli/mlops-loan-approval architecture

> Architecture diagram of the GitHub repository kcmchandramouli/mlops-loan-approval, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kcmchandramouli/mlops-loan-approval
- Repository: https://github.com/kcmchandramouli/mlops-loan-approval

## Overview

This is a loan-approval prediction application with frontend, API, model-serving, and monitoring services. Its main user flow is applicant input through the frontend and API to model inference, returning an approval prediction; the API also records prediction events. A separate training and tracking lifecycle uses versioned data and MLflow, while monitoring compares reference data with production prediction data. The README documents the service and MLOps capabilities; some subsystem wiring is therefore shown only where explicitly documented, since not all source was sampled.

Main entry points: [`api/app.py`](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/api/app.py) (Prediction API), [`monitoring/app.py`](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/monitoring/app.py) (Monitoring Service), [`model/app.py`](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/app.py) (Model Service), [`model/inference.py`](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/inference.py) (Inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Prediction Serving"]
  node_frontend["Loan Form<br/>[app.py]"]
  node_form_template["Form Template<br/>[index.html]"]
  node_api["Prediction API<br/>[app.py]"]
  node_model_service["Model Service<br/>[app.py]"]
  node_inference["Inference<br/>[inference.py]"]
  node_prediction["Loan Decision"]
end

subgraph group_training["Training Lifecycle"]
  node_raw_data["Raw Loan Data"]
  node_processed_data["Train and Test Data"]
  node_training_job["Model Training"]
end

subgraph group_observability["Monitoring and Audit"]
  node_event_log["Prediction Event Log<br/>[app.py]"]
  node_cloud_logging[("Cloud Logging")]
  node_bigquery[("BigQuery Predictions")]
  node_reference_data["Reference Data"]
  node_monitoring_service["Monitoring Service<br/>[app.py]"]
  node_drift_analysis["Drift Reports"]
end

subgraph group_platform["Versioning and Tracking"]
  node_model_artifact["Registered Model<br/>[model.pkl.dvc]"]
  node_dvc[("DVC Storage")]
  node_mlflow[("MLflow Registry")]
end

node_applicant(("Applicant"))

node_applicant -->|"enters features"| node_frontend
node_frontend -->|"renders form"| node_form_template
node_form_template -->|"submits request"| node_api
node_api -->|"forwards request"| node_model_service
node_model_service -->|"calls inference"| node_inference
node_inference -->|"loads model"| node_mlflow
node_inference -->|"returns decision"| node_prediction
node_model_service -->|"returns result"| node_api
node_api -->|"returns response"| node_frontend
node_api -->|"appends event"| node_event_log
node_api -->|"emits logs"| node_cloud_logging
node_cloud_logging -.->|"stores audit data"| node_bigquery
node_raw_data -.->|"prepared for training"| node_processed_data
node_processed_data -->|"trains from data"| node_training_job
node_training_job -->|"logs runs and model"| node_mlflow
node_training_job -->|"saves model"| node_model_artifact
node_dvc -->|"versions data"| node_raw_data
node_dvc -->|"versions data"| node_processed_data
node_dvc -->|"versions reference"| node_reference_data
node_monitoring_service -->|"fetches current data"| node_bigquery
node_monitoring_service -->|"loads reference"| node_reference_data
node_monitoring_service -->|"builds reports"| node_drift_analysis
node_drift_analysis -->|"returns drift results"| node_monitoring_service

click node_frontend "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/frontend/app.py"
click node_form_template "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/frontend/templates/index.html"
click node_api "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/api/app.py"
click node_model_service "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/app.py"
click node_inference "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/inference.py"
click node_raw_data "https://github.com/kcmchandramouli/mlops-loan-approval/tree/main/data/raw"
click node_processed_data "https://github.com/kcmchandramouli/mlops-loan-approval/tree/main/data/processed"
click node_training_job "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/modelling_refactor.py"
click node_model_artifact "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/model.pkl.dvc"
click node_event_log "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/api/app.py"
click node_reference_data "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/data/simulation/reference_data.csv.dvc"
click node_monitoring_service "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/monitoring/app.py"
click node_drift_analysis "https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/monitoring/evidently_profile.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_frontend,node_form_template,node_api,node_model_service,node_inference,node_prediction toneBlue
class node_raw_data,node_processed_data,node_training_job toneAmber
class node_event_log,node_cloud_logging,node_bigquery,node_reference_data,node_monitoring_service,node_drift_analysis toneMint
class node_model_artifact,node_dvc,node_mlflow toneRose
class node_applicant toneIndigo
```

## Components

### Prediction Serving

- [Loan Form](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/frontend/app.py): `frontend/app.py`
- [Form Template](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/frontend/templates/index.html): `frontend/templates/index.html`
- [Prediction API](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/api/app.py): `api/app.py`
- [Model Service](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/app.py): `model/app.py`
- [Inference](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/inference.py): `model/inference.py`
- **Loan Decision**

### Training Lifecycle

- [Raw Loan Data](https://github.com/kcmchandramouli/mlops-loan-approval/tree/main/data/raw): `data/raw`
- [Train and Test Data](https://github.com/kcmchandramouli/mlops-loan-approval/tree/main/data/processed): `data/processed`
- [Model Training](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/modelling_refactor.py): `model/modelling_refactor.py`

### Monitoring and Audit

- [Prediction Event Log](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/api/app.py): `api/app.py`
- **Cloud Logging**
- **BigQuery Predictions**
- [Reference Data](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/data/simulation/reference_data.csv.dvc): `data/simulation/reference_data.csv.dvc`
- [Monitoring Service](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/monitoring/app.py): `monitoring/app.py`
- [Drift Reports](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/monitoring/evidently_profile.py): `monitoring/evidently_profile.py`

### Versioning and Tracking

- [Registered Model](https://github.com/kcmchandramouli/mlops-loan-approval/blob/main/model/model.pkl.dvc): `model/model.pkl.dvc`
- **DVC Storage**
- **MLflow Registry**

### Other components

- **Applicant**

## Connections

- Applicant → Loan Form: enters features
- Loan Form → Form Template: renders form
- Form Template → Prediction API: submits request
- Prediction API → Model Service: forwards request
- Model Service → Inference: calls inference
- Inference → MLflow Registry: loads model
- Inference → Loan Decision: returns decision
- Model Service → Prediction API: returns result
- Prediction API → Loan Form: returns response
- Prediction API → Prediction Event Log: appends event
- Prediction API → Cloud Logging: emits logs
- Cloud Logging → BigQuery Predictions: stores audit data
- Raw Loan Data → Train and Test Data: prepared for training
- Train and Test Data → Model Training: trains from data
- Model Training → MLflow Registry: logs runs and model
- Model Training → Registered Model: saves model
- DVC Storage → Raw Loan Data: versions data
- DVC Storage → Train and Test Data: versions data
- DVC Storage → Reference Data: versions reference
- Monitoring Service → BigQuery Predictions: fetches current data
- Monitoring Service → Reference Data: loads reference
- Monitoring Service → Drift Reports: builds reports
- Drift Reports → Monitoring Service: returns drift results
