Banking AnalyticsLive on BigQuery

Space Financial

A regional bank analytics platform built end-to-end: synthetic data generation, a BigQuery data warehouse modeled with dbt, an interactive BI dashboard, and an AI analyst that writes SQL and renders charts on demand.

2.37M

Data Rows

31

dbt Models

16

Mart Tables

7

AI Agent Nodes

Architecture

Data Generation
Python + Faker2.37M rows across 15 raw tables, 3 years of history
Data Warehouse
Google BigQueryraw → staging → marts with 16 mart tables
Transformations
dbt Cloud15 staging views + 16 mart models, SCD2 customers
AI Analyst
LangGraph + Claude7-node agent: intent → SQL → validate → execute → chart → narrative
BI Dashboard
Next.js + RechartsLive BigQuery queries, filterable charts, no caching delay
Auth Gate
NextAuth v5 + bcryptInvite-only credentials, signed JWT sessions

Key Engineering Decisions

SCD2 for customer history

dim_customer tracks changes over time with valid_from/valid_to and is_current. Queries use is_current=true for current state, preserving full audit trail.

Safety layer on AI SQL

Every query from Claude passes keyword blocking (no INSERT/DELETE/DROP), table allowlisting, and a 15-second timeout before hitting BigQuery. The AI cannot mutate data.

Native BigQuery surrogate keys

Surrogate keys use to_hex(md5(...)) natively in BigQuery — no dbt_utils dependency required, avoiding package import errors.

CAST AS FLOAT64 for NUMERICs

BigQuery NUMERIC type serializes as strings in JSON. All aggregations cast to FLOAT64 to ensure correct numeric parsing in the Next.js API layer.