A morning briefing where SQL does the maths.

A hiring-assignment build: a daily CRM briefing where the database does the maths.

Role
Solo build
When
Feb 2026
Built with
Python · Zoho CRM API · Supabase / Postgres · LangChain · Ollama · Streamlit · Twilio
Where
AHA Smart Homes · hiring assignment
1 pageLLM job
2Formats
≤ 1,500WhatsApp limit

What it showed AHA

  • Numbers that can’t be inventedPostgres computes every figure; the local model only writes the sentences around them.
  • CRM data stays in-houseA local Llama 3.2 writes the report, so no customer record goes to an outside AI service.
  • Lands on WhatsAppA one-page report, plus a WhatsApp summary kept under 1,500 characters.

The problem

  • Management wanted a daily “how are we doing?” without opening the CRM.
  • The first version handed raw data to an LLM, and its numbers were wrong.

What I built

  • Incremental sync: Zoho leads, deals, contacts and accounts, upserted by ID, with the raw record kept in JSONB.
  • Maths in the database: about 255 lines of Python replaced by Postgres functions and fixed anomaly rules.
  • The LLM only narrates: a local Llama 3.2 writes the report from precomputed numbers, and WhatsApp gets a fixed template. Read →
  • Practical fixes: DNS-over-HTTPS when an ISP blocked the host, E.164 phone numbers, and a token refresh on every run.

What I learned

Compute deterministically, narrate with the model. It’s how I build every data agent now.

Written up from this project.

All posts

Don’t let the LLM do the maths

~255 lines of Python maths moved to SQL

More work.

All case studies

Computer visionMar – Apr 2025

Live emotion detection

Seven emotions, live from a webcam.

Credit-card fraud · outliers flagged

Machine learningMay – Jun 2024

Credit score classification

100,000 messy rows to a 76.6% Random Forest.