Repository navigation
Archive MAX seat flags daily on a public data branch - #4
Merged
Merged
Conversation
The SNCF feed only shows today's seats, so seat odds need history. A daily workflow saves one gzipped snapshot per day to the data branch, each service stored once with a flag per day, and never overwrites a day.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: the SNCF feed only shows today's MAX seats, so the seat history is gone each day.
After: a daily workflow saves one snapshot per day to the public
databranch (archive/max/YYYY/YYYY-MM-DD.json.gz). Once a couple of months have built up, seat odds can be computed from it by weekday, departure time and days before travel.How:
scripts/archive-max.tsstores each service (origin, destination, train, departure) once, with one character per day of the feed window (1free,0full,.not running), and gzips it. The workflow runs at 14:00 UTC, after the 13:30 publish. It creates the orphandatabranch on its first run, and never overwrites a day that's already archived. The format is indocs/archive.md. Nothing in the shared build code changes.Tested with unit tests on the fixture, plus two simulated workflow runs against a local remote. The first run created the branch and the snapshot. The second left the day as it was.
Replaces #2, which was the same change on a different branch name.
Generated by Claude Code