# royprem19/loan_default_risk_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/royprem19/loan_default_risk_analysis
- Repository: https://github.com/royprem19/loan_default_risk_analysis

## Overview

This repository is a Streamlit loan-default risk dashboard. A user selects a dashboard page; the app loads cleaned loan data for overview, exploration, and business insights, or loads trained model artifacts to score a borrower and present a risk assessment. Model comparison is another dashboard capability. The principal runtime and page implementations are all in app.py. The README documents the pages and capabilities; excerpts show data loading, prediction, and some page behavior, but not every page implementation.

Main entry points: [`app.py`](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py) (Page Navigation), [`Data/loan_default_clean.csv`](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Data/loan_default_clean.csv) (Cleaned Loan Data), [`Model/loan_default_model.pkl`](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/loan_default_model.pkl) (Model Artifacts), [`Model/scaler.pkl`](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/scaler.pkl) (Feature Scaler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Streamlit App<br/>[app.py]"]
  node_navigation["Page Navigation<br/>[app.py]"]
  node_home["Home Overview<br/>[app.py]"]
  node_about["About Page<br/>[app.py]"]
end

subgraph group_data["Loan Data"]
  node_clean_data[("Cleaned Loan Data")]
  node_data_loader["Data Loader<br/>[app.py]"]
  node_exploration["Data Exploration<br/>[app.py]"]
end

subgraph group_risk["Risk Assessment"]
  node_model_artifacts["Model Artifacts"]
  node_scaler["Feature Scaler<br/>[scaler.pkl]"]
  node_encoders["Label Encoders<br/>[encoders.pkl]"]
  node_feature_names["Feature Names<br/>[feature_names.pkl]"]
  node_prediction["Loan Prediction<br/>[app.py]"]
  node_assessment["Risk Assessment<br/>[app.py]"]
end

subgraph group_insights["Analysis"]
  node_performance["Model Performance<br/>[app.py]"]
  node_business_insights["Business Insights<br/>[app.py]"]
end

node_user(("Dashboard User"))

node_user -->|"uses"| node_app
node_app -->|"shows pages"| node_navigation
node_navigation -->|"routes to"| node_home
node_navigation -->|"routes to"| node_exploration
node_navigation -->|"routes to"| node_performance
node_navigation -->|"routes to"| node_prediction
node_navigation -->|"routes to"| node_business_insights
node_navigation -->|"routes to"| node_about
node_app -->|"loads data"| node_data_loader
node_data_loader -->|"reads CSV"| node_clean_data
node_home -->|"summarizes"| node_clean_data
node_exploration -->|"explores"| node_clean_data
node_business_insights -->|"analyzes"| node_clean_data
node_prediction -->|"loads model"| node_model_artifacts
node_prediction -->|"loads scaler"| node_scaler
node_prediction -->|"loads encoders"| node_encoders
node_prediction -->|"loads columns"| node_feature_names
node_prediction -->|"produces"| node_assessment
node_performance -->|"shows comparisons"| node_user
node_assessment -->|"shows risk"| node_user

click node_app "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_navigation "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_home "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_about "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_clean_data "https://github.com/royprem19/loan_default_risk_analysis/blob/main/Data/loan_default_clean.csv"
click node_data_loader "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_exploration "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_model_artifacts "https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/loan_default_model.pkl"
click node_scaler "https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/scaler.pkl"
click node_encoders "https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/encoders.pkl"
click node_feature_names "https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/feature_names.pkl"
click node_prediction "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_assessment "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_performance "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py"
click node_business_insights "https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.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_app,node_navigation,node_home,node_about,node_user toneBlue
class node_clean_data,node_data_loader,node_exploration toneAmber
class node_model_artifacts,node_scaler,node_encoders,node_feature_names,node_prediction,node_assessment toneMint
class node_performance,node_business_insights toneRose
```

## Components

### Dashboard

- [Streamlit App](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [Page Navigation](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [Home Overview](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [About Page](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`

### Loan Data

- [Cleaned Loan Data](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Data/loan_default_clean.csv): `Data/loan_default_clean.csv`
- [Data Loader](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [Data Exploration](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`

### Risk Assessment

- [Model Artifacts](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/loan_default_model.pkl): `Model/loan_default_model.pkl`
- [Feature Scaler](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/scaler.pkl): `Model/scaler.pkl`
- [Label Encoders](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/encoders.pkl): `Model/encoders.pkl`
- [Feature Names](https://github.com/royprem19/loan_default_risk_analysis/blob/main/Model/feature_names.pkl): `Model/feature_names.pkl`
- [Loan Prediction](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [Risk Assessment](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`

### Analysis

- [Model Performance](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`
- [Business Insights](https://github.com/royprem19/loan_default_risk_analysis/blob/main/app.py): `app.py`

### Other components

- **Dashboard User**

## Connections

- Dashboard User → Streamlit App: uses (evidence: `README.md`)
- Streamlit App → Page Navigation: shows pages (evidence: `app.py`)
- Page Navigation → Home Overview: routes to (evidence: `app.py`)
- Page Navigation → Data Exploration: routes to (evidence: `README.md`)
- Page Navigation → Model Performance: routes to (evidence: `README.md`)
- Page Navigation → Loan Prediction: routes to (evidence: `README.md`)
- Page Navigation → Business Insights: routes to (evidence: `README.md`)
- Page Navigation → About Page: routes to (evidence: `README.md`)
- Streamlit App → Data Loader: loads data (evidence: `app.py`)
- Data Loader → Cleaned Loan Data: reads CSV (evidence: `app.py`)
- Home Overview → Cleaned Loan Data: summarizes (evidence: `app.py`)
- Data Exploration → Cleaned Loan Data: explores (evidence: `README.md`)
- Business Insights → Cleaned Loan Data: analyzes (evidence: `app.py`)
- Loan Prediction → Model Artifacts: loads model (evidence: `app.py`)
- Loan Prediction → Feature Scaler: loads scaler (evidence: `app.py`)
- Loan Prediction → Label Encoders: loads encoders (evidence: `app.py`)
- Loan Prediction → Feature Names: loads columns (evidence: `app.py`)
- Loan Prediction → Risk Assessment: produces (evidence: `app.py`)
- Model Performance → Dashboard User: shows comparisons (evidence: `README.md`)
- Risk Assessment → Dashboard User: shows risk (evidence: `app.py`)
