ProductTransport

Transport

One-line: Run the school’s bus operations end to end — fleet, routes and stops, drivers and staff, student enrollments, and per-route transport fees.

What it does

Transport gives a school one place to manage everything about getting students to and from campus:

  • Buses — the fleet, with registration number and seat capacity.
  • Routes and stops — named routes (e.g. “North Route”), each with an ordered list of stops that carry pickup and drop times.
  • Drivers and staff — drivers (license, phone) and additional staff/helpers (conductors) assigned to buses.
  • Student enrollments — which student boards which route at which stop, for pickup, drop, or both.
  • Fee plans — a transport fee per route (monthly or annual) that feeds the fees module.

It also surfaces a dashboard summary, schedule exceptions (cancelled / delayed / alternate bus), conflict checks, and a printable contact sheet for drivers.

Who uses it

  • Transport admin (admin-web) — the full desk: create buses, routes, stops, drivers and staff, enroll students, set fee plans, and read the dashboard at the /transport page.
  • Mobile transport-admin — a read-focused companion (dashboard, routes, buses, drivers, enrolment) with light actions for on-the-go checks.

Key concepts

  • Bus — a vehicle with a name, registration, and student capacity.
  • Route — a named path a bus runs; owns its stops and enrollments.
  • Stop — an ordered point on a route with pickup and drop times.
  • Driver — the person driving a bus (license, contact phone).
  • Helper / staff — a conductor or extra staff member assigned to a bus.
  • Student enrollment — a student tied to a route and stop (pickup, drop, or both).
  • Transport fee plan — the charge for using a route, billed monthly or annually.

How it works

1. Define routes and their ordered stops (pickup/drop times).
2. Assign a bus and a driver (and any helper/staff) to each route.
3. Enroll students onto a route + stop; capacity is checked as they join.
4. Attach a fee plan per route so transport charges flow into fees.
5. Handle day-to-day exceptions (cancelled, delayed, alternate bus).

On mobile the transport admin mostly reads the same data (dashboard, routes, buses, drivers, enrolment) plus a few light actions; the full desk work happens on admin-web.

Rules & edge cases

  • Plan-gated — the module requires the transport plan feature; without it the endpoints return a feature error.
  • Tenant scoping — every record is scoped to the school; a student and route must belong to the same tenant before enrollment is allowed.
  • Driver/helper overlap prevention — a bus assignment rejects double-booking: one active assignment per bus, and no driver or helper already assigned to another bus for an overlapping period.
  • Capacity race — enrolling checks route capacity against bus seats under a row lock, so two concurrent enrollments can’t overfill a bus.
  • Safe phone calls on mobile — driver/parent numbers are handled through the device’s dialer safely rather than dialing automatically.

Where it lives

  • Backend: server/modules/transport/ (models.py, routes.py)
  • Admin-web: transport pages under /transport (admin-web/src/components/transport/, transportService.ts)
  • Mobile: the transport-admin module in the mobile client
  • Plan key: transport