TopN Analytics
Success Story

A Configurable Rules Engine for Driver Settlements and Bad-Debt Detection

A leading pan-India fleet management company that leases vehicles to driver-partners.

Challenge

Where things stood

Fleet management companies that lease vehicles to driver-partners must reconcile a constantly-moving set of charges — weekly rent, trip earnings, penalties (late payment, vehicle damage, unauthorized usage), deposits, and adjustments — into a single running statement, and need to know when a driver has stopped paying and disappeared while still owing money.

Doing this with hardcoded logic becomes fragile as the underlying rate structure and adjustment types evolve: new penalty or adjustment categories inevitably appear as the business changes, and rigid systems either break or silently miscategorize them.

Architecture

What we built

MySQL operational data (penalties, adjustments, deposits, payments) feeds a PostgreSQL analytics warehouse.

A rules-engine layer uses an embedded analytical engine for the join-heavy weekly bad-debt computation, producing weekly settlement and bad-debt tables, with a human-in-the-loop sheet for recording manually-negotiated write-offs.

Solution

How it works

TopN Analytics built a configuration-driven settlement rules engine — internally called 'Hissab,' the company's term for a driver's account statement — that reads pricing and adjustment rules from a database table rather than hardcoding them, automatically creating a new category the first time it encounters an adjustment type it hasn't seen before, rather than failing.

On top of this settlement layer, TopN built a bad-debt detection pipeline with a precise, auditable formula: a driver is flagged when their outstanding balance generated no new charges the following week (a sign of inactivity) while their projected balance — outstanding amount plus deposit, net of recorded recovery — remains negative.

Key Takeaways

What we delivered and learned

The bad-debt formula is explicit and auditable rather than a black box — a driver only counts as bad debt if they are both inactive and carrying a net-negative projected balance, avoiding false positives on drivers simply between allocations.

The rules engine's self-extending category taxonomy means new penalty or adjustment types don't require an engineering change to be captured correctly.

Tech Stack

What it's built on

Want the full picture?

We're happy to walk through the details, numbers, and trade-offs directly.