Skip to content

Conversation

@jloria2703
Copy link
Collaborator

Sub-issue 14 — Progress on GTFS-Realtime Serialization/Deserialization

Work continued on the implementation of serialization and deserialization for GTFS-Realtime feeds.
A dedicated test suite was introduced through the GTFSRealtimeTests class, built on Python’s unittest framework. This suite validates the full encode/decode workflow for GTFS-Realtime messages and ensures correct handling of protobuf structures.

Robust error handling was added using specific exceptions such as
requests.exceptions.RequestException and DecodeError, strengthening the reliability of external feed ingestion.

The build_alerts() function was fully implemented, providing end-to-end construction of alert messages.
This includes:

  1. Building the FeedMessage in both JSON and Protobuf formats.
  2. Supporting optional GTFS-Realtime fields such as cause, effect, severity_level, and active_period.
  3. Automatically registering each generated alert in the database via FeedMessage.objects.create().

The get_service_alerts() function was rewritten to properly process real-time alert feeds.
The updated workflow includes:

  1. Structural validation of the incoming FeedMessage.
  2. Extraction of affected entities such as route_id, trip_id, and stop_id.
  3. Storing alerts in the database with their active windows, severity, and associated service metadata.

All of this moves the sub-issue forward by strengthening the encoding/decoding pipeline and preparing the ground for final validation and binary generation in later commits.

@jloria2703 jloria2703 self-assigned this Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants