johnbrussell / gtfs_parser

0 stars 0 forks source link

gtfs_parser

This is a GTFS parser. I built it to be used with gtfs-traversal, but it can be used for more general purposes. Its main feature is that it amalgamates the data in ways that:

Usage

Typically, something like this:

from gtfs_parser.gtfs_parsing.analyses import determine_analysis_parameters, parse

configurations = determine_analysis_parameters(config)
configuration_to_analyze = configurations[0]  # choose appropriate index

data = parse(configuration_to_analyze, data_location)

where config is a dictionary that stores information about what you need parsed (more on that below) and data_location is the file path to the folder containing the folder for the GTFS data for the agency whose data is in the configuration_to_analyze.

Config

The config variable in the example above typically looks something like this:

{
  "agencies": {
    "mbta": {
      "data_sets": {
        "2018-10-13": {
          "start_date": "2018-10-13",
          "end_date": "2018-10-19",
          "route_types_to_solve": [0, 1]
        }
      }
    }
  }
}

In the example: