I want to share a story about a system I built for a transportation company that had about 100 trucks and 90 drivers. The goal was not just to make some charts, but to build a tool that would show exactly what was happening with the fleet in real-time.
Some people ask why I used R for a live tracking system. At that time, R Shiny was a great choice because it lets you build “reactive” web apps. This means the map and the UI update automatically whenever the data changes. I wasn’t just looking at old files; I was connecting to external APIs to get live data from the trucks.
The Human Problem
Before I wrote any code, I sat down with the dispatchers to understand their day. Their job was very stressful. They were managing 100 moving trucks and they often had to call drivers on the phone just to ask where they were or why they were late. They didn’t need a complex “analytics” report; they just needed to know what was happening right now.
My goal was to stop this stress. I wanted to take the noisy data from the GPS and engine sensors and turn it into a clean map that answered their questions before they had to pick up the phone.
The Normalization Challenge
The hardest technical part was that the fleet was split between two different companies for the hardware, Scania and STG. Each company had its own API and its own way of sending data. For the dispatchers, this was a mess because they had to log into different websites just to see all their trucks.
I had to build what I call a “normalization layer.” Basically, I wrote code to clean and format the data from both Scania and STG so it looked the same. This way, the dashboard could show every truck in the same place, and the dispatchers didn’t have to care which hardware was inside the truck.
From Signals to State
Once the data was in one place, the challenge was to turn raw numbers into “business state.” A truck is not just a point on a map. I wanted the system to know if a truck was “Driving,” “Loading,” or “Idling.”
I built a pipeline that checked the GPS coordinates against “geofencing” zones, which are just virtual boundaries around depots or customer sites. If a truck was standing still with the engine on outside of a depot, the system would flag it as a waste of fuel. This moved the hard work from the human dispatcher to the computer.
The Result
I deployed the final app using Docker so it was easy to host. It allowed the team to see their entire operation on one screen. We built the map in French for the local team, and we used different layers to hide the noise. We had a layer for the fleet density, and a very important layer for “Inactive” units. A manager could just look at the screen and immediately see which trucks were not being used.
This changed how the office worked. Instead of calling drivers to ask “Where are you?”, they could see the truck was at the warehouse and ask “How is the loading going?” This made the communication much more reliable and the whole team felt more in control.