Introducing a new way to review your PRs.

Read the announcement

nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.

View on GitHub

20 documents · Updated Nov 6, 2026

docs / venue-and-transport-tools

Venue and transport tools

The venue and transport tools help students find teaching rooms, check when rooms are free, locate rooms on campus maps, and view campus shuttle arrivals. Venue schedules come from the semester data service. Room locations and shuttle stops provide the map context around those schedules. See Campus tools for the wider set of campus features.

Venue discovery

Venue discovery connects a semester's room timetable with searchable room names and campus location data. The /venues page is the main entry point. It shows a room list and opens the selected room's details beside or above the list depending on the screen size.

The venue search matches each search term against the venue code and its known room name. Results are sorted in a stable, human-friendly order and grouped by their first letter. The search URL keeps the query and selected venue so a result can be shared or revisited.

References: website/…/VenuesContainer.tsx• L141-176 website/…/VenuesContainer.tsx• L310-337 website/…/VenueList.tsx• L21-60 website/…/venues.ts• L30-50

Venue details

Selecting a venue shows its room name, floor, map position when available, and a timetable of lessons held there. The timetable can lead to the related module page, which connects room use with the module information described in the module prerequisite explorer.

References: website/…/VenueDetails.tsx• L29-57 website/…/VenueDetails.tsx• L85-97 website/…/VenueLocation.tsx• L79-120

Room availability

Room availability turns the timetable for each venue into a free-room search. A user selects a school day, a start time, and a duration. The tool keeps only rooms with no occupied half-hour slot in the requested period.

Availability criteria

The search offers every school day from Monday through Sunday, start times from 8:00 through 22:00, and a duration that ends within the school day. Its initial day and time follow the current date and hour, with hours outside class time moved to the earliest class hour. Rooms used for occasional lessons but not intended as general teaching rooms are excluded from free-room results. When filtering hides otherwise matching rooms, the page offers a way to show all rooms again.

References: website/…/AvailabilitySearch.tsx• L17-34 website/…/AvailabilitySearch.tsx• L49-97 website/…/venues.ts• L52-88 website/…/VenuesContainer.tsx• L241-261

Availability context

The selected availability period is also passed to the room timetable as a highlighted period. This lets the user compare the free-room result with the lessons around the requested time. The search choices remain in the URL, so the room result and its time window travel together.

References: website/…/VenuesContainer.tsx• L163-189 website/…/VenueDetails.tsx• L89-95

The venue search flow combines semester schedule data with room search and location data as shown below.

flowchart LR
    A[Semester venue information] --> B[Venue search]
    B --> C{Availability enabled?}
    C -- No --> D[Matching venue list]
    C -- Yes --> E[Free-room filter]
    E --> D
    D --> F[Selected venue timetable]
    F --> G[Room location map]

Campus location maps

Campus location data gives a venue a human-readable room name, an optional floor, and an optional map point. A venue can still appear in search when its location data is missing. The detail view then explains what is missing and offers a way to improve the record.

Location data

The location map is loaded from a cached service backed by the project's venue data. The app uses a bundled copy when the service cannot be reached. This keeps room details usable during a service outage while allowing corrected location data to reach users without a full schedule change.

References: website/…/venues.ts• L39-43 website/…/venues.ts• L78-79 website/…/github.ts• L36-59 website/…/withVenueLocations.tsx• L41-71

Map context

A mapped venue is shown on an OpenStreetMap base map with an option to open the point in Google Maps. The same map also displays campus bus-stop markers, so a room location and nearby shuttle information share one geographic view.

References: website/…/VenueLocation.tsx• L79-109 website/…/LocationMap.tsx• L26-66

Location feedback

Users can report a missing or incorrect room name, floor, or map point through the venue detail view. The form requires a map change before submission and sends the proposed room data to the venue feedback service. Map features such as building outlines or walkways are sent to OpenStreetMap instead of the venue data channel.

References: website/…/FeedbackModal.tsx• L36-73 website/…/ImproveVenueForm.tsx• L116-148 website/…/ImproveVenueForm.tsx• L267-325

Campus shuttle data

Campus shuttle data supplies the transport layer of each venue map. Static stop records provide coordinates, display names, stop codes, route associations, and links to opposite stops. The map uses those records to show clickable stop markers and route labels.

Bus routes and stops

The stop data is the display model for the shuttle map. Each stop identifies the routes that serve it, while route names use a shared form that can distinguish campus routes from public routes. The route list also provides the known campus route names used by route-name checks and data validation.

References: website/…/venues.ts• L47-67 website/…/bus-stops.json• L1-40 website/…/bus-routes.json• L1 website/…/venues.ts• L104-120

Stop map behavior

Each stop marker opens a separate arrival panel. Stop data is kept apart from live timing data, which allows several open stop panels to show their own loading, result, or error state at the same time. A restricted map-edit mode can move stop coordinates for data maintenance without changing the normal student view.

References: website/…/BusStops.tsx• L17-38 website/…/BusStops.tsx• L115-177 website/…/venues.ts• L81-87

NextBus arrivals

NextBus is the live transport integration for shuttle arrival times. It queries the NUS NextBus service for one stop at a time and converts the service response into route-keyed arrival data for the stop panel.

Arrival requests

Opening a stop panel starts a request for that stop's code. The result contains the next two arrival values for each route. Numeric values are shown in minutes. The service can also report Arr for an arriving bus or - when no numeric time is available.

References: website/…/nextbus.ts• L21-41 website/…/ArrivalTimes.tsx• L30-49 website/…/ArrivalTimes.tsx• L51-67

Arrival refresh

Arrival data is on-demand rather than part of the initial venue or map data load. A user can refresh one stop while the last result remains visible during the request. A failed request shows an error and a retry action for that stop.

References: website/…/BusStops.tsx• L85-113 website/…/ArrivalTimes.tsx• L30-45 website/…/ArrivalTimes.tsx• L72-82

The transport flow keeps stable campus data local and requests only the live information needed by an opened stop.

sequenceDiagram
    participant User
    participant Map as Venue map
    participant NextBus as NUS NextBus service

    User->>Map: Open bus-stop marker
    Map->>NextBus: Request arrivals for stop code
    NextBus-->>Map: Route arrival values
    Map-->>User: Show next two arrivals
    User->>Map: Refresh stop
    Map->>NextBus: Request current arrivals again

Data boundaries

The tools use different freshness rules for different kinds of data. This split keeps the semester room schedule tied to the selected academic period while location and transport data serve the map and live stop panels.

Data sources

The main data boundaries are:

  • Venue schedules: semester-specific venue information from the NUSMods API.
  • Venue locations: shared venue records from the GitHub-backed service, with bundled fallback data.
  • Bus stops and routes: bundled campus map data.
  • Bus arrivals: live, stop-specific responses from the NUS NextBus service.

References: website/…/nusmods.js• L50-69 website/…/github.ts• L36-59 website/…/VenuesContainer.tsx• L389-407 website/…/BusStops.tsx• L10-17 website/…/nextbus.ts• L5-32

Feature relationships

Venue details provide the room timetable and map context. The map adds transport access around that room. The room timetable remains a separate view from timetable optimisation, but its lesson data gives engineers a useful point of comparison when tracing schedule-related behavior in timetable optimisation.

References: website/…/VenueDetails.tsx• L36-50 website/…/LocationMap.tsx• L53-65 website/…/Routes.tsx• L28-39

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the venue information shape must preserve the day availability and half-hour occupancy contract used by both the free-room filter and the room timetable.
  • Changes to venue availability controls must preserve valid Sunday selection, class-hour bounds, and durations that end within the school day.
  • Changes to venue location keys or coordinates must preserve the lookup from venue code to room display data and map position.
  • Changes to bus-stop codes must remain valid for both the stop marker lookup and the NextBus request parameter.
  • Changes to route names must keep route labels, public-route handling, and arrival rows consistent.
  • Changes to the live arrival response must preserve the numeric, Arr, and - values expected by the arrival display.
  • Changes to map loading or venue data fallback must keep the venue detail view able to distinguish missing data from a failed data request.

Important failure modes

TriggerConsequenceGuard
Venue schedule data cannot loadThe venue page cannot build its search resultsThe page shows a venue-information API error with retry support
Venue location service cannot loadRoom search still works but map details depend on the bundled copyThe location loader falls back to bundled venue data
A venue has no location record or map pointThe room has no usable map pinThe detail view shows a clear missing-location state and a feedback path
A NextBus request failsOne stop has no current arrival timesThe stop panel shows an error and a retry action
A NextBus response contains an unknown time valueThe arrival result is rejected instead of being shown as a false timeThe response adapter accepts only minutes, Arr, or -
A requested room interval contains an occupied half-hour slotThe room is excluded from free-room resultsAvailability checks every half-hour slot in the requested duration

Key files

FileWhy to read it
website/…/VenuesContainer.tsxMain venue page flow from loading and URL state through search, availability, and selection
website/…/AvailabilitySearch.tsxAvailability controls and their default school-day and time choices
website/…/venues.tsSearch, free-room, class-hour, and route-name rules
website/…/VenueDetails.tsxRelationship between a selected room, its timetable, its location, and its module links
website/…/VenueLocation.tsxRoom location states and the map or feedback entry points
website/…/LocationMap.tsxShared map context for room markers, shuttle stops, and external map links
website/…/BusStops.tsxCampus stop markers and per-stop live timing state
website/…/ArrivalTimes.tsxUser-facing arrival values, refresh behavior, and error handling
website/…/nextbus.tsBoundary between the NextBus service response and the app's arrival model
website/…/github.tsVenue location loading, caching, and bundled fallback behavior
website/…/nusmods.jsSemester venue-information endpoint used by the venue page
website/…/venues.tsShared shape for venue schedules, locations, stops, and arrivals
website/…/bus-stops.jsonCampus stop coordinates, names, opposite stops, and route associations
website/…/venues.jsonBundled venue location data used as the local fallback