Metadata-Version: 2.4
Name: creditsetu
Version: 1.0.0
Summary: General-purpose, explainable credit intelligence engine for thin-file and alternative-data lending — Intent, Capacity, and Guardrail scoring engines with SHAP-backed adverse action reasons.
Author-email: Adarsh <23ucs509@lnmiit.ac.in>
License: MIT
Project-URL: Homepage, https://github.com/adarshcod30/CreditSetu
Project-URL: Repository, https://github.com/adarshcod30/CreditSetu
Project-URL: Issues, https://github.com/adarshcod30/CreditSetu/issues
Project-URL: Live Demo, https://credit-setu-iota.vercel.app
Keywords: credit-scoring,credit-risk,alternative-credit-scoring,thin-file,lending,fintech,explainable-ai,shap,lightgbm,underwriting
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: pandas>=2.3.0
Requires-Dist: numpy>=2.2.6
Requires-Dist: scikit-learn>=1.7.0
Requires-Dist: lightgbm>=4.6.0
Requires-Dist: pydantic>=2.11.3
Requires-Dist: pyyaml>=6.0
Provides-Extra: explain
Requires-Dist: shap>=0.46.0; extra == "explain"
Provides-Extra: intent
Requires-Dist: ruptures>=1.1.9; extra == "intent"
Provides-Extra: full
Requires-Dist: shap>=0.46.0; extra == "full"
Requires-Dist: ruptures>=1.1.9; extra == "full"
Provides-Extra: api
Requires-Dist: fastapi>=0.115.12; extra == "api"
Requires-Dist: uvicorn[standard]>=0.34.3; extra == "api"
Requires-Dist: sqlalchemy>=2.0.41; extra == "api"
Requires-Dist: psycopg2-binary>=2.9.9; extra == "api"
Requires-Dist: python-multipart>=0.0.20; extra == "api"
Requires-Dist: pydantic-settings>=2.9.1; extra == "api"
Requires-Dist: python-dotenv>=1.1.0; extra == "api"
Provides-Extra: dev
Requires-Dist: pytest>=8.4.1; extra == "dev"
Requires-Dist: httpx>=0.28.1; extra == "dev"
Requires-Dist: pyarrow>=14.0.0; extra == "dev"

# CreditSetu

General-purpose, explainable credit intelligence engine for thin-file and alternative-data lending. Score customers on behavioral transaction data — including customers with no bureau score at all — using three composable engines (Intent, Capacity, Guardrail), SHAP-backed explanations, and regulator-style adverse action reason codes.

This is the library package. For the full project — a reference FastAPI service, a React dashboard, synthetic demo data, and deployment docs — see the [GitHub repository](https://github.com/adarshcod30/CreditSetu).

## Install

```bash
pip install creditsetu
```

That pulls in only `pandas`, `numpy`, `scikit-learn`, `lightgbm`, `pydantic`, and `pyyaml` — enough to fit models and score customers. SHAP explainability and ruptures-based life-event detection are opt-in and degrade gracefully if skipped:

```bash
pip install "creditsetu[explain]"   # + SHAP feature attributions / adverse action reasons
pip install "creditsetu[intent]"    # + ruptures change-point life-event detection
pip install "creditsetu[full]"      # both
```

## Usage

```python
from app.pipeline import CreditIntelligencePipeline
from app.scoring_profile import ScoringProfile

# Currency, guardrail thresholds, product catalog, weights — all policy,
# no code changes needed to adapt this to a different institution/market.
profile = ScoringProfile(name="acme", org_name="Acme Lending", currency_symbol="$")
pipeline = CreditIntelligencePipeline(profile=profile)

# Fit on your own historical data — customers_df needs a
# `true_repayment_capacity` column, ideally a real `is_stressed` column too.
pipeline.fit(customers_df, transactions_df)

# Score one customer...
result = pipeline.score_customer(customer, customer_transactions_df)

# ...or a whole batch, vectorized end-to-end.
scores_df = pipeline.score_batch(customers_df, transactions_df)
```

**Data contract** — `customer` is a dict needing at least `customer_id` and `bureau_score` (`None` is a first-class value, not an edge case — that's the point). `transactions` is a DataFrame with `date`, `amount`, `type` (`credit`/`debit`), `category`, `counterparty`, `is_bounce`.

Full details live in the package's `pipeline.py` module docstring, and the complete architecture/evaluation writeup is in the [GitHub README](https://github.com/adarshcod30/CreditSetu#readme).

## License

MIT
