# tanishq-latent/credit-risk-assesment-using-shap architecture

> Architecture diagram of the GitHub repository tanishq-latent/credit-risk-assesment-using-shap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanishq-latent/credit-risk-assesment-using-shap
- Repository: https://github.com/tanishq-latent/credit-risk-assesment-using-shap

## Overview

This is a browser-based credit-risk assessment service. A user enters loan and borrower details, the browser submits them to FastAPI, and the service scores the application with a preloaded model, applies a stored threshold, and returns a risk verdict for display. The tree also includes a training notebook and dataset, but their contents were not sampled, so their role and connections are not assumed.

Main entry points: [`main.py`](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py) (FastAPI service), [`static/script.js`](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/script.js) (Form and results), [`static/index.html`](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/index.html) (Application form), [`credit_risk_model.pkl`](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/credit_risk_model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_ui["Application form<br/>[index.html]"]
  node_browser_logic["Form and results<br/>[script.js]"]
  node_styles["Interface styling<br/>[style.css]"]
end

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

subgraph group_artifacts["Model artifacts"]
  node_model["Trained model"]
  node_threshold["Decision threshold<br/>[best_threshold.pkl]"]
  node_training_notebook["Training notebook<br/>[Credit_Risk.ipynb]"]
  node_dataset["Credit dataset"]
end

node_user(("Applicant"))

node_user -->|"enters details"| node_ui
node_ui -->|"provides form"| node_browser_logic
node_browser_logic -->|"POST /predict"| node_api
node_api -->|"validates with"| node_input_schema
node_api -->|"calls"| node_scoring
node_scoring -->|"scores with"| node_model
node_scoring -->|"compares against"| node_threshold
node_api -->|"returns verdict"| node_browser_logic
node_browser_logic -->|"displays result"| node_user
node_api -->|"loads at startup"| node_model
node_api -->|"loads at startup"| node_threshold
node_api -->|"serves static files"| node_ui
node_browser_logic -->|"uses styles"| node_styles

click node_ui "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/index.html"
click node_browser_logic "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/script.js"
click node_styles "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/style.css"
click node_api "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py"
click node_input_schema "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py"
click node_scoring "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py"
click node_model "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/credit_risk_model.pkl"
click node_threshold "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/best_threshold.pkl"
click node_training_notebook "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/Credit_Risk.ipynb"
click node_dataset "https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/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_ui,node_browser_logic,node_styles toneBlue
class node_api,node_input_schema,node_scoring toneAmber
class node_model,node_threshold,node_training_notebook,node_dataset toneMint
class node_user toneIndigo
```

## Components

### Web interface

- [Application form](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/index.html): `static/index.html`
- [Form and results](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/script.js): `static/script.js`
- [Interface styling](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/static/style.css): `static/style.css`

### Risk service

- [FastAPI service](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py): `main.py`
- [Loan input schema](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py): `main.py`
- [Risk scoring](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/main.py): `main.py`

### Model artifacts

- [Trained model](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/credit_risk_model.pkl): `credit_risk_model.pkl`
- [Decision threshold](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/best_threshold.pkl): `best_threshold.pkl`
- [Training notebook](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/Credit_Risk.ipynb): `Credit_Risk.ipynb`
- [Credit dataset](https://github.com/tanishq-latent/credit-risk-assesment-using-shap/blob/main/credit_risk_dataset.csv): `credit_risk_dataset.csv`

### Other components

- **Applicant**

## Connections

- Applicant → Application form: enters details
- Application form → Form and results: provides form
- Form and results → FastAPI service: POST /predict
- FastAPI service → Loan input schema: validates with
- FastAPI service → Risk scoring: calls
- Risk scoring → Trained model: scores with
- Risk scoring → Decision threshold: compares against
- FastAPI service → Form and results: returns verdict
- Form and results → Applicant: displays result
- FastAPI service → Trained model: loads at startup
- FastAPI service → Decision threshold: loads at startup
- FastAPI service → Application form: serves static files
- Form and results → Interface styling: uses styles
