@pulsecharterconnect/types 0.2.31 → 0.2.33
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.
|
@@ -178,6 +178,8 @@ export declare class TransportationRequest implements ITransportationRequest {
|
|
|
178
178
|
updatedAt?: number;
|
|
179
179
|
constructor(transportationRequest: ITransportationRequest);
|
|
180
180
|
airTransportationRecommended(): boolean;
|
|
181
|
+
createTripAirSegmentsFromTransportationRequest(localTimezone: string, distalTimezone: string): ITripSegment[];
|
|
182
|
+
createTripGroundSegmentsFromTransportationRequest(localTimezone: string, distalTimezone: string): ITripSegment[];
|
|
181
183
|
}
|
|
182
184
|
export declare function calculateTravelTime(distanceMiles: number, speedMph: number): Duration;
|
|
183
185
|
/**
|
|
@@ -186,5 +188,3 @@ export declare function calculateTravelTime(distanceMiles: number, speedMph: num
|
|
|
186
188
|
* @returns The procedure time in hours
|
|
187
189
|
*/
|
|
188
190
|
export declare function getProcedureTime(recoveryType: RecoveryType): number;
|
|
189
|
-
export declare function createTripAirSegmentsFromTransportationRequest(transportationRequest: ITransportationRequest, localTimezone: string, distalTimezone: string): ITripSegment[];
|
|
190
|
-
export declare function createTripGroundSegmentsFromTransportationRequest(transportationRequest: ITransportationRequest, localTimezone: string, distalTimezone: string): ITripSegment[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getProcedureTime = exports.calculateTravelTime = exports.TransportationRequest = exports.RECOVERY_TIME_DURATION = exports.RECOVERY_TIME = exports.RecoveryType = exports.SegmentLocationType = exports.getEquipmentForOrgan = exports.EquipmentType = exports.KidneyEquipmentType = exports.LiverEquipmentType = exports.LungEquipmentType = exports.HeartEquipmentType = exports.OrganType = exports.TransportRequestType = exports.OrganRecoveryStatus = exports.TransportationRequestProposalStatus = exports.TransportationRequestStatus = exports.AVERAGE_AIR_SPEED = exports.DISTANCE_THRESHOLD_MILES_AIR_VS_GROUND = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const Trip_1 = require("./Trip");
|
|
6
6
|
const Proposal_1 = require("./Proposal");
|
|
@@ -199,6 +199,339 @@ class TransportationRequest {
|
|
|
199
199
|
}
|
|
200
200
|
return false;
|
|
201
201
|
}
|
|
202
|
+
createTripAirSegmentsFromTransportationRequest(localTimezone, distalTimezone) {
|
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
204
|
+
const recoveryTimeDuration = (_a = exports.RECOVERY_TIME_DURATION[this.recoveryType]) !== null && _a !== void 0 ? _a : luxon_1.Duration.fromObject({ hours: 3, minutes: 0 });
|
|
205
|
+
const tripDistanceInMiles = this.tripDistanceInMiles || 0;
|
|
206
|
+
const flightTime = calculateTravelTime(tripDistanceInMiles, exports.AVERAGE_AIR_SPEED);
|
|
207
|
+
if (this.transportationRequestType === TransportRequestType.ROUND_TRIP) {
|
|
208
|
+
// Local Airport -> Distal Airport
|
|
209
|
+
// Air Departure Time =
|
|
210
|
+
// OR Time
|
|
211
|
+
// - 1.5 hours for distal ground time
|
|
212
|
+
// - flight time
|
|
213
|
+
// - 30 minutes of getting from the car to the flight and ready for departure
|
|
214
|
+
// Air Arrival Time
|
|
215
|
+
// Air Departure Time + flight time
|
|
216
|
+
//
|
|
217
|
+
// Distal Airport -> Local Airport
|
|
218
|
+
// Air Departure Time =
|
|
219
|
+
// OR Time
|
|
220
|
+
// + 30 minutes of getting from hospital and into car
|
|
221
|
+
// + 30 minutes of drive time to the hospital
|
|
222
|
+
// + 30 minutes of getting from car to flight and ready for departure
|
|
223
|
+
// Air Arrival Time =
|
|
224
|
+
// Air Departure Time + flight time
|
|
225
|
+
//
|
|
226
|
+
return [
|
|
227
|
+
{
|
|
228
|
+
transportationOperatorId: this.organizationId,
|
|
229
|
+
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
230
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
231
|
+
passengers: [],
|
|
232
|
+
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
233
|
+
segmentNumber: 0,
|
|
234
|
+
scheduledDepartureAirportCode: `${(_b = this.recipientFacility) === null || _b === void 0 ? void 0 : _b.city} area airport`,
|
|
235
|
+
scheduledArrivalAirportCode: `${(_c = this.recoveryLocation) === null || _c === void 0 ? void 0 : _c.city} area airport`,
|
|
236
|
+
scheduledArrivalAirportLocation: this.recoveryLocation.location || {
|
|
237
|
+
lat: 0,
|
|
238
|
+
lng: 0,
|
|
239
|
+
},
|
|
240
|
+
scheduledDepartureAirportLocation: this.recipientFacility
|
|
241
|
+
.location || {
|
|
242
|
+
lat: 0,
|
|
243
|
+
lng: 0,
|
|
244
|
+
},
|
|
245
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
246
|
+
.minus(flightTime)
|
|
247
|
+
.minus({ hours: 1, minutes: 30 })
|
|
248
|
+
.toMillis(),
|
|
249
|
+
scheduledDepartureTimeTimezone: localTimezone,
|
|
250
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
251
|
+
.minus({ hours: 1, minutes: 30 })
|
|
252
|
+
.toMillis(),
|
|
253
|
+
scheduledArrivalTimeTimezone: distalTimezone,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
transportationOperatorId: this.organizationId,
|
|
257
|
+
passengers: [],
|
|
258
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
259
|
+
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
260
|
+
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
261
|
+
segmentNumber: 0,
|
|
262
|
+
scheduledDepartureAirportCode: `${(_d = this.recoveryLocation) === null || _d === void 0 ? void 0 : _d.city} area airport`,
|
|
263
|
+
scheduledDepartureAirportLocation: this.recoveryLocation.location || {
|
|
264
|
+
lat: 0,
|
|
265
|
+
lng: 0,
|
|
266
|
+
},
|
|
267
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
268
|
+
.plus(recoveryTimeDuration)
|
|
269
|
+
.plus({ hours: 1, minutes: 30 })
|
|
270
|
+
.toMillis(),
|
|
271
|
+
scheduledArrivalAirportCode: `${(_e = this.recipientFacility) === null || _e === void 0 ? void 0 : _e.city} area airport`,
|
|
272
|
+
scheduledArrivalAirportLocation: this.recipientFacility.location || {
|
|
273
|
+
lat: 0,
|
|
274
|
+
lng: 0,
|
|
275
|
+
},
|
|
276
|
+
scheduledDepartureTimeTimezone: distalTimezone,
|
|
277
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
278
|
+
.plus(recoveryTimeDuration)
|
|
279
|
+
.plus({ hours: 1, minutes: 30 })
|
|
280
|
+
.plus(flightTime)
|
|
281
|
+
.toMillis(),
|
|
282
|
+
scheduledArrivalTimeTimezone: localTimezone,
|
|
283
|
+
},
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
transportationOperatorId: this.organizationId,
|
|
290
|
+
passengers: [],
|
|
291
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
292
|
+
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
293
|
+
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
294
|
+
segmentNumber: 0,
|
|
295
|
+
scheduledDepartureAirportCode: `${((_f = this.pickupLocation) === null || _f === void 0 ? void 0 : _f.city) || ((_g = this.recoveryLocation) === null || _g === void 0 ? void 0 : _g.city)} area airport`,
|
|
296
|
+
scheduledDepartureAirportLocation: ((_h = this.pickupLocation) === null || _h === void 0 ? void 0 : _h.location) ||
|
|
297
|
+
this.recoveryLocation.location || {
|
|
298
|
+
lat: 0,
|
|
299
|
+
lng: 0,
|
|
300
|
+
},
|
|
301
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
302
|
+
.plus({ hours: 1, minutes: 0 })
|
|
303
|
+
.toMillis(),
|
|
304
|
+
scheduledArrivalAirportCode: `${(_j = this.recipientFacility) === null || _j === void 0 ? void 0 : _j.city} area airport`,
|
|
305
|
+
scheduledArrivalAirportLocation: this.recipientFacility.location || {
|
|
306
|
+
lat: 0,
|
|
307
|
+
lng: 0,
|
|
308
|
+
},
|
|
309
|
+
scheduledDepartureTimeTimezone: distalTimezone,
|
|
310
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
311
|
+
.plus({ hours: 1, minutes: 0 })
|
|
312
|
+
.plus(flightTime)
|
|
313
|
+
.toMillis(),
|
|
314
|
+
scheduledArrivalTimeTimezone: localTimezone,
|
|
315
|
+
},
|
|
316
|
+
];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
createTripGroundSegmentsFromTransportationRequest(localTimezone, distalTimezone) {
|
|
320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
321
|
+
const recoveryTimeInMinutes = (_a = exports.RECOVERY_TIME_DURATION[this.recoveryType]) !== null && _a !== void 0 ? _a : luxon_1.Duration.fromObject({ hours: 3, minutes: 0 });
|
|
322
|
+
const localAirportLocation = {
|
|
323
|
+
id: "1234",
|
|
324
|
+
displayName: `${(_b = this.recipientFacility) === null || _b === void 0 ? void 0 : _b.city} area airport`,
|
|
325
|
+
formattedAddress: "",
|
|
326
|
+
city: ((_c = this.recipientFacility) === null || _c === void 0 ? void 0 : _c.city) || "",
|
|
327
|
+
county: (_d = this.recipientFacility) === null || _d === void 0 ? void 0 : _d.county,
|
|
328
|
+
state: ((_e = this.recipientFacility) === null || _e === void 0 ? void 0 : _e.state) || "",
|
|
329
|
+
zip: ((_f = this.recipientFacility) === null || _f === void 0 ? void 0 : _f.zip) || "",
|
|
330
|
+
location: (_g = this.recipientFacility) === null || _g === void 0 ? void 0 : _g.location,
|
|
331
|
+
utcOffsetMinutes: (_h = this.recipientFacility) === null || _h === void 0 ? void 0 : _h.utcOffsetMinutes,
|
|
332
|
+
};
|
|
333
|
+
const distalAirportLocation = this.transportationRequestType === TransportRequestType.ROUND_TRIP
|
|
334
|
+
? {
|
|
335
|
+
id: "5678",
|
|
336
|
+
displayName: `${(_j = this.recoveryLocation) === null || _j === void 0 ? void 0 : _j.city} area airport`,
|
|
337
|
+
formattedAddress: "",
|
|
338
|
+
city: ((_k = this.recoveryLocation) === null || _k === void 0 ? void 0 : _k.city) || "",
|
|
339
|
+
county: (_l = this.recoveryLocation) === null || _l === void 0 ? void 0 : _l.county,
|
|
340
|
+
state: ((_m = this.recoveryLocation) === null || _m === void 0 ? void 0 : _m.state) || "",
|
|
341
|
+
zip: ((_o = this.recoveryLocation) === null || _o === void 0 ? void 0 : _o.zip) || "",
|
|
342
|
+
location: (_p = this.recoveryLocation) === null || _p === void 0 ? void 0 : _p.location,
|
|
343
|
+
utcOffsetMinutes: (_q = this.recoveryLocation) === null || _q === void 0 ? void 0 : _q.utcOffsetMinutes,
|
|
344
|
+
}
|
|
345
|
+
: {
|
|
346
|
+
id: "5678",
|
|
347
|
+
displayName: `${((_r = this.pickupLocation) === null || _r === void 0 ? void 0 : _r.city) || ((_s = this.recoveryLocation) === null || _s === void 0 ? void 0 : _s.city)} area airport`,
|
|
348
|
+
formattedAddress: "",
|
|
349
|
+
city: ((_t = this.pickupLocation) === null || _t === void 0 ? void 0 : _t.city) || ((_u = this.recoveryLocation) === null || _u === void 0 ? void 0 : _u.city) || "",
|
|
350
|
+
county: ((_v = this.pickupLocation) === null || _v === void 0 ? void 0 : _v.county) ||
|
|
351
|
+
((_w = this.recoveryLocation) === null || _w === void 0 ? void 0 : _w.county) ||
|
|
352
|
+
"",
|
|
353
|
+
state: ((_x = this.pickupLocation) === null || _x === void 0 ? void 0 : _x.state) || ((_y = this.recoveryLocation) === null || _y === void 0 ? void 0 : _y.state) || "",
|
|
354
|
+
zip: ((_z = this.pickupLocation) === null || _z === void 0 ? void 0 : _z.zip) || ((_0 = this.recoveryLocation) === null || _0 === void 0 ? void 0 : _0.zip) || "",
|
|
355
|
+
location: ((_1 = this.pickupLocation) === null || _1 === void 0 ? void 0 : _1.location) ||
|
|
356
|
+
((_2 = this.recoveryLocation) === null || _2 === void 0 ? void 0 : _2.location) || {
|
|
357
|
+
lat: 0,
|
|
358
|
+
lng: 0,
|
|
359
|
+
},
|
|
360
|
+
utcOffsetMinutes: ((_3 = this.pickupLocation) === null || _3 === void 0 ? void 0 : _3.utcOffsetMinutes) ||
|
|
361
|
+
((_4 = this.recoveryLocation) === null || _4 === void 0 ? void 0 : _4.utcOffsetMinutes),
|
|
362
|
+
};
|
|
363
|
+
const tripDistanceInMiles = this.tripDistanceInMiles || 0;
|
|
364
|
+
const flightTime = calculateTravelTime(tripDistanceInMiles, exports.AVERAGE_AIR_SPEED);
|
|
365
|
+
if (this.transportationRequestType === TransportRequestType.ROUND_TRIP) {
|
|
366
|
+
// Recipient Facility -> Local Airport
|
|
367
|
+
// Ground Departure Time =
|
|
368
|
+
// OR Time
|
|
369
|
+
// - 1.5 hours for distal ground time
|
|
370
|
+
// - flight time
|
|
371
|
+
// - 30 minutes of getting from the car to the flight and ready for departure
|
|
372
|
+
// Ground Arrival Time
|
|
373
|
+
// Ground Departure Time + 30 minutes of drive time
|
|
374
|
+
//
|
|
375
|
+
// Distal Airport -> Recovery Location
|
|
376
|
+
// Ground Departure Time =
|
|
377
|
+
// OR Time
|
|
378
|
+
// - 30 minutes of getting into the hospital and OR
|
|
379
|
+
// - 30 minutes of drive time to the hospital)
|
|
380
|
+
// Ground Arrival Time =
|
|
381
|
+
// Ground Departure Time + 30 minutes of drive time
|
|
382
|
+
//
|
|
383
|
+
// Recovery Location -> Distal Airport
|
|
384
|
+
// Ground Departure Time =
|
|
385
|
+
// OR Time
|
|
386
|
+
// + recovery time
|
|
387
|
+
// + 30 minutes of getting out of OR and into the car
|
|
388
|
+
// Ground Arrival Time =
|
|
389
|
+
// Ground Departure Time + 30 minutes of drive time
|
|
390
|
+
//
|
|
391
|
+
// Local Airport -> Recipient Facility
|
|
392
|
+
// Ground Departure Time =
|
|
393
|
+
// OR Time
|
|
394
|
+
// + recovery time
|
|
395
|
+
// + 1.5 hours of getting out of OR and into the car, drive time, getting out of car and ready for departure
|
|
396
|
+
// Ground Arrival Time =
|
|
397
|
+
// Ground Departure Time + 30 minutes of drive time
|
|
398
|
+
//
|
|
399
|
+
return [
|
|
400
|
+
{
|
|
401
|
+
transportationOperatorId: this.organizationId,
|
|
402
|
+
groundTransportationServices: [],
|
|
403
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
404
|
+
passengers: [],
|
|
405
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
406
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
407
|
+
segmentNumber: 0,
|
|
408
|
+
scheduledArrivalLocation: localAirportLocation,
|
|
409
|
+
scheduledDepartureLocation: this.recipientFacility,
|
|
410
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
411
|
+
.minus(flightTime)
|
|
412
|
+
.minus({ hours: 2, minutes: 30 })
|
|
413
|
+
.toMillis(),
|
|
414
|
+
scheduledDepartureTimeTimezone: localTimezone,
|
|
415
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
416
|
+
.minus(flightTime)
|
|
417
|
+
.minus({ hours: 2, minutes: 0 })
|
|
418
|
+
.toMillis(),
|
|
419
|
+
scheduledArrivalTimeTimezone: localTimezone,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
transportationOperatorId: this.organizationId,
|
|
423
|
+
groundTransportationServices: [],
|
|
424
|
+
passengers: [],
|
|
425
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
426
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
427
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
428
|
+
segmentNumber: 0,
|
|
429
|
+
scheduledArrivalLocation: this.recoveryLocation,
|
|
430
|
+
scheduledDepartureLocation: distalAirportLocation,
|
|
431
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
432
|
+
.minus({ hours: 1 })
|
|
433
|
+
.toMillis(),
|
|
434
|
+
scheduledDepartureTimeTimezone: distalTimezone,
|
|
435
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
436
|
+
.minus({ minutes: 30 })
|
|
437
|
+
.toMillis(),
|
|
438
|
+
scheduledArrivalTimeTimezone: distalTimezone,
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
transportationOperatorId: this.organizationId,
|
|
442
|
+
groundTransportationServices: [],
|
|
443
|
+
passengers: [],
|
|
444
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
445
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
446
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
447
|
+
segmentNumber: 0,
|
|
448
|
+
scheduledDepartureLocation: this.recoveryLocation,
|
|
449
|
+
scheduledArrivalLocation: distalAirportLocation,
|
|
450
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
451
|
+
.plus(recoveryTimeInMinutes)
|
|
452
|
+
.plus({ minutes: 30 })
|
|
453
|
+
.toMillis(),
|
|
454
|
+
scheduledDepartureTimeTimezone: distalTimezone,
|
|
455
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
456
|
+
.plus(recoveryTimeInMinutes)
|
|
457
|
+
.plus({ hours: 1 })
|
|
458
|
+
.toMillis(),
|
|
459
|
+
scheduledArrivalTimeTimezone: distalTimezone,
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
transportationOperatorId: this.organizationId,
|
|
463
|
+
groundTransportationServices: [],
|
|
464
|
+
passengers: [],
|
|
465
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
466
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
467
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
468
|
+
segmentNumber: 0,
|
|
469
|
+
scheduledArrivalLocation: this.recipientFacility,
|
|
470
|
+
scheduledDepartureLocation: localAirportLocation,
|
|
471
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
472
|
+
.plus(recoveryTimeInMinutes)
|
|
473
|
+
.plus(flightTime)
|
|
474
|
+
.plus({ minutes: 30 })
|
|
475
|
+
.toMillis(),
|
|
476
|
+
scheduledDepartureTimeTimezone: localTimezone,
|
|
477
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
478
|
+
.plus(recoveryTimeInMinutes)
|
|
479
|
+
.plus(flightTime)
|
|
480
|
+
.plus({ hours: 1 })
|
|
481
|
+
.toMillis(),
|
|
482
|
+
scheduledArrivalTimeTimezone: localTimezone,
|
|
483
|
+
},
|
|
484
|
+
];
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
return [
|
|
488
|
+
{
|
|
489
|
+
transportationOperatorId: this.organizationId,
|
|
490
|
+
groundTransportationServices: [],
|
|
491
|
+
passengers: [],
|
|
492
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
493
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
494
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
495
|
+
segmentNumber: 0,
|
|
496
|
+
scheduledArrivalLocation: distalAirportLocation,
|
|
497
|
+
scheduledDepartureLocation: this.pickupLocation || this.recoveryLocation,
|
|
498
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
499
|
+
.plus(recoveryTimeInMinutes)
|
|
500
|
+
.plus({ hours: 1 })
|
|
501
|
+
.toMillis(),
|
|
502
|
+
scheduledArrivalTimeTimezone: distalTimezone,
|
|
503
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
504
|
+
.plus(recoveryTimeInMinutes)
|
|
505
|
+
.minus({ hours: 1.5 })
|
|
506
|
+
.toMillis(),
|
|
507
|
+
scheduledDepartureTimeTimezone: distalTimezone,
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
transportationOperatorId: this.organizationId,
|
|
511
|
+
groundTransportationServices: [],
|
|
512
|
+
passengers: [],
|
|
513
|
+
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
514
|
+
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
515
|
+
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
516
|
+
segmentNumber: 0,
|
|
517
|
+
scheduledArrivalLocation: this.recipientFacility,
|
|
518
|
+
scheduledDepartureLocation: localAirportLocation,
|
|
519
|
+
scheduledArrivalTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
520
|
+
.plus(recoveryTimeInMinutes)
|
|
521
|
+
.plus(flightTime)
|
|
522
|
+
.plus({ hours: 1 })
|
|
523
|
+
.toMillis(),
|
|
524
|
+
scheduledArrivalTimeTimezone: localTimezone,
|
|
525
|
+
scheduledDepartureTime: luxon_1.DateTime.fromMillis(this.orDateTimeGMT)
|
|
526
|
+
.plus(recoveryTimeInMinutes)
|
|
527
|
+
.plus(flightTime)
|
|
528
|
+
.plus({ minutes: 30 })
|
|
529
|
+
.toMillis(),
|
|
530
|
+
scheduledDepartureTimeTimezone: localTimezone,
|
|
531
|
+
},
|
|
532
|
+
];
|
|
533
|
+
}
|
|
534
|
+
}
|
|
202
535
|
}
|
|
203
536
|
exports.TransportationRequest = TransportationRequest;
|
|
204
537
|
function calculateTravelTime(distanceMiles, speedMph) {
|
|
@@ -233,339 +566,3 @@ function getProcedureTime(recoveryType) {
|
|
|
233
566
|
}
|
|
234
567
|
}
|
|
235
568
|
exports.getProcedureTime = getProcedureTime;
|
|
236
|
-
function createTripAirSegmentsFromTransportationRequest(transportationRequest, localTimezone, distalTimezone) {
|
|
237
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
238
|
-
const recoveryTimeDuration = (_a = exports.RECOVERY_TIME_DURATION[transportationRequest.recoveryType]) !== null && _a !== void 0 ? _a : luxon_1.Duration.fromObject({ hours: 3, minutes: 0 });
|
|
239
|
-
const tripDistanceInMiles = transportationRequest.tripDistanceInMiles || 0;
|
|
240
|
-
const flightTime = calculateTravelTime(tripDistanceInMiles, exports.AVERAGE_AIR_SPEED);
|
|
241
|
-
if (transportationRequest.transportationRequestType ===
|
|
242
|
-
TransportRequestType.ROUND_TRIP) {
|
|
243
|
-
// Local Airport -> Distal Airport
|
|
244
|
-
// Air Departure Time =
|
|
245
|
-
// OR Time
|
|
246
|
-
// - 1.5 hours for distal ground time
|
|
247
|
-
// - flight time
|
|
248
|
-
// - 30 minutes of getting from the car to the flight and ready for departure
|
|
249
|
-
// Air Arrival Time
|
|
250
|
-
// Air Departure Time + flight time
|
|
251
|
-
//
|
|
252
|
-
// Distal Airport -> Local Airport
|
|
253
|
-
// Air Departure Time =
|
|
254
|
-
// OR Time
|
|
255
|
-
// + 30 minutes of getting from hospital and into car
|
|
256
|
-
// + 30 minutes of drive time to the hospital
|
|
257
|
-
// + 30 minutes of getting from car to flight and ready for departure
|
|
258
|
-
// Air Arrival Time =
|
|
259
|
-
// Air Departure Time + flight time
|
|
260
|
-
//
|
|
261
|
-
return [
|
|
262
|
-
{
|
|
263
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
264
|
-
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
265
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
266
|
-
passengers: [],
|
|
267
|
-
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
268
|
-
segmentNumber: 0,
|
|
269
|
-
scheduledDepartureAirportCode: `${(_b = transportationRequest.recipientFacility) === null || _b === void 0 ? void 0 : _b.city} area airport`,
|
|
270
|
-
scheduledArrivalAirportCode: `${(_c = transportationRequest.recoveryLocation) === null || _c === void 0 ? void 0 : _c.city} area airport`,
|
|
271
|
-
scheduledArrivalAirportLocation: transportationRequest.recoveryLocation
|
|
272
|
-
.location || { lat: 0, lng: 0 },
|
|
273
|
-
scheduledDepartureAirportLocation: transportationRequest
|
|
274
|
-
.recipientFacility.location || { lat: 0, lng: 0 },
|
|
275
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
276
|
-
.minus(flightTime)
|
|
277
|
-
.minus({ hours: 1, minutes: 30 })
|
|
278
|
-
.toMillis(),
|
|
279
|
-
scheduledDepartureTimeTimezone: localTimezone,
|
|
280
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
281
|
-
.minus({ hours: 1, minutes: 30 })
|
|
282
|
-
.toMillis(),
|
|
283
|
-
scheduledArrivalTimeTimezone: distalTimezone,
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
287
|
-
passengers: [],
|
|
288
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
289
|
-
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
290
|
-
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
291
|
-
segmentNumber: 0,
|
|
292
|
-
scheduledDepartureAirportCode: `${(_d = transportationRequest.recoveryLocation) === null || _d === void 0 ? void 0 : _d.city} area airport`,
|
|
293
|
-
scheduledDepartureAirportLocation: transportationRequest
|
|
294
|
-
.recoveryLocation.location || { lat: 0, lng: 0 },
|
|
295
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
296
|
-
.plus(recoveryTimeDuration)
|
|
297
|
-
.plus({ hours: 1, minutes: 30 })
|
|
298
|
-
.toMillis(),
|
|
299
|
-
scheduledArrivalAirportCode: `${(_e = transportationRequest.recipientFacility) === null || _e === void 0 ? void 0 : _e.city} area airport`,
|
|
300
|
-
scheduledArrivalAirportLocation: transportationRequest.recipientFacility
|
|
301
|
-
.location || { lat: 0, lng: 0 },
|
|
302
|
-
scheduledDepartureTimeTimezone: distalTimezone,
|
|
303
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
304
|
-
.plus(recoveryTimeDuration)
|
|
305
|
-
.plus({ hours: 1, minutes: 30 })
|
|
306
|
-
.plus(flightTime)
|
|
307
|
-
.toMillis(),
|
|
308
|
-
scheduledArrivalTimeTimezone: localTimezone,
|
|
309
|
-
},
|
|
310
|
-
];
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
return [
|
|
314
|
-
{
|
|
315
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
316
|
-
passengers: [],
|
|
317
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
318
|
-
segmentType: Trip_1.SegmentType.AIR_TRANSPORTATION,
|
|
319
|
-
typeOfService: Proposal_1.TypeOfService.AIR,
|
|
320
|
-
segmentNumber: 0,
|
|
321
|
-
scheduledDepartureAirportCode: `${((_f = transportationRequest.pickupLocation) === null || _f === void 0 ? void 0 : _f.city) ||
|
|
322
|
-
((_g = transportationRequest.recoveryLocation) === null || _g === void 0 ? void 0 : _g.city)} area airport`,
|
|
323
|
-
scheduledDepartureAirportLocation: ((_h = transportationRequest.pickupLocation) === null || _h === void 0 ? void 0 : _h.location) ||
|
|
324
|
-
transportationRequest.recoveryLocation.location || {
|
|
325
|
-
lat: 0,
|
|
326
|
-
lng: 0,
|
|
327
|
-
},
|
|
328
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
329
|
-
.plus({ hours: 1, minutes: 0 })
|
|
330
|
-
.toMillis(),
|
|
331
|
-
scheduledArrivalAirportCode: `${(_j = transportationRequest.recipientFacility) === null || _j === void 0 ? void 0 : _j.city} area airport`,
|
|
332
|
-
scheduledArrivalAirportLocation: transportationRequest.recipientFacility
|
|
333
|
-
.location || { lat: 0, lng: 0 },
|
|
334
|
-
scheduledDepartureTimeTimezone: distalTimezone,
|
|
335
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
336
|
-
.plus({ hours: 1, minutes: 0 })
|
|
337
|
-
.plus(flightTime)
|
|
338
|
-
.toMillis(),
|
|
339
|
-
scheduledArrivalTimeTimezone: localTimezone,
|
|
340
|
-
},
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
exports.createTripAirSegmentsFromTransportationRequest = createTripAirSegmentsFromTransportationRequest;
|
|
345
|
-
function createTripGroundSegmentsFromTransportationRequest(transportationRequest, localTimezone, distalTimezone) {
|
|
346
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
347
|
-
const recoveryTimeInMinutes = (_a = exports.RECOVERY_TIME_DURATION[transportationRequest.recoveryType]) !== null && _a !== void 0 ? _a : luxon_1.Duration.fromObject({ hours: 3, minutes: 0 });
|
|
348
|
-
const localAirportLocation = {
|
|
349
|
-
id: "1234",
|
|
350
|
-
displayName: `${(_b = transportationRequest.recipientFacility) === null || _b === void 0 ? void 0 : _b.city} area airport`,
|
|
351
|
-
formattedAddress: "",
|
|
352
|
-
city: ((_c = transportationRequest.recipientFacility) === null || _c === void 0 ? void 0 : _c.city) || "",
|
|
353
|
-
county: (_d = transportationRequest.recipientFacility) === null || _d === void 0 ? void 0 : _d.county,
|
|
354
|
-
state: ((_e = transportationRequest.recipientFacility) === null || _e === void 0 ? void 0 : _e.state) || "",
|
|
355
|
-
zip: ((_f = transportationRequest.recipientFacility) === null || _f === void 0 ? void 0 : _f.zip) || "",
|
|
356
|
-
location: (_g = transportationRequest.recipientFacility) === null || _g === void 0 ? void 0 : _g.location,
|
|
357
|
-
utcOffsetMinutes: (_h = transportationRequest.recipientFacility) === null || _h === void 0 ? void 0 : _h.utcOffsetMinutes,
|
|
358
|
-
};
|
|
359
|
-
const distalAirportLocation = transportationRequest.transportationRequestType ===
|
|
360
|
-
TransportRequestType.ROUND_TRIP
|
|
361
|
-
? {
|
|
362
|
-
id: "5678",
|
|
363
|
-
displayName: `${(_j = transportationRequest.recoveryLocation) === null || _j === void 0 ? void 0 : _j.city} area airport`,
|
|
364
|
-
formattedAddress: "",
|
|
365
|
-
city: ((_k = transportationRequest.recoveryLocation) === null || _k === void 0 ? void 0 : _k.city) || "",
|
|
366
|
-
county: (_l = transportationRequest.recoveryLocation) === null || _l === void 0 ? void 0 : _l.county,
|
|
367
|
-
state: ((_m = transportationRequest.recoveryLocation) === null || _m === void 0 ? void 0 : _m.state) || "",
|
|
368
|
-
zip: ((_o = transportationRequest.recoveryLocation) === null || _o === void 0 ? void 0 : _o.zip) || "",
|
|
369
|
-
location: (_p = transportationRequest.recoveryLocation) === null || _p === void 0 ? void 0 : _p.location,
|
|
370
|
-
utcOffsetMinutes: (_q = transportationRequest.recoveryLocation) === null || _q === void 0 ? void 0 : _q.utcOffsetMinutes,
|
|
371
|
-
}
|
|
372
|
-
: {
|
|
373
|
-
id: "5678",
|
|
374
|
-
displayName: `${((_r = transportationRequest.pickupLocation) === null || _r === void 0 ? void 0 : _r.city) ||
|
|
375
|
-
((_s = transportationRequest.recoveryLocation) === null || _s === void 0 ? void 0 : _s.city)} area airport`,
|
|
376
|
-
formattedAddress: "",
|
|
377
|
-
city: ((_t = transportationRequest.pickupLocation) === null || _t === void 0 ? void 0 : _t.city) ||
|
|
378
|
-
((_u = transportationRequest.recoveryLocation) === null || _u === void 0 ? void 0 : _u.city) ||
|
|
379
|
-
"",
|
|
380
|
-
county: ((_v = transportationRequest.pickupLocation) === null || _v === void 0 ? void 0 : _v.county) ||
|
|
381
|
-
((_w = transportationRequest.recoveryLocation) === null || _w === void 0 ? void 0 : _w.county) ||
|
|
382
|
-
"",
|
|
383
|
-
state: ((_x = transportationRequest.pickupLocation) === null || _x === void 0 ? void 0 : _x.state) ||
|
|
384
|
-
((_y = transportationRequest.recoveryLocation) === null || _y === void 0 ? void 0 : _y.state) ||
|
|
385
|
-
"",
|
|
386
|
-
zip: ((_z = transportationRequest.pickupLocation) === null || _z === void 0 ? void 0 : _z.zip) ||
|
|
387
|
-
((_0 = transportationRequest.recoveryLocation) === null || _0 === void 0 ? void 0 : _0.zip) ||
|
|
388
|
-
"",
|
|
389
|
-
location: ((_1 = transportationRequest.pickupLocation) === null || _1 === void 0 ? void 0 : _1.location) ||
|
|
390
|
-
((_2 = transportationRequest.recoveryLocation) === null || _2 === void 0 ? void 0 : _2.location) || {
|
|
391
|
-
lat: 0,
|
|
392
|
-
lng: 0,
|
|
393
|
-
},
|
|
394
|
-
utcOffsetMinutes: ((_3 = transportationRequest.pickupLocation) === null || _3 === void 0 ? void 0 : _3.utcOffsetMinutes) ||
|
|
395
|
-
((_4 = transportationRequest.recoveryLocation) === null || _4 === void 0 ? void 0 : _4.utcOffsetMinutes),
|
|
396
|
-
};
|
|
397
|
-
const tripDistanceInMiles = transportationRequest.tripDistanceInMiles || 0;
|
|
398
|
-
const flightTime = calculateTravelTime(tripDistanceInMiles, exports.AVERAGE_AIR_SPEED);
|
|
399
|
-
if (transportationRequest.transportationRequestType ===
|
|
400
|
-
TransportRequestType.ROUND_TRIP) {
|
|
401
|
-
// Recipient Facility -> Local Airport
|
|
402
|
-
// Ground Departure Time =
|
|
403
|
-
// OR Time
|
|
404
|
-
// - 1.5 hours for distal ground time
|
|
405
|
-
// - flight time
|
|
406
|
-
// - 30 minutes of getting from the car to the flight and ready for departure
|
|
407
|
-
// Ground Arrival Time
|
|
408
|
-
// Ground Departure Time + 30 minutes of drive time
|
|
409
|
-
//
|
|
410
|
-
// Distal Airport -> Recovery Location
|
|
411
|
-
// Ground Departure Time =
|
|
412
|
-
// OR Time
|
|
413
|
-
// - 30 minutes of getting into the hospital and OR
|
|
414
|
-
// - 30 minutes of drive time to the hospital)
|
|
415
|
-
// Ground Arrival Time =
|
|
416
|
-
// Ground Departure Time + 30 minutes of drive time
|
|
417
|
-
//
|
|
418
|
-
// Recovery Location -> Distal Airport
|
|
419
|
-
// Ground Departure Time =
|
|
420
|
-
// OR Time
|
|
421
|
-
// + recovery time
|
|
422
|
-
// + 30 minutes of getting out of OR and into the car
|
|
423
|
-
// Ground Arrival Time =
|
|
424
|
-
// Ground Departure Time + 30 minutes of drive time
|
|
425
|
-
//
|
|
426
|
-
// Local Airport -> Recipient Facility
|
|
427
|
-
// Ground Departure Time =
|
|
428
|
-
// OR Time
|
|
429
|
-
// + recovery time
|
|
430
|
-
// + 1.5 hours of getting out of OR and into the car, drive time, getting out of car and ready for departure
|
|
431
|
-
// Ground Arrival Time =
|
|
432
|
-
// Ground Departure Time + 30 minutes of drive time
|
|
433
|
-
//
|
|
434
|
-
return [
|
|
435
|
-
{
|
|
436
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
437
|
-
groundTransportationServices: [],
|
|
438
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
439
|
-
passengers: [],
|
|
440
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
441
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
442
|
-
segmentNumber: 0,
|
|
443
|
-
scheduledArrivalLocation: localAirportLocation,
|
|
444
|
-
scheduledDepartureLocation: transportationRequest.recipientFacility,
|
|
445
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
446
|
-
.minus(flightTime)
|
|
447
|
-
.minus({ hours: 2, minutes: 30 })
|
|
448
|
-
.toMillis(),
|
|
449
|
-
scheduledDepartureTimeTimezone: localTimezone,
|
|
450
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
451
|
-
.minus(flightTime)
|
|
452
|
-
.minus({ hours: 2, minutes: 0 })
|
|
453
|
-
.toMillis(),
|
|
454
|
-
scheduledArrivalTimeTimezone: localTimezone,
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
458
|
-
groundTransportationServices: [],
|
|
459
|
-
passengers: [],
|
|
460
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
461
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
462
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
463
|
-
segmentNumber: 0,
|
|
464
|
-
scheduledArrivalLocation: transportationRequest.recoveryLocation,
|
|
465
|
-
scheduledDepartureLocation: distalAirportLocation,
|
|
466
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
467
|
-
.minus({ hours: 1 })
|
|
468
|
-
.toMillis(),
|
|
469
|
-
scheduledDepartureTimeTimezone: distalTimezone,
|
|
470
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
471
|
-
.minus({ minutes: 30 })
|
|
472
|
-
.toMillis(),
|
|
473
|
-
scheduledArrivalTimeTimezone: distalTimezone,
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
477
|
-
groundTransportationServices: [],
|
|
478
|
-
passengers: [],
|
|
479
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
480
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
481
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
482
|
-
segmentNumber: 0,
|
|
483
|
-
scheduledDepartureLocation: transportationRequest.recoveryLocation,
|
|
484
|
-
scheduledArrivalLocation: distalAirportLocation,
|
|
485
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
486
|
-
.plus(recoveryTimeInMinutes)
|
|
487
|
-
.plus({ minutes: 30 })
|
|
488
|
-
.toMillis(),
|
|
489
|
-
scheduledDepartureTimeTimezone: distalTimezone,
|
|
490
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
491
|
-
.plus(recoveryTimeInMinutes)
|
|
492
|
-
.plus({ hours: 1 })
|
|
493
|
-
.toMillis(),
|
|
494
|
-
scheduledArrivalTimeTimezone: distalTimezone,
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
498
|
-
groundTransportationServices: [],
|
|
499
|
-
passengers: [],
|
|
500
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
501
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
502
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
503
|
-
segmentNumber: 0,
|
|
504
|
-
scheduledArrivalLocation: transportationRequest.recipientFacility,
|
|
505
|
-
scheduledDepartureLocation: localAirportLocation,
|
|
506
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
507
|
-
.plus(recoveryTimeInMinutes)
|
|
508
|
-
.plus(flightTime)
|
|
509
|
-
.plus({ minutes: 30 })
|
|
510
|
-
.toMillis(),
|
|
511
|
-
scheduledDepartureTimeTimezone: localTimezone,
|
|
512
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
513
|
-
.plus(recoveryTimeInMinutes)
|
|
514
|
-
.plus(flightTime)
|
|
515
|
-
.plus({ hours: 1 })
|
|
516
|
-
.toMillis(),
|
|
517
|
-
scheduledArrivalTimeTimezone: localTimezone,
|
|
518
|
-
},
|
|
519
|
-
];
|
|
520
|
-
}
|
|
521
|
-
else {
|
|
522
|
-
return [
|
|
523
|
-
{
|
|
524
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
525
|
-
groundTransportationServices: [],
|
|
526
|
-
passengers: [],
|
|
527
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
528
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
529
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
530
|
-
segmentNumber: 0,
|
|
531
|
-
scheduledArrivalLocation: distalAirportLocation,
|
|
532
|
-
scheduledDepartureLocation: transportationRequest.pickupLocation ||
|
|
533
|
-
transportationRequest.recoveryLocation,
|
|
534
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
535
|
-
.plus(recoveryTimeInMinutes)
|
|
536
|
-
.plus({ hours: 1 })
|
|
537
|
-
.toMillis(),
|
|
538
|
-
scheduledArrivalTimeTimezone: distalTimezone,
|
|
539
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
540
|
-
.plus(recoveryTimeInMinutes)
|
|
541
|
-
.minus({ hours: 1.5 })
|
|
542
|
-
.toMillis(),
|
|
543
|
-
scheduledDepartureTimeTimezone: distalTimezone,
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
transportationOperatorId: transportationRequest.organizationId,
|
|
547
|
-
groundTransportationServices: [],
|
|
548
|
-
passengers: [],
|
|
549
|
-
segmentStatus: Trip_1.SegmentStatus.NOT_STARTED,
|
|
550
|
-
segmentType: Trip_1.SegmentType.GROUND_TRANSPORTATION,
|
|
551
|
-
typeOfService: Proposal_1.TypeOfService.GROUND,
|
|
552
|
-
segmentNumber: 0,
|
|
553
|
-
scheduledArrivalLocation: transportationRequest.recipientFacility,
|
|
554
|
-
scheduledDepartureLocation: localAirportLocation,
|
|
555
|
-
scheduledArrivalTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
556
|
-
.plus(recoveryTimeInMinutes)
|
|
557
|
-
.plus(flightTime)
|
|
558
|
-
.plus({ hours: 1 })
|
|
559
|
-
.toMillis(),
|
|
560
|
-
scheduledArrivalTimeTimezone: localTimezone,
|
|
561
|
-
scheduledDepartureTime: luxon_1.DateTime.fromMillis(transportationRequest.orDateTimeGMT)
|
|
562
|
-
.plus(recoveryTimeInMinutes)
|
|
563
|
-
.plus(flightTime)
|
|
564
|
-
.plus({ minutes: 30 })
|
|
565
|
-
.toMillis(),
|
|
566
|
-
scheduledDepartureTimeTimezone: localTimezone,
|
|
567
|
-
},
|
|
568
|
-
];
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
exports.createTripGroundSegmentsFromTransportationRequest = createTripGroundSegmentsFromTransportationRequest;
|
package/dist/types/Trip.d.ts
CHANGED
package/dist/types/Trip.js
CHANGED
|
@@ -166,5 +166,16 @@ class Trip {
|
|
|
166
166
|
this.createdAt = trip.createdAt;
|
|
167
167
|
this.updatedAt = trip.updatedAt;
|
|
168
168
|
}
|
|
169
|
+
sortTripSegments() {
|
|
170
|
+
var _a;
|
|
171
|
+
if (!this.tripSegments)
|
|
172
|
+
return [];
|
|
173
|
+
const tripSegments = (_a = this.tripSegments) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.scheduledDepartureTime - b.scheduledDepartureTime);
|
|
174
|
+
for (const [idx, tripSegment] of tripSegments === null || tripSegments === void 0 ? void 0 : tripSegments.entries()) {
|
|
175
|
+
tripSegment.segmentNumber = idx + 1;
|
|
176
|
+
}
|
|
177
|
+
this.tripSegments = tripSegments;
|
|
178
|
+
return tripSegments;
|
|
179
|
+
}
|
|
169
180
|
}
|
|
170
181
|
exports.Trip = Trip;
|