Skip to content

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

Get Started


How It Works

1 Natural Language Question

2 ChromaDB Retrieval

3 OpenAI GPT-4o

4 SQL Execution

5 JSON + Plotly

By the Numbers

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

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


Dataset Overview

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

Category Key Columns Description
Demographics Gender, State, BirthDate, age_group Borrower personal details
Loan Details AmountGranted, Tenor, Rate, ScheduleType Core loan terms
Business Profile Sector, NatureOfBusiness, MSMEAnnualTurnover Business classification
Risk Signals pred_default_prob, risk_score, risk_category ML-generated risk metrics
PFI PFI ID, ES_Rating, FirstTimeAccessToCredit Lender & 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')"
}