@golemio/pid 2.6.5-dev.834035052 → 2.6.6
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.
- package/db/example/00_clear_test_data.sql +4 -4
- package/db/example/03_ropidgtfs_dump.sql +1 -10
- package/db/example/14_nightDelays.sql +8 -16
- package/db/example/99_precomputed_tables.sql +169 -0
- package/db/migrations/postgresql/sqls/20220915123941-partitioned-departures-down.sql +0 -2
- package/db/migrations/postgresql/sqls/20230307124639-positions-internal-down.sql +1 -1
- package/dist/integration-engine/queueDefinitions.js +0 -10
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.d.ts +7 -13
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js +45 -50
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMetadataModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.d.ts +19 -0
- package/dist/integration-engine/ropid-gtfs/{data-access/precomputed/MinMaxStopSequencesRepository.js → RopidGTFSMinMaxSequencesModel.js} +33 -34
- package/dist/integration-engine/ropid-gtfs/RopidGTFSMinMaxSequencesModel.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.d.ts +21 -0
- package/dist/integration-engine/ropid-gtfs/{data-access/precomputed/TripScheduleRepository.js → RopidGTFSScheduledTripsModel.js} +26 -27
- package/dist/integration-engine/ropid-gtfs/RopidGTFSScheduledTripsModel.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.d.ts +19 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js +142 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSServicesFirst14daysModel.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.d.ts +3 -4
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js +18 -50
- package/dist/integration-engine/ropid-gtfs/RopidGTFSWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/{precomputed/DeparturesRepository.d.ts → DeparturesRepository.d.ts} +1 -2
- package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js +162 -0
- package/dist/integration-engine/ropid-gtfs/data-access/DeparturesRepository.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/index.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/{precomputed/index.js → index.js} +0 -3
- package/dist/integration-engine/ropid-gtfs/data-access/index.js.map +1 -0
- package/dist/integration-engine/ropid-gtfs/index.d.ts +3 -0
- package/dist/integration-engine/ropid-gtfs/index.js +3 -0
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/utils.js +4 -5
- package/dist/integration-engine/ropid-gtfs/utils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +3 -3
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +18 -18
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/output-gateway/departure-boards/DepartureBoardsRouter.js +1 -1
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js +6 -0
- package/dist/output-gateway/pid/data-access/DeparturesRepository.js.map +1 -1
- package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +2 -2
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -3
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +15 -15
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.d.ts +1 -0
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js +18 -5
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/DeparturesModel.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/models/precomputed/interfaces/IDeparturesModel.d.ts +1 -0
- package/docs/implementation_documentation.md +10 -30
- package/docs/openapi-output.yaml +1 -1
- package/package.json +3 -4
- package/db/migrations/postgresql/20230327121511-departure-view.js +0 -53
- package/db/migrations/postgresql/sqls/20230327121511-departure-view-down.sql +0 -81
- package/db/migrations/postgresql/sqls/20230327121511-departure-view-up.sql +0 -37
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +0 -132
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.d.ts +0 -9
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.d.ts +0 -9
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js +0 -135
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.d.ts +0 -11
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.d.ts +0 -4
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/index.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.d.ts +0 -5
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js +0 -10
- package/dist/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.js.map +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
DROP FUNCTION gtfs_timestamp (varchar, date);
|
|
2
|
-
|
|
3
|
-
CREATE OR REPLACE FUNCTION departure_part (par_stop_id text, t_schema text, is_tmp boolean DEFAULT false)
|
|
4
|
-
RETURNS integer
|
|
5
|
-
LANGUAGE plpgsql
|
|
6
|
-
AS $function$
|
|
7
|
-
declare txt_sql text;
|
|
8
|
-
declare master_table_name text;
|
|
9
|
-
begin
|
|
10
|
-
txt_sql = 'SET search_path TO ' || t_schema || ';';
|
|
11
|
-
|
|
12
|
-
if is_tmp = true then
|
|
13
|
-
txt_sql = txt_sql ||' ALTER TABLE IF EXISTS ropidgtfs_departures_' || trim(par_stop_id) || ' RENAME TO ropidgtfs_departures_' || trim(par_stop_id) || '_drop;';
|
|
14
|
-
master_table_name = 'ropidgtfs_departures_tmp';
|
|
15
|
-
else
|
|
16
|
-
master_table_name = 'ropidgtfs_departures';
|
|
17
|
-
end if;
|
|
18
|
-
|
|
19
|
-
txt_sql = txt_sql || ' CREATE TABLE IF NOT EXISTS ropidgtfs_departures_' || trim(par_stop_id);
|
|
20
|
-
txt_sql = txt_sql || ' PARTITION OF ' || master_table_name || ' FOR VALUES IN (''' || trim(par_stop_id) || ''')';
|
|
21
|
-
execute txt_sql;
|
|
22
|
-
return 0;
|
|
23
|
-
end;
|
|
24
|
-
$function$
|
|
25
|
-
;
|
|
26
|
-
|
|
27
|
-
ALTER TABLE ropidgtfs_precomputed_services_calendar rename to ropidgtfs_services_first14days;
|
|
28
|
-
ALTER TABLE ropidgtfs_precomputed_services_calendar_actual rename to ropidgtfs_services_first14days_actual;
|
|
29
|
-
|
|
30
|
-
ALTER TABLE ropidgtfs_precomputed_minmax_stop_sequences rename to ropidgtfs_trips_minmaxsequences;
|
|
31
|
-
ALTER TABLE ropidgtfs_precomputed_minmax_stop_sequences_actual rename to ropidgtfs_trips_minmaxsequences_actual;
|
|
32
|
-
|
|
33
|
-
ALTER TABLE ropidgtfs_precomputed_trip_schedule rename to ropidgtfs_scheduled_trips;
|
|
34
|
-
ALTER TABLE ropidgtfs_precomputed_trip_schedule_actual rename to ropidgtfs_scheduled_trips_actual;
|
|
35
|
-
|
|
36
|
-
CREATE TABLE ropidgtfs_departures (
|
|
37
|
-
stop_sequence smallint NOT NULL,
|
|
38
|
-
stop_headsign varchar(70) NULL,
|
|
39
|
-
pickup_type char(1) NULL,
|
|
40
|
-
drop_off_type char(1) NULL,
|
|
41
|
-
arrival_time varchar(20) NULL,
|
|
42
|
-
arrival_datetime timestamptz NULL,
|
|
43
|
-
departure_time varchar(20) NULL,
|
|
44
|
-
departure_datetime timestamptz NULL,
|
|
45
|
-
stop_id varchar(25) NOT NULL,
|
|
46
|
-
stop_name varchar(100) NULL,
|
|
47
|
-
platform_code varchar(10) NULL,
|
|
48
|
-
wheelchair_boarding smallint NULL,
|
|
49
|
-
min_stop_sequence smallint NULL,
|
|
50
|
-
max_stop_sequence smallint NULL,
|
|
51
|
-
trip_id varchar(50) NOT NULL,
|
|
52
|
-
trip_headsign varchar(100) NOT NULL,
|
|
53
|
-
trip_short_name varchar(30) NULL,
|
|
54
|
-
wheelchair_accessible smallint NULL,
|
|
55
|
-
service_id varchar(30) NULL,
|
|
56
|
-
"date" date NULL,
|
|
57
|
-
route_short_name varchar(50) NULL,
|
|
58
|
-
route_type char(1) NULL,
|
|
59
|
-
route_id varchar(20) NULL,
|
|
60
|
-
is_night char(1) NULL,
|
|
61
|
-
is_regional char(1) NULL,
|
|
62
|
-
is_substitute_transport char(1) NULL,
|
|
63
|
-
next_stop_sequence smallint NULL,
|
|
64
|
-
next_stop_id varchar(30) NULL,
|
|
65
|
-
last_stop_sequence smallint NULL,
|
|
66
|
-
last_stop_id varchar(30) NULL,
|
|
67
|
-
part_index varchar(4) NOT NULL
|
|
68
|
-
) partition by list(part_index);
|
|
69
|
-
|
|
70
|
-
SELECT departure_part(part_index, split_part(current_setting('search_path'), ',', 1)) FROM
|
|
71
|
-
(SELECT DISTINCT left(stop_id, 4) part_index FROM ropidgtfs_stops) as parts;
|
|
72
|
-
|
|
73
|
-
INSERT INTO ropidgtfs_departures
|
|
74
|
-
SELECT *, left(stop_id, 4) part_index FROM ropidgtfs_precomputed_departures;
|
|
75
|
-
|
|
76
|
-
CREATE INDEX ropidgtfs_departures_stop_idx ON ropidgtfs_departures USING btree (stop_id);
|
|
77
|
-
CREATE INDEX ropidgtfs_departures_part_index_idx ON ropidgtfs_departures USING btree (part_index);
|
|
78
|
-
CREATE UNIQUE INDEX ropidgtfs_departures_unique_idx ON ropidgtfs_departures USING btree (part_index, service_id, date, trip_id, stop_sequence);
|
|
79
|
-
|
|
80
|
-
DROP TABLE ropidgtfs_precomputed_departures;
|
|
81
|
-
DROP TABLE IF EXISTS ropidgtfs_precomputed_departures_tmp;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
DROP FUNCTION departure_part (text, text, boolean);
|
|
2
|
-
|
|
3
|
-
ALTER TABLE ropidgtfs_services_first14days rename to ropidgtfs_precomputed_services_calendar;
|
|
4
|
-
ALTER TABLE ropidgtfs_services_first14days_actual rename to ropidgtfs_precomputed_services_calendar_actual;
|
|
5
|
-
|
|
6
|
-
ALTER TABLE ropidgtfs_trips_minmaxsequences rename to ropidgtfs_precomputed_minmax_stop_sequences;
|
|
7
|
-
ALTER TABLE ropidgtfs_trips_minmaxsequences_actual rename to ropidgtfs_precomputed_minmax_stop_sequences_actual;
|
|
8
|
-
|
|
9
|
-
ALTER TABLE ropidgtfs_scheduled_trips rename to ropidgtfs_precomputed_trip_schedule;
|
|
10
|
-
ALTER TABLE ropidgtfs_scheduled_trips_actual rename to ropidgtfs_precomputed_trip_schedule_actual;
|
|
11
|
-
|
|
12
|
-
CREATE TABLE ropidgtfs_precomputed_departures
|
|
13
|
-
AS SELECT * FROM ropidgtfs_departures WHERE "date" = current_date;
|
|
14
|
-
ALTER TABLE ropidgtfs_precomputed_departures drop column part_index;
|
|
15
|
-
CREATE INDEX ropidgtfs_precomputed_departures_stop_id_idx ON ropidgtfs_precomputed_departures USING btree (stop_id);
|
|
16
|
-
CREATE UNIQUE INDEX ropidgtfs_precomputed_departures_unique_idx ON ropidgtfs_precomputed_departures USING btree (date, trip_id, stop_sequence);
|
|
17
|
-
|
|
18
|
-
DROP TABLE ropidgtfs_departures;
|
|
19
|
-
DROP TABLE IF EXISTS ropidgtfs_departures_tmp;
|
|
20
|
-
|
|
21
|
-
CREATE OR REPLACE FUNCTION gtfs_timestamp(gtfs_time varchar, target_date date)
|
|
22
|
-
RETURNS timestamptz AS
|
|
23
|
-
$$
|
|
24
|
-
BEGIN
|
|
25
|
-
RETURN CASE
|
|
26
|
-
WHEN (date_part('hour'::text, (gtfs_time)::interval) > (23)::double precision) THEN make_timestamptz((date_part('year'::text, (target_date + '1 day'::interval)))::integer, (date_part('month'::text, (target_date + '1 day'::interval)))::integer, (date_part('day'::text, (target_date + '1 day'::interval)))::integer, ((date_part('hour'::text, (gtfs_time)::interval))::integer - 24), (date_part('minute'::text, (gtfs_time)::interval))::integer, date_part('second'::text, (gtfs_time)::interval), 'Europe/Prague'::text)
|
|
27
|
-
ELSE make_timestamptz((date_part('year'::text, target_date))::integer, (date_part('month'::text, target_date))::integer, (date_part('day'::text, target_date))::integer, (date_part('hour'::text, (gtfs_time)::interval))::integer, (date_part('minute'::text, (gtfs_time)::interval))::integer, date_part('second'::text, (gtfs_time)::interval), 'Europe/Prague'::text)
|
|
28
|
-
END;
|
|
29
|
-
END;
|
|
30
|
-
$$
|
|
31
|
-
LANGUAGE plpgsql;
|
|
32
|
-
|
|
33
|
-
COMMENT ON FUNCTION gtfs_timestamp(gtfs_time varchar, target_date date) IS '
|
|
34
|
-
Converts a time string from GTFS feed to a timestamp.
|
|
35
|
-
If the GTFS time string represents a time later than 23:59, the timestamp returned will be for the day following the target date, with the hour adjusted accordingly.
|
|
36
|
-
Otherwise, the timestamp returned will be for the target date.
|
|
37
|
-
';
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DeparturesRepository = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
15
|
-
const precomputed_1 = require("../../../../schema-definitions/ropid-gtfs/models/precomputed");
|
|
16
|
-
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
17
|
-
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
18
|
-
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
19
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
20
|
-
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
21
|
-
class DeparturesRepository extends models_1.PostgresModel {
|
|
22
|
-
constructor() {
|
|
23
|
-
super("DeparturesRepository", {
|
|
24
|
-
pgTableName: precomputed_1.DeparturesModel.TABLE_NAME,
|
|
25
|
-
pgSchema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
26
|
-
outputSequelizeAttributes: precomputed_1.DeparturesModel.attributeModel,
|
|
27
|
-
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
28
|
-
savingType: "insertOnly",
|
|
29
|
-
}, new golemio_validator_1.JSONSchemaValidator("DeparturesRepository", precomputed_1.DeparturesModel.jsonSchema));
|
|
30
|
-
this.createAndPopulate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const timeConstraintLiteral = config_1.config.NODE_ENV !== "test" ? `WHERE gtfs_timestamp(t.arrival_time, t4.date) > now() - interval '6 hours'` : "";
|
|
32
|
-
/* eslint-disable max-len */
|
|
33
|
-
const sql = `
|
|
34
|
-
SELECT
|
|
35
|
-
t.stop_sequence,
|
|
36
|
-
t.stop_headsign,
|
|
37
|
-
t.pickup_type,
|
|
38
|
-
t.drop_off_type,
|
|
39
|
-
t.arrival_time,
|
|
40
|
-
gtfs_timestamp(t.arrival_time, t4.date) AS arrival_datetime,
|
|
41
|
-
t.departure_time,
|
|
42
|
-
gtfs_timestamp(t.departure_time, t4.date) AS departure_datetime,
|
|
43
|
-
t0.stop_id,
|
|
44
|
-
t0.stop_name,
|
|
45
|
-
t0.platform_code,
|
|
46
|
-
t0.wheelchair_boarding,
|
|
47
|
-
t1.min_stop_sequence,
|
|
48
|
-
t1.max_stop_sequence,
|
|
49
|
-
t2.trip_id,
|
|
50
|
-
t2.trip_headsign,
|
|
51
|
-
t2.trip_short_name,
|
|
52
|
-
t2.wheelchair_accessible,
|
|
53
|
-
t3.service_id,
|
|
54
|
-
t4.date,
|
|
55
|
-
t5.route_short_name,
|
|
56
|
-
t5.route_type,
|
|
57
|
-
t5.route_id,
|
|
58
|
-
t5.is_night,
|
|
59
|
-
t5.is_regional,
|
|
60
|
-
t5.is_substitute_transport,
|
|
61
|
-
t6.stop_sequence AS next_stop_sequence,
|
|
62
|
-
t6.stop_id AS next_stop_id,
|
|
63
|
-
t7.stop_sequence AS last_stop_sequence,
|
|
64
|
-
t7.stop_id AS last_stop_id
|
|
65
|
-
FROM ropidgtfs_stop_times${sourceTableSuffix} t
|
|
66
|
-
LEFT JOIN ropidgtfs_stops${sourceTableSuffix} t0 ON t.stop_id = t0.stop_id
|
|
67
|
-
LEFT JOIN ropidgtfs_trips${sourceTableSuffix} t2 ON t.trip_id = t2.trip_id
|
|
68
|
-
INNER JOIN ropidgtfs_precomputed_services_calendar_tmp t4 ON t2.service_id = t4.service_id
|
|
69
|
-
INNER JOIN ropidgtfs_precomputed_minmax_stop_sequences_tmp t1 ON t.trip_id = t1.trip_id
|
|
70
|
-
LEFT JOIN ropidgtfs_calendar${sourceTableSuffix} t3 ON t2.service_id = t3.service_id
|
|
71
|
-
LEFT JOIN ropidgtfs_routes${sourceTableSuffix} t5 ON t2.route_id = t5.route_id
|
|
72
|
-
LEFT JOIN ropidgtfs_stop_times${sourceTableSuffix} t6 ON t.trip_id = t6.trip_id AND t6.stop_sequence = t.stop_sequence + 1
|
|
73
|
-
LEFT JOIN ropidgtfs_stop_times${sourceTableSuffix} t7 ON t.trip_id = t7.trip_id AND t7.stop_sequence = t.stop_sequence - 1
|
|
74
|
-
${timeConstraintLiteral}`;
|
|
75
|
-
/* eslint-enable max-len */
|
|
76
|
-
try {
|
|
77
|
-
const tableName = precomputed_1.DeparturesModel.TABLE_NAME;
|
|
78
|
-
const tmpTableName = tableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
79
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
80
|
-
SET LOCAL search_path TO ${ropid_gtfs_1.RopidGTFS.pgSchema};
|
|
81
|
-
DROP TABLE IF EXISTS ${tmpTableName};
|
|
82
|
-
CREATE TABLE ${tmpTableName} (LIKE ${tableName});
|
|
83
|
-
INSERT INTO ${tmpTableName} ${sql};`);
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
helpers_1.log.error(err);
|
|
87
|
-
throw err;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
try {
|
|
92
|
-
const tableName = precomputed_1.DeparturesModel.TABLE_NAME;
|
|
93
|
-
const tmpTableName = tableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
94
|
-
const dropTableName = tableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Drop;
|
|
95
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(precomputed_1.DeparturesModel.indexesOptions);
|
|
96
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
97
|
-
SET LOCAL search_path TO ${ropid_gtfs_1.RopidGTFS.pgSchema};
|
|
98
|
-
LOCK ${tableName} IN EXCLUSIVE MODE;
|
|
99
|
-
ALTER TABLE ${tableName} RENAME TO ${dropTableName};
|
|
100
|
-
ALTER TABLE ${tmpTableName} RENAME TO ${tableName};
|
|
101
|
-
DROP TABLE ${dropTableName} CASCADE;
|
|
102
|
-
${indexQuery}`, { transaction });
|
|
103
|
-
}
|
|
104
|
-
catch (err) {
|
|
105
|
-
helpers_1.log.error(err);
|
|
106
|
-
throw err;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
this.analyze = () => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
try {
|
|
111
|
-
yield this.sequelizeModel.sequelize.query(`analyze ${ropid_gtfs_1.RopidGTFS.pgSchema}.${precomputed_1.DeparturesModel.TABLE_NAME}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp};`);
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
helpers_1.log.error(err);
|
|
115
|
-
throw err;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
try {
|
|
120
|
-
const indexes = precomputed_1.DeparturesModel.indexesOptions;
|
|
121
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(precomputed_1.DeparturesModel.TABLE_NAME, indexes);
|
|
122
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
helpers_1.log.error(err);
|
|
126
|
-
throw err;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.DeparturesRepository = DeparturesRepository;
|
|
132
|
-
//# sourceMappingURL=DeparturesRepository.js.map
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeparturesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,8FAAqE;AACrE,2EAAoE;AACpE,yEAAsE;AACtE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAE5E,MAAa,oBAAqB,SAAQ,sBAAa;IACnD;QACI,KAAK,CACD,sBAAsB,EACtB;YACI,WAAW,EAAE,6BAAe,CAAC,UAAU;YACvC,QAAQ,EAAE,sBAAS,CAAC,QAAQ;YAC5B,yBAAyB,EAAE,6BAAe,CAAC,cAAc;YACzD,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;YACtD,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,sBAAsB,EAAE,6BAAe,CAAC,UAAU,CAAC,CAC9E,CAAC;QAGC,sBAAiB,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YACzF,MAAM,qBAAqB,GACvB,eAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,4EAA4E,CAAC,CAAC,CAAC,EAAE,CAAC;YAEnH,4BAA4B;YAC5B,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAgCmB,iBAAiB;2CACb,iBAAiB;2CACjB,iBAAiB;;;8CAGd,iBAAiB;4CACnB,iBAAiB;gDACb,iBAAiB;gDACjB,iBAAiB;cACnD,qBAAqB,EAAE,CAAC;YAC9B,2BAA2B;YAE3B,IAAI;gBACA,MAAM,SAAS,GAAG,6BAAe,CAAC,UAAU,C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AAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAEK,kBAAa,GAAG,GAAwB,EAAE;YAC7C,IAAI;gBACA,MAAM,OAAO,GAAG,6BAAe,CAAC,cAAc,CAAC;gBAC/C,MAAM,UAAU,GAAG,IAAA,6BAAqB,EAAC,6BAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;gBAE9E,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;aAC1D;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAhHF,CAAC;CAiHJ;AA9HD,oDA8HC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
-
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
|
-
export declare class MinMaxStopSequencesRepository extends PostgresModel implements IModel {
|
|
5
|
-
constructor();
|
|
6
|
-
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
7
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
|
-
createIndexes: () => Promise<void>;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MinMaxStopSequencesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/MinMaxStopSequencesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;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icesCalendarRepository.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
-
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
|
-
export declare class ServicesCalendarRepository extends PostgresModel implements IModel {
|
|
5
|
-
constructor();
|
|
6
|
-
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
7
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
8
|
-
createIndexes: () => Promise<void>;
|
|
9
|
-
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ServicesCalendarRepository = void 0;
|
|
13
|
-
const utils_1 = require("../../utils");
|
|
14
|
-
const ropid_gtfs_1 = require("../../../../schema-definitions/ropid-gtfs");
|
|
15
|
-
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
16
|
-
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
-
const SourceTableSuffixEnum_1 = require("../../helpers/SourceTableSuffixEnum");
|
|
19
|
-
class ServicesCalendarRepository extends models_1.PostgresModel {
|
|
20
|
-
constructor() {
|
|
21
|
-
super("ServicesCalendarRepository", {
|
|
22
|
-
outputSequelizeAttributes: ropid_gtfs_1.RopidGTFS.servicesCalendar.outputSequelizeAttributes,
|
|
23
|
-
pgTableName: ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName,
|
|
24
|
-
pgSchema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
25
|
-
savingType: "insertOnly",
|
|
26
|
-
attributesToRemove: ["id", "created_at", "updated_at"],
|
|
27
|
-
}, new golemio_validator_1.JSONSchemaValidator("ServicesCalendarRepositoryValidator", ropid_gtfs_1.RopidGTFS.servicesCalendar.outputJsonSchema));
|
|
28
|
-
this.createAndPopulate = (sourceTableSuffix) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const sql = `
|
|
30
|
-
SELECT
|
|
31
|
-
dates.date,
|
|
32
|
-
date_part('day', dates.date - to_char(timezone('Europe/Prague', now()), 'YYYY-MM-DD')::timestamp) AS day_diff,
|
|
33
|
-
service_id
|
|
34
|
-
FROM (
|
|
35
|
-
SELECT
|
|
36
|
-
date_trunc('day', dd.dd)::date AS date
|
|
37
|
-
FROM generate_series(
|
|
38
|
-
( SELECT (CURRENT_TIMESTAMP - interval '1 day') )::date,
|
|
39
|
-
( SELECT (CURRENT_TIMESTAMP + interval '2 days') )::date,
|
|
40
|
-
'1 day'
|
|
41
|
-
) dd(dd)) dates
|
|
42
|
-
INNER JOIN "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar${sourceTableSuffix} calendar ON ((1 = 1))
|
|
43
|
-
WHERE (
|
|
44
|
-
(
|
|
45
|
-
dates.date >= "start_date"::date
|
|
46
|
-
AND dates.date <= end_date::date
|
|
47
|
-
AND (
|
|
48
|
-
(
|
|
49
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'monday'
|
|
50
|
-
AND monday = 1
|
|
51
|
-
) OR (
|
|
52
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'tuesday'
|
|
53
|
-
AND tuesday = 1
|
|
54
|
-
) OR (
|
|
55
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'wednesday'
|
|
56
|
-
AND wednesday = 1
|
|
57
|
-
) OR (
|
|
58
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'thursday'
|
|
59
|
-
AND thursday = 1
|
|
60
|
-
) OR (
|
|
61
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'friday'
|
|
62
|
-
AND friday = 1
|
|
63
|
-
) OR (
|
|
64
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'saturday'
|
|
65
|
-
AND saturday = 1
|
|
66
|
-
) OR (
|
|
67
|
-
btrim(to_char(dates.date::timestamptz, 'day')) = 'sunday'
|
|
68
|
-
AND sunday = 1
|
|
69
|
-
)
|
|
70
|
-
) AND (
|
|
71
|
-
NOT service_id IN (
|
|
72
|
-
SELECT service_id
|
|
73
|
-
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar_dates${sourceTableSuffix} calendar_dates
|
|
74
|
-
WHERE (
|
|
75
|
-
exception_type = 2
|
|
76
|
-
AND dates.date = calendar_dates.date::date
|
|
77
|
-
)
|
|
78
|
-
)
|
|
79
|
-
)) OR service_id IN (
|
|
80
|
-
SELECT service_id
|
|
81
|
-
FROM "${ropid_gtfs_1.RopidGTFS.pgSchema}".ropidgtfs_calendar_dates${sourceTableSuffix} calendar_dates
|
|
82
|
-
WHERE
|
|
83
|
-
calendar_dates.exception_type = 1
|
|
84
|
-
AND dates.date = calendar_dates.date::date
|
|
85
|
-
)
|
|
86
|
-
)
|
|
87
|
-
ORDER BY dates.date
|
|
88
|
-
`;
|
|
89
|
-
try {
|
|
90
|
-
const tmpTable = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
91
|
-
yield this.sequelizeModel.sequelize.query(`DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable};
|
|
92
|
-
CREATE TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} (
|
|
93
|
-
LIKE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName}
|
|
94
|
-
);
|
|
95
|
-
INSERT INTO "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tmpTable} ${sql};`);
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
helpers_1.log.error(err);
|
|
99
|
-
throw err;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
this.replaceByTmp = (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
try {
|
|
104
|
-
const pgTableName = ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName;
|
|
105
|
-
const tableNameTmp = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp;
|
|
106
|
-
const tableNameActual = pgTableName + SourceTableSuffixEnum_1.SourceTableSuffixEnum.Actual;
|
|
107
|
-
const indexQuery = (0, utils_1.buildAlterIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
108
|
-
yield this.sequelizeModel.sequelize.query(`
|
|
109
|
-
LOCK "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName} IN EXCLUSIVE MODE;
|
|
110
|
-
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} NO INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
111
|
-
DROP TABLE IF EXISTS "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual};
|
|
112
|
-
${indexQuery}
|
|
113
|
-
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameTmp} RENAME TO ${tableNameActual};
|
|
114
|
-
ALTER TABLE "${ropid_gtfs_1.RopidGTFS.pgSchema}".${tableNameActual} INHERIT "${ropid_gtfs_1.RopidGTFS.pgSchema}".${pgTableName};
|
|
115
|
-
`, { transaction });
|
|
116
|
-
}
|
|
117
|
-
catch (err) {
|
|
118
|
-
helpers_1.log.error(err);
|
|
119
|
-
throw err;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
this.createIndexes = () => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
try {
|
|
124
|
-
const indexQuery = (0, utils_1.buildCreateIndexQuery)(ropid_gtfs_1.RopidGTFS.servicesCalendar.pgTableName, ropid_gtfs_1.RopidGTFS.servicesCalendar.modelIndexOptions);
|
|
125
|
-
yield this.sequelizeModel.sequelize.query(indexQuery);
|
|
126
|
-
}
|
|
127
|
-
catch (err) {
|
|
128
|
-
helpers_1.log.error(err);
|
|
129
|
-
throw err;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.ServicesCalendarRepository = ServicesCalendarRepository;
|
|
135
|
-
//# sourceMappingURL=ServicesCalendarRepository.js.map
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesCalendarRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/ServicesCalendarRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAE5E,MAAa,0BAA2B,SAAQ,sBAAa;IACzD;QACI,KAAK,CACD,4BAA4B,EAC5B;YACI,yBAAyB,EAAE,sBAAS,CAAC,gBAAgB,CAAC,yBAAyB;YAC/E,WAAW,EAAE,sBAAS,CAAC,gBAAgB,CAAC,WAAW;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@golemio/core/dist/integration-engine/models";
|
|
2
|
-
import { FindOptions, Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
-
import { SourceTableSuffixEnum } from "../../helpers/SourceTableSuffixEnum";
|
|
4
|
-
import { IGtfsRunTripCache } from "../../interfaces/IGtfsRunTripCache";
|
|
5
|
-
export declare class TripScheduleRepository extends PostgresModel implements IModel {
|
|
6
|
-
constructor();
|
|
7
|
-
findAll: (options: FindOptions) => Promise<IGtfsRunTripCache[]>;
|
|
8
|
-
createAndPopulate: (sourceTableSuffix: SourceTableSuffixEnum) => Promise<void>;
|
|
9
|
-
replaceByTmp: (transaction: Transaction) => Promise<void>;
|
|
10
|
-
createIndexes: () => Promise<void>;
|
|
11
|
-
}
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAmF;AACnF,0EAA4C;AAC5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAG5E,MAAa,sBAAuB,SAAQ,sBAAa;IACrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,sBAAS,CAAC,YAAY,CAAC,yBAAyB;YAC3E,WAAW,EAAE,sBAAS,CAAC,YAAY,CAAC,WAAW;YAC/C,QAAQ,EAAE,sBAAS,CAAC,QAAQ;YAC5B,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,sBAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CACtG,CAAC;QAGC,YAAO,GAAG,CAAC,OAAoB,EAAgC,EAAE;YACpE,OAAO,IAAI,CAAC,c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|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SourceTableSuffixEnum = void 0;
|
|
4
|
-
var SourceTableSuffixEnum;
|
|
5
|
-
(function (SourceTableSuffixEnum) {
|
|
6
|
-
SourceTableSuffixEnum["Actual"] = "_actual";
|
|
7
|
-
SourceTableSuffixEnum["Tmp"] = "_tmp";
|
|
8
|
-
SourceTableSuffixEnum["Drop"] = "_drop";
|
|
9
|
-
})(SourceTableSuffixEnum = exports.SourceTableSuffixEnum || (exports.SourceTableSuffixEnum = {}));
|
|
10
|
-
//# sourceMappingURL=SourceTableSuffixEnum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SourceTableSuffixEnum.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/helpers/SourceTableSuffixEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,2CAAkB,CAAA;IAClB,qCAAY,CAAA;IACZ,uCAAc,CAAA;AAClB,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC"}
|