§ 00 — LOADING STACK
◆
LangGraphLangGraph
Azure OpenAIAzure OpenAI
QdrantQdrant
Arize PhoenixArize Phoenix
LLangfuse
MMastra
Next.jsNext.js
SSupabase
LANGGRAPH ◆ AZURE ◆ QDRANT ◆ ARIZE ◆ LANGFUSE ◆ MASTRA ◆ NEXT.JS ◆ SUPABASE ◆ LANGGRAPH ◆ AZURE ◆ QDRANT ◆ ARIZE ◆ LANGFUSE ◆ MASTRA ◆ NEXT.JS ◆ SUPABASE
KKomal Vardhan.
HomeWorkAboutWritingResourcesContact
HomeWorkWritingResourcesAboutContact
Build like an engineer. Teach like a friend.

© 2026 Komal Vardhan Lolugu

Sitemap
  • Home
  • Work
  • About
  • Writing
  • Contact
  • Resources
Elsewhere
  • LinkedIn · 3.5K
  • Medium · Writing
  • Instagram
  • GitHub
  • Topmate
Newsletter

A field note every other Sunday. No hype, no AI spam. Unsubscribe anytime.

Designed & built by Komal. Made in India.
← All work
2025 · Agentic AILiveLead Engineer

Profit Intelligence

An analytics platform that transforms monthly farm financial uploads into peer-benchmarked dashboards, helping advisors identify underperforming operations before risk compounds.

45+Financial and production metrics computed per farm
4KPI highlights surfaced per dashboard each monthly cycle
AutomatedDaily data ingestion from SharePoint — zero manual intervention
3 rolesFarmer · Consultant · Admin — each with scoped access
§ 01

The Problem

Agricultural advisors had no systematic way to compare a dairy farm's financial performance against its peer group. Monthly data lived in Excel files — no benchmark, no anomaly detection, no narrative. Advisors spent hours manually interpreting raw numbers and still missed early warning signs in farms trending toward credit risk.

§ 02

The Solution

Built a platform that ingests monthly farm financial and production data, computes 45+ dairy-specific metrics across every cost category, and benchmarks each farm against a configurable peer group. Advisors get interactive dashboards across rolling 3-, 6-, 9-, and 12-month windows. A KPI highlights widget surfaces the four most decision-relevant numbers on every dashboard load. An AI layer lets consultants auto-generate written summaries grounded in actual farm data — with a prompt-injection classifier gate to keep the tool focused in a regulated advisory context.

§ 02b

How it works

01
Data arrives automatically

Every night, the platform pulls the latest farm financial and production Excel files from SharePoint. No one re-uploads anything.

02
Audit before it goes live

An automated audit gate flags statistically anomalous values — net margin, milk price, grain expense — before any data becomes visible. Admins promote or reject flagged records.

03
Benchmarked dashboards

On load, 45+ metrics are computed and ranked against the farm's peer group. Advisors can filter by region or quartile. Charts update across rolling 3-, 6-, 9-, and 12-month windows.

04
AI-assisted narrative

Consultants trigger a summary in one click. The model receives the actual KPI values and writes a grounded, farm-specific narrative. A classifier gate blocks off-topic or injected queries before they reach the model.

§ 03

What I Learnt

  • 01

    Storing metric formulas as versioned Python closures in the database lets domain formulas evolve independently of code deploys — the metric catalog becomes a first-class data artifact, not hard-coded logic.

  • 02

    An audit gate before data promotion is more valuable than post-hoc anomaly alerts — catching a data entry error before it corrupts 12 months of benchmarks saves far more downstream trust.

  • 03

    A prompt-injection classifier before every LLM call matters in regulated contexts — it kept the AI feature from being repurposed as a general chatbot by users who found the interface.

  • 04

    Rolling window chart variants (R3, R6, R9, R12) are more useful than fixed-period views — advisors reason in trailing averages, not point-in-time snapshots.

§ 04

Technologies Used

FastAPIFastAPI

Async API server — dashboard, chart, ingestion, and AI endpoints

PostgreSQLPostgreSQL

Primary relational store — farms, dashboards, users, uploads

MongoDBMongoDB

Computed metric cache keyed by deterministic hash of transformer options

Redis + RQRedis + RQ

Background job queue for metric computation, audit processing, notifications

Azure OpenAIAzure OpenAI

AI summary generation and prompt-injection classification gate

LLangfuse

LLM observability — traces, prompt versions, cost tracking

Microsoft Graph / SharePointMicrosoft Graph / SharePoint

Automated nightly Excel ingestion — zero-touch data pipeline

OpenFGAOpenFGA

Fine-grained authorisation — per-dashboard viewer/editor/owner relations

PythonPython

Metric formula engine, peer group transformer, and audit service

FastAPIFastAPI
PostgreSQLPostgreSQL
MongoDBMongoDB
Redis + RQRedis + RQ
Azure OpenAIAzure OpenAI
LLangfuse
Microsoft Graph / SharePointMicrosoft Graph / SharePoint
OpenFGAOpenFGA
PythonPython
← All workWork together ↗
← PreviousVisit AgentNext →AI Mock Interview