Skip to content
Allan Nuwamanya
Back to engineering archive
Systems & Backend

SchoolRun Geo-Logistics

School commute logistics backend with Haversine routing and PostGIS

Geo-logistics service powering student commute coordination, driver route optimization, and live event-stamped trip manifests. Built with Django REST Framework, PostGIS spatial queries, Haversine nearest-neighbour algorithms, and nightly Celery manifest generation.

CategorySystems & Backend
LinksSource
StackDjango REST, Python
ScaleHaversine Engine

The Challenge

Real-time GPS socket streaming from dozens of school vans across fluctuating cellular networks in Kampala causes excessive battery drain and drops connection constantly, leaving parents blind to pickup statuses.

Architecture & Solution

Replaced fragile continuous socket streams with an event-driven GPS checkpoint architecture. Drivers check in at milestone waypoints; the Haversine engine calculates remaining route distance and estimated arrival, and Celery workers generate nightly optimized manifests.

Engineering Decisions

  • PostGIS Spatial IndexingLeveraged PostGIS spatial geometry indexes for ultra-fast point-in-polygon queries and student pickup cluster calculations.
  • Nightly Celery ManifestsAutomated overnight route generation using Celery workers with Redis, ensuring drivers have cached offline-ready manifests before morning runs begin.

Outcomes

  • Rock-solid delivery reliability over 3G/4G cellular connections
  • Zero battery drain issues on driver Android devices