Architecture¶
subway-access is organized as a small typed library with explicit subpackages
and a real-data snapshot workflow.
Package Shape¶
subway_access.models: typed data contracts for requests, datasets, and exportssubway_access.io: file and URL loading entry pointssubway_access.analysis: catchment generation, scoring, gaps, reliability, and station metricssubway_access.export: GeoJSON and CSV outputssubway_access.pipeline: official-data fetch/cache helpers and snapshot loadingsubway_access.cli: installed real-data CLI workflows
Current data flow¶
pipeline.fetch_study_area_snapshot()selects a study area throughnyc-geo-toolkit.- The pipeline fetches official MTA station, equipment, and availability data.
- The pipeline fetches MTA subway entrance/exit points and filters them to the
study area (
entrances.geojson). When a GTFS zip is present, it optionally parses GTFS-Pathwayspathways.txt/locations.txtintogtfs-pathways.jsonwhen those files exist in the archive. - The pipeline fetches ACS tract-level demographics and writes cache files.
pipeline.load_cached_snapshot()loads those cache files back into typed datasets (includingEntranceDatasetand optionalGtfsPathwaysSnapshot).analysis.generate_catchments()builds first-pass circle polygons.pipeline.fetch_walk_graph()can cache an OSM walking graph for the same study area.analysis.score_accessibility()joins station coverage to tract demand.analysis.score_accessibility_network()compares the Euclidean baseline to network travel.analysis.compute_reliability()scores stations from public availability history.analysis.compare_accessibility_models()andanalysis.summarize_accessibility_by_group()produce richer rollups.analysis.analyze_gaps()ranks uncovered tracts.analysis.build_station_metrics()aggregates station-level metrics.export.export_catchments_geojson(),export.export_gap_table(), andexport.export_station_metrics()write outputs.
Geography and shared foundations¶
The repo now centers on example-local cache directories rather than packaged synthetic fixtures. The intended consumer pattern is:
- fetch official public records once
- pin a local cache snapshot
- optionally pin a local OSM walking graph
- reload it in memory for analysis and export
- update tracked reports intentionally, not implicitly
Reusable dependency-free geodesy helpers now live in nyc-geo-toolkit, while
the accessibility-specific scoring and transit-domain logic stays local to this
package.
Planned expansion¶
The package now grows along two explicit tracks:
- Euclidean accessibility as a documented baseline
- network-based walking graphs and comparison outputs as the advanced path