8000 Add VIA Rail (Canada) coverage area by Kai-Goodall · Pull Request #3 · trainiac-hq/docs · GitHub
[go: up one dir, main page]

Skip to content

Add VIA Rail (Canada) coverage area - #3

Open
Kai-Goodall wants to merge 1 commit into
trainiac-hq:masterfrom
Kai-Goodall:add-via-rail-coverage
Open

Kai-Goodall wants to merge 1 commit into
trainiac-hq:masterfrom
Kai-Goodall:add-via-rail-coverage

Conversation

@Kai-Goodall
Copy link
Copy Markdown

Hey! This adds VIA Rail (Canada) as a new coverage area that speaks the existing /v1 contract exactly — same envelope, same v1.d.ts types, same endpoints — just pointed at Canadian passenger rail.

It's completely isolated. Everything lives in a single new via/ folder. No existing files are touched (your README.md, openapi.v1.json, v1.d.ts, MIGRATING.md, examples/ are all untouched), and there are no new CI/workflows, so merging can't break anything already here.

What it does

Serves all ten /v1 endpoints for VIA — departures, journey (direct + changes), train, stations, activity, delays, cancellations, summary, status, index — built from VIA's own open feeds:

  • Live tracker (tsimobile.viarail.ca/data/allData.json) → actuals, positions, delays, activity
  • GTFS (viarail.zip) → the 387-station registry, forward timetable, journey planning, counts

Notes

  • Zero runtime dependencies. Runs on Node 22+ with no build step: cd via && node src/server.ts.
  • Contract-proven: 33 tests, including strict validation of every response against openapi.v1.json. npm --prefix via test.
  • Correctness: multi-day trains (the Canadian runs 4 days) and all six time zones are materialised and verified to the minute against the live feed.
  • Known divergences (documented in via/README.md): status.feeds is hard-coded to {trust, td, darwin} in the contract, so VIA's tracker maps onto trust and the other two report unknown; platforms are always unknown (no VIA source); cancellations come from service alerts.
  • via/ vendors a copy of v1.d.ts and openapi.v1.json so the module is self-contained — happy to de-dupe against the repo root if you'd rather.

Totally your call on placement

I wasn't sure if you'd prefer this as its own repo (e.g. trainiac-hq/via) rather than living inside docs. If so, say the word and I'll move it — this PR is just the easiest way to hand it over for review. No pressure to merge as-is.

🤖 Generated with Claude Code

A self-contained service that serves live Canadian passenger rail in the
exact Trainiac /v1 shape, built from VIA's open feeds (live tracker + GTFS).
Lives entirely in via/; no existing files are touched.

- All ten /v1 endpoints, same envelope and v1.d.ts types
- Live tracker for actuals/positions/delays, GTFS for schedule/journeys
- Multi-day trains and all six time zones materialised correctly
- Zero runtime dependencies; runs on Node 22+ with no build step
- 33 tests incl. strict validation against openapi.v1.json

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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

0