Development Bank of Nigeria · RC 1215724

DBN Analytics

RAG-powered Natural Language to SQL for MSME Loan intelligence.

Ask plain-English questions. Get structured data and chart code back — instantly.

...Financing Sustainable Growth

FastAPI
Vanna AI
OpenAI GPT-4o
ChromaDB
Azure Ready
MS SQL Server

How It Works

1Natural Language Question
2ChromaDB Retrieval
3OpenAI GPT-4o
4SQL Execution
5JSON + Plotly

Powered by Enterprise Scale

~11KLoan Records
40Data Columns
6API Endpoints
3Cloud Targets
RAGArchitecture
T-SQLProduction DB

Strategic Value to DBN

Risk Management

Strengthens credit risk management and early warning systems.

Decision Speed

Improves decision speed and quality across lending operations.

Compliance Readiness

Enhances regulatory compliance, governance, and audit readiness.

Operational Efficiency

Reduces operational dependency on technical resources.

Data Foundation

Establishes a foundation for enterprise-wide data-driven decision-making.

Technical Foundation

Our architecture is built on a modern enterprise stack focused on data integrity, automated documentation, and seamless accessibility for non-technical stakeholders.

Next.js

High-performance frontend framework

SQL Server

Robust enterprise data storage

dbt

Data transformation and modeling

Vanna

AI-powered data accessibility

Google Cloud

Scalable cloud infrastructure

Fly.dev

Modern deployment & edge computing

Architecture Hub

Dataset Overview

The underlying msmeloans table holds ~11,000 MSME loan records across 40 columns sourced from the DBN data warehouse.

CategoryKey ColumnsDescription
DemographicsGender, State, BirthDate, age_groupBorrower personal details
Loan DetailsAmountGranted, Tenor, Rate, ScheduleTypeCore loan terms
Business ProfileSector, NatureOfBusiness, MSMEAnnualTurnoverBusiness classification
Risk Signalspred_default_prob, risk_score, risk_categoryML-generated risk metrics
PFIPFI ID, ES_Rating, FirstTimeAccessToCreditLender & credit history flags

Live Query Example

Send this to POST /api/v1/chat/ask and get back structured data + a Plotly chart:

{ "question": "Which sector has the highest average predicted default probability?" }
{
  "sql": "SELECT Sector, AVG(pred_default_prob) AS avg_risk FROM msmeloans GROUP BY Sector ORDER BY avg_risk DESC LIMIT 5;",
  "data": [{ "Sector": "Agriculture", "avg_risk": 0.041 }],
  "plotly_code": "fig = px.bar(df, x='Sector', y='avg_risk')"
}

POC Outcome

The POC successfully confirms that DBN can transition from descriptive reporting to predictive and forward-looking analytics using AI-driven platforms. The solution is technically viable, scalable, and aligned with DBN's strategic objectives.

Recommended Next Steps

Approve progression to a production-grade implementation
Integrate with DBN's enterprise data warehouse and core systems
Expand predictive models and macroeconomic indicators
Implement governance, security, and performance controls

"Positioning DBN to strengthen its role as a data-driven development finance institution while improving risk management, compliance, and lending effectiveness."

POC Achievement

Infrastructure, Governance & Security Enhancements

Transparent Data Encryption (TDE)
Observation & Risk

Observation: The current DBN data warehouse does not implement encryption at rest.

Risk: This exposes sensitive data (e.g., BVN, loan details) to potential breaches and compromises DBN’s compliance with NDPR and other regulatory standards.

Recommendation

We provided a step-by-step guide to enable Transparent Data Encryption (TDE) to secure the data warehouse at rest.

Explore the Docs

Getting Started

Install dependencies, set your OpenAI API key, and run your first query in under 2 minutes.

Installation
Architecture

Understand the layered FastAPI design, the RAG pipeline, and the approved DBN Azure production topology.

DBN Production Setup
API Reference

Detailed documentation for all Chat and Training endpoints, request/response schemas, and error codes.

Chat Endpoints
Training & Retraining

Learn how to bootstrap ChromaDB, add verified SQL examples, and continuously improve accuracy over time.

Concepts
Azure Deployment

Step-by-step guides for Container Apps, App Service, AKS — with full GitHub Actions CI/CD pipelines.

Azure Guide
Fly.io Deployment

Containerised, secrets-managed, HTTPS-enforced deployment in minutes using fly deploy.

Fly.io Guide