← All work

Vehicle telemetry automation: the driving log that keeps itself

An automation pipeline that pulls a vehicle's telemetry into a database, sorts every drive into business, commute or personal, and produces the monthly mileage and reimbursement report. It replaced a recurring monthly job of going through trips by hand. Built and run by Agentas.

Status
Logging since April 2026; current app live since September 2026
Type
Data pipeline and web app on our own server
Stack
Python, Flask, PostgreSQL, SQLite, Docker
Source
Private — walkthrough on request
Vehicle telemetry monthly breakdown
The monthly breakdown of business kilometres and reimbursement, above the classified trip list. Places are blurred.

What it does

Every drive, recorded automatically

A self-hosted, open-source logger records each drive from the vehicle's telemetry into PostgreSQL. Our app only reads from it, and keeps its own decisions in a separate SQLite database.

Places drawn on a map

The home office and client sites are geofences placed on a map. Each drive's GPS start and end is matched against them, so moving or adding a place re-tags the whole history at once.

Rules decide the trip type

Rules link each place to a trip type and purpose: a drive between the home office and a client site is a business trip. A manual correction always wins, and only corrections are stored; everything else is computed live.

Track the next drive

One tap marks the next drive, or every drive in the next few hours, as business. A background process tags the matching drives once they finish, and the same trigger can come from the smart-home system.

Stops, detours and gaps handled

A drive with a stop on the way counts as one trip. The direct distance per route is learned from past drives, so detours show up as extra km. If the logger misses an arrival, it is inferred from the next departure, and the distance is never made up.

Monthly report and export

Business km and the reimbursement per month, plus the number of commute days for the travel deduction. Everything is exported to a spreadsheet as a backup, and drives the logger never recorded can be added by hand with a note.

Relevant if you're looking for…

This is an internal tool we use ourselves, and we build the same kind of system for other businesses.

  • An automatic mileage log: every drive is recorded on its own from the vehicle's telemetry, and its start and end are matched against places you draw on a map.
  • Telling business trips from personal driving: rules link each place to a trip type, so a drive between the home office and a client site counts as business, and a manual correction always wins.
  • Mileage reimbursement, month by month: the report shows business kilometres and the reimbursement, plus the number of commute days for the travel deduction.
  • An alternative to tracking mileage in a spreadsheet: trips sit in a table with sort, filter and show/hide on every column, and everything is exported to a spreadsheet as a backup.

We build this for clients: Custom software and internal tools · AI automation of manual work

How it works

  1. 01

    Record

    The logger stores every drive from the vehicle's telemetry.

  2. 02

    Match

    GPS start and end matched to the places on the map.

  3. 03

    Classify

    Rules and manual triggers set business, commute or personal.

  4. 04

    Report

    Monthly km and reimbursement, exported as a backup.

How it's built

The app is Python and Flask with a little plain JavaScript and no build step. It runs as two containers from one image: the web app, and a reconciler that applies armed triggers to finished drives. It reads the logger's PostgreSQL database read-only and writes only to its own SQLite file, so the vehicle data is never changed.

The logic that decides money, such as trip grouping, trigger matching, geofence matching and the reimbursement sum, is written as pure functions and covered by unit tests. A push to the main branch deploys through GitHub Actions over a private network, and the run fails if the new version does not pass its health check.

Engineering highlights

  • Vehicle data is only read; decisions live in a separate database
  • Kilometres are never invented: a missing arrival is inferred, the recorded distance kept
  • Unit tests on trip grouping, matching and reimbursement
  • Push-to-deploy with a health-check gate
  • Trip table with sort, filter and show/hide on every column
  • Runs on our own server, reachable only on our private network

Questions

Can a driving log keep itself?

Mostly, yes. Here every drive is recorded from the vehicle's telemetry, sorted by rules for places and purposes, and summed in a monthly report. A person only corrects the edge cases, and only the corrections are stored.

How does an automatic mileage tracker tell business from personal trips?

In this system the home office and client sites are geofences drawn on a map, and rules link each place to a trip type. One tap can also mark the next drive, or every drive in the next few hours, as business.

Can you build something like this for our company?

Yes. We build the same kind of automation for recurring admin work: collect the data you already have, keep the rules that decide money in tested code, and let a person correct the edge cases. The source is private, but we are happy to give a walkthrough.

Want something like this?

Small, recurring admin jobs are often the easiest to automate well: collect the data you already have, keep the rules that decide money in tested code, and let a person correct the edge cases.

Get in touch

← All work · Software & AI for businesses