transitio.index.read_index#
- transitio.index.read_index(path, *, country=None)#
Read the index at
path, or raise if it is unsupported or corrupt.A schema-7 index is a directory of partitions: without
countryevery partition is read and joined into the flat feeds, places and edges tables (the cross-border edges included, so nothing a flat index carried is lost), and thelinkstable is kept beside them; withcountrythe result holds that partition’s feeds, places and domestic edges, and the links whose place lies in it.countryis refused for an older schema. A schema-8 index also carries its GTFS-RT companions inrealtime(joined, or the country’s own). A schema-12 index keeps place boundaries and the edges’ evidence, selectors and curation in on-demand tables: only the core tables are read here, and a partition’s on-demand ones when first needed (Place.geometry,area(), an edge’sevidenceorselector);check_index()reads them all.pandas(and itspyarrowParquet engine, a required dependency) readsfeeds.parquet. The manifest is read first, so an incompatible snapshot is refused before the larger file is touched, and the Parquet’s bytes are checked against thefeeds_sha256the manifest records. That match proves the Parquet and manifest are the paired halves of one build — not that the build is authentic;refresh()additionally checks a downloaded archive against the digest its release manifest declares. Each file is read as a size-bounded regular file, so a symlinked or over-large one is refused rather than followed. The manifest’ssnapshot_idand the Parquet’s columns are checked against the schema version, so a structurally wrong but correctly-hashed index is refused rather than misread downstream.