# kumaravi005/credit_risk_assessment architecture

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

- Interactive diagram: https://gitdiagram.com/kumaravi005/credit_risk_assessment
- Repository: https://github.com/kumaravi005/credit_risk_assessment

## Overview

CreditIQ is a browser-based underwriting dashboard backed by a FastAPI credit-risk prediction service. Underwriters enter applicant and loan details; the UI calculates the loan-to-income ratio and submits the fields, the API validates them, scores them with the calibrated model, applies the loaded decision threshold, and returns a probability and risk verdict for display. The README documents model training and calibration as a separate capability; its notebook is present, but its implementation was not sampled. Edges cite the README or sampled caller source where the relationship is visible.

Main entry points: [`static/script.js`](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js) (Risk form workflow), [`main.py`](https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py) (FastAPI service), [`Credit_Risk.ipynb`](https://github.com/kumaravi005/credit_risk_assessment/blob/master/Credit_Risk.ipynb) (Training and calibration), [`static/index.html`](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/index.html) (Dashboard interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Underwriting dashboard"]
  node_dashboard_ui["Dashboard interface<br/>[index.html]"]
  node_dti["Live DTI meter<br/>[script.js]"]
  node_risk_form["Risk form workflow<br/>[script.js]"]
  node_verdict_view["Verdict display<br/>[script.js]"]
end

subgraph group_service["Prediction service"]
  node_api["FastAPI service<br/>[main.py]"]
  node_loan_schema["Loan validation schema<br/>[main.py]"]
  node_scoring["Risk scoring<br/>[main.py]"]
end

subgraph group_modeling["Risk modeling"]
  node_model_artifact["Calibrated model"]
  node_threshold_artifact["Decision threshold<br/>[best_threshold.pkl]"]
  node_training["Training and calibration<br/>[Credit_Risk.ipynb]"]
  node_dataset[("Credit dataset")]
end

node_underwriter(("Loan underwriter"))

node_underwriter -->|"enters applicant data"| node_dashboard_ui
node_dashboard_ui -->|"provides form"| node_risk_form
node_risk_form -->|"updates live ratio"| node_dti
node_risk_form -->|"posts applicant JSON"| node_api
node_api -->|"validates input"| node_loan_schema
node_api -->|"scores application"| node_scoring
node_scoring -->|"loads and predicts"| node_model_artifact
node_scoring -->|"loads threshold"| node_threshold_artifact
node_api -->|"returns JSON"| node_risk_form
node_risk_form -->|"renders verdict"| node_verdict_view
node_dataset -.->|"trains from"| node_training
node_training -.->|"produces model"| node_model_artifact
node_training -.->|"selects threshold"| node_threshold_artifact

click node_dashboard_ui "https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/index.html"
click node_dti "https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js"
click node_risk_form "https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js"
click node_verdict_view "https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js"
click node_api "https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py"
click node_loan_schema "https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py"
click node_scoring "https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py"
click node_model_artifact "https://github.com/kumaravi005/credit_risk_assessment/blob/master/credit_risk_model.pkl"
click node_threshold_artifact "https://github.com/kumaravi005/credit_risk_assessment/blob/master/best_threshold.pkl"
click node_training "https://github.com/kumaravi005/credit_risk_assessment/blob/master/Credit_Risk.ipynb"
click node_dataset "https://github.com/kumaravi005/credit_risk_assessment/blob/master/credit_risk_dataset.csv"

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_dashboard_ui,node_dti,node_risk_form,node_verdict_view toneBlue
class node_api,node_loan_schema,node_scoring toneAmber
class node_model_artifact,node_threshold_artifact,node_training,node_dataset toneMint
class node_underwriter toneIndigo
```

## Components

### Underwriting dashboard

- [Dashboard interface](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/index.html): `static/index.html`
- [Live DTI meter](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js): `static/script.js`
- [Risk form workflow](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js): `static/script.js`
- [Verdict display](https://github.com/kumaravi005/credit_risk_assessment/blob/master/static/script.js): `static/script.js`

### Prediction service

- [FastAPI service](https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py): `main.py`
- [Loan validation schema](https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py): `main.py`
- [Risk scoring](https://github.com/kumaravi005/credit_risk_assessment/blob/master/main.py): `main.py`

### Risk modeling

- [Calibrated model](https://github.com/kumaravi005/credit_risk_assessment/blob/master/credit_risk_model.pkl): `credit_risk_model.pkl`
- [Decision threshold](https://github.com/kumaravi005/credit_risk_assessment/blob/master/best_threshold.pkl): `best_threshold.pkl`
- [Training and calibration](https://github.com/kumaravi005/credit_risk_assessment/blob/master/Credit_Risk.ipynb): `Credit_Risk.ipynb`
- [Credit dataset](https://github.com/kumaravi005/credit_risk_assessment/blob/master/credit_risk_dataset.csv): `credit_risk_dataset.csv`

### Other components

- **Loan underwriter**

## Connections

- Loan underwriter → Dashboard interface: enters applicant data (evidence: `README.md`)
- Dashboard interface → Risk form workflow: provides form (evidence: `README.md`)
- Risk form workflow → Live DTI meter: updates live ratio (evidence: `static/script.js`)
- Risk form workflow → FastAPI service: posts applicant JSON (evidence: `static/script.js`)
- FastAPI service → Loan validation schema: validates input (evidence: `README.md`)
- FastAPI service → Risk scoring: scores application (evidence: `main.py`)
- Risk scoring → Calibrated model: loads and predicts (evidence: `main.py`)
- Risk scoring → Decision threshold: loads threshold (evidence: `main.py`)
- FastAPI service → Risk form workflow: returns JSON (evidence: `README.md`)
- Risk form workflow → Verdict display: renders verdict (evidence: `static/script.js`)
- Credit dataset → Training and calibration: trains from
- Training and calibration → Calibrated model: produces model
- Training and calibration → Decision threshold: selects threshold (evidence: `README.md`)
