@transportme/load-ptv-gtfs 1.3.1 → 1.3.3

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.
@@ -48,7 +48,7 @@ export default class GTFSTrip {
48
48
  * @returns {GTFSTrip} A trip instance representing the data being passed in
49
49
  */
50
50
  static create(data, mode) {
51
- let types = [ SmartrakTrip, MetroRRBTrip, MetroTrip, GTFSTrip ]
51
+ let types = [ SmartrakTrip, MetroTrip, GTFSTrip ]
52
52
  for (let type of types) {
53
53
  if (type.canProcess(data, mode)) return new type(data)
54
54
  }
@@ -148,12 +148,12 @@ export class MetroTrip extends GTFSTrip {
148
148
  constructor(data) {
149
149
  super(data)
150
150
 
151
- let runID = data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{3})$/)
151
+ let runID = data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{2,3})$/)
152
152
  this.#runID = runID[1]
153
153
  }
154
154
 
155
155
  static canProcess(data, mode) {
156
- return mode === TRANSIT_MODES.metroTrain && data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{3})$/)
156
+ return mode === TRANSIT_MODES.metroTrain && data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{2,3})$/)
157
157
  }
158
158
 
159
159
  getTrainDirection() {
@@ -163,11 +163,12 @@ export class MetroTrip extends GTFSTrip {
163
163
 
164
164
  getTripData() {
165
165
  let runID = this.getRunID()
166
+ let tripID = this.getTripID()
166
167
 
167
168
  return {
168
169
  ...super.getTripData(),
169
170
  runID,
170
- isRailReplacementBus: runID.length === 5 && runID[0] === 'B',
171
+ isRailReplacementBus: (runID.length === 5 && runID[0] === 'B') || !!tripID.match(/^02-\w{3}-R-/),
171
172
  direction: this.getTrainDirection()
172
173
  }
173
174
  }
@@ -119,7 +119,10 @@ export default class TripLoader {
119
119
  stopDistance: stop.distanceTravelled
120
120
  }
121
121
 
122
- if (bay.platform) data.platform = bay.platform
122
+ if (bay.platform) {
123
+ if (bay.parentStopGTFSID) data.stopGTFSID = bay.parentStopGTFSID
124
+ data.platform = bay.platform
125
+ }
123
126
 
124
127
  return data
125
128
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -17,10 +17,10 @@ describe('The GTFSStopTimesReader class', () => {
17
17
  let stopTimes = await reader.getNextEntity()
18
18
  expect(stopTimes.tripID).to.equal('02-ALM--12-T5-2000')
19
19
  expect(stopTimes.stops.length).to.equal(7)
20
- expect(stopTimes.stops[0].stopID).to.equal('19847')
20
+ expect(stopTimes.stops[0].stopID).to.equal('11197')
21
21
  expect(stopTimes.stops[0].departureTime).to.equal('04:57')
22
22
 
23
- expect(stopTimes.stops[6].stopID).to.equal('19853')
23
+ expect(stopTimes.stops[6].stopID).to.equal('11207')
24
24
  expect(stopTimes.stops[6].departureTime).to.equal('05:08')
25
25
 
26
26
  await reader.getNextEntity()
@@ -29,7 +29,7 @@ describe('The GTFSStopTimesReader class', () => {
29
29
  let lastTrip = await reader.getNextEntity()
30
30
  expect(lastTrip.tripID).to.equal('02-ALM--12-T5-2001')
31
31
  expect(lastTrip.stops.length).to.equal(7)
32
- expect(lastTrip.stops[0].stopID).to.equal('19853')
32
+ expect(lastTrip.stops[0].stopID).to.equal('11207')
33
33
  expect(lastTrip.stops[0].departureTime).to.equal('23:31')
34
34
 
35
35
  expect(reader.available()).to.be.false
@@ -58,6 +58,7 @@ describe('The TripLoader class', () => {
58
58
 
59
59
  expect(trip.stopTimings.length).to.equal(7)
60
60
  expect(trip.stopTimings[0].stopName).to.equal('Alamein Railway Station')
61
+ expect(trip.stopTimings[0].stopGTFSID).to.equal('vic:rail:ALM')
61
62
  expect(trip.stopTimings[0].arrivalTime).to.be.null
62
63
  expect(trip.stopTimings[0].arrivalTimeMinutes).to.be.null
63
64
  expect(trip.stopTimings[0].stopConditions.dropoff).to.equal(1)
@@ -67,16 +68,18 @@ describe('The TripLoader class', () => {
67
68
  expect(trip.stopTimings[0].platform).to.equal('1')
68
69
 
69
70
  expect(trip.stopTimings[5].stopName).to.equal('Riversdale Railway Station')
70
- expect(trip.stopTimings[5].platform).to.equal('2')
71
+ expect(trip.stopTimings[5].stopGTFSID).to.equal('vic:rail:RIV')
72
+ expect(trip.stopTimings[5].platform).to.equal('1')
71
73
 
72
74
  expect(trip.stopTimings[6].stopName).to.equal('Camberwell Railway Station')
75
+ expect(trip.stopTimings[6].stopGTFSID).to.equal('vic:rail:CAM')
73
76
  expect(trip.stopTimings[6].arrivalTime).to.equal('05:08')
74
77
  expect(trip.stopTimings[6].arrivalTimeMinutes).to.equal(5 * 60 + 8)
75
78
  expect(trip.stopTimings[6].departureTime).to.be.null
76
79
  expect(trip.stopTimings[6].departureTimeMinutes).to.be.null
77
80
  expect(trip.stopTimings[6].stopConditions.dropoff).to.equal(0)
78
81
  expect(trip.stopTimings[6].stopConditions.pickup).to.equal(1)
79
- expect(trip.stopTimings[6].platform).to.equal('3')
82
+ expect(trip.stopTimings[6].platform).to.equal('1')
80
83
 
81
84
  expect(trip.origin).to.equal('Alamein Railway Station')
82
85
  expect(trip.destination).to.equal('Camberwell Railway Station')
@@ -11,21 +11,20 @@ const __dirname = path.dirname(__filename)
11
11
 
12
12
  const tripsFile = path.join(__dirname, 'sample-data', 'trips', 'trips.txt')
13
13
  const busTripsFile = path.join(__dirname, 'sample-data', 'trips', 'bus_trips.txt')
14
+ const calendar = new GTFSCalendar({
15
+ id: 'T1',
16
+ startDay: '20241122',
17
+ endDay: '20241129',
18
+ daysOfWeek: ["0","0","0","0","1","1","0"]
19
+ })
14
20
 
15
21
  describe('The GTFSTrip class', () => {
16
22
  it('Should process the skeleton trip data and populate the operation days', () => {
17
- let calendar = new GTFSCalendar({
18
- id: 'T1',
19
- startDay: '20241122',
20
- endDay: '20241129',
21
- daysOfWeek: ["0","0","0","0","1","1","0"]
22
- })
23
-
24
23
  // route_id,service_id,trip_id,shape_id,trip_headsign,direction_id,block_id
25
24
  // "6-452-mjp-1","T0_16","1.T0.6-452-mjp-1.1.H","6-452-mjp-1.1.H","Eynesbury","0",""
26
25
  let trip = new GTFSTrip({
27
26
  routeGTFSID: '6-452',
28
- calendar: calendar,
27
+ calendar,
29
28
  id: '1.T0.6-452-mjp-1.1.H',
30
29
  shapeID: '6-452-mjp-1.1.H',
31
30
  headsign: 'Eynesbury',
@@ -7,6 +7,8 @@ import { expect } from 'chai'
7
7
  import suburbs from './sample-data/suburbs.json' with { type: 'json' }
8
8
  import RouteLoader from '../lib/loader/RouteLoader.mjs'
9
9
  import TripLoader from '../lib/loader/TripLoader.mjs'
10
+ import GTFSCalendar from '../lib/gtfs-parser/GTFSCalendar.mjs'
11
+ import { MetroTrip } from '../lib/gtfs-parser/GTFSTrip.mjs'
10
12
 
11
13
  const __filename = url.fileURLToPath(import.meta.url)
12
14
  const __dirname = path.dirname(__filename)
@@ -198,4 +200,45 @@ describe('The GTFS Loaders with the new Metro data', () => {
198
200
  expect(trip.stopTimings[2].arrivalTime).to.equal('00:10')
199
201
  })
200
202
  })
203
+
204
+ describe('The MetroTrip subclass', () => {
205
+ it('Should detect rail buses', () => {
206
+ let calendar = new GTFSCalendar({
207
+ id: 'T1',
208
+ startDay: '20241122',
209
+ endDay: '20241129',
210
+ daysOfWeek: ["0","0","0","0","1","1","0"]
211
+ })
212
+
213
+ expect(new MetroTrip({
214
+ routeGTFSID: '2-PKM',
215
+ calendar,
216
+ id: '02-PKM--54-T6-C962',
217
+ shapeID: '2-PKM-vpt-54.70.R',
218
+ headsign: 'South Yarra',
219
+ direction: '0',
220
+ block: ''
221
+ }).getTripData().isRailReplacementBus).to.be.false
222
+
223
+ expect(new MetroTrip({
224
+ routeGTFSID: '2-PKM',
225
+ calendar,
226
+ id: '02-PKM-R-6-T5_bp-BF400',
227
+ shapeID: '2-PKM-R-vpt-6.7.R',
228
+ headsign: 'South Yarra',
229
+ direction: '0',
230
+ block: ''
231
+ }).getTripData().isRailReplacementBus).to.be.true
232
+
233
+ expect(new MetroTrip({
234
+ routeGTFSID: '2-PKM',
235
+ calendar,
236
+ id: '02-PKM-R-6-T5_bp-BF22',
237
+ shapeID: '2-PKM-R-vpt-6.7.R',
238
+ headsign: 'South Yarra',
239
+ direction: '0',
240
+ block: ''
241
+ }).getTripData().isRailReplacementBus).to.be.true
242
+ })
243
+ })
201
244
  })
@@ -1,29 +1,29 @@
1
1
  trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_type,drop_off_type,shape_dist_traveled
2
- "02-ALM--12-T5-2000","04:57:00","04:57:00","19847","1","","0","0","0.00"
3
- "02-ALM--12-T5-2000","04:58:00","04:58:00","19848","2","","0","0","724.22"
4
- "02-ALM--12-T5-2000","05:00:00","05:00:00","19849","3","","0","0","1954.65"
5
- "02-ALM--12-T5-2000","05:02:00","05:02:00","19850","4","","0","0","2902.91"
6
- "02-ALM--12-T5-2000","05:04:00","05:04:00","19851","5","","0","0","3931.98"
7
- "02-ALM--12-T5-2000","05:05:00","05:05:00","19852","6","","0","0","4418.97"
8
- "02-ALM--12-T5-2000","05:08:00","05:08:00","19853","7","","0","0","5923.31"
9
- "02-ALM--12-T5-2002","07:08:00","07:08:00","19847","1","","0","0","0.00"
10
- "02-ALM--12-T5-2002","07:09:00","07:09:00","19848","2","","0","0","724.22"
11
- "02-ALM--12-T5-2002","07:11:00","07:11:00","19849","3","","0","0","1954.65"
12
- "02-ALM--12-T5-2002","07:13:00","07:13:00","19850","4","","0","0","2902.91"
13
- "02-ALM--12-T5-2002","07:15:00","07:15:00","19851","5","","0","0","3931.98"
14
- "02-ALM--12-T5-2002","07:16:00","07:16:00","19852","6","","0","0","4418.97"
15
- "02-ALM--12-T5-2002","07:19:00","07:19:00","19853","7","","0","0","5923.31"
16
- "02-ALM--12-T5-2004","23:16:00","23:16:00","19847","1","","0","0","0.00"
17
- "02-ALM--12-T5-2004","23:17:00","23:17:00","19848","2","","0","0","724.22"
18
- "02-ALM--12-T5-2004","23:19:00","23:19:00","19849","3","","0","0","1954.65"
19
- "02-ALM--12-T5-2004","23:21:00","23:21:00","19850","4","","0","0","2902.91"
20
- "02-ALM--12-T5-2004","23:23:00","23:23:00","19851","5","","0","0","3931.98"
21
- "02-ALM--12-T5-2004","23:24:00","23:24:00","19852","6","","0","0","4418.97"
22
- "02-ALM--12-T5-2004","23:27:00","23:27:00","19853","7","","0","0","5923.31"
23
- "02-ALM--12-T5-2001","23:31:00","23:31:00","19853","1","","0","0","0.00"
24
- "02-ALM--12-T5-2001","23:33:00","23:33:00","19852","2","","0","0","1504.34"
25
- "02-ALM--12-T5-2001","23:35:00","23:35:00","19851","3","","0","0","1991.33"
26
- "02-ALM--12-T5-2001","23:37:00","23:37:00","19850","4","","0","0","3020.40"
27
- "02-ALM--12-T5-2001","23:38:00","23:38:00","19849","5","","0","0","3968.66"
28
- "02-ALM--12-T5-2001","23:40:00","23:40:00","19848","6","","0","0","5199.09"
29
- "02-ALM--12-T5-2001","23:42:00","23:42:00","19847","7","","0","0","5923.31"
2
+ "02-ALM--12-T5-2000","04:57:00","04:57:00","11197","1","","0","0","0.00"
3
+ "02-ALM--12-T5-2000","04:58:00","04:58:00","11198","2","","0","0","716.06"
4
+ "02-ALM--12-T5-2000","05:00:00","05:00:00","11200","3","","0","0","1920.94"
5
+ "02-ALM--12-T5-2000","05:02:00","05:02:00","11202","4","","0","0","2903.58"
6
+ "02-ALM--12-T5-2000","05:04:00","05:04:00","11203","5","","0","0","3923.66"
7
+ "02-ALM--12-T5-2000","05:05:00","05:05:00","11205","6","","0","0","4428.35"
8
+ "02-ALM--12-T5-2000","05:08:00","05:08:00","11207","7","","0","0","5935.97"
9
+ "02-ALM--12-T5-2002","07:08:00","07:08:00","11197","1","","0","0","0.00"
10
+ "02-ALM--12-T5-2002","07:09:00","07:09:00","11198","2","","0","0","716.06"
11
+ "02-ALM--12-T5-2002","07:11:00","07:11:00","11200","3","","0","0","1920.94"
12
+ "02-ALM--12-T5-2002","07:13:00","07:13:00","11202","4","","0","0","2903.58"
13
+ "02-ALM--12-T5-2002","07:15:00","07:15:00","11203","5","","0","0","3923.66"
14
+ "02-ALM--12-T5-2002","07:16:00","07:16:00","11205","6","","0","0","4428.35"
15
+ "02-ALM--12-T5-2002","07:19:00","07:19:00","11208","7","","0","0","5935.62"
16
+ "02-ALM--12-T5-2004","23:16:00","23:16:00","11197","1","","0","0","0.00"
17
+ "02-ALM--12-T5-2004","23:17:00","23:17:00","11198","2","","0","0","716.06"
18
+ "02-ALM--12-T5-2004","23:19:00","23:19:00","11200","3","","0","0","1920.94"
19
+ "02-ALM--12-T5-2004","23:21:00","23:21:00","11202","4","","0","0","2903.58"
20
+ "02-ALM--12-T5-2004","23:23:00","23:23:00","11203","5","","0","0","3923.66"
21
+ "02-ALM--12-T5-2004","23:24:00","23:24:00","11205","6","","0","0","4428.35"
22
+ "02-ALM--12-T5-2004","23:27:00","23:27:00","11207","7","","0","0","5935.97"
23
+ "02-ALM--12-T5-2001","23:31:00","23:31:00","11207","1","","0","0","0.00"
24
+ "02-ALM--12-T5-2001","23:33:00","23:33:00","11206","2","","0","0","1491.70"
25
+ "02-ALM--12-T5-2001","23:35:00","23:35:00","11204","3","","0","0","2014.00"
26
+ "02-ALM--12-T5-2001","23:37:00","23:37:00","11201","4","","0","0","3028.33"
27
+ "02-ALM--12-T5-2001","23:38:00","23:38:00","11199","5","","0","0","4003.04"
28
+ "02-ALM--12-T5-2001","23:40:00","23:40:00","11198","6","","0","0","5220.10"
29
+ "02-ALM--12-T5-2001","23:42:00","23:42:00","11197","7","","0","0","5936.16"
@@ -1,8 +1,93 @@
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"
1
+ stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station,wheelchair_boarding,level_id,platform_code
2
+ "10920","Flagstaff Station","-37.81187992","144.95604277","","vic:rail:FGS","1","Level -2","1"
3
+ "10921","Flagstaff Station","-37.81172541","144.95596751","","vic:rail:FGS","1","Level -2","2"
4
+ "10922","Melbourne Central Station","-37.80997401","144.96254713","","vic:rail:MCE","1","Level -2","1"
5
+ "10923","Melbourne Central Station","-37.80986533","144.96251604","","vic:rail:MCE","1","Level -2","2"
6
+ "10924","Parliament Station","-37.81100921","144.97292350","","vic:rail:PAR","1","Level -2","1"
7
+ "11197","Alamein Station","-37.86820440","145.07972689","","vic:rail:ALM","1","Level 0","1"
8
+ "11198","Ashburton Station","-37.86193224","145.08139014","","vic:rail:ASH","1","Level 0","1"
9
+ "11199","Burwood Station","-37.85162801","145.08061168","","vic:rail:BWD","1","Level 0","2"
10
+ "11200","Burwood Station","-37.85174400","145.08054048","","vic:rail:BWD","1","Level 0","1"
11
+ "11201","Hartwell Station","-37.84384815","145.07548359","","vic:rail:HWL","1","Level 0","2"
12
+ "11202","Hartwell Station","-37.84388325","145.07542585","","vic:rail:HWL","1","Level 0","1"
13
+ "11203","Willison Station","-37.83567850","145.07023035","","vic:rail:WSN","1","Level 0","1"
14
+ "11204","Willison Station","-37.83568036","145.07034393","","vic:rail:WSN","1","Level 0","2"
15
+ "11205","Riversdale Station","-37.83129769","145.06961731","","vic:rail:RIV","1","Level 0","1"
16
+ "11206","Riversdale Station","-37.83116499","145.06976848","","vic:rail:RIV","1","Level 0","2"
17
+ "11207","Camberwell Station","-37.82668783","145.05836453","","vic:rail:CAM","1","Level -2","1"
18
+ "11208","Camberwell Station","-37.82659756","145.05835553","","vic:rail:CAM","1","Level -2","2"
19
+ "11209","Camberwell Station","-37.82651798","145.05844851","","vic:rail:CAM","1","Level -2","3"
20
+ "11210","Parliament Station","-37.81091306","144.97309652","","vic:rail:PAR","1","Level -2","2"
21
+ "11212","Flinders Street Station","-37.81851165","144.96483434","","vic:rail:FSS","1","Level 0","1"
22
+ "11213","Flinders Street Station","-37.81830668","144.96601006","","vic:rail:FSS","1","Level 0","2"
23
+ "11214","Flinders Street Station","-37.81822445","144.96646672","","vic:rail:FSS","1","Level 0","3"
24
+ "11215","Flinders Street Station","-37.81828907","144.96655582","","vic:rail:FSS","1","Level 0","4"
25
+ "11216","Flinders Street Station","-37.81832588","144.96660025","","vic:rail:FSS","1","Level 0","5"
26
+ "11217","Flinders Street Station","-37.81837661","144.96692830","","vic:rail:FSS","1","Level 0","6"
27
+ "11218","Flinders Street Station","-37.81849057","144.96674342","","vic:rail:FSS","1","Level 0","7"
28
+ "12195","Flagstaff Station","-37.81193456","144.95607534","","vic:rail:FGS","1","Level -3","3"
29
+ "12196","Flagstaff Station","-37.81175303","144.95600083","","vic:rail:FGS","1","Level -3","4"
30
+ "12197","Melbourne Central Station","-37.81002865","144.96257971","","vic:rail:MCE","1","Level -3","3"
31
+ "12198","Melbourne Central Station","-37.80990097","144.96249234","","vic:rail:MCE","1","Level -3","4"
32
+ "12199","Parliament Station","-37.81097201","144.97285637","","vic:rail:PAR","1","Level -3","3"
33
+ "12200","Parliament Station","-37.81092148","144.97306221","","vic:rail:PAR","1","Level -3","4"
34
+ "12201","Flinders Street Station","-37.81845378","144.96826668","","vic:rail:FSS","1","Level 0","13"
35
+ "12202","Flinders Street Station","-37.81840717","144.96817708","","vic:rail:FSS","1","Level 0","12"
36
+ "12203","Flinders Street Station","-37.81891371","144.96619788","","vic:rail:FSS","1","Level 0","10"
37
+ "12204","Flinders Street Station","-37.81860101","144.96687671","","vic:rail:FSS","1","Level 0","9"
38
+ "12205","Flinders Street Station","-37.81855617","144.96688930","","vic:rail:FSS","1","Level 0","8"
39
+ "12238","Auburn Station","-37.82255502","145.04605538","","vic:rail:AUB","1","Level 0","1"
40
+ "12239","Auburn Station","-37.82249272","145.04610247","","vic:rail:AUB","1","Level 0","2"
41
+ "12240","Auburn Station","-37.82237411","145.04601471","","vic:rail:AUB","1","Level 0","3"
42
+ "12241","Glenferrie Station","-37.82159483","145.03654905","","vic:rail:GFE","1","Level 0","1"
43
+ "12242","Glenferrie Station","-37.82153196","145.03656207","","vic:rail:GFE","1","Level 0","2"
44
+ "12243","Glenferrie Station","-37.82142406","145.03657629","","vic:rail:GFE","1","Level 0","3"
45
+ "12244","Hawthorn Station","-37.82207113","145.02300573","","vic:rail:HAW","1","Level 0","1"
46
+ "12245","Hawthorn Station","-37.82196208","145.02295183","","vic:rail:HAW","1","Level 0","2"
47
+ "12246","Hawthorn Station","-37.82189883","145.02294216","","vic:rail:HAW","1","Level 0","3"
48
+ "12247","Burnley Station","-37.82768805","145.00765396","","vic:rail:BLY","1","Level 0","1"
49
+ "12248","Burnley Station","-37.82761657","145.00768997","","vic:rail:BLY","1","Level 0","2"
50
+ "12249","Burnley Station","-37.82752649","145.00769239","","vic:rail:BLY","1","Level 0","3"
51
+ "12250","Burnley Station","-37.82748126","145.00768225","","vic:rail:BLY","1","Level 0","4"
52
+ "12251","East Richmond Station","-37.82651183","144.99675591","","vic:rail:ERM","1","Level 0","1"
53
+ "12252","East Richmond Station","-37.82633303","144.99684028","","vic:rail:ERM","1","Level 0","2"
54
+ "12253","Richmond Station","-37.82406640","144.98916470","","vic:rail:RMD","1","Level 0","1"
55
+ "12254","Richmond Station","-37.82403938","144.98916544","","vic:rail:RMD","1","Level 0","2"
56
+ "12255","Richmond Station","-37.82395008","144.98921331","","vic:rail:RMD","1","Level 0","3"
57
+ "12256","Richmond Station","-37.82392305","144.98921404","","vic:rail:RMD","1","Level 0","4"
58
+ "12257","Richmond Station","-37.82383356","144.98925055","","vic:rail:RMD","1","Level 0","5"
59
+ "12258","Richmond Station","-37.82380712","144.98928535","","vic:rail:RMD","1","Level 0","6"
60
+ "12259","Richmond Station","-37.82371743","144.98931051","","vic:rail:RMD","1","Level 0","7"
61
+ "12260","Richmond Station","-37.82369060","144.98932260","","vic:rail:RMD","1","Level 0","8"
62
+ "12261","Richmond Station","-37.82360091","144.98934775","","vic:rail:RMD","1","Level 0","9"
63
+ "12262","Richmond Station","-37.82358348","144.98938231","","vic:rail:RMD","1","Level 0","10"
64
+ "22187","Southern Cross Station","-37.81765471","144.95179389","","vic:rail:SSS","1","Level 0","8"
65
+ "22188","Southern Cross Station","-37.81825315","144.95200455","","vic:rail:SSS","1","Level 0","9"
66
+ "22189","Southern Cross Station","-37.81853495","144.95214444","","vic:rail:SSS","1","Level 0","10"
67
+ "22190","Southern Cross Station","-37.81853100","144.95191735","","vic:rail:SSS","1","Level 0","11"
68
+ "22191","Southern Cross Station","-37.81854783","144.95184872","","vic:rail:SSS","1","Level 0","12"
69
+ "22192","Southern Cross Station","-37.81866354","144.95176600","","vic:rail:SSS","1","Level 0","13"
70
+ "22193","Southern Cross Station","-37.81868957","144.95170848","","vic:rail:SSS","1","Level 0","14"
71
+ "26128","Burnley Rail Replacement Bus Stop","-37.82832757","145.00710276","","vic:rail:BLY","1","Level 0","Replacement bus"
72
+ "26170","Flinders Street Rail Replacement Bus Stop","-37.81798064","144.96591676","","vic:rail:FSS","1","Level 0","Replacement bus"
73
+ "26263","Richmond Rail Replacement Bus Stop","-37.82486644","144.98957471","","vic:rail:RMD","1","Level 0","Replacement bus"
74
+ "26282","Southern Cross Rail Replacement Bus Stop","-37.81743698","144.95326534","","vic:rail:SSS","1","Level 0","Replacement bus"
75
+ "vic:rail:ALM","Alamein Railway Station","-37.86832039","145.07965567","1","","1","",""
76
+ "vic:rail:ASH","Ashburton Railway Station","-37.86196753","145.08134376","1","","1","",""
77
+ "vic:rail:AUB","Auburn Railway Station","-37.82239831","145.04584366","1","","1","",""
78
+ "vic:rail:BLY","Burnley Railway Station","-37.82756022","145.00755515","1","","1","",""
79
+ "vic:rail:BWD","Burwood Railway Station","-37.85156328","145.08051107","1","","1","",""
80
+ "vic:rail:CAM","Camberwell Railway Station","-37.82656714","145.05869718","1","","1","",""
81
+ "vic:rail:ERM","East Richmond Railway Station","-37.82639995","144.99706569","1","","1","",""
82
+ "vic:rail:FGS","Flagstaff Railway Station","-37.81198150","144.95566511","1","","1","",""
83
+ "vic:rail:FSS","Flinders Street Railway Station","-37.81830513","144.96696435","1","","1","",""
84
+ "vic:rail:GFE","Glenferrie Railway Station","-37.82146682","145.03643883","1","","1","",""
85
+ "vic:rail:HAW","Hawthorn Railway Station","-37.82182601","145.02289866","1","","1","",""
86
+ "vic:rail:HWL","Hartwell Railway Station","-37.84398457","145.07555959","1","","1","",""
87
+ "vic:rail:JOR","Jordanville Railway Station","-37.87360339","145.11209016","1","","1","",""
88
+ "vic:rail:MCE","Melbourne Central Railway Station","-37.80993896","144.96260489","1","","1","",""
89
+ "vic:rail:PAR","Parliament Railway Station","-37.81133700","144.97311900","1","","1","",""
90
+ "vic:rail:RIV","Riversdale Railway Station","-37.83150543","145.06964598","1","","1","",""
91
+ "vic:rail:RMD","Richmond Railway Station","-37.82407446","144.99016426","1","","1","",""
92
+ "vic:rail:SSS","Southern Cross Railway Station","-37.81866310","144.95277706","1","","1","",""
93
+ "vic:rail:WSN","Willison Railway Station","-37.83571565","145.07029756","1","","1","",""
@@ -22,8 +22,8 @@ const stopsFile = path.join(__dirname, 'sample-data', 'trips', 'stops.txt')
22
22
  const stopTimesFile = path.join(__dirname, 'sample-data', 'trips', 'stop_times.txt')
23
23
  const tripsFile = path.join(__dirname, 'sample-data', 'trips', 'trips.txt')
24
24
 
25
- describe('The TripLoader class', () => {
26
- it('Should process the trip and add it to the database', async () => {
25
+ describe('The set stop services function', () => {
26
+ it('Should set stop and screen services on each bay', async () => {
27
27
  let database = new LokiDatabaseConnection('test-db')
28
28
  let stops = await database.createCollection('stops')
29
29
  let routes = await database.createCollection('routes')
@@ -47,8 +47,8 @@ describe('The TripLoader class', () => {
47
47
 
48
48
  await setStopServices(database)
49
49
 
50
- let alamein = await stops.findDocument({ 'bays.stopGTFSID': '19847' })
51
- let alameinPlatform = alamein.bays.find(bay => bay.stopGTFSID === '19847')
50
+ let alamein = await stops.findDocument({ 'bays.stopGTFSID': 'vic:rail:ALM' })
51
+ let alameinPlatform = alamein.bays.find(bay => bay.stopGTFSID === 'vic:rail:ALM')
52
52
  expect(alameinPlatform).to.not.be.null
53
53
  expect(alameinPlatform.services).to.deep.equal([{
54
54
  routeGTFSID: "2-ALM",