Skip to content

Feature: GTFS Frequencies Phase 3 (API Integration & Handlers) #666

@3rabiii

Description

@3rabiii

This issue tracks Phase 3 (the final phase) of the GTFS Frequencies implementation.
With Phase 1 (Storage/DB) and Phase 2 #582 (Core Logic & Helpers) already merged, this phase focuses entirely on wiring the frequency data into the API Handlers and Response Models.

Implementation

Part 1: Models & Core Handlers

  • stop_time_schedule.go: Implement ScheduleFrequency struct and update slices.
  • trip_details_handler.go: Populate Frequency, TripStatusForTripDetails.Frequency, and Schedule.Frequency.
  • trips_helper.go (BuildTripSchedule): Populate Schedule.Frequency.
  • arrivals_and_departure_for_stop.go: Populate Frequency and adjust predicted times based on headways for exact_times=0.
  • trip_for_vehicle_handler.go: Populate frequency for the vehicle's active trip.

Part 2: Batch Queries & Schedule Handlers

  • schedule_for_stop_handler.go: Build ScheduleFrequencies using the new struct. Expand stop times for exact_times=1.
  • schedule_for_route_handler.go: Include frequency data per-trip-direction group.
  • trips_for_route_handler.go: Populate *int64 headway field using batch query to avoid N+1.
  • trips_for_location_handler.go: Populate using batch query and update time-window filtering logic for active frequency windows.

Testing Requirements

  • Create createTestApiWithFrequencyData(t) fixture helper.
  • Add subtests for trip_details_handler_test.go.
  • Add subtests for trips_for_route_handler_test.go & trips_for_location_handler_test.go.
  • Add subtests for schedule_for_stop_handler_test.go.
  • Add subtests for arrivals_and_departure_for_stop_test.go.
  • Verify standard regression suite passes perfectly with normal (non-frequency) data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions