The problem
Service businesses pay staff per kilometre for travel and bill customers for hours on site. Both figures usually come from logbooks, so people have to remember every trip, the office has to reconcile it, and disputes come down to one person's memory against another's.
Phone GPS looks like the obvious fix, but the raw signal lies. A parked phone drifts around its true position, and a single bad fix can jump a kilometre in a second. Add those distances up and the business pays for kilometres nobody drove.
What I built
Staff start a trip on their phone and the app records the route, then times the on-site work, using a screen wake-lock so the timer keeps running. Admins see who is travelling or on site right now, approve or correct trips, set per-staff ₹/km and ₹/hour rates, and export date-range payout reports to CSV.
Decisions that matter
- The server decides what counts
- Phones report what the GPS says and the server turns raw points into a trusted distance. The rules stay the same on every device and improve without an app update.
- Rates are frozen onto each trip
- A rate change only affects future trips. A payout report from three months ago still says what it said then, because its numbers were captured when each trip happened.
- Dead zones lose nothing
- Points are buffered on the device and sync when the network returns, so a drive through patchy coverage still produces a complete trip.
- A person has the final say
- Filtering can't be perfect, so admins review and correct trips when a reading is off. Every figure traces back to a distance, a time and the rate that applied.
- Tracking stops at the job
- Capture runs only during trips that staff start themselves. It records work travel, not a person's day.
- The filter is a pure function
- It takes a sequence of points and returns a distance, so each noise pattern can be tested with synthetic data in milliseconds instead of a test drive.
Where it stands
Live in production and used to calculate real payouts.
Why rates are frozen onto trips
Raise today's rate. Past payouts must not move.
| Sample trip | Distance | Rate that day | Snapshotted payout | If rates were looked up live |
|---|---|---|---|---|
| March trip | 42.6 km | ₹8/km | ₹341 | ₹511 |
| June trip | 18.2 km | ₹8/km | ₹146 | ₹218 |
| October trip | 30.5 km | ₹10/km | ₹305 | ₹366 |
Sample figures, to show the behaviour. They aren't real trips or rates.