Skip to content

Commit

Permalink
fix: Add GTFS fixture to pkg data for use in tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
r-leyshon committed Jul 4, 2024
1 parent 9285ef9 commit 9e91f9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ docs/tutorials/outputs/
!tests/data/chester-20230816-small_gtfs.zip
!tests/data/newport-20230613_gtfs.zip
!src/assess_gtfs/data/route_lookup.pkl
!src/assess_gtfs/data/newport-20230613_gtfs.zip
!tests/data/report/html_template.html

# exception for html templates
Expand Down
33 changes: 8 additions & 25 deletions docs/getting_started/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ toc: true

### Installation

This package is designed to work with python 3.9, 3.10 and 3.11.
This package works with python 3.9, 3.10 and 3.11.

We recommend running the package with a virtual environment such as
[conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
Expand All @@ -30,37 +30,20 @@ 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][gtfs-how-to].

Alternatively, you can use the small GTFS fixture available in our
[GitHub repository][newport-gtfs-fixture].
Alternatively, you can use the small GTFS fixture that is bundled with the
`assess_gtfs` package.

```{python}
#| warning: false
#| output: false
import glob
import os
import subprocess
import tempfile
from assess_gtfs.multi_validation import MultiGtfsInstance
from assess_gtfs.utils.constants import PKG_PATH # to access package data
# download the data
tmp = tempfile.TemporaryDirectory()
gtfs_pth = os.path.join(tmp.name, "downloaded_gtfs.zip")
subprocess.run(
["curl",
"-L",
"-o",
gtfs_pth,
"https://github.com/datasciencecampus/assess_gtfs/raw/dev/tests/data/gtfs/newport-20230613_gtfs.zip"
])
```

Once the data has been downloaded you can instantiate a gtfs object using
`assess-gtfs`.

```{python}
#| warning: false
gtfs = MultiGtfsInstance(gtfs_pth)
gtfs_pth = os.path.join(PKG_PATH, "data")
gtfs = MultiGtfsInstance(glob.glob(gtfs_pth + "/*.zip"))
gtfs.is_valid()
```

For more on how to use `assess-gtfs`, see the [tutorial](/docs/tutorials/index.qmd).
Expand Down
Binary file added src/assess_gtfs/data/newport-20230613_gtfs.zip
Binary file not shown.

0 comments on commit 9e91f9e

Please sign in to comment.