# sahbimlesh007/credit-risk-scoring-system architecture

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

- Interactive diagram: https://gitdiagram.com/sahbimlesh007/credit-risk-scoring-system
- Repository: https://github.com/sahbimlesh007/credit-risk-scoring-system

## Overview

This is a browser-based credit-risk scoring application. An applicant enters loan and credit-history details, the browser submits them to the FastAPI prediction endpoint, and the service preprocesses the application, scores it with a loaded CatBoost model, applies a decision threshold, and returns risk and confidence metrics for display. The browser also supports exporting a report. The sampled source confirms the request, scoring, and display flow; training-data and notebook roles are not shown, so they are omitted.

Main entry points: [`main.py`](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py) (Prediction endpoint), [`static/script.js`](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js) (Form and results), [`static/index.html`](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/index.html) (Application form), [`CatBOost.pkl`](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/CatBOost.pkl) (CatBoost model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_form["Application form<br/>[index.html]"]
  node_browser["Form and results<br/>[script.js]"]
  node_riskresult["Risk assessment<br/>[script.js]"]
  node_report["Report export<br/>[script.js]"]
end

subgraph group_service["Prediction service"]
  node_api["Prediction endpoint<br/>[main.py]"]
  node_preprocess["Input preprocessing<br/>[main.py]"]
  node_scoring["Risk scoring<br/>[main.py]"]
end

subgraph group_inference["Scoring assets"]
  node_model["CatBoost model<br/>[CatBOost.pkl]"]
  node_threshold["Decision threshold<br/>[catThresold.pkl]"]
end

node_applicant(("Applicant"))

node_applicant -->|"enters application"| node_form
node_form -->|"submits form"| node_browser
node_browser -->|"POST /predict"| node_api
node_api -->|"validates and prepares"| node_preprocess
node_api -->|"requests prediction"| node_scoring
node_scoring -->|"predicts probability"| node_model
node_scoring -->|"reads threshold"| node_threshold
node_scoring -->|"returns assessment"| node_api
node_api -->|"returns JSON"| node_browser
node_browser -->|"renders results"| node_riskresult
node_riskresult -->|"exports report"| node_report

click node_form "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/index.html"
click node_browser "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js"
click node_api "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py"
click node_preprocess "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py"
click node_scoring "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py"
click node_model "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/CatBOost.pkl"
click node_threshold "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/catThresold.pkl"
click node_riskresult "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js"
click node_report "https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js"

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_form,node_browser,node_riskresult,node_report toneBlue
class node_api,node_preprocess,node_scoring toneAmber
class node_model,node_threshold toneMint
class node_applicant toneIndigo
```

## Components

### Web interface

- [Application form](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/index.html): `static/index.html`
- [Form and results](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js): `static/script.js`
- [Risk assessment](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js): `static/script.js`
- [Report export](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/static/script.js): `static/script.js`

### Prediction service

- [Prediction endpoint](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py): `main.py`
- [Input preprocessing](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py): `main.py`
- [Risk scoring](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/main.py): `main.py`

### Scoring assets

- [CatBoost model](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/CatBOost.pkl): `CatBOost.pkl`
- [Decision threshold](https://github.com/sahbimlesh007/credit-risk-scoring-system/blob/main/catThresold.pkl): `catThresold.pkl`

### Other components

- **Applicant**

## Connections

- Applicant → Application form: enters application
- Application form → Form and results: submits form
- Form and results → Prediction endpoint: POST /predict
- Prediction endpoint → Input preprocessing: validates and prepares
- Prediction endpoint → Risk scoring: requests prediction
- Risk scoring → CatBoost model: predicts probability
- Risk scoring → Decision threshold: reads threshold
- Risk scoring → Prediction endpoint: returns assessment
- Prediction endpoint → Form and results: returns JSON
- Form and results → Risk assessment: renders results
- Risk assessment → Report export: exports report
