Transit Stacks

Basic tools for downloading and viewing the Cal-ITP transit technology stack database.

Example stack diagram


From source: pip install .

Usage examples

Browse Components in all Transit Stacks

import transitstacks as ts
all_stacks = ts.Stack(
    ts.read_stack_from_gsheets(filter_dict = {"Transit Provider": "GET Bus"})

# list all products

# get most common products

You can use the Jupyter Notebook /notebooks/Stack Database Analysis.ipynb for interactive viewing of dataframes by using the command jupyter notebook.

Browse relationships in Single Transit Stack

import transitstacks as ts
my_stack = ts.Stack(
    ts.read_stack_from_gsheets(filter_dict = {"Transit Provider": "GET Bus"})


Create a transit stack diagram with two grouping levels

LEVEL1 = "Function Group"
LEVEL2 = "Product"

d = ts.stack_diagram(
    cluster_level_1 = LEVEL1,
    cluster_level_2 = LEVEL2,
    bgcolor_cluster_L1 = ts.stack.greenyellow_functiongroup_map,

You can use the Jupyter Notebook /notebooks/Individual Transit Provider Analysis.ipynb for interactive transit stack diagram generation by using the command jupyter notebook.


General steps:

  1. Fork it (
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Add your feature, add tests which test your feature, document your feature, and pass all tests.
  4. Commit your changes (git commit -am 'Add some fooBar')
  5. Push to the branch (git push origin feature/fooBar)
  6. Create a new Pull Request

Development requirements are listed in dev-requirements.txt and can be installed by: pip install -r dev-requirements.txt

Tests are written for pytest and can be run using the command pytest.

Docstrings are written in google style and auto-rendered as api documentation using mkdocstrings as specified in /docs/

Documentation uses mkdocs and is in the /docs folder. It can be rendered locally using the command mkdocs serve.