Validating GTFS
The first row in the validity table shows an apparent error, reporting “Invalid route_type; maybe has extra space characters”. Examining the routes table for the affected rows:
-0 3
1 200
diff --git a/docs/getting_started/index.html b/docs/getting_started/index.html
index e80c706..c685128 100644
--- a/docs/getting_started/index.html
+++ b/docs/getting_started/index.html
@@ -228,7 +228,7 @@ Installation
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
@@ -239,7 +239,7 @@ Installation
= MultiGtfsInstance(glob.glob(gtfs_pth + "/*.zip"))
gtfs 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, 7.06it/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, 7.03it/s]
+ 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]
diff --git a/docs/tutorials/index.html b/docs/tutorials/index.html
index 472a787..8afadd6 100644
--- a/docs/tutorials/index.html
+++ b/docs/tutorials/index.html
@@ -291,7 +291,7 @@ Requirements
Working With GTFS
Let’s import the necessary dependencies:
-
+
import datetime
import os
import pathlib
@@ -313,7 +313,7 @@ Working With GTFS
You may wish to manually download at least one GTFS feed and store somewhere in your file system. Alternatively you may programmatically download the data, as in the solution here.
-
+
= "<INSERT_SOME_URL_TO_BUS_GTFS>"
BUS_URL = "<INSERT_SOME_URL_TO_RAIL_GTFS>"
RAIL_URL
@@ -325,7 +325,7 @@ Working With GTFS
-
+
= "https://tsvc.pilote4.cityway.fr/api/Export/v1/GetExportedDataFile?ExportFormat=Gtfs&OperatorCode=RTM"
BUS_URL = "https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip"
RAIL_URL # using tmp for tutorial but not necessary
@@ -337,13 +337,13 @@ Working With GTFS
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 16 3931k 16 642k 0 0 380k 0 0:00:10 0:00:01 0:00:09 380k 93 3931k 93 3676k 0 0 1365k 0 0:00:02 0:00:02 --:--:-- 1365k100 3931k 100 3931k 0 0 1436k 0 0:00:02 0:00:02 --:--:-- 1436k
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 68 3931k 68 2685k 0 0 1681k 0 0:00:02 0:00:01 0:00:01 1681k100 3931k 100 3931k 0 0 2273k 0 0:00:01 0:00:01 --:--:-- 2273k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 91397 100 91397 0 0 161k 0 --:--:-- --:--:-- --:--:-- 161k
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 91397 100 91397 0 0 195k 0 --:--:-- --:--:-- --:--:-- 196k
-CompletedProcess(args=['curl', 'https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip', '-o', '/tmp/tmp8s_537sp/intercity_rail_gtfs.zip'], returncode=0)
+CompletedProcess(args=['curl', 'https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip', '-o', '/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip'], returncode=0)
@@ -359,14 +359,14 @@ Working With GTFS
Instantiate a feed
object by pointing the MultiGtfsInstance
class at a path to the GTFS feed(s) that you have downloaded. Once you have successfully instantiated feed
, inspect the correct attribute in order to confirm the number of separate feeds instances contained within it.
-
+
= "<INSERT_PATH_TO_GTFS>"
gtfs_pth = MultiGtfsInstance(path=gtfs_pth)
feed print(len(feed.<INSERT_CORRECT_ATTRIBUTE>))
-
+
= pathlib.Path(tmp_path.name) # need to use pathlib for tmp_path
gtfs_pth = MultiGtfsInstance(path=gtfs_pth)
feed print(f"There are {len(feed.instances)} feed instances")
@@ -385,14 +385,14 @@ Working With GTFS
By accessing the appropriate attribute, print out the first 5 stops of the first instance within the feed
object.
-
+
<INSERT_CORRECT_ATTR>[0].feed.stops.<INSERT_CORRECT_METHOD>(5) feed.
These records will match the contents of the stops.txt file within the feed that you downloaded.
-
+
0].feed.stops.head(5) feed.instances[
@@ -487,7 +487,7 @@ Working With GTFS
Checking Validity
Transport routing operations require services that run upon a specified date. It is a useful sanity check to confirm that the dates that you expect to perform routing on exist within the GTFS feed. To do this, we can use the get_dates()
method to print out the first and last date in the available date range, as below.
-
+
= feed.get_dates()
s0, e0 print(f"Feed starts at: {s0}\nFeed ends at: {e0}")
@@ -506,7 +506,7 @@ Checking Validity
-
+
=False) feed.get_dates(return_range
['20240703',
@@ -619,10 +619,10 @@ Checking Validity
-
+
feed.is_valid()
- 0%| | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmp8s_537sp/intercity_rail_gtfs.zip: 0%| | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmp8s_537sp/intercity_rail_gtfs.zip: 50%|█████ | 1/2 [00:00<00:00, 4.84it/s]Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 50%|█████ | 1/2 [00:00<00:00, 4.84it/s] Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00, 1.68s/it]Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00, 1.46s/it]
+ 0%| | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmpxzeeqykk/intercity_rail_gtfs.zip: 0%| | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmpxzeeqykk/intercity_rail_gtfs.zip: 50%|█████ | 1/2 [00:00<00:00, 4.80it/s]Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 50%|█████ | 1/2 [00:00<00:00, 4.80it/s] Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00, 1.70s/it]Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00, 1.48s/it]
@@ -646,7 +646,7 @@ Checking Validity
Unrecognized column feed_id
feed_info
[]
-/tmp/tmp8s_537sp/intercity_rail_gtfs.zip
+/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip
1
@@ -654,7 +654,7 @@ Checking Validity
Unrecognized column conv_rev
feed_info
[]
-/tmp/tmp8s_537sp/intercity_rail_gtfs.zip
+/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip
2
@@ -662,7 +662,7 @@ Checking Validity
Unrecognized column plan_rev
feed_info
[]
-/tmp/tmp8s_537sp/intercity_rail_gtfs.zip
+/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip
3
@@ -670,7 +670,7 @@ Checking Validity
Repeated pair (route_short_name, route_long_name)
routes
[16, 17, 18, 19, 20]
-/tmp/tmp8s_537sp/intercity_rail_gtfs.zip
+/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip
4
@@ -678,7 +678,7 @@ Checking Validity
Repeated pair (trip_id, departure_time)
stop_times
[1352, 1361, 1363, 1367, 1372, 1375, 1377, 138...
-/tmp/tmp8s_537sp/rtm_gtfs.zip
+/tmp/tmpxzeeqykk/rtm_gtfs.zip
5
@@ -686,7 +686,7 @@ Checking Validity
Stop has no stop times
stops
[146, 1498, 1499, 2130]
-/tmp/tmp8s_537sp/rtm_gtfs.zip
+/tmp/tmpxzeeqykk/rtm_gtfs.zip
@@ -712,12 +712,12 @@ Viz Stops
Inspect the MultiGtfsInstance
api reference for the appropriate method.
-
+
feed.viz_...()
-
+
feed.viz_stops()
Make this Notebook Trusted to load map: File -> Trust Notebook