Skip to content
Youssef M.

Case study · Data analytics & AI

InsightDesk

A sales analytics tool that computes every number in Python first, then lets an AI model explain those numbers in plain language.

  • Python
  • Pandas
  • FastAPI
  • React
  • TypeScript
  • Gemini API

A project by Youssef Manssouri

What I built
Built a Python/Pandas analytics pipeline, React dashboards and a Gemini analyst grounded in calculated summaries.
Verifiable result
The analytics engine, AI context builder, backend tests and local setup are public.
Status, audience and limitations
For whom:
People exploring sales CSV data and dashboard calculations.
Status:
Independent analytics project with public source and local setup; no public hosted demo.
Limitations:
Results depend on supported input data. Gemini explanations require configuration and can be inaccurate; computed results remain the reference.

The problem

Asking a language model to read raw sales rows invites made-up totals and wrong rankings. Real CSV exports are also messy: currency symbols, thousands separators, refunds as negative amounts and missing columns all break a naive import. I wanted an assistant whose answers can be traced back to exact calculations.

What I built

Dashboard: revenue, orders, average order value and monthly growth, all computed by Pandas from the uploaded file.
Data quality: completeness, duplicate rows, missing values per column and detected types, checked before any analysis.
AI analyst: Gemini receives the computed summaries, not the raw rows, and its answers are checked against those numbers.

Key decisions

  1. All maths happens in Pandas, never in the model

    Totals, rankings and growth rates are computed in code before the AI sees anything. The model only explains numbers it was given.

    Trade-off: The assistant can only discuss what the backend has already calculated; new kinds of questions need new calculations first.

  2. Clean the data, but keep refunds

    The importer strips currency symbols, commas and percent signs, but keeps negative amounts, because refunds are real sales events.

    Trade-off: Cleaning rules are tuned for sales files; other kinds of data would need their own schema and rules.

  3. A small in-memory cache instead of a database

    Each uploaded dataset gets its own session in a cache capped at 50 datasets; the oldest is removed when it is full.

    Trade-off: It runs with no database or Docker, but sessions disappear when the server restarts.

What I learned

A language model is a good explainer and a bad calculator. Treating it as the interface on top of verified calculations, not as the calculation engine, is what makes an AI feature trustworthy enough to use on real business data.

Check it yourself