# rajdeepofgithub/sbdr architecture

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

- Interactive diagram: https://gitdiagram.com/rajdeepofgithub/sbdr
- Repository: https://github.com/rajdeepofgithub/sbdr

## Overview

SBDR is a research prototype for compassionate debt recovery: customer and payment data are prepared, three AI branches produce distress and behavioral signals, a classifier assigns recovery tiers, and an audit rule can flag strategic defaults. Relationship managers explore the resulting customer-level decisions in a Streamlit dashboard. The README documents pipeline stages and capabilities whose runtime implementation is not present in the sampled source; those documented links are cited to the README, while dashboard data and manifest reads are evidenced in dashboard.py.

Main entry points: [`dashboard.py`](https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py) (Streamlit dashboard), [`notebooks/Phase 1/04_feature_engineering.ipynb`](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/04_feature_engineering.ipynb) (Feature engineering), [`notebooks/Phase 2/ML/08_xgboost_recovery_tier.ipynb`](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/ML/08_xgboost_recovery_tier.ipynb) (XGBoost classifier), [`notebooks/Phase 1/05_synthetic_chats.ipynb`](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/05_synthetic_chats.ipynb) (Synthetic chats)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_sources[("Source datasets")]
  node_prepare["Clean and merge"]
  node_features["Feature engineering"]
  node_chatgen["Synthetic chats"]
end

subgraph group_signals["AI signals"]
  node_finbert["FinBERT distress"]
  node_bilstm["BiLSTM anomalies"]
end

subgraph group_decisions["Recovery decisions"]
  node_xgb["XGBoost classifier"]
  node_audit["Strategic-default audit"]
  node_tierdata[("Audited tier data")]
  node_manifest["Model manifest"]
end

subgraph group_dashboard["Manager dashboard"]
  node_dashboardapp["Streamlit dashboard<br/>[dashboard.py]"]
  node_explore["Customer exploration<br/>[dashboard.py]"]
  node_explain["Model explanations<br/>[dashboard.py]"]
end

node_manager(("Relationship manager"))
node_openai["OpenAI GPT-4o"]

node_sources -->|"clean and merge"| node_prepare
node_prepare -->|"engineer features"| node_features
node_features -->|"generate chats"| node_chatgen
node_openai -.->|"generate text"| node_chatgen
node_chatgen -->|"score distress"| node_finbert
node_features -->|"analyze payments"| node_bilstm
node_finbert -->|"fuse signals"| node_xgb
node_bilstm -->|"fuse signals"| node_xgb
node_features -->|"provide features"| node_xgb
node_xgb -->|"classify then audit"| node_audit
node_audit -->|"write tier results"| node_tierdata
node_manager -->|"opens"| node_dashboardapp
node_dashboardapp -->|"reads CSV"| node_tierdata
node_dashboardapp -->|"reads manifest"| node_manifest
node_dashboardapp -->|"renders"| node_explore
node_dashboardapp -->|"renders"| node_explain

click node_prepare "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/03_dataset_merge.ipynb"
click node_features "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/04_feature_engineering.ipynb"
click node_chatgen "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/05_synthetic_chats.ipynb"
click node_finbert "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/NLP/07_finbert_distress_score.ipynb"
click node_bilstm "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/DL/06_bilstm_stress_patterns.ipynb"
click node_xgb "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/ML/08_xgboost_recovery_tier.ipynb"
click node_audit "https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/ML/09_audit_layer.ipynb"
click node_tierdata "https://github.com/rajdeepofgithub/sbdr/tree/main/data/processed"
click node_manifest "https://github.com/rajdeepofgithub/sbdr/blob/main/models/xgboost/xgboost_manifest.json"
click node_dashboardapp "https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py"
click node_explore "https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py"
click node_explain "https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.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_sources,node_prepare,node_features,node_chatgen toneBlue
class node_finbert,node_bilstm toneAmber
class node_xgb,node_audit,node_tierdata,node_manifest toneMint
class node_dashboardapp,node_explore,node_explain toneRose
class node_manager,node_openai toneIndigo
```

## Components

### Data preparation

- **Source datasets**
- [Clean and merge](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/03_dataset_merge.ipynb): `notebooks/Phase 1/03_dataset_merge.ipynb`
- [Feature engineering](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/04_feature_engineering.ipynb): `notebooks/Phase 1/04_feature_engineering.ipynb`
- [Synthetic chats](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%201/05_synthetic_chats.ipynb): `notebooks/Phase 1/05_synthetic_chats.ipynb`

### AI signals

- [FinBERT distress](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/NLP/07_finbert_distress_score.ipynb): `notebooks/Phase 2/NLP/07_finbert_distress_score.ipynb`
- [BiLSTM anomalies](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/DL/06_bilstm_stress_patterns.ipynb): `notebooks/Phase 2/DL/06_bilstm_stress_patterns.ipynb`

### Recovery decisions

- [XGBoost classifier](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/ML/08_xgboost_recovery_tier.ipynb): `notebooks/Phase 2/ML/08_xgboost_recovery_tier.ipynb`
- [Strategic-default audit](https://github.com/rajdeepofgithub/sbdr/blob/main/notebooks/Phase%202/ML/09_audit_layer.ipynb): `notebooks/Phase 2/ML/09_audit_layer.ipynb`
- [Audited tier data](https://github.com/rajdeepofgithub/sbdr/tree/main/data/processed): `data/processed`
- [Model manifest](https://github.com/rajdeepofgithub/sbdr/blob/main/models/xgboost/xgboost_manifest.json): `models/xgboost/xgboost_manifest.json`

### Manager dashboard

- [Streamlit dashboard](https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py): `dashboard.py`
- [Customer exploration](https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py): `dashboard.py`
- [Model explanations](https://github.com/rajdeepofgithub/sbdr/blob/main/dashboard.py): `dashboard.py`

### Other components

- **Relationship manager**
- **OpenAI GPT-4o**

## Connections

- Source datasets → Clean and merge: clean and merge (evidence: `README.md`)
- Clean and merge → Feature engineering: engineer features (evidence: `README.md`)
- Feature engineering → Synthetic chats: generate chats (evidence: `README.md`)
- OpenAI GPT-4o → Synthetic chats: generate text (evidence: `README.md`)
- Synthetic chats → FinBERT distress: score distress (evidence: `README.md`)
- Feature engineering → BiLSTM anomalies: analyze payments (evidence: `README.md`)
- FinBERT distress → XGBoost classifier: fuse signals (evidence: `README.md`)
- BiLSTM anomalies → XGBoost classifier: fuse signals (evidence: `README.md`)
- Feature engineering → XGBoost classifier: provide features (evidence: `README.md`)
- XGBoost classifier → Strategic-default audit: classify then audit (evidence: `README.md`)
- Strategic-default audit → Audited tier data: write tier results (evidence: `README.md`)
- Relationship manager → Streamlit dashboard: opens (evidence: `README.md`)
- Streamlit dashboard → Audited tier data: reads CSV (evidence: `dashboard.py`)
- Streamlit dashboard → Model manifest: reads manifest (evidence: `dashboard.py`)
- Streamlit dashboard → Customer exploration: renders (evidence: `README.md`)
- Streamlit dashboard → Model explanations: renders (evidence: `README.md`)
