@pulsecharterconnect/types 0.2.25 → 0.2.27
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Duration } from "luxon";
|
|
2
2
|
import { Facility, GroundService } from "./Organization";
|
|
3
|
+
import { ITripSegment } from "./Trip";
|
|
3
4
|
export declare const DISTANCE_THRESHOLD_MILES_AIR_VS_GROUND = 100;
|
|
4
5
|
export declare const AVERAGE_AIR_SPEED = 450;
|
|
5
6
|
export declare enum TransportationRequestStatus {
|
|
@@ -178,9 +179,12 @@ export declare class TransportationRequest implements ITransportationRequest {
|
|
|
178
179
|
constructor(transportationRequest: ITransportationRequest);
|
|
179
180
|
airTransportationRecommended(): boolean;
|
|
180
181
|
}
|
|
182
|
+
export declare function calculateTravelTime(distanceMiles: number, speedMph: number): Duration;
|
|
181
183
|
/**
|
|
182
184
|
* Returns the procedure time in hours for a given recovery type
|
|
183
185
|
* @param recoveryType - The type of organ recovery procedure
|
|
184
186
|
* @returns The procedure time in hours
|
|
185
187
|
*/
|
|
186
188
|
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,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProcedureTime = 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;
|
|
3
|
+
exports.createTripGroundSegmentsFromTransportationRequest = exports.createTripAirSegmentsFromTransportationRequest = 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
|
+
const Trip_1 = require("./Trip");
|
|
6
|
+
const Proposal_1 = require("./Proposal");
|
|
5
7
|
exports.DISTANCE_THRESHOLD_MILES_AIR_VS_GROUND = 100;
|
|
6
8
|
exports.AVERAGE_AIR_SPEED = 450;
|
|
7
9
|
var TransportationRequestStatus;
|
|
@@ -199,6 +201,18 @@ class TransportationRequest {
|
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
exports.TransportationRequest = TransportationRequest;
|
|
204
|
+
function calculateTravelTime(distanceMiles, speedMph) {
|
|
205
|
+
// Luxon's Duration.fromDurationLike (and fromObject) does not accept Infinity or NaN as valid values for duration units. This is why you see the error:
|
|
206
|
+
// If speed is 0, return 0 hours and 0 minutes
|
|
207
|
+
if (speedMph === 0) {
|
|
208
|
+
return luxon_1.Duration.fromDurationLike({ hours: 0, minutes: 0 });
|
|
209
|
+
}
|
|
210
|
+
const totalHours = distanceMiles / speedMph;
|
|
211
|
+
const hours = Math.floor(totalHours);
|
|
212
|
+
const minutes = Math.round((totalHours - hours) * 60);
|
|
213
|
+
return luxon_1.Duration.fromDurationLike({ hours, minutes });
|
|
214
|
+
}
|
|
215
|
+
exports.calculateTravelTime = calculateTravelTime;
|
|
202
216
|
/**
|
|
203
217
|
* Returns the procedure time in hours for a given recovery type
|
|
204
218
|
* @param recoveryType - The type of organ recovery procedure
|
|
@@ -219,3 +233,339 @@ function getProcedureTime(recoveryType) {
|
|
|
219
233
|
}
|
|
220
234
|
}
|
|
221
235
|
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;
|