Skip to content

Conversation

@jloria2703
Copy link
Collaborator

Summary

This PR adds the documentation required for Sub-issue #18 by incorporating minimal producer and consumer patterns for GTFS-Realtime feeds.
The examples are drawn from existing modules in the project (test_realtime.py, stream_mbta_feeds.py, and regenerate_fixtures.py) to ensure alignment with the actual implementation.
The new material was added to the existing README.md under the section titled “Minimal Producers & Consumers (GTFS-Realtime)”.


Additions to Documentation

Producer Snippets

The README now includes examples illustrating how a FeedMessage is constructed, populated, and serialized to Protobuf.
The snippets show:

  • creation of the message header
  • adding an entity and associated TripUpdate
  • constructing a StopTimeUpdate
  • serializing the message with SerializeToString()
  • the use of the deterministic producer from build_trip_updates_bytewax()

These examples demonstrate the minimal pattern required to publish GTFS-Realtime messages.

Consumer Snippets

Examples were added showing how GTFS-Realtime feeds are consumed, including:

  • fetching a feed from a remote source (MBTA streamer)
  • decoding a .pb file using ParseFromString()
  • processing the resulting FeedMessage

These patterns represent the minimal structure needed to ingest GTFS-Realtime messages.

Error Handling Patterns

The documentation now includes the error-handling approaches already used in the codebase, including:

  • network request validation (raise_for_status())
  • general exception handling during ingestion
  • Protobuf parsing errors triggered by malformed binaries
  • structural checks such as header verification and entity presence

These patterns provide contributors with practical references for building resilient ingestion flows.

Reference Links

Relevant specification and binding resources were added to the README:

  • GTFS-Realtime Specification
  • Google Protocol Buffers documentation
  • SIMOVILab Contribution Guidelines
  • Bytewax reference documentation

Acceptance Criteria

  • Producer and consumer snippets were included.
  • Error handling patterns were documented.
  • Links to official specifications and bindings were added.

Additional Notes

A new CONTRIBUTING.md document was created to formalize branch naming conventions, commit standards, testing instructions, and documentation expectations.
This ensures consistency across future contributions.

@jloria2703 jloria2703 self-assigned this Nov 24, 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