First public release. Download, inspect, and filter Swiss national NeTEx
timetable packages from opentransportdata.swiss.
Added
- CLI binary
swiss-netexwithhelp,version,download,operators,
lines,filter, andextract download— resolve the latest (or year-pinned) national NeTEx zip via the
public catalog + dataset page HTML, stream to disk, cache under
~/.cache/swiss-netex(override with--cache-dir/--force)operators/lines— discovery tables from RESOURCE / SERVICE only
(TSV when piped; aligned columns on a TTY). Optional--operator/
--linefilters onlines. Omit--fromto download/cache first
(-y/-d/-c/-f, same rules asextract)filter— operator/line filter for a local zip or directory package:
streaming SERVICE + TIMETABLE passes, transitive RESOURCE / SERVICE /
SITE / SERVICECALENDAR / COMMON rewrite, drop empty timetable shards,
README.txtin the output zipextract— download (when--fromomitted) + filter in one command- Operator aliases: GO number,
ch:1:Operator:*, SBOID, ShortName
(repeatable--operator= union). Line aliases: PublicCode, id, SLNID,
ShortName, Name. With explicit--line, journeys must carry a matching
LineRef(operator-only fallback only when no line filter is set) - COMMON connection entities (
JourneyMeeting,InterchangeRule) kept only
when every tracked journey/stop/line ref still resolves in the package - Bare
-ostem without extension becomesstem.zipfor filter/extract;
existing directories / trailing/still get the default*_op-….zip
name inside - National-scale streaming: short-lived fork workers for TIMETABLE shards
and support frames, parent byte pre-scan to skip empty shards, streamed
kept-journey bodies, non-DOM COMMON scanner - Env knobs:
SWISS_NETEX_TT_WORKERS(default CPU count;1= serial),
SWISS_NETEX_TT_BATCH(default 1 shard/child),SWISS_NETEX_NO_FORK=1 SwissNetex::Package,ResourceFrame,Operators,Lines,Filter,
Download,Extractlibrary entry points- Minitest suite (fixture packages only; no national zip in CI), GitHub
Actions CI + tag publish gated on test/lint, minimal RuboCop, RubyGems
trusted-publish on version tags rake publish VERSION=x.y.zdates CHANGELOG, verifies, tags, and pushes;
the tag workflow creates the GitHub Release from that version section
Fixed
- Filtered XML no longer keeps blank “holes” where dropped entities used to sit
(streaming whitespace collapse in SERVICE/SITE/RESOURCE/SERVICECALENDAR,
TIMETABLE, and COMMON writers — no full DOM pretty-print)
Notes
- Tool is MIT; timetable data remains under OpenTransportData terms
- Cache key is the remote filename (export timestamp embedded); a positive-size
file must also open as a zip before it counts as a hit. Use--forceto
re-download - Downloads request
Accept-Encoding: identityso size checks compare
wireContent-Lengthto the bytes written on disk - Filter/extract write the output zip via a same-directory temp file + rename
- TIMETABLE
TrainNumberdefs are kept whether they appear before or after
vehicleJourneys(defs-first inputs may emittrainNumbersafter journeys) - Filtered-package
README.txtand public README document Swiss-profile
expectations:ValidDayBitscalendars, closed COMMON connections, sparse
TIMETABLE shard indices - Peak system RSS scales roughly with worker count × largest kept shard;
prefer a machine with several GB free RAM for full national filters extract/operators/lines:--fromcannot be combined with
--dataset/--year/--force/--cache-dir(download-only flags)
See CHANGELOG.md for the full history.