@transportme/load-ptv-gtfs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.github/workflows/unit-test.yml +46 -0
  2. package/lib/constants.mjs +18 -0
  3. package/lib/gtfs-package/PTVGTFS.mjs +96 -0
  4. package/lib/gtfs-parser/GTFSAgency.mjs +15 -0
  5. package/lib/gtfs-parser/GTFSCalendar.mjs +63 -0
  6. package/lib/gtfs-parser/GTFSCalendarDate.mjs +15 -0
  7. package/lib/gtfs-parser/GTFSRoute.mjs +106 -0
  8. package/lib/gtfs-parser/GTFSShape.mjs +39 -0
  9. package/lib/gtfs-parser/GTFSStop.mjs +212 -0
  10. package/lib/gtfs-parser/GTFSStopTime.mjs +30 -0
  11. package/lib/gtfs-parser/GTFSTrip.mjs +169 -0
  12. package/lib/gtfs-parser/readers/GTFSAgencyReader.mjs +27 -0
  13. package/lib/gtfs-parser/readers/GTFSCalendarDatesReader.mjs +25 -0
  14. package/lib/gtfs-parser/readers/GTFSCalendarReader.mjs +63 -0
  15. package/lib/gtfs-parser/readers/GTFSReader.mjs +48 -0
  16. package/lib/gtfs-parser/readers/GTFSRouteReader.mjs +35 -0
  17. package/lib/gtfs-parser/readers/GTFSShapeReader.mjs +75 -0
  18. package/lib/gtfs-parser/readers/GTFSStopTimesReader.mjs +85 -0
  19. package/lib/gtfs-parser/readers/GTFSStopsReader.mjs +36 -0
  20. package/lib/gtfs-parser/readers/GTFSTripReader.mjs +61 -0
  21. package/lib/gtfs-parser/readers/line-reader.mjs +112 -0
  22. package/lib/loader/RouteLoader.mjs +101 -0
  23. package/lib/loader/ShapeLoader.mjs +86 -0
  24. package/lib/loader/StopsLoader.mjs +139 -0
  25. package/lib/loader/TripLoader.mjs +187 -0
  26. package/lib/post-processing/merge-stops.mjs +85 -0
  27. package/lib/post-processing/set-route-stops.mjs +73 -0
  28. package/lib/post-processing/set-stop-services.mjs +64 -0
  29. package/lib/utils.mjs +16 -0
  30. package/package.json +27 -0
  31. package/test/gtfs-calendar.test.mjs +182 -0
  32. package/test/gtfs-route-loader.test.mjs +190 -0
  33. package/test/gtfs-routes.test.mjs +77 -0
  34. package/test/gtfs-shapes-loader.test.mjs +105 -0
  35. package/test/gtfs-shapes.test.mjs +23 -0
  36. package/test/gtfs-stop-loader-metro.test.mjs +49 -0
  37. package/test/gtfs-stop-loader.test.mjs +223 -0
  38. package/test/gtfs-stop-times.test.mjs +37 -0
  39. package/test/gtfs-stops.test.mjs +290 -0
  40. package/test/gtfs-trip-loader.test.mjs +142 -0
  41. package/test/gtfs-trips.test.mjs +109 -0
  42. package/test/line-reader.test.mjs +94 -0
  43. package/test/merge-stops.test.mjs +376 -0
  44. package/test/ptv-gtfs.test.mjs +106 -0
  45. package/test/sample-data/calendar/calendar.txt +34 -0
  46. package/test/sample-data/calendar/calendar_dates.txt +26 -0
  47. package/test/sample-data/gtfs-splitting/force_unique_stops_bus.txt +7 -0
  48. package/test/sample-data/gtfs-splitting/force_unique_stops_tram.txt +3 -0
  49. package/test/sample-data/gtfs-splitting/line_reader_test.txt +8 -0
  50. package/test/sample-data/gtfs-splitting/name_overrides.txt +4 -0
  51. package/test/sample-data/gtfs-splitting/nov_2024_train_data.txt +6 -0
  52. package/test/sample-data/gtfs-splitting/sample_stops.txt +20 -0
  53. package/test/sample-data/gtfs-splitting/special_chars_stops_csv.txt +6 -0
  54. package/test/sample-data/gtfs-splitting/stops_without_secondary.txt +6 -0
  55. package/test/sample-data/gtfs-unzipping/gtfs.zip +0 -0
  56. package/test/sample-data/one_line.csv +2 -0
  57. package/test/sample-data/routes/agency.txt +11 -0
  58. package/test/sample-data/routes/metro_bus_routes.txt +4 -0
  59. package/test/sample-data/routes/metro_lines.txt +5 -0
  60. package/test/sample-data/routes/regional_bus_routes.txt +7 -0
  61. package/test/sample-data/routes/vline.txt +7 -0
  62. package/test/sample-data/routes/west_gipp_transit.txt +20 -0
  63. package/test/sample-data/shapes/shapes.txt +89 -0
  64. package/test/sample-data/shapes/stop_times.txt +9 -0
  65. package/test/sample-data/shapes/stops.txt +4 -0
  66. package/test/sample-data/shapes/trips.txt +4 -0
  67. package/test/sample-data/stop-data/name-overrides.json +25 -0
  68. package/test/sample-data/stop-data/unique-stops.json +1 -0
  69. package/test/sample-data/suburbs.json +77 -0
  70. package/test/sample-data/trips/bus_trips.txt +5 -0
  71. package/test/sample-data/trips/stop_times.txt +29 -0
  72. package/test/sample-data/trips/stop_times_new.txt +8 -0
  73. package/test/sample-data/trips/stops.txt +8 -0
  74. package/test/sample-data/trips/trips.txt +5 -0
  75. package/test/sample-data/trips/trips_new.txt +2 -0
  76. package/test/set-stop-services.test.mjs +69 -0
  77. package/test/utils-test.mjs +26 -0
@@ -0,0 +1,6 @@
1
+ stop_id,stop_name,stop_lat,stop_lon
2
+ "12593","Robertson Dr","-38.2237081718997","145.052698159639"
3
+ "12596","Frankston Hospital","-38.1506579763471","145.130062890534"
4
+ "12598","Culcairn Dr","-38.166104751281","145.13749838788"
5
+ "12599","Kooyong Road - Stop 42","-37.8613464183028","145.019899262257"
6
+ "125","McArthur Rd","-37.7778985493395","145.063910947756"
@@ -0,0 +1,2 @@
1
+ trip_id
2
+ "1.T2.2-ALM-vpt-1.1.R"
@@ -0,0 +1,11 @@
1
+ agency_id,agency_name,agency_url,agency_timezone,agency_lang,agency_phone,agency_fare_url
2
+ "43","CDC Ballarat","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
3
+ "99","Paynesville Bus Lines","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
4
+ "168","Dysons Bairnsdale","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
5
+ "68","Christians Bus Company (Bendigo)","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
6
+ "94","Henty Highway Coach","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
7
+ "32","Ventura Bus Lines","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
8
+ "38","CDC","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
9
+ "3","Metro","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
10
+ "57","Warragul Bus Lines","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
11
+ "33","V/Line","https://www.ptv.vic.gov.au/footer/customer-service/operator-contact-details/?utm_source=open_data_click_agency&utm_medium=open_data_agency_click&utm_campaign=open_data_click","Australia/Melbourne","EN","1800 800 007","https://www.ptv.vic.gov.au/tickets/myki/?utm_source=open_data_click_fare&utm_medium=open_data_fare_click&utm_campaign=open_data_click"
@@ -0,0 +1,4 @@
1
+ route_id,agency_id,route_short_name,route_long_name,route_type,route_color,route_text_color
2
+ "41-900-aus-1","32","900","Stud Park SC - Caulfield","3","FF8200","FFFFFF"
3
+ "49-900-aus-1","38","900","Caulfield - Stud Park SC (Rowville)","3","FF8200","FFFFFF"
4
+ "49-601-aus-1","38","601","Huntingdale Station - Monash University (Clayton)","3","FF8200","FFFFFF"
@@ -0,0 +1,5 @@
1
+ route_id,agency_id,route_short_name,route_long_name,route_type,route_color,route_text_color
2
+ "2-ALM-vpt-1","3","Alamein","Alamein - City","2","152C6B","FFFFFF"
3
+ "2-ALM-vpt-61","3","Alamein","Alamein - City","2","152C6B","FFFFFF"
4
+ "2-RCE-vpt-1","3","Flemington Racecourse","City","2","95979A","000000"
5
+ "2-STY-vpt-1","3","Stony Point","Stony Point - Frankston","2","028430","FFFFFF"
@@ -0,0 +1,7 @@
1
+ route_id,agency_id,route_short_name,route_long_name,route_type,route_color,route_text_color
2
+ "6-10x-mjp-1","43","10","Alfredton - Ballarat Station Via Wendouree","3","FF8200","FFFFFF"
3
+ "6-13-mjp-1","99","13","Paynesville - Bairnsdale Via Paynesville","3","FF8200","FFFFFF"
4
+ "6-14B-mjp-1","43","14","Black Hill - Ballarat Station Via Black Hill","3","FF8200","FFFFFF"
5
+ "6-14-mjp-1","168","14","Omeo - Bairnsdale Via Bruthen, Swifts Creek","3","FF8200","FFFFFF"
6
+ "6-BN5-mjp-1","68","WN05","Bendigo","3","FF8200","FFFFFF"
7
+ "6-MLH-mjp-1","94","","Horsham - Mildura Via Ouyen, Warracknabeal","3","FF8200","FFFFFF"
@@ -0,0 +1,7 @@
1
+ route_id,agency_id,route_short_name,route_long_name,route_type,route_color,route_text_color
2
+ "1-TRN-mjp-7","33","","Traralgon - Melbourne Via Pakenham, Moe & Morwell","2","8F1A95","FFFFFF"
3
+ "1-TRN-mjp-8","33","","Traralgon - Melbourne Via Pakenham, Moe & Morwell","2","8F1A95","FFFFFF"
4
+ "1-TRN-mjp-9","33","","Traralgon - Melbourne Via Pakenham, Moe & Morwell","2","8F1A95","FFFFFF"
5
+ "1-vPK-mjp-10","33","Pakenham","Pakenham - City Via Pakenham","2","8F1A95","FFFFFF"
6
+ "1-vPK-mjp-11","33","Pakenham","Pakenham - City Via Pakenham","2","8F1A95","FFFFFF"
7
+ "1-vPK-mjp-12","33","Pakenham","Pakenham - City Via Pakenham","2","8F1A95","FFFFFF"
@@ -0,0 +1,20 @@
1
+ route_id,agency_id,route_short_name,route_long_name,route_type,route_color,route_text_color
2
+ "6-w13-mjp-1","57","","Moe - Albert St Via Moe - Albert St","3","FF8200","FFFFFF"
3
+ "6-w19-mjp-1","57","","Garfield Station Via Garfield Station","3","FF8200","FFFFFF"
4
+ "6-w20-mjp-1","57","","Moe Station Via Moe Station","3","FF8200","FFFFFF"
5
+ "6-w28-mjp-1","57","","Nar Nar Goon Station Via Nar Nar Goon Station","3","FF8200","FFFFFF"
6
+ "6-w30-mjp-1","57","","Traralgon Station Via Traralgon Station","3","FF8200","FFFFFF"
7
+ "6-w31-mjp-1","57","","Warragul Station Via Warragul Station","3","FF8200","FFFFFF"
8
+ "6-w32-mjp-1","57","","Newborough TAFE - Yallourn Via Newborough TAFE - Yallourn","3","FF8200","FFFFFF"
9
+ "6-w33-mjp-1","57","","Traralgon Plaza Via Traralgon Plaza","3","FF8200","FFFFFF"
10
+ "6-w34-mjp-1","57","","Moe Bus Interchange Via Moe Bus Interchange","3","FF8200","FFFFFF"
11
+ "6-w35-mjp-1","57","","Drouin North Via Drouin North","3","FF8200","FFFFFF"
12
+ "6-w36-mjp-1","57","","Drouin North Via Drouin North","3","FF8200","FFFFFF"
13
+ "6-w37-mjp-1","57","","Drouin North Via Drouin North","3","FF8200","FFFFFF"
14
+ "6-w38-mjp-1","57","","Drouin North Via Drouin North","3","FF8200","FFFFFF"
15
+ "6-w39-mjp-1","57","","Drouin North Via Drouin North","3","FF8200","FFFFFF"
16
+ "6-w40-mjp-1","57","","Garfield Station Via Garfield Station","3","FF8200","FFFFFF"
17
+ "6-w41-mjp-1","57","","Pakenham Station Via Pakenham Station","3","FF8200","FFFFFF"
18
+ "6-w76-mjp-1","57","","Warragul Station Via Warragul Station","3","FF8200","FFFFFF"
19
+ "6-w77-mjp-1","57","","Drouin Station Via Drouin Station","3","FF8200","FFFFFF"
20
+ "6-W89-mjp-1","57","89","Noojee - Warragul Station Via Buln Buln","3","FF8200","FFFFFF"
@@ -0,0 +1,89 @@
1
+ shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled
2
+ "49-601-aus-1.2.R","-37.910905","145.102663","1","0.00"
3
+ "49-601-aus-1.2.R","-37.910868","145.102607","2","6.41"
4
+ "49-601-aus-1.2.R","-37.910804","145.102552","3","15.01"
5
+ "49-601-aus-1.2.R","-37.91075","145.102565","4","21.12"
6
+ "49-601-aus-1.2.R","-37.910697","145.102623","5","28.90"
7
+ "49-601-aus-1.2.R","-37.910689","145.102703","6","35.98"
8
+ "49-601-aus-1.2.R","-37.910709","145.102804","7","45.11"
9
+ "49-601-aus-1.2.R","-37.910892","145.102959","8","69.59"
10
+ "49-601-aus-1.2.R","-37.911002","145.103081","9","85.84"
11
+ "49-601-aus-1.2.R","-37.911194","145.103236","10","111.15"
12
+ "49-601-aus-1.2.R","-37.911276","145.103336","11","123.81"
13
+ "49-601-aus-1.2.R","-37.91135","145.103448","12","136.62"
14
+ "49-601-aus-1.2.R","-37.911395","145.103435","13","141.75"
15
+ "49-601-aus-1.2.R","-37.911507","145.103683","14","166.82"
16
+ "49-601-aus-1.2.R","-37.911806","145.106029","15","375.30"
17
+ "49-601-aus-1.2.R","-37.911859","145.106472","16","414.61"
18
+ "49-601-aus-1.2.R","-37.912005","145.107742","17","527.20"
19
+ "49-601-aus-1.2.R","-37.912215","145.109602","18","692.04"
20
+ "49-601-aus-1.2.R","-37.912543","145.112597","19","957.30"
21
+ "49-601-aus-1.2.R","-37.912826","145.115069","20","1176.43"
22
+ "49-601-aus-1.2.R","-37.91296","145.116146","21","1272.08"
23
+ "49-601-aus-1.2.R","-37.913023","145.116713","22","1322.31"
24
+ "49-601-aus-1.2.R","-37.913096","145.117303","23","1374.70"
25
+ "49-601-aus-1.2.R","-37.913493","145.12074","24","1679.43"
26
+ "49-601-aus-1.2.R","-37.913638","145.121885","25","1781.17"
27
+ "49-601-aus-1.2.R","-37.913912","145.12438","26","2002.15"
28
+ "49-601-aus-1.2.R","-37.914287","145.12643","27","2186.76"
29
+ "49-601-aus-1.2.R","-37.914357","145.12686","28","2225.28"
30
+ "49-601-aus-1.2.R","-37.914456","145.127404","29","2274.25"
31
+ "49-601-aus-1.2.R","-37.914681","145.12857","30","2379.55"
32
+ "49-601-aus-1.2.R","-37.914761","145.129057","31","2423.19"
33
+ "49-601-aus-1.2.R","-37.914806","145.12959","32","2470.22"
34
+ "49-601-aus-1.2.R","-37.914995","145.131303","33","2621.95"
35
+ "49-601-aus-1.2.R","-37.914877","145.131215","34","2637.17"
36
+ "49-601-aus-1.2.R","-37.914427","145.131306","35","2687.85"
37
+ "49-601-aus-1.2.R","-37.913888","145.131399","36","2748.33"
38
+ "49-601-aus-1.2.R","-37.913536","145.131363","37","2787.60"
39
+ "49-601-aus-1.2.R","-37.913473","145.131387","38","2794.91"
40
+ "49-601-aus-1.2.R","-37.913421","145.131457","39","2803.35"
41
+ "49-601-aus-1.2.R","-37.913442","145.131684","40","2823.40"
42
+ "49-601-aus-1.2.R","-37.914601","145.131484","41","2953.46"
43
+ "49-601-aus-1.2.R","-37.914665","145.131482","42","2960.58"
44
+ "49-601-aus-1.2.R","-37.914676","145.131641","43","2974.58"
45
+ "49-601-aus-1.2.R","-37.914659","145.131721","44","2981.85"
46
+ "49-601-aus-1.2.R","-37.914606","145.131779","45","2989.64"
47
+ "49-601-aus-1.2.R","-37.913896","145.131911","46","3069.43"
48
+ "49-601-aus-1.3.H","-37.913926","145.132081","1","0.00"
49
+ "49-601-aus-1.3.H","-37.914879","145.131932","2","106.77"
50
+ "49-601-aus-1.3.H","-37.914828","145.131558","3","140.07"
51
+ "49-601-aus-1.3.H","-37.915035","145.131518","4","163.35"
52
+ "49-601-aus-1.3.H","-37.915005","145.131337","5","179.58"
53
+ "49-601-aus-1.3.H","-37.915256","145.131285","6","207.86"
54
+ "49-601-aus-1.3.H","-37.91503","145.129516","7","365.06"
55
+ "49-601-aus-1.3.H","-37.914724","145.127829","8","516.91"
56
+ "49-601-aus-1.3.H","-37.914634","145.127285","9","565.67"
57
+ "49-601-aus-1.3.H","-37.914477","145.126459","10","640.21"
58
+ "49-601-aus-1.3.H","-37.914417","145.126131","11","669.74"
59
+ "49-601-aus-1.3.H","-37.91438","145.125517","12","723.76"
60
+ "49-601-aus-1.3.H","-37.914352","145.12487","13","780.61"
61
+ "49-601-aus-1.3.H","-37.914298","145.124302","14","830.80"
62
+ "49-601-aus-1.3.H","-37.913971","145.121876","15","1046.70"
63
+ "49-601-aus-1.3.H","-37.913666","145.11912","16","1290.84"
64
+ "49-601-aus-1.3.H","-37.913573","145.118417","17","1353.37"
65
+ "49-601-aus-1.3.H","-37.913356","145.116659","18","1509.47"
66
+ "49-601-aus-1.3.H","-37.913167","145.115004","19","1656.17"
67
+ "49-601-aus-1.3.H","-37.91294","145.113235","20","1813.40"
68
+ "49-601-aus-1.3.H","-37.912513","145.109617","21","2134.33"
69
+ "49-601-aus-1.3.H","-37.912462","145.109232","22","2168.58"
70
+ "49-601-aus-1.3.H","-37.912181","145.106918","23","2373.97"
71
+ "49-601-aus-1.3.H","-37.91217","145.106771","24","2386.92"
72
+ "49-601-aus-1.3.H","-37.912375","145.106083","25","2451.44"
73
+ "49-601-aus-1.3.H","-37.912562","145.105965","26","2474.67"
74
+ "49-601-aus-1.3.H","-37.912641","145.105792","27","2492.20"
75
+ "49-601-aus-1.3.H","-37.912673","145.105564","28","2512.52"
76
+ "49-601-aus-1.3.H","-37.912625","145.105383","29","2529.27"
77
+ "49-601-aus-1.3.H","-37.912616","145.105372","30","2530.66"
78
+ "49-601-aus-1.3.H","-37.912038","145.104215","31","2650.80"
79
+ "49-601-aus-1.3.H","-37.911825","145.1038","32","2694.23"
80
+ "49-601-aus-1.3.H","-37.911593","145.103396","33","2738.07"
81
+ "49-601-aus-1.3.H","-37.911395","145.103435","34","2760.35"
82
+ "49-601-aus-1.3.H","-37.911366","145.103311","35","2771.69"
83
+ "49-601-aus-1.3.H","-37.911311","145.103233","36","2780.87"
84
+ "49-601-aus-1.3.H","-37.9112","145.103088","37","2798.60"
85
+ "49-601-aus-1.3.H","-37.910905","145.102663","38","2848.26"
86
+ "49-601-aus-1.4.H","-37.913926","145.132081","1","0.00"
87
+ "49-601-aus-1.4.H","-37.914879","145.131932","2","106.77"
88
+ "49-601-aus-1.4.H","-37.9112","145.103088","37","2798.60"
89
+ "49-601-aus-1.4.H","-37.910905","145.102663","38","2848.26"
@@ -0,0 +1,9 @@
1
+ trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_type,drop_off_type,shape_dist_traveled
2
+ "49-601--1-MF10-4481014","07:01:00","07:01:00","21611","1","","0","0","0.00"
3
+ "49-601--1-MF10-4481014","07:03:00","07:03:00","7098","2","","0","0","2168.58"
4
+ "49-601--1-MF10-4481014","07:06:00","07:06:00","51587","3","","0","0","2848.26"
5
+ "49-601--1-MF10-4481114","07:08:00","07:08:00","51587","1","","0","0","0.00"
6
+ "49-601--1-MF10-4481114","07:15:00","07:15:00","21611","2","","0","0","3069.43"
7
+ "49-601--1-MF10-999","07:01:00","07:01:00","21611","1","","0","0","0.00"
8
+ "49-601--1-MF10-999","07:03:00","07:03:00","7098","2","","0","0","2168.58"
9
+ "49-601--1-MF10-999","07:06:00","07:06:00","51587","3","","0","0","2848.26"
@@ -0,0 +1,4 @@
1
+ stop_id,stop_name,stop_lat,stop_lon
2
+ "21611","Monash University (Clayton)","-37.9139064388162","145.131978988767"
3
+ "7098","Milgate St/North Rd (Oakleigh South)","-37.912515519291","145.109218966528"
4
+ "51587","Huntingdale Station/Haughton Rd (Oakleigh)","-37.910940302153","145.102616537489"
@@ -0,0 +1,4 @@
1
+ route_id,service_id,trip_id,shape_id,trip_headsign,direction_id,block_id
2
+ "49-601-aus-1","MF10-49-601-aus","49-601--1-MF10-4481014","49-601-aus-1.3.H","Huntingdale Station","0",""
3
+ "49-601-aus-1","MF10-49-601-aus","49-601--1-MF10-4481114","49-601-aus-1.2.R","Monash University (Clayton)","1",""
4
+ "49-601-aus-1","MF10-49-601-aus","49-601--1-MF10-999","49-601-aus-1.4.H","Huntingdale Station","0",""
@@ -0,0 +1,25 @@
1
+ {
2
+ "Ballarat Bus Interchange": "Ballarat Railway Station",
3
+ "Box Hill Bus Station/Station Street": "Box Hill Railway Station/Station Street",
4
+ "Chrisholm Institute of TAFE/Beach Street": "Chisholm TAFE - Frankston/Beach Street",
5
+ "Chisholm Institute Of TAFE/Beach Street": "Chisholm TAFE - Frankston/Beach Street",
6
+ "Chisholm Institute/Cleeland Street": "Chisholm TAFE - Dandenong/Cleeland Street",
7
+ "Chisholm TAFE/Stud Road": "Chisholm TAFE - Dandenong/Stud Road",
8
+ "Dalgetty Street/Holding Street": "Dalgetty Road/Holding Street",
9
+ "Freeburgh Hall/Great Alpine Rd": "Freeburgh Community Hall/Great Alpine Rd ",
10
+ "Holmesglen TAFE/Warrigal Road": "Holmesglen TAFE - Chadstone/Warrigal Road",
11
+ "Kangan Batman TAFE/Buckley Street": "Kangan TAFE - Docklands/Buckley Street",
12
+ "Monash University": "Monash University Bus Loop",
13
+ "Newport Interchange/Mason Street": "Newport Railway Station/Mason Street",
14
+ "Swinburne TAFE/Norton Road": "Swinburne TAFE - Croydon/Norton Road",
15
+ "Swinburne TAFE/Stud Road": "Swinburne TAFE - Wantirna/Stud Road",
16
+ "Clarendon Street/Whiteman Street": "Clarendon Street Junction/Whiteman Street",
17
+ "Flemington Racecourse/Racecourse Road": "Ascot Vale Road/Racecourse Road",
18
+ "New Quay Promenade/Docklands Drive": "NewQuay Promenade/Docklands Drive",
19
+ "Port Junction/79 Whiteman Street": "Clarendon Street Junction/79 Whiteman Street",
20
+ "Lakes Caravilla/Princes Highway": "Hunters Lane/Princes Highway",
21
+ "South Dudley Road/Bass Highway": "Wonthaggi Community Garden/Bass Highway",
22
+ "Clunes-Creswick": "Williams St/Clunes-Creswick Road",
23
+ "Alfred Street/Clunes-Creswick Road": "Williams St/Clunes-Creswick Road",
24
+ "Warnambool Railway Station/Merri Street": "Warrnambool Railway Station/Merri Street"
25
+ }
@@ -0,0 +1 @@
1
+ ["Melbourne University/Royal Parade","Melbourne University/Swanston Street","Melbourne University/Grattan Street","Arts Precinct/Sturt Street"]
@@ -0,0 +1,77 @@
1
+ {
2
+ "type": "FeatureCollection",
3
+ "features": [
4
+ {
5
+ "type": "Feature",
6
+ "properties": {
7
+ "LOC_NAME": "Camberwell"
8
+ },
9
+ "geometry": {
10
+ "coordinates": [
11
+ [
12
+ [
13
+ 145.0654826594208,
14
+ -37.83227599257904
15
+ ],
16
+ [
17
+ 145.0654826594208,
18
+ -37.82320541031217
19
+ ],
20
+ [
21
+ 145.05296983324547,
22
+ -37.82320541031217
23
+ ],
24
+ [
25
+ 145.05296983324547,
26
+ -37.83227599257904
27
+ ],
28
+ [
29
+ 145.0654826594208,
30
+ -37.83227599257904
31
+ ]
32
+ ]
33
+ ],
34
+ "type": "Polygon"
35
+ },
36
+ "id": 0
37
+ },
38
+ {
39
+ "type": "Feature",
40
+ "properties": {
41
+ "LOC_NAME": "St Kilda"
42
+ },
43
+ "geometry": {
44
+ "coordinates": [
45
+ [
46
+ [
47
+ 144.97209311935387,
48
+ -37.8628358446381
49
+ ],
50
+ [
51
+ 144.97431392178527,
52
+ -37.87757849344121
53
+ ],
54
+ [
55
+ 144.99528500125763,
56
+ -37.879387737748246
57
+ ],
58
+ [
59
+ 144.9956525653555,
60
+ -37.85862681642262
61
+ ],
62
+ [
63
+ 144.9841718180511,
64
+ -37.85611049869745
65
+ ],
66
+ [
67
+ 144.97209311935387,
68
+ -37.8628358446381
69
+ ]
70
+ ]
71
+ ],
72
+ "type": "Polygon"
73
+ },
74
+ "id": 1
75
+ }
76
+ ]
77
+ }
@@ -0,0 +1,5 @@
1
+ route_id,service_id,trip_id,shape_id,trip_headsign,direction_id,block_id
2
+ "43-490-aus-1","T2_2","43-490--1-MF4-1111914","43-490-aus-1.3.H","Gowanbrae","0",""
3
+ "6-wr9-mjp-1","T2_2","5.T3.6-wr9-mjp-1.2.R","6-wr9-mjp-1.2.R","Warrnambool","1",""
4
+ "53-G01-aus-1","T2_2","58-G01--1-MF1-9942214","53-G01-aus-1.2.R","North Shore Station","0",""
5
+ "57-83-aus-1","T2_2","57-83--1-MF2-57586310","57-83-aus-1.2.R","Warragul East","0",""
@@ -0,0 +1,29 @@
1
+ trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_type,drop_off_type,shape_dist_traveled
2
+ "1.T2.2-ALM-vpt-1.1.R","04:57:00","04:57:00","19847","1","","0","0","0.00"
3
+ "1.T2.2-ALM-vpt-1.1.R","04:58:00","04:58:00","19848","2","","0","0","724.22"
4
+ "1.T2.2-ALM-vpt-1.1.R","05:00:00","05:00:00","19849","3","","0","0","1954.65"
5
+ "1.T2.2-ALM-vpt-1.1.R","05:02:00","05:02:00","19850","4","","0","0","2902.91"
6
+ "1.T2.2-ALM-vpt-1.1.R","05:04:00","05:04:00","19851","5","","0","0","3931.98"
7
+ "1.T2.2-ALM-vpt-1.1.R","05:05:00","05:05:00","19852","6","","0","0","4418.97"
8
+ "1.T2.2-ALM-vpt-1.1.R","05:08:00","05:08:00","19853","7","","0","0","5923.31"
9
+ "10.T2.2-ALM-vpt-1.3.R","07:08:00","07:08:00","19847","1","","0","0","0.00"
10
+ "10.T2.2-ALM-vpt-1.3.R","07:09:00","07:09:00","19848","2","","0","0","724.22"
11
+ "10.T2.2-ALM-vpt-1.3.R","07:11:00","07:11:00","19849","3","","0","0","1954.65"
12
+ "10.T2.2-ALM-vpt-1.3.R","07:13:00","07:13:00","19850","4","","0","0","2902.91"
13
+ "10.T2.2-ALM-vpt-1.3.R","07:15:00","07:15:00","19851","5","","0","0","3931.98"
14
+ "10.T2.2-ALM-vpt-1.3.R","07:16:00","07:16:00","19852","6","","0","0","4418.97"
15
+ "10.T2.2-ALM-vpt-1.3.R","07:19:00","07:19:00","19853","7","","0","0","5923.31"
16
+ "100.T2.2-ALM-vpt-1.1.R","23:16:00","23:16:00","19847","1","","0","0","0.00"
17
+ "100.T2.2-ALM-vpt-1.1.R","23:17:00","23:17:00","19848","2","","0","0","724.22"
18
+ "100.T2.2-ALM-vpt-1.1.R","23:19:00","23:19:00","19849","3","","0","0","1954.65"
19
+ "100.T2.2-ALM-vpt-1.1.R","23:21:00","23:21:00","19850","4","","0","0","2902.91"
20
+ "100.T2.2-ALM-vpt-1.1.R","23:23:00","23:23:00","19851","5","","0","0","3931.98"
21
+ "100.T2.2-ALM-vpt-1.1.R","23:24:00","23:24:00","19852","6","","0","0","4418.97"
22
+ "100.T2.2-ALM-vpt-1.1.R","23:27:00","23:27:00","19853","7","","0","0","5923.31"
23
+ "101.T2.2-ALM-vpt-1.2.H","23:31:00","23:31:00","19853","1","","0","0","0.00"
24
+ "101.T2.2-ALM-vpt-1.2.H","23:33:00","23:33:00","19852","2","","0","0","1504.34"
25
+ "101.T2.2-ALM-vpt-1.2.H","23:35:00","23:35:00","19851","3","","0","0","1991.33"
26
+ "101.T2.2-ALM-vpt-1.2.H","23:37:00","23:37:00","19850","4","","0","0","3020.40"
27
+ "101.T2.2-ALM-vpt-1.2.H","23:38:00","23:38:00","19849","5","","0","0","3968.66"
28
+ "101.T2.2-ALM-vpt-1.2.H","23:40:00","23:40:00","19848","6","","0","0","5199.09"
29
+ "101.T2.2-ALM-vpt-1.2.H","23:42:00","23:42:00","19847","7","","0","0","5923.31"
@@ -0,0 +1,8 @@
1
+ trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_type,drop_off_type,shape_dist_traveled
2
+ "02-ALM--1-T2-2302","04:57:00","04:57:00","19847","1","","0","0","0.00"
3
+ "02-ALM--1-T2-2302","04:58:00","04:58:00","19848","2","","0","0","724.22"
4
+ "02-ALM--1-T2-2302","05:00:00","05:00:00","19849","3","","0","0","1954.65"
5
+ "02-ALM--1-T2-2302","05:02:00","05:02:00","19850","4","","0","0","2902.91"
6
+ "02-ALM--1-T2-2302","05:04:00","05:04:00","19851","5","","0","0","3931.98"
7
+ "02-ALM--1-T2-2302","05:05:00","05:05:00","19852","6","","0","0","4418.97"
8
+ "02-ALM--1-T2-2302","05:08:00","05:08:00","19853","7","","0","0","5923.31"
@@ -0,0 +1,8 @@
1
+ stop_id,stop_name,stop_lat,stop_lon,platform_code
2
+ "19847","Alamein Railway Station (Ashburton)","-37.8683203919916","145.079655668512","1"
3
+ "19848","Ashburton Railway Station (Ashburton)","-37.8619675331742","145.081343759057","1"
4
+ "19849","Burwood Railway Station (Glen Iris)","-37.8515632823222","145.080511068965","1"
5
+ "19850","Hartwell Railway Station (Camberwell)","-37.8439845657224","145.075559591232","1"
6
+ "19851","Willison Railway Station (Camberwell)","-37.835715650541","145.070297555358","1","1"
7
+ "19852","Riversdale Railway Station (Camberwell)","-37.8315054341774","145.069645982205","2"
8
+ "19853","Camberwell Railway Station (Camberwell)","-37.8265671441721","145.058697177155","3"
@@ -0,0 +1,5 @@
1
+ route_id,service_id,trip_id,shape_id,trip_headsign,direction_id,block_id
2
+ "2-ALM-vpt-1","T2_2","1.T2.2-ALM-vpt-1.1.R","2-ALM-vpt-1.1.R","Camberwell","1",""
3
+ "2-ALM-vpt-1","T2_2","10.T2.2-ALM-vpt-1.3.R","2-ALM-vpt-1.3.R","Camberwell","1",""
4
+ "2-ALM-vpt-1","T2_2","100.T2.2-ALM-vpt-1.1.R","2-ALM-vpt-1.1.R","Camberwell","1",""
5
+ "2-ALM-vpt-1","T2_2","101.T2.2-ALM-vpt-1.2.H","2-ALM-vpt-1.2.H","Alamein","0",""
@@ -0,0 +1,2 @@
1
+ route_id,service_id,trip_id,shape_id,trip_headsign,direction_id,block_id
2
+ "2-ALM-vpt-1","T2_2","02-ALM--1-T2-2302","2-ALM-vpt-1.1.R","Camberwell","1",""
@@ -0,0 +1,69 @@
1
+ import { expect } from 'chai'
2
+ import path from 'path'
3
+ import url from 'url'
4
+ import { TRANSIT_MODES } from '../lib/constants.mjs'
5
+ import { LokiDatabaseConnection } from '@transportme/database'
6
+ import StopsLoader from '../lib/loader/StopsLoader.mjs'
7
+ import RouteLoader from '../lib/loader/RouteLoader.mjs'
8
+ import TripLoader from '../lib/loader/TripLoader.mjs'
9
+ import setStopServices from '../lib/post-processing/set-stop-services.mjs'
10
+ import suburbs from './sample-data/suburbs.json' with { type: 'json' }
11
+
12
+ const __filename = url.fileURLToPath(import.meta.url)
13
+ const __dirname = path.dirname(__filename)
14
+
15
+ const routesFile = path.join(__dirname, 'sample-data', 'routes', 'metro_lines.txt')
16
+ const agencyFile = path.join(__dirname, 'sample-data', 'routes', 'agency.txt')
17
+
18
+ const calendarFile = path.join(__dirname, 'sample-data', 'calendar', 'calendar.txt')
19
+ const calendarDatesFile = path.join(__dirname, 'sample-data', 'calendar', 'calendar_dates.txt')
20
+
21
+ const stopsFile = path.join(__dirname, 'sample-data', 'trips', 'stops.txt')
22
+ const stopTimesFile = path.join(__dirname, 'sample-data', 'trips', 'stop_times.txt')
23
+ const tripsFile = path.join(__dirname, 'sample-data', 'trips', 'trips.txt')
24
+
25
+ describe('The TripLoader class', () => {
26
+ it('Should process the trip and add it to the database', async () => {
27
+ let database = new LokiDatabaseConnection('test-db')
28
+ let stops = await database.createCollection('stops')
29
+ let routes = await database.createCollection('routes')
30
+ let trips = await database.createCollection('gtfs timetables')
31
+
32
+ let stopLoader = new StopsLoader(stopsFile, suburbs, TRANSIT_MODES.metroTrain, database)
33
+ await stopLoader.loadStops()
34
+
35
+ let routeLoader = new RouteLoader(routesFile, agencyFile, TRANSIT_MODES.metroTrain, database)
36
+ await routeLoader.loadRoutes()
37
+
38
+ let routeIDMap = routeLoader.getRouteIDMap()
39
+
40
+ let tripLoader = new TripLoader({
41
+ tripsFile, stopTimesFile,
42
+ calendarFile, calendarDatesFile
43
+ }, TRANSIT_MODES.metroTrain, database)
44
+ await tripLoader.loadTrips({
45
+ routeIDMap
46
+ })
47
+
48
+ await setStopServices(database)
49
+
50
+ let alamein = await stops.findDocument({ 'bays.stopGTFSID': '19847' })
51
+ let alameinPlatform = alamein.bays.find(bay => bay.stopGTFSID === '19847')
52
+ expect(alameinPlatform).to.not.be.null
53
+ expect(alameinPlatform.services).to.deep.equal([{
54
+ routeGTFSID: "2-ALM",
55
+ gtfsDirection: 0,
56
+ routeNumber: null
57
+ }, {
58
+ routeGTFSID: "2-ALM",
59
+ gtfsDirection: 1,
60
+ routeNumber: null
61
+ }])
62
+
63
+ expect(alameinPlatform.screenServices, "Only trips from Alamein to Camberwell should have matched").to.deep.equal([{
64
+ routeGTFSID: "2-ALM",
65
+ gtfsDirection: 1,
66
+ routeNumber: null
67
+ }])
68
+ })
69
+ })
@@ -0,0 +1,26 @@
1
+ import { expect } from 'chai'
2
+ import { hhmmToMinutesPastMidnight, parseDate, toGTFSDate } from '../lib/utils.mjs'
3
+
4
+ describe('The utils class', () => {
5
+ describe('The parseDate function', () => {
6
+ it('Should convert a GTFS date to a Melbourne timezoned date', () => {
7
+ expect(parseDate('20241122').toUTC().toISO()).to.equal('2024-11-21T13:00:00.000Z')
8
+ })
9
+ })
10
+
11
+
12
+ describe('The toGTFSDate function', () => {
13
+ it('Should convert a Luxon date back into a GTFS date', () => {
14
+ let date = parseDate('20241122')
15
+ expect(toGTFSDate(date.plus({ day: 3 }))).to.equal('20241125')
16
+ })
17
+ })
18
+
19
+ describe('The hhmmToMinutesPastMidnight function', () => {
20
+ it('Should convert a HH:MM timestamp into the minutes past midnight', () => {
21
+ expect(hhmmToMinutesPastMidnight('06:05')).to.equal(6 * 60 + 5)
22
+ expect(hhmmToMinutesPastMidnight('24:00')).to.equal(1440)
23
+ expect(hhmmToMinutesPastMidnight('25:00')).to.equal(1500)
24
+ })
25
+ })
26
+ })