Getting Started

Usage

Installation

This package works with python 3.9, 3.10 and 3.11.

We recommend running the package with a virtual environment such as conda or venv.

With conda:

conda create -n assess-gtfs python=3.11 -y

Once completed, activate the environment:

conda activate assess-gtfs

Install the python package with required dependencies:

pip install assess-gtfs

To use assess-gtfs, you will need a source of GTFS data. To locate your own, follow the how-to on GTFS data.

Alternatively, you can use the small GTFS fixture that is bundled with the assess_gtfs package.

import glob
import os

from assess_gtfs.multi_validation import MultiGtfsInstance
from assess_gtfs.utils.constants import PKG_PATH # to access package data

gtfs_pth = os.path.join(PKG_PATH, "data")
gtfs = MultiGtfsInstance(glob.glob(gtfs_pth + "/*.zip"))
gtfs.is_valid()
  0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip:   0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  6.81it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  6.78it/s]
type message table rows GTFS
0 error Invalid route_type; maybe has extra space char... routes [1, 2, 3, 4] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
1 warning Unrecognized column agency_noc agency [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
2 warning Feed expired calendar [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
3 warning Repeated pair (route_short_name, route_long_name) routes [13] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
4 warning Unrecognized column stop_direction_name stop_times [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
5 warning Unrecognized column platform_code stops [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
6 warning Unrecognized column trip_direction_name trips [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...
7 warning Unrecognized column vehicle_journey_code trips [] /opt/hostedtoolcache/Python/3.11.9/x64/lib/pyt...

For more on how to use assess-gtfs, see the tutorial.