Transportation Management

Bus fleet management, route planning, live GPS tracking, driver operations, and SOS alerts.

Primary manager: facilities_admin. Admin also has full access. The driver role is a dedicated new role for bus drivers — minimal web access, primary interface is the mobile app.

Core Concepts

Bus

Vehicle registration, capacity, driver assignment, insurance/fitness expiry tracking

Route

Named route with ordered stops — each stop has GPS coordinates, ETAs, and geofence radius

Student Assignment

Links a student to a route with their specific pickup and dropoff stop

Driver Trip

One trip instance with live location state and SOS flag

Driver App Flow

View Today's Trips→Start Trip→Mark Pickups→Live Location Updates→End Trip

Live Tracking & SOS

  • Driver app broadcasts GPS coordinates via Socket.IO every 10 seconds during an active trip
  • Parents see live bus location on a map for their child's assigned route
  • When student boards/exits, driver marks pickup/dropoff — parent receives instant push notification
  • If a student is not at the stop, driver marks absent — parent notified
  • SOS button on driver app broadcasts an SOS alert to the entire school room (admin)
  • SOS alert includes current GPS coordinates and driver identity
  • Admin can monitor all active trips on a live map dashboard

Socket.IO Events

EventDirectionPayload
transport:locationDriver → Server → Parents/Admin{ tripId, lat, lng, timestamp }
transport:student-statusServer → Parent{ studentId, status: pickup|dropoff|absent, stopLabel, time }
transport:sosDriver → Server → School room{ tripId, driverId, lat, lng, timestamp }
transport:trip-startedServer → School room{ tripId, routeName, busNumber }
transport:trip-endedServer → School room{ tripId, endTime }

API Routes

POST/api/transport/buses

Create a bus record

GET/api/transport/buses

List all buses for the school

POST/api/transport/routes

Create a route with ordered stops

GET/api/transport/routes/:id

Route detail with all stops and assigned students

POST/api/transport/routes/:id/students

Assign a student to a route with pickup/dropoff stops

POST/api/transport/trips

Driver starts a trip

PATCH/api/transport/trips/:id/location

Driver updates live GPS location

PATCH/api/transport/trips/:id/student-status

Driver marks pickup/dropoff/absent for a student

POST/api/transport/trips/:id/sos

Driver triggers SOS alert

GET/api/transport/trips/active

Admin lists all currently active trips

Frontend Pages

/dashboard/admin/transportTransport overview — active trips, fleet summary
/dashboard/admin/transport/busesManage buses (create, edit, assign driver)
/dashboard/admin/transport/routesManage routes and stops
/dashboard/admin/transport/studentsAssign students to routes
/dashboard/admin/transport/liveLive map with all active buses
/dashboard/driverDriver home — today's trip manifest
/dashboard/driver/trip/[id]Active trip: mark pickups, trigger SOS
/dashboard/parent/transportChild's route info and live bus map