InsightDesk
A sales analytics dashboard with Python/Pandas calculations and an AI analyst grounded in computed summaries.
Built as a working showcase that can serve as a foundation for a customized business implementation.
Inspect the evidence
Review the implementation, data model and tests in the repository.
What I built
- Deterministic sales aggregation engine computing revenue, orders, AOV, and discount rates
- Monthly revenue trend analysis with month-over-month percentage growth calculation
- Top product ranking with individual revenue contribution and unit volume shares
- Regional sales breakdown across North America, EMEA, APAC, and LATAM
- Automated rule-based business insight generator producing 3–5 key observations
- Data quality and completeness profiler flagging missing values and inferred column types
- Grounded natural language AI analyst powered by Gemini with verified context injection
- Session isolation with bounded LRU cache preventing cross-dataset context contamination
Numerical Hallucination & Data Quality Failures in AI Dashboards
Prompting large language models with raw tabular records often leads to fabricated totals, faulty ranking logic, and credential leakage. Additionally, real-world CSV inputs contain formatting anomalies like currency symbols, commas, negative adjustments, and missing columns that break naive ingestion pipelines.
Two-Stage Architecture: 'Python Calculates; AI Explains'
InsightDesk enforces a strict two-stage pipeline. The Python/Pandas backend sanitizes inputs, preserves legitimate negative refund entries, computes exact metrics (revenue, AOV, monthly trends, regional share), and profiles schema completeness. The AI layer receives only structured analytical packets, and its answers undergo server-side validation against verified ground truth.
03 / PRODUCT EXPERIENCE
Core Capabilities & Workflow
Deterministic Pandas Analytics Engine
Computes baseline executive KPIs (total revenue, unique order count, average order value, units sold, average discount), monthly revenue progression with month-over-month growth rates, top product rankings with revenue share, and regional volume distributions.
Guarantees 100% mathematical consistency without relying on approximate probabilistic estimates.
Executive sales analytics dashboard displaying baseline KPIs, monthly revenue progression, and transaction telemetry
Data Quality & Schema Profiler
Evaluates incoming datasets against a canonical sales schema, assessing completeness score, duplicate row detection, per-column null percentages, and data type inference. Sanitizes currency symbols, commas, and percentage representations while preserving negative refund values.
Surfaces data hygiene issues transparently to the analyst prior to reporting.
Data quality profiler with healthy schema validation badge, completeness scoring, and column type breakdown
Grounded Natural Language AI Analyst
Integrates Google Gemini to interpret analytical findings in natural language. Receives structured KPI contexts rather than raw rows, verifies cited metrics against backend ground truths, redacts API credentials on error, and gracefully informs when unconfigured.
Provides executive-ready written explanations with zero risk of fabricated figures.
Grounded AI Analyst powered by Gemini answering natural language queries with verified numerical facts and follow-ups
Bounded Session Isolation & In-Memory Cache
Generates unique session identifiers per loaded or uploaded dataset. Enforces an in-memory Least-Recently-Used (LRU) cache with a bounded capacity of 50 datasets to prevent memory exhaustion, returning HTTP 404 for unknown or expired identifiers.
Prevents cross-dataset context leakage when querying multiple files sequentially.
Top products ranking and regional performance breakdown isolated by active dataset session context
04 / TECHNICAL ARCHITECTURE
Engineering Foundation & Architecture
Two-Stage Analytical Separation
Architected around the principle that numerical calculations belong in pure, vectorized Python/Pandas logic, while LLMs are strictly reserved for linguistic synthesis and contextual narrative.
Data Sanitization & Integrity Preservation
Implemented robust input sanitization stripping currency formatting and commas without silently clipping negative financial records such as returns and credit adjustments.
Server-Side Fact Verification Guardrails
Constructed verification logic comparing metrics cited in AI answers against computed values, rejecting ungrounded claims and protecting credentials across error boundaries.
Comprehensive Automated Test Verification
Engineered 28 pytest verification checks spanning mathematical ground truth, endpoint contracts, upload hardening, and dataset context isolation.
05 / ENGINEERING DECISIONS
Technical decisions & trade-offs
Vectorized Pandas over Raw LLM Arithmetic
Perform all math in Pandas before AI context compilation.
LLMs are probabilistic token predictors that cannot guarantee reproducible mathematical precision. Vectorized Pandas guarantees deterministic arithmetic.
In-Memory LRU Cache over Persistent Database
Store active sessions in a bounded Python in-memory LRU cache with capacity 50.
Keeps the workstation lightweight and zero-infrastructure without running Docker, PostgreSQL, or Redis, while preventing unbounded memory growth.
06 / REFLECTIONS & LEARNINGS
What This Project Demonstrated
Decoupling Computation from Narrative Generation
Designing InsightDesk proved that reliable AI applications require hard mathematical guardrails. By treating the language model as an explanatory interface rather than a calculation engine, data-driven systems remain both trustworthy and articulate.
Deployed interactive web application on Vercel
Read the implementation and browse its history.
Inspect the layouts in the screenshots and demo.
Explore the architecture and decisions in this case study.
DATA ANALYTICS & GROUNDED AI
Interested in deterministic analytics or grounded AI systems?
I welcome technical discussions on Python and Pandas analytics engines, verified LLM workflows, data quality pipelines, or developer opportunities.