Skip to content

GTFS static schedule > generate from past > use last service date to avoid missing 1st day of "generated" next schedule#97

Merged
mmathieum merged 2 commits intomasterfrom
mm/fix_gtfs_schedule_from_last_no_srv_today_but_early_1st_day_of_service
Mar 22, 2026
Merged

GTFS static schedule > generate from past > use last service date to avoid missing 1st day of "generated" next schedule#97
mmathieum merged 2 commits intomasterfrom
mm/fix_gtfs_schedule_from_last_no_srv_today_but_early_1st_day_of_service

Conversation

@mmathieum
Copy link
Member

@mmathieum mmathieum commented Mar 22, 2026

Example:

  • for express route Mon-Fri, on Sunday morning (last day of current schedule) was showing next departure on Tuesday instead of Monday because it was using XML *gtfs_rts_last_departure_in_sec instead of SQL MAX(service_dates.date).

…avoid missing 1st day of "generated" next schedule
@mmathieum mmathieum self-assigned this Mar 22, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the GTFS static schedule generation and lookup process to ensure data integrity, particularly when retrieving past schedules. The primary goal is to prevent scenarios where the initial days of a schedule might be overlooked by correctly leveraging the 'last service date' as a boundary for historical data queries. Additionally, it introduces more detailed logging for database deployment steps, which will aid in performance analysis and troubleshooting.

Highlights

  • GTFS Schedule Generation Logic: Implemented a mechanism to prevent missing the first day of a generated GTFS static schedule by incorporating the 'last service date' into the lookup process for past schedules. This ensures that when looking backward in time for schedule data, the system does not query dates beyond the known operational period, thus avoiding data gaps.
  • Improved Database Deployment Logging: Enhanced the logging for database table initialization during deployment, providing more granular duration tracking for each table. This allows for better performance monitoring and debugging of the database setup process.
  • Code Refinements and Readability: Applied minor code style improvements, including updating for loops to forEach where appropriate and simplifying log messages by importing a constant for the database name, contributing to cleaner and more maintainable code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mmathieum mmathieum marked this pull request as ready for review March 22, 2026 18:45
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a fix for GTFS static schedule generation by using the last service date to prevent missing the first day of a new schedule. It also includes logging improvements for database deployment and some code style enhancements. My review focuses on improving the new logic by reducing code duplication and refining exception handling for better maintainability and robustness.

@mmathieum mmathieum merged commit e8b81cc into master Mar 22, 2026
4 checks passed
@mmathieum mmathieum deleted the mm/fix_gtfs_schedule_from_last_no_srv_today_but_early_1st_day_of_service branch March 22, 2026 18:58
mmathieum added a commit to mtransitapps/ca-montreal-stm-bus-android that referenced this pull request Mar 22, 2026
…m past > use last service date to avoid missing 1st day of "generated" next schedule mtransitapps/commons-android#97
montransit added a commit to mtransitapps/mtransit-for-android that referenced this pull request Mar 22, 2026
… from past > use last service date to avoid missing 1st day of "generated" next schedule mtransitapps/commons-android#97
montransit added a commit to mtransitapps/ca-montreal-stm-subway-android that referenced this pull request Mar 22, 2026
- commons: Enable GTFS RT Trip Updates FF mtransitapps/commons#615
- commons: CI > record screenshot > fix TZ/xmllint
- commons-android: GTFS static schedule > generate from past > use last service date to avoid missing 1st day of "generated" next schedule mtransitapps/commons-android#97
- commons-android: Increment database version for service updates
- commons-android: Fix duplicate service updates from STM API mtransitapps/commons-android#96
- commons-android: STM.info > brand new API > bump DB version
- commons-android: logs++
- commons-android: needed
- commons-android: fix debug
- commons-android: screenshot emulator time format
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.

1 participant