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
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
| Event | Direction | Payload |
|---|---|---|
| transport:location | Driver → Server → Parents/Admin | { tripId, lat, lng, timestamp } |
| transport:student-status | Server → Parent | { studentId, status: pickup|dropoff|absent, stopLabel, time } |
| transport:sos | Driver → Server → School room | { tripId, driverId, lat, lng, timestamp } |
| transport:trip-started | Server → School room | { tripId, routeName, busNumber } |
| transport:trip-ended | Server → School room | { tripId, endTime } |
API Routes
/api/transport/busesCreate a bus record
/api/transport/busesList all buses for the school
/api/transport/routesCreate a route with ordered stops
/api/transport/routes/:idRoute detail with all stops and assigned students
/api/transport/routes/:id/studentsAssign a student to a route with pickup/dropoff stops
/api/transport/tripsDriver starts a trip
/api/transport/trips/:id/locationDriver updates live GPS location
/api/transport/trips/:id/student-statusDriver marks pickup/dropoff/absent for a student
/api/transport/trips/:id/sosDriver triggers SOS alert
/api/transport/trips/activeAdmin 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