PulseMetrics Copilot™ — SaaS Revenue & Cohort Intelligence
High-performance analytics platform powered by DuckDB columnar OLAP, M0-M12+ cohort heatmaps & Text-to-SQL
| Cohort | Acquired | M0 | M1 | M2 | M3 | M6 | M12 |
|---|---|---|---|---|---|---|---|
| 2023-Q1 | 124,500 | 100% | 34.2% | 28.6% | 24.1% | 18.6% | 14.8% |
| 2023-Q2 | 148,200 | 100% | 36.8% | 30.2% | 25.4% | 19.8% | 15.6% |
| 2023-Q3 | 162,100 | 100% | 38.4% | 31.8% | 27.2% | 21.4% | 16.9% |
| 2023-Q4 | 189,400 | 100% | 41.2% | 34.6% | 29.8% | 23.1% | 18.2% |
01 // SYSTEM OVERVIEW
PulseMetrics Copilot™ replaces slow spreadsheet reporting with an in-process vectorized columnar analytical engine. Built on DuckDB and Streamlit, it computes dynamic cohort retention matrices, Net Revenue Retention (NRR %), and multi-quarter MRR waterfalls across 541,000+ transactional records in sub-second timeframes, accompanied by an AST-validated Text-to-SQL conversational copilot.
02 // THE PROBLEM & ENGINEERING SIGNIFICANCE
Modern SaaS executives and data teams struggle with slow cloud data warehouse queries or brittle Excel sheets when calculating customer cohort retention curves and MRR expansion/contraction.
Lagging revenue intelligence obscures customer flight-risk and understates churn until contract renewal cycles have already passed.
- •Aggregating half a million raw invoice events into multi-dimensional cohort retention matrices in under 2 seconds without dedicated data warehouse infrastructure.
- •Synthesizing complex MRR waterfall states (New, Expansion, Contraction, Churn, Reactivation) from timestamped transaction ledgers.
- •Preventing SQL injection and hallucinated schemas in natural language Text-to-SQL conversational queries.
03 // DATA PIPELINE & PREPROCESSING
- Columnar schema enforcement and ISO timestamp normalization into DuckDB virtual tables
- Window partition aggregation grouping first-purchase cohort periods with subsequent renewal activity
- Outlier clipping and zero-revenue transaction reconciliation
04 // SYSTEM ARCHITECTURE & DATA FLOW
Streamlit Modern Interface <-> DuckDB In-Memory Columnar Engine <-> Scikit-Learn Churn Scorer <-> AST SQL Validator <-> Plotly Interactive Visualizer.
In-process columnar SQL database executing complex window functions and multi-table joins without network roundtrips.
Dynamically calculates retention percentages from acquisition month M0 through M12+ with gradient color mapping.
Scikit-Learn Logistic Regression model scoring customer renewal risk based on recency, frequency, and monetary tenure.
Natural language translation engine mapping executive English queries into validated SQL queries.
05 // MODEL ENGINEERING & HYPERPARAMETERS
Trained on historical subscription renewal windows with balanced class weighting.
- • DuckDB Threads: Auto (All Cores)
- • Regularization: L2 (C=1.0)
- • Lookback Window: 12 Months
- • Churn Threshold: 0.45
06 // FAILURE ANALYSIS & ZERO-TRUST SAFEGUARDS
- • Sudden schema drift in imported third-party CSV headers.
- • Missing intermediate months in discontinuous customer subscription lifecycles.
Cloud free-tier host memory limits (<1GB) with 541k transactional records.
Standard Pandas groupby cohort pivots consumed 1.4GB peak RAM, risking silent OOM kills.
Migrated analytical aggregation to in-process DuckDB columnar SQL with streaming projection.
RAM footprint dropped by 64% (down to 280MB peak) while query execution dropped from 7.4s to 1.18s.
07 // PRODUCTION DEPLOYMENT SPECS
08 // ARCHITECTURAL DECISIONS & TRADE-OFFS
09 // PLANNED IMPROVEMENTS & NEXT REVISIONS
- →Add Apache Arrow zero-copy IPC streaming for multi-gigabyte dataset ingestion.
- →Integrate automated LLM explanation notes generated directly from cohort retention drop-offs.
Designed for SaaS C-suite executives: eliminated visual clutter, replaced multi-nested menus with tactile 1-click time window presets, and color-coded retention cells with perceptual luminance scales.
- Q1:"Why use embedded DuckDB over serverless Cloud Data Warehouses (BigQuery/Snowflake) for executive dashboards?"
- Q2:"How did you prevent SQL injection when users ask natural-language questions through Text-to-SQL?"
- Q3:"How is the cohort retention matrix calculated to accurately account for mid-month subscription upgrades?"