@golemio/pid 6.4.0 → 6.4.1-dev.3054859807

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/db/example/00_clear_test_data.sql +1 -0
  2. package/db/example/24_jis_delayed_segments.sql +142 -0
  3. package/db/migrations/postgresql/20261027100000-jis-delayed-segments.js +16 -0
  4. package/db/migrations/postgresql/sqls/20250127134438-departure-additional-indexes-down.sql +20 -2
  5. package/db/migrations/postgresql/sqls/20261027100000-jis-delayed-segments-down.sql +17 -0
  6. package/db/migrations/postgresql/sqls/20261027100000-jis-delayed-segments-up.sql +42 -0
  7. package/dist/integration-engine/jis/datasources/JISDelayedSegmentsDataSourceFactory.d.ts +9 -0
  8. package/dist/integration-engine/jis/datasources/JISDelayedSegmentsDataSourceFactory.js +54 -0
  9. package/dist/integration-engine/jis/datasources/JISDelayedSegmentsDataSourceFactory.js.map +1 -0
  10. package/dist/integration-engine/jis/ioc/Di.js +10 -0
  11. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  12. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +5 -0
  13. package/dist/integration-engine/jis/ioc/JISContainerToken.js +5 -0
  14. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  15. package/dist/integration-engine/jis/repositories/JISDelayedSegmentEnrichmentRepository.d.ts +14 -0
  16. package/dist/integration-engine/jis/repositories/JISDelayedSegmentEnrichmentRepository.js +69 -0
  17. package/dist/integration-engine/jis/repositories/JISDelayedSegmentEnrichmentRepository.js.map +1 -0
  18. package/dist/integration-engine/jis/repositories/JISDelayedSegmentsRepository.d.ts +23 -0
  19. package/dist/integration-engine/jis/repositories/JISDelayedSegmentsRepository.js +73 -0
  20. package/dist/integration-engine/jis/repositories/JISDelayedSegmentsRepository.js.map +1 -0
  21. package/dist/integration-engine/jis/repositories/helpers/JISDelayedSegmentEnrichmentQuery.d.ts +13 -0
  22. package/dist/integration-engine/jis/repositories/helpers/JISDelayedSegmentEnrichmentQuery.js +266 -0
  23. package/dist/integration-engine/jis/repositories/helpers/JISDelayedSegmentEnrichmentQuery.js.map +1 -0
  24. package/dist/integration-engine/jis/repositories/interfaces/IJISDelayedSegmentEnrichmentParams.d.ts +23 -0
  25. package/dist/integration-engine/jis/repositories/interfaces/IJISDelayedSegmentEnrichmentParams.js +2 -0
  26. package/dist/integration-engine/jis/repositories/interfaces/IJISDelayedSegmentEnrichmentParams.js.map +1 -0
  27. package/dist/integration-engine/jis/services/JISDelayedSegmentsDataService.d.ts +38 -0
  28. package/dist/integration-engine/jis/services/JISDelayedSegmentsDataService.js +174 -0
  29. package/dist/integration-engine/jis/services/JISDelayedSegmentsDataService.js.map +1 -0
  30. package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
  31. package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
  32. package/dist/integration-engine/jis/workers/tasks/RefreshDelayedSegmentsTask.d.ts +15 -0
  33. package/dist/integration-engine/jis/workers/tasks/RefreshDelayedSegmentsTask.js +55 -0
  34. package/dist/integration-engine/jis/workers/tasks/RefreshDelayedSegmentsTask.js.map +1 -0
  35. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.d.ts +2 -0
  36. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.js +16 -0
  37. package/dist/integration-engine/vehicle-positions/workers/runs/helpers/TramMessageFilter.js.map +1 -1
  38. package/dist/output-gateway/jis/controllers/v1/V1DelayedSegmentsController.d.ts +9 -0
  39. package/dist/output-gateway/jis/controllers/v1/V1DelayedSegmentsController.js +54 -0
  40. package/dist/output-gateway/jis/controllers/v1/V1DelayedSegmentsController.js.map +1 -0
  41. package/dist/output-gateway/jis/data-access/JISDelayedSegmentsRepository.d.ts +14 -0
  42. package/dist/output-gateway/jis/data-access/JISDelayedSegmentsRepository.js +56 -0
  43. package/dist/output-gateway/jis/data-access/JISDelayedSegmentsRepository.js.map +1 -0
  44. package/dist/output-gateway/jis/domain/IJISDelayedSegmentDto.d.ts +12 -0
  45. package/dist/output-gateway/jis/domain/IJISDelayedSegmentDto.js +2 -0
  46. package/dist/output-gateway/jis/domain/IJISDelayedSegmentDto.js.map +1 -0
  47. package/dist/output-gateway/jis/dto/interfaces/IDelayedSegmentsQueryDto.d.ts +5 -0
  48. package/dist/output-gateway/jis/dto/interfaces/IDelayedSegmentsQueryDto.js +2 -0
  49. package/dist/output-gateway/jis/dto/interfaces/IDelayedSegmentsQueryDto.js.map +1 -0
  50. package/dist/output-gateway/jis/helpers/JISDelayedSegmentInfoPanelStopsFilter.d.ts +8 -0
  51. package/dist/output-gateway/jis/helpers/JISDelayedSegmentInfoPanelStopsFilter.js +13 -0
  52. package/dist/output-gateway/jis/helpers/JISDelayedSegmentInfoPanelStopsFilter.js.map +1 -0
  53. package/dist/output-gateway/jis/ioc/Di.js +6 -0
  54. package/dist/output-gateway/jis/ioc/Di.js.map +1 -1
  55. package/dist/output-gateway/jis/ioc/OgJisToken.d.ts +3 -0
  56. package/dist/output-gateway/jis/ioc/OgJisToken.js +3 -0
  57. package/dist/output-gateway/jis/ioc/OgJisToken.js.map +1 -1
  58. package/dist/output-gateway/jis/routers/v1/V1JISRouter.d.ts +2 -0
  59. package/dist/output-gateway/jis/routers/v1/V1JISRouter.js +9 -0
  60. package/dist/output-gateway/jis/routers/v1/V1JISRouter.js.map +1 -1
  61. package/dist/output-gateway/jis/transformations/JISDelayedSegmentsTransformation.d.ts +7 -0
  62. package/dist/output-gateway/jis/transformations/JISDelayedSegmentsTransformation.js +32 -0
  63. package/dist/output-gateway/jis/transformations/JISDelayedSegmentsTransformation.js.map +1 -0
  64. package/dist/schema-definitions/jis/datasources/MapaPidDelayShapesJsonSchema.d.ts +3 -0
  65. package/dist/schema-definitions/jis/datasources/MapaPidDelayShapesJsonSchema.js +16 -0
  66. package/dist/schema-definitions/jis/datasources/MapaPidDelayShapesJsonSchema.js.map +1 -0
  67. package/dist/schema-definitions/jis/datasources/interfaces/IMapaPidDelayShape.d.ts +10 -0
  68. package/dist/schema-definitions/jis/datasources/interfaces/IMapaPidDelayShape.js +2 -0
  69. package/dist/schema-definitions/jis/datasources/interfaces/IMapaPidDelayShape.js.map +1 -0
  70. package/dist/schema-definitions/jis/datasources/interfaces/index.d.ts +1 -0
  71. package/dist/schema-definitions/jis/datasources/interfaces/index.js +1 -0
  72. package/dist/schema-definitions/jis/datasources/interfaces/index.js.map +1 -1
  73. package/dist/schema-definitions/jis/models/JISDelayedSegmentsModel.d.ts +24 -0
  74. package/dist/schema-definitions/jis/models/JISDelayedSegmentsModel.js +138 -0
  75. package/dist/schema-definitions/jis/models/JISDelayedSegmentsModel.js.map +1 -0
  76. package/dist/schema-definitions/jis/models/interfaces/IJISDelayedSegment.d.ts +44 -0
  77. package/dist/schema-definitions/jis/models/interfaces/IJISDelayedSegment.js +2 -0
  78. package/dist/schema-definitions/jis/models/interfaces/IJISDelayedSegment.js.map +1 -0
  79. package/dist/schema-definitions/jis/models/interfaces/index.d.ts +1 -0
  80. package/dist/schema-definitions/jis/models/interfaces/index.js +1 -0
  81. package/dist/schema-definitions/jis/models/interfaces/index.js.map +1 -1
  82. package/docs/assets/pid_jis_erd.png +0 -0
  83. package/docs/asyncapi.yaml +15 -0
  84. package/docs/implementation_documentation.md +56 -0
  85. package/docs/index.md +1 -0
  86. package/docs/jis/delayed-segments.md +241 -0
  87. package/docs/jis/index.md +9 -0
  88. package/docs/openapi-output.yaml +176 -0
  89. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  SET TIME ZONE "europe/prague";
2
2
  TRUNCATE
3
+ "jis_delayed_segments",
3
4
  "jis_events_ropidgtfs_routes",
4
5
  "jis_events",
5
6
  "jis_infotexts_ropidgtfs_stops",
@@ -0,0 +1,142 @@
1
+ -- Synthetic corridor for delayed segment enrichment tests (vymi-general#365).
2
+ -- Segment A (U9903Z1) -> D (U9906Z1); route X traverses it fully, Y partially (B -> C), Z only touches D,
3
+ -- W traverses it but is exceptional, V traverses it far outside the tested time window (10:00 Europe/Prague).
4
+ -- Separate segment G2 (U9912Z1) -> G3 (U9913Z1) on route G, whose stop sequences have a gap.
5
+ -- Segment H1 (U9914Z1) -> H4 (U9917Z1) with mixed stopping patterns: express H skips H2 and H3, local L serves all
6
+ -- stops and route J joins it in H3.
7
+ -- Segment K1 (U9919Z1) -> K4 (U9922Z1) with two branches visiting KX at different depths (K1, KB, KX, K4 and
8
+ -- K1, KX, KY, KZ, K4) and route KS running only KB -> KX.
9
+ WITH init_values AS (SELECT NOW()::DATE AS now_date)
10
+ INSERT INTO ropidgtfs_calendar_actual (service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date) VALUES
11
+ ('dseg-1111111',1,1,1,1,1,1,1,TO_CHAR((SELECT now_date FROM init_values)-INTERVAL '1 days','YYYYMMDD'),TO_CHAR((SELECT now_date FROM init_values)+INTERVAL '7 days','YYYYMMDD'));
12
+
13
+ INSERT INTO ropidgtfs_stops_actual (stop_id,stop_name,location_type,stop_lat,stop_lon,zone_id,asw_node_id,asw_stop_id) VALUES
14
+ ('U9900Z1P','DSeg P0',0,50.0,14.40,'P',9900,1),
15
+ ('U9901Z1P','DSeg P1',0,50.0,14.41,'P',9901,1),
16
+ ('U9902Z1P','DSeg P2',0,50.0,14.42,'P',9902,1),
17
+ ('U9903Z1P','DSeg A',0,50.0,14.43,'P',9903,1),
18
+ ('U9904Z1P','DSeg B',0,50.0,14.44,'P',9904,1),
19
+ ('U9904Z1','DSeg B',0,50.0,14.44,'P',9904,1),
20
+ ('U9905Z1P','DSeg C',0,50.0,14.45,'P',9905,1),
21
+ ('U9906Z1P','DSeg D',0,50.0,14.46,'P',9906,1),
22
+ ('U9907Z1P','DSeg N1',0,50.0,14.47,'P',9907,1),
23
+ ('U9908Z1P','DSeg Q1',0,50.1,14.44,'P',9908,1),
24
+ ('U9909Z1P','DSeg E',0,50.1,14.46,'P',9909,1),
25
+ ('U9910Z1P','DSeg R1',0,50.1,14.47,'P',9910,1),
26
+ ('U9911Z1P','DSeg G1',0,50.2,14.40,'P',9911,1),
27
+ ('U9912Z1P','DSeg G2',0,50.2,14.41,'P',9912,1),
28
+ ('U9913Z1P','DSeg G3',0,50.2,14.42,'P',9913,1),
29
+ ('U9914Z1P','DSeg H1',0,50.3,14.40,'P',9914,1),
30
+ ('U9915Z1P','DSeg H2',0,50.3,14.41,'P',9915,1),
31
+ ('U9916Z1P','DSeg H3',0,50.3,14.42,'P',9916,1),
32
+ ('U9917Z1P','DSeg H4',0,50.3,14.43,'P',9917,1),
33
+ ('U9918Z1P','DSeg J1',0,50.4,14.42,'P',9918,1),
34
+ ('U9919Z1P','DSeg K1',0,50.5,14.40,'P',9919,1),
35
+ ('U9920Z1P','DSeg KB',0,50.5,14.41,'P',9920,1),
36
+ ('U9921Z1P','DSeg KX',0,50.5,14.42,'P',9921,1),
37
+ ('U9922Z1P','DSeg K4',0,50.5,14.43,'P',9922,1),
38
+ ('U9923Z1P','DSeg KY',0,50.6,14.42,'P',9923,1),
39
+ ('U9924Z1P','DSeg KZ',0,50.6,14.43,'P',9924,1);
40
+
41
+ INSERT INTO ropidgtfs_routes_actual (route_id,route_short_name,route_long_name,route_type,agency_id,is_night,is_regional,is_substitute_transport) VALUES
42
+ ('L9901','9901','DSeg X','3','99','0','0','0'),
43
+ ('L9902','9902','DSeg Y','3','99','0','0','0'),
44
+ ('L9903','9903','DSeg Z','3','99','0','0','0'),
45
+ ('L9904','9904','DSeg W','3','99','0','0','0'),
46
+ ('L9905','9905','DSeg V','3','99','0','0','0'),
47
+ ('L9906','9906','DSeg G','3','99','0','0','0'),
48
+ ('L9907','9907','DSeg H express','3','99','0','0','0'),
49
+ ('L9908','9908','DSeg L local','3','99','0','0','0'),
50
+ ('L9909','9909','DSeg J','3','99','0','0','0'),
51
+ ('L9910','9910','DSeg K branch 1','3','99','0','0','0'),
52
+ ('L9911','9911','DSeg K branch 2','3','99','0','0','0'),
53
+ ('L9912','9912','DSeg KS','3','99','0','0','0');
54
+
55
+ INSERT INTO ropidgtfs_trips_actual (trip_id,route_id,service_id,exceptional,direction_id,trip_headsign) VALUES
56
+ ('dseg_x_1','L9901','dseg-1111111',0,0,'DSeg N1'),
57
+ ('dseg_y_1','L9902','dseg-1111111',0,0,'DSeg E'),
58
+ ('dseg_z_1','L9903','dseg-1111111',0,0,'DSeg R1'),
59
+ ('dseg_w_1','L9904','dseg-1111111',1,0,'DSeg B'),
60
+ ('dseg_v_1','L9905','dseg-1111111',0,0,'DSeg C'),
61
+ ('dseg_g_1','L9906','dseg-1111111',0,0,'DSeg G3'),
62
+ ('dseg_h_1','L9907','dseg-1111111',0,0,'DSeg H4'),
63
+ ('dseg_l_1','L9908','dseg-1111111',0,0,'DSeg H4'),
64
+ ('dseg_j_1','L9909','dseg-1111111',0,0,'DSeg H4'),
65
+ ('dseg_k1_1','L9910','dseg-1111111',0,0,'DSeg K4'),
66
+ ('dseg_k2_1','L9911','dseg-1111111',0,0,'DSeg K4'),
67
+ ('dseg_ks_1','L9912','dseg-1111111',0,0,'DSeg KX');
68
+
69
+ INSERT INTO ropidgtfs_stop_times_actual (trip_id,stop_sequence,stop_id,arrival_time,departure_time,pickup_type,drop_off_type) VALUES
70
+ ('dseg_x_1',1,'U9900Z1P','10:00:00','10:00:00','0','0'),
71
+ ('dseg_x_1',2,'U9901Z1P','10:02:00','10:02:00','0','0'),
72
+ ('dseg_x_1',3,'U9902Z1P','10:04:00','10:04:00','0','0'),
73
+ ('dseg_x_1',4,'U9903Z1P','10:06:00','10:06:00','0','0'),
74
+ ('dseg_x_1',5,'U9904Z1P','10:08:00','10:08:00','0','0'),
75
+ ('dseg_x_1',6,'U9905Z1P','10:10:00','10:10:00','0','0'),
76
+ ('dseg_x_1',7,'U9906Z1P','10:12:00','10:12:00','0','0'),
77
+ ('dseg_x_1',8,'U9907Z1P','10:14:00','10:14:00','0','0'),
78
+ ('dseg_y_1',1,'U9908Z1P','10:05:00','10:05:00','0','0'),
79
+ ('dseg_y_1',2,'U9904Z1P','10:09:00','10:09:00','0','0'),
80
+ ('dseg_y_1',3,'U9905Z1P','10:11:00','10:11:00','0','0'),
81
+ ('dseg_y_1',4,'U9909Z1P','10:13:00','10:13:00','0','0'),
82
+ ('dseg_z_1',1,'U9906Z1P','10:15:00','10:15:00','0','0'),
83
+ ('dseg_z_1',2,'U9910Z1P','10:17:00','10:17:00','0','0'),
84
+ ('dseg_w_1',1,'U9903Z1P','10:06:00','10:06:00','0','0'),
85
+ ('dseg_w_1',2,'U9904Z1P','10:08:00','10:08:00','0','0'),
86
+ ('dseg_v_1',1,'U9904Z1P','14:00:00','14:00:00','0','0'),
87
+ ('dseg_v_1',2,'U9905Z1P','14:02:00','14:02:00','0','0'),
88
+ ('dseg_g_1',1,'U9911Z1P','10:00:00','10:00:00','0','0'),
89
+ ('dseg_g_1',5,'U9912Z1P','10:02:00','10:02:00','0','0'),
90
+ ('dseg_g_1',6,'U9913Z1P','10:04:00','10:04:00','0','0'),
91
+ ('dseg_h_1',1,'U9914Z1P','10:00:00','10:00:00','0','0'),
92
+ ('dseg_h_1',2,'U9917Z1P','10:04:00','10:04:00','0','0'),
93
+ ('dseg_l_1',1,'U9914Z1P','10:00:00','10:00:00','0','0'),
94
+ ('dseg_l_1',2,'U9915Z1P','10:02:00','10:02:00','0','0'),
95
+ ('dseg_l_1',3,'U9916Z1P','10:04:00','10:04:00','0','0'),
96
+ ('dseg_l_1',4,'U9917Z1P','10:06:00','10:06:00','0','0'),
97
+ ('dseg_j_1',1,'U9918Z1P','10:00:00','10:00:00','0','0'),
98
+ ('dseg_j_1',2,'U9916Z1P','10:02:00','10:02:00','0','0'),
99
+ ('dseg_j_1',3,'U9917Z1P','10:04:00','10:04:00','0','0'),
100
+ ('dseg_k1_1',1,'U9919Z1P','10:00:00','10:00:00','0','0'),
101
+ ('dseg_k1_1',2,'U9920Z1P','10:02:00','10:02:00','0','0'),
102
+ ('dseg_k1_1',3,'U9921Z1P','10:04:00','10:04:00','0','0'),
103
+ ('dseg_k1_1',4,'U9922Z1P','10:06:00','10:06:00','0','0'),
104
+ ('dseg_k2_1',1,'U9919Z1P','10:00:00','10:00:00','0','0'),
105
+ ('dseg_k2_1',2,'U9921Z1P','10:02:00','10:02:00','0','0'),
106
+ ('dseg_k2_1',3,'U9923Z1P','10:04:00','10:04:00','0','0'),
107
+ ('dseg_k2_1',4,'U9924Z1P','10:06:00','10:06:00','0','0'),
108
+ ('dseg_k2_1',5,'U9922Z1P','10:08:00','10:08:00','0','0'),
109
+ ('dseg_ks_1',1,'U9920Z1P','10:02:00','10:02:00','0','0'),
110
+ ('dseg_ks_1',2,'U9921Z1P','10:04:00','10:04:00','0','0');
111
+
112
+ INSERT INTO ropid_departures_presets (route_name,api_version,route,url_query_params,note,created_at,updated_at,is_testing) VALUES
113
+ ('dseg-p0',2,'/pid/departureboards','aswIds=9900_1','delayed segments test',now(),now(),false),
114
+ ('dseg-p1',2,'/pid/departureboards','aswIds=9901_1','delayed segments test',now(),now(),false),
115
+ ('dseg-b',2,'/pid/departureboards','aswIds=9904_1','delayed segments test',now(),now(),false),
116
+ ('dseg-b-2',2,'/pid/departureboards','aswIds=9904_1','delayed segments test',now(),now(),false),
117
+ ('dseg-q1',2,'/pid/departureboards','aswIds=9908_1','delayed segments test',now(),now(),false),
118
+ ('dseg-n1',2,'/pid/departureboards','aswIds=9907_1','delayed segments test',now(),now(),false),
119
+ ('dseg-r1',2,'/pid/departureboards','aswIds=9910_1','delayed segments test',now(),now(),false),
120
+ ('dseg-g1',2,'/pid/departureboards','aswIds=9911_1','delayed segments test',now(),now(),false);
121
+
122
+ -- Preset ids are looked up by route_name, as they depend on the order of fixture files
123
+ INSERT INTO ropid_departures_presets_ropidgtfs_stops (preset_id,stop_id,created_at,updated_at)
124
+ SELECT p.id, s.stop_id, now(), now()
125
+ FROM (VALUES
126
+ ('dseg-p0','U9900Z1P'),
127
+ ('dseg-p1','U9901Z1P'),
128
+ ('dseg-b','U9904Z1'),
129
+ ('dseg-b-2','U9904Z1'),
130
+ ('dseg-q1','U9908Z1P'),
131
+ ('dseg-n1','U9907Z1P'),
132
+ ('dseg-r1','U9910Z1P'),
133
+ ('dseg-g1','U9911Z1P')
134
+ ) AS s(route_name, stop_id)
135
+ JOIN ropid_departures_presets p ON p.route_name = s.route_name;
136
+
137
+ INSERT INTO jis_delayed_segments (id,external_from_stop_id,external_to_stop_id,from_stop_id,from_stop_name,to_stop_id,to_stop_name,expected_delay_seconds,stops,routes,info_panel_stops,created_at,updated_at) VALUES
138
+ ('9903/1-9906/1','U9903Z1','U9906Z1','U9903Z1P','DSeg A','U9906Z1P','DSeg D',900,
139
+ '[{"id":"U9903Z1P","name":"DSeg A"},{"id":"U9904Z1","name":"DSeg B"},{"id":"U9905Z1P","name":"DSeg C"},{"id":"U9906Z1P","name":"DSeg D"}]',
140
+ '[{"id":"L9901","short_name":"9901","type":3},{"id":"L9902","short_name":"9902","type":3}]',
141
+ '[{"stop":{"id":"U9901Z1P","name":"DSeg P1"},"preset_route_names":["dseg-p1"],"routes":[{"id":"L9901","distance_stops":-2}]},{"stop":{"id":"U9904Z1","name":"DSeg B"},"preset_route_names":["dseg-b","dseg-b-2"],"routes":[{"id":"L9901","distance_stops":0},{"id":"L9902","distance_stops":0}]}]',
142
+ '2026-10-27 09:50:00+01','2026-10-27 10:00:00+01');
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs/promises');
4
+ const path = require('path');
5
+
6
+ const runSql = (db, name) =>
7
+ fs.readFile(path.join(__dirname, 'sqls', name), 'utf-8').then((sql) => {
8
+ console.log('received data: ' + sql);
9
+ return db.runSql(sql);
10
+ });
11
+
12
+ exports.up = (db) => runSql(db, '20261027100000-jis-delayed-segments-up.sql');
13
+
14
+ exports.down = (db) => runSql(db, '20261027100000-jis-delayed-segments-down.sql');
15
+
16
+ exports._meta = { version: 1 };
@@ -1,7 +1,25 @@
1
1
  drop index ropidgtfs_run_numbers_unique_idx;
2
- drop index if exists ropidgtfs_run_numbers_unique_idx_actual;
3
2
 
4
- drop index ropidgtfs_precomputed_departures_idx;
3
+ -- Index names of the _actual and precomputed tables change with every GTFS import (the tables are recreated LIKE
4
+ -- themselves), so these indexes are found by their columns
5
+ do $$
6
+ declare
7
+ index_name text;
8
+ begin
9
+ select i.relname into strict index_name
10
+ from pg_index x
11
+ join pg_class i on i.oid = x.indexrelid
12
+ where x.indrelid = 'ropidgtfs_run_numbers_actual'::regclass
13
+ and pg_get_indexdef(x.indexrelid) like '%USING btree (trip_id, service_id)';
14
+ execute format('drop index %I', index_name);
15
+
16
+ select i.relname into strict index_name
17
+ from pg_index x
18
+ join pg_class i on i.oid = x.indexrelid
19
+ where x.indrelid = 'ropidgtfs_precomputed_departures'::regclass
20
+ and pg_get_indexdef(x.indexrelid) like '%USING btree (trip_id, service_id)';
21
+ execute format('drop index %I', index_name);
22
+ end $$;
5
23
 
6
24
  -- Add columns in the resulting table of the get_departures function
7
25
  -- + origin_route_name
@@ -0,0 +1,17 @@
1
+ drop table jis_delayed_segments;
2
+
3
+ -- The stop_id index is created before the replacing index is dropped, so that the exclusive lock of the drop is held
4
+ -- only shortly. Index names change with every GTFS import (the table is recreated LIKE itself), so the replacing
5
+ -- index is found by its columns.
6
+ create index ropidgtfs_precomputed_departures_stop_id_idx on ropidgtfs_precomputed_departures (stop_id);
7
+ do $$
8
+ declare
9
+ index_name text;
10
+ begin
11
+ select i.relname into strict index_name
12
+ from pg_index x
13
+ join pg_class i on i.oid = x.indexrelid
14
+ where x.indrelid = 'ropidgtfs_precomputed_departures'::regclass
15
+ and pg_get_indexdef(x.indexrelid) like '%USING btree (stop_id, departure_datetime)';
16
+ execute format('drop index %I', index_name);
17
+ end $$;
@@ -0,0 +1,42 @@
1
+ create table jis_delayed_segments (
2
+ id text not null,
3
+ external_from_stop_id varchar(50) not null,
4
+ external_to_stop_id varchar(50) not null,
5
+ from_stop_id varchar(50) not null,
6
+ from_stop_name text not null,
7
+ to_stop_id varchar(50) not null,
8
+ to_stop_name text not null,
9
+ expected_delay_seconds integer not null,
10
+ stops jsonb not null,
11
+ routes jsonb not null,
12
+ info_panel_stops jsonb not null,
13
+ created_at timestamptz not null,
14
+ updated_at timestamptz not null,
15
+ constraint jis_delayed_segments_pk primary key (id)
16
+ );
17
+
18
+ comment on column jis_delayed_segments.id is 'Composed of ASW ids of the segment endpoints: {from node}/{from stop}-{to node}/{to stop}';
19
+ comment on column jis_delayed_segments.external_from_stop_id is 'Stop id of the segment start as reported by the data source, in its own format, kept for debugging';
20
+ comment on column jis_delayed_segments.external_to_stop_id is 'Stop id of the segment end as reported by the data source, in its own format, kept for debugging';
21
+ comment on column jis_delayed_segments.from_stop_id is 'GTFS stop_id (ropidgtfs_stops.stop_id) of the segment start';
22
+ comment on column jis_delayed_segments.to_stop_id is 'GTFS stop_id (ropidgtfs_stops.stop_id) of the segment end';
23
+ comment on column jis_delayed_segments.created_at is 'Time of the first fetch of the current continuous detection of the segment; a segment missing from a fetch is deleted and starts over';
24
+ comment on column jis_delayed_segments.updated_at is 'Time of the last fetch that contained the segment, same for all segments of one fetch';
25
+
26
+ -- Departures of stops within a time window, for the delayed segments enrichment. Replaces the stop_id index,
27
+ -- which it covers. The new index is created before the old one is dropped: the drop locks the table exclusively
28
+ -- until the migration commits, which must not last for the whole index build (departure boards read the table).
29
+ -- Index names change with every GTFS import (the table is recreated LIKE itself), so the replaced index is found
30
+ -- by its columns.
31
+ create index ropidgtfs_precomputed_departures_stop_id_departure_datetime_idx on ropidgtfs_precomputed_departures (stop_id, departure_datetime);
32
+ do $$
33
+ declare
34
+ index_name text;
35
+ begin
36
+ select i.relname into strict index_name
37
+ from pg_index x
38
+ join pg_class i on i.oid = x.indexrelid
39
+ where x.indrelid = 'ropidgtfs_precomputed_departures'::regclass
40
+ and pg_get_indexdef(x.indexrelid) like '%USING btree (stop_id)';
41
+ execute format('drop index %I', index_name);
42
+ end $$;
@@ -0,0 +1,9 @@
1
+ import { type IMapaPidDelayShape } from "#sch/jis/datasources/interfaces/index";
2
+ import { type ISimpleConfig } from "@golemio/core/dist/helpers/configuration/ISimpleConfig.js";
3
+ import { type IDataSource } from "@golemio/core/dist/integration-engine/index.js";
4
+ export declare class JISDelayedSegmentsDataSourceFactory {
5
+ private config;
6
+ private static DATASOURCE_NAME;
7
+ constructor(config: ISimpleConfig);
8
+ getDataSource(): IDataSource<IMapaPidDelayShape[]>;
9
+ }
@@ -0,0 +1,54 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var JISDelayedSegmentsDataSourceFactory_1;
14
+ import { mapaPidDelayShapesJsonSchema } from "#sch/jis/datasources/MapaPidDelayShapesJsonSchema";
15
+ import { CoreToken } from "@golemio/core/dist/helpers/ioc/CoreToken.js";
16
+ import { DataSource, JSONDataTypeStrategy } from "@golemio/core/dist/integration-engine/index.js";
17
+ import { HTTPFetchProtocolStrategy } from "@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPFetchProtocolStrategy.js";
18
+ import GolemioValidatorCore from "@golemio/core/dist/shared/golemio-validator.js";
19
+ const { JSONSchemaValidator } = GolemioValidatorCore;
20
+ import { inject, injectable } from "@golemio/core/dist/shared/tsyringe.js";
21
+ /**
22
+ * Delayed segments are always returned for the whole network. Empty bounds make Mapa PID skip all vehicles
23
+ * and disabled delay sections skip the segment shapes, keeping the response (and the load on Mapa PID) minimal.
24
+ */
25
+ const REQUEST_BODY = {
26
+ action: "getData",
27
+ dimensions: [0, 0],
28
+ bounds: [0, 0, 0, 0],
29
+ openedVehicleWindow: false,
30
+ show_delay_sections: false,
31
+ past_time: false,
32
+ };
33
+ let JISDelayedSegmentsDataSourceFactory = JISDelayedSegmentsDataSourceFactory_1 = class JISDelayedSegmentsDataSourceFactory {
34
+ constructor(config) {
35
+ this.config = config;
36
+ }
37
+ getDataSource() {
38
+ return new DataSource(JISDelayedSegmentsDataSourceFactory_1.DATASOURCE_NAME, new HTTPFetchProtocolStrategy({
39
+ method: "POST",
40
+ url: this.config.getValue("module.pid.jis.delayedSegments.url"),
41
+ headers: { Accept: "application/json", "Content-Type": "application/json" },
42
+ body: JSON.stringify(REQUEST_BODY),
43
+ timeoutInSeconds: 20,
44
+ }), new JSONDataTypeStrategy({ resultsPath: "delay_shapes" }), new JSONSchemaValidator(JISDelayedSegmentsDataSourceFactory_1.DATASOURCE_NAME + "Validator", mapaPidDelayShapesJsonSchema));
45
+ }
46
+ };
47
+ JISDelayedSegmentsDataSourceFactory.DATASOURCE_NAME = "JISDelayedSegmentsDataSource";
48
+ JISDelayedSegmentsDataSourceFactory = JISDelayedSegmentsDataSourceFactory_1 = __decorate([
49
+ injectable(),
50
+ __param(0, inject(CoreToken.SimpleConfig)),
51
+ __metadata("design:paramtypes", [Object])
52
+ ], JISDelayedSegmentsDataSourceFactory);
53
+ export { JISDelayedSegmentsDataSourceFactory };
54
+ //# sourceMappingURL=JISDelayedSegmentsDataSourceFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISDelayedSegmentsDataSourceFactory.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/datasources/JISDelayedSegmentsDataSourceFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAA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,CAAC;;AApBc,mDAAe,GAAG,8BAA8B,AAAjC,CAAkC;AADvD,mCAAmC;IAD/C,UAAU,EAAE;IAII,WAAA,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;;GAHlC,mCAAmC,CAsB/C"}
@@ -1,7 +1,10 @@
1
1
  import { PidContainer } from "#ie/ioc/Di";
2
2
  import { RopidGTFSStopsModel } from "#ie/ropid-gtfs/RopidGTFSStopsModel";
3
3
  import { JISEventsDataSourceFactory } from "../datasources/JISEventsDataSourceFactory.js";
4
+ import { JISDelayedSegmentsDataSourceFactory } from "../datasources/JISDelayedSegmentsDataSourceFactory.js";
4
5
  import { JISInfotextsDataSourceFactory } from "../datasources/JISInfotextsDataSourceFactory.js";
6
+ import { JISDelayedSegmentEnrichmentRepository } from "../repositories/JISDelayedSegmentEnrichmentRepository.js";
7
+ import { JISDelayedSegmentsRepository } from "../repositories/JISDelayedSegmentsRepository.js";
5
8
  import { JISEventsRepository } from "../repositories/JISEventsRepository.js";
6
9
  import { JISEventsRopidGTFSRoutesRepository } from "../repositories/JISEventsRopidGTFSRoutesRepository.js";
7
10
  import { JISInfotextsRedisRepository } from "../repositories/JISInfotextsRedisRepository.js";
@@ -9,6 +12,7 @@ import { JISInfotextsPresetsRepository } from "../repositories/JISInfotextsPrese
9
12
  import { JISInfotextsRepository } from "../repositories/JISInfotextsRepository.js";
10
13
  import { JISInfotextsRopidGTFSStopsRepository } from "../repositories/JISInfotextsRopidGTFSStopsRepository.js";
11
14
  import { JISMetadataRepository } from "../repositories/JISMetadataRepository.js";
15
+ import { JISDelayedSegmentsDataService } from "../services/JISDelayedSegmentsDataService.js";
12
16
  import { JISEventsDataService } from "../services/JISEventsDataService.js";
13
17
  import { JISInfotextsDataService } from "../services/JISInfotextsDataService.js";
14
18
  import { JISEventsGtfsRtTransformation } from "../transformations/JISEventsGtfsRtTransformation.js";
@@ -18,6 +22,7 @@ import { JISInfotextsTransformation } from "../transformations/JISInfotextsTrans
18
22
  import { UpdateEventWebhookTransformation } from "../transformations/UpdateEventWebhookTransformation.js";
19
23
  import { FetchJISEventsTask } from "../workers/tasks/FetchJISEventsTask.js";
20
24
  import { FetchJISInfotextsTask } from "../workers/tasks/FetchJISInfotextsTask.js";
25
+ import { RefreshDelayedSegmentsTask } from "../workers/tasks/RefreshDelayedSegmentsTask.js";
21
26
  import { RefreshJISEventsTask } from "../workers/tasks/RefreshJISEventsTask.js";
22
27
  import { RefreshJISInfotextsCacheTask } from "../workers/tasks/RefreshJISInfotextsCacheTask.js";
23
28
  import { RefreshJISInfotextsTask } from "../workers/tasks/RefreshJISInfotextsTask.js";
@@ -30,6 +35,7 @@ const JISContainer = PidContainer.createChildContainer();
30
35
  //#region Data Sources
31
36
  JISContainer.registerSingleton(JISContainerToken.JISEventsDataSourceFactory, JISEventsDataSourceFactory);
32
37
  JISContainer.registerSingleton(JISContainerToken.JISInfotextsDataSourceFactory, JISInfotextsDataSourceFactory);
38
+ JISContainer.registerSingleton(JISContainerToken.JISDelayedSegmentsDataSourceFactory, JISDelayedSegmentsDataSourceFactory);
33
39
  //#endregion
34
40
  //#region Cache Repositories
35
41
  JISContainer.registerSingleton(JISContainerToken.JISInfotextsRedisRepository, JISInfotextsRedisRepository);
@@ -43,10 +49,13 @@ JISContainer.registerSingleton(JISContainerToken.JISInfotextsPresetsRepository,
43
49
  JISContainer.registerSingleton(JISContainerToken.JISMetadataRepository, JISMetadataRepository);
44
50
  JISContainer.registerSingleton(JISContainerToken.RopidGTFSStopsRepository, RopidGTFSStopsModel);
45
51
  JISContainer.registerSingleton(JISContainerToken.RopidGTFSRoutesRepository, RopidGTFSRoutesRepository);
52
+ JISContainer.registerSingleton(JISContainerToken.JISDelayedSegmentsRepository, JISDelayedSegmentsRepository);
53
+ JISContainer.registerSingleton(JISContainerToken.JISDelayedSegmentEnrichmentRepository, JISDelayedSegmentEnrichmentRepository);
46
54
  //#endregion
47
55
  //#region Services
48
56
  JISContainer.registerSingleton(JISContainerToken.JISEventsDataService, JISEventsDataService);
49
57
  JISContainer.register(JISContainerToken.JISInfotextsDataService, JISInfotextsDataService);
58
+ JISContainer.registerSingleton(JISContainerToken.JISDelayedSegmentsDataService, JISDelayedSegmentsDataService);
50
59
  //#endregion
51
60
  //#region Tasks
52
61
  JISContainer.registerSingleton(JISContainerToken.FetchJISEventsTask, FetchJISEventsTask);
@@ -55,6 +64,7 @@ JISContainer.registerSingleton(JISContainerToken.RefreshJISEventsTask, RefreshJI
55
64
  JISContainer.registerSingleton(JISContainerToken.RefreshJISInfotextsTask, RefreshJISInfotextsTask);
56
65
  JISContainer.registerSingleton(JISContainerToken.RefreshJISInfotextsCacheTask, RefreshJISInfotextsCacheTask);
57
66
  JISContainer.registerSingleton(JISContainerToken.UpdateEventWebhookTask, UpdateEventWebhookTask);
67
+ JISContainer.registerSingleton(JISContainerToken.RefreshDelayedSegmentsTask, RefreshDelayedSegmentsTask);
58
68
  //#endregion
59
69
  //#region Transformations
60
70
  JISContainer.registerSingleton(JISContainerToken.JISEventsTransformation, JISEventsTransformation);
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,kCAAkC,EAAE,MAAM,uDAAuD,CAAC;AAC3G,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OA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iB,CAAC,iBAAiB,CAAC,8BAA8B,EAAE,8BAA8B,CAAC,CAAC;AACjH,YAAY,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,gCAAgC,EAAE,gCAAgC,CAAC,CAAC;AACrH,YAAY;AAEZ,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  declare const JISContainerToken: {
2
2
  JISEventsDataSourceFactory: symbol;
3
3
  JISInfotextsDataSourceFactory: symbol;
4
+ JISDelayedSegmentsDataSourceFactory: symbol;
4
5
  JISInfotextsRedisRepository: symbol;
5
6
  JISEventsRepository: symbol;
6
7
  JISEventsRopidGTFSRoutesRepository: symbol;
@@ -10,8 +11,11 @@ declare const JISContainerToken: {
10
11
  JISMetadataRepository: symbol;
11
12
  RopidGTFSStopsRepository: symbol;
12
13
  RopidGTFSRoutesRepository: symbol;
14
+ JISDelayedSegmentsRepository: symbol;
15
+ JISDelayedSegmentEnrichmentRepository: symbol;
13
16
  JISEventsDataService: symbol;
14
17
  JISInfotextsDataService: symbol;
18
+ JISDelayedSegmentsDataService: symbol;
15
19
  JISEventsTransformation: symbol;
16
20
  JISEventsGtfsRtTransformation: symbol;
17
21
  JISInfotextsTransformation: symbol;
@@ -23,5 +27,6 @@ declare const JISContainerToken: {
23
27
  RefreshJISInfotextsTask: symbol;
24
28
  RefreshJISInfotextsCacheTask: symbol;
25
29
  UpdateEventWebhookTask: symbol;
30
+ RefreshDelayedSegmentsTask: symbol;
26
31
  };
27
32
  export { JISContainerToken };
@@ -2,6 +2,7 @@ const JISContainerToken = {
2
2
  /* Data Sources */
3
3
  JISEventsDataSourceFactory: Symbol("JISEventsDataSourceFactory"),
4
4
  JISInfotextsDataSourceFactory: Symbol("JISInfotextsDataSourceFactory"),
5
+ JISDelayedSegmentsDataSourceFactory: Symbol("JISDelayedSegmentsDataSourceFactory"),
5
6
  /* Cache Repositories */
6
7
  JISInfotextsRedisRepository: Symbol("JISInfotextsRedisRepository"),
7
8
  /* Repositories */
@@ -13,9 +14,12 @@ const JISContainerToken = {
13
14
  JISMetadataRepository: Symbol("JISMetadataRepository"),
14
15
  RopidGTFSStopsRepository: Symbol("RopidGTFSStopsRepository"),
15
16
  RopidGTFSRoutesRepository: Symbol("RopidGTFSRoutesRepository"),
17
+ JISDelayedSegmentsRepository: Symbol("JISDelayedSegmentsRepository"),
18
+ JISDelayedSegmentEnrichmentRepository: Symbol("JISDelayedSegmentEnrichmentRepository"),
16
19
  /* Services */
17
20
  JISEventsDataService: Symbol("JISEventsDataService"),
18
21
  JISInfotextsDataService: Symbol("JISInfotextsDataService"),
22
+ JISDelayedSegmentsDataService: Symbol("JISDelayedSegmentsDataService"),
19
23
  /* Transformations */
20
24
  JISEventsTransformation: Symbol("JISEventsTransformation"),
21
25
  JISEventsGtfsRtTransformation: Symbol("JISEventsGtfsRtTransformation"),
@@ -29,6 +33,7 @@ const JISContainerToken = {
29
33
  RefreshJISInfotextsTask: Symbol("RefreshJISInfotextsTask"),
30
34
  RefreshJISInfotextsCacheTask: Symbol("RefreshJISInfotextsCacheTask"),
31
35
  UpdateEventWebhookTask: Symbol("UpdateEventWebhookTask"),
36
+ RefreshDelayedSegmentsTask: Symbol("RefreshDelayedSegmentsTask"),
32
37
  };
33
38
  export { JISContainerToken };
34
39
  //# sourceMappingURL=JISContainerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,wBAAwB;IACxB,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC;IAC9D,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,8BAA8B,EAAE,MAAM,CAAC,gCAAgC,CAAC;IACxE,gCAAgC,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAC5E,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAAC;IACpE,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;CAC3D,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,mCA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AC;IACpE,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;CACnE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type IJISDelayedSegmentEnrichment } from "#sch/jis/models/interfaces/index";
2
+ import { type IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector.js";
3
+ import { type IJISDelayedSegmentEnrichmentParams } from "./interfaces/IJISDelayedSegmentEnrichmentParams.js";
4
+ /**
5
+ * Derives stops, affected routes and info panel stops of delayed segments from precomputed GTFS departures
6
+ */
7
+ export declare class JISDelayedSegmentEnrichmentRepository {
8
+ private connector;
9
+ constructor(connector: IDatabaseConnector);
10
+ /**
11
+ * Returns the enrichments of all given segments in their order
12
+ */
13
+ getEnrichments(params: IJISDelayedSegmentEnrichmentParams): Promise<IJISDelayedSegmentEnrichment[]>;
14
+ }
@@ -0,0 +1,69 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { CoreToken } from "@golemio/core/dist/helpers/ioc/CoreToken.js";
14
+ import GolemioErrorsCore from "@golemio/core/dist/shared/golemio-errors.js";
15
+ const { GeneralError } = GolemioErrorsCore;
16
+ import SequelizeCore from "@golemio/core/dist/shared/sequelize.js";
17
+ const { QueryTypes } = SequelizeCore;
18
+ import { inject, injectable } from "@golemio/core/dist/shared/tsyringe.js";
19
+ import { JIS_DELAYED_SEGMENT_ENRICHMENT_QUERY } from "./helpers/JISDelayedSegmentEnrichmentQuery.js";
20
+ /**
21
+ * Derives stops, affected routes and info panel stops of delayed segments from precomputed GTFS departures
22
+ */
23
+ let JISDelayedSegmentEnrichmentRepository = class JISDelayedSegmentEnrichmentRepository {
24
+ constructor(connector) {
25
+ this.connector = connector;
26
+ }
27
+ /**
28
+ * Returns the enrichments of all given segments in their order
29
+ */
30
+ async getEnrichments(params) {
31
+ if (params.segments.length === 0) {
32
+ return [];
33
+ }
34
+ const segments = params.segments.map((segment, index) => ({
35
+ segment_index: index,
36
+ from_node_id: segment.from.nodeId,
37
+ from_stop_id: segment.from.stopId,
38
+ to_node_id: segment.to.nodeId,
39
+ to_stop_id: segment.to.stopId,
40
+ }));
41
+ const connection = this.connector.getConnection();
42
+ try {
43
+ return await connection.transaction(async (transaction) => {
44
+ // JIT compilation of the query plan alone takes seconds, many times the query itself
45
+ await connection.query("SET LOCAL jit = off", { transaction });
46
+ return connection.query(JIS_DELAYED_SEGMENT_ENRICHMENT_QUERY, {
47
+ type: QueryTypes.SELECT,
48
+ replacements: {
49
+ segments: JSON.stringify(segments),
50
+ windowStart: params.windowStart,
51
+ windowEnd: params.windowEnd,
52
+ maxInfoPanelDistanceStops: params.maxInfoPanelDistanceStops,
53
+ },
54
+ transaction,
55
+ });
56
+ });
57
+ }
58
+ catch (err) {
59
+ throw new GeneralError("Error while enriching delayed segments", this.constructor.name, err);
60
+ }
61
+ }
62
+ };
63
+ JISDelayedSegmentEnrichmentRepository = __decorate([
64
+ injectable(),
65
+ __param(0, inject(CoreToken.PostgresConnector)),
66
+ __metadata("design:paramtypes", [Object])
67
+ ], JISDelayedSegmentEnrichmentRepository);
68
+ export { JISDelayedSegmentEnrichmentRepository };
69
+ //# sourceMappingURL=JISDelayedSegmentEnrichmentRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISDelayedSegmentEnrichmentRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISDelayedSegmentEnrichmentRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,iBAAiB,MAAM,6CAA6C,CAAC;AAC5E,MAAM,EAAE,YAAY,EAAE,GAAG,iBAAiB,CAAC;AAC3C,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAGrG;;GAEG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAC9C,YAAyD,SAA6B;QAA7B,cAAS,GAAT,SAAS,CAAoB;IAAG,CAAC;IAE1F;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,MAA0C;QAClE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACtD,aAAa,EAAE,KAAK;YACpB,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;YACjC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;YACjC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM;YAC7B,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM;SAChC,CAAC,CAAC,CAAC;QAEJ,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;QAClD,IAAI,CAAC;YACD,OAAO,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;gBACtD,qFAAqF;gBACrF,MAAM,UAAU,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC/D,OAAO,UAAU,CAAC,KAAK,CAA+B,oCAAoC,EAAE;oBACxF,IAAI,EAAE,UAAU,CAAC,MAAM;oBACvB,YAAY,EAAE;wBACV,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;wBAClC,WAAW,EAAE,MAAM,CAAC,WAAW;wBAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;wBAC3B,yBAAyB,EAAE,MAAM,CAAC,yBAAyB;qBAC9D;oBACD,WAAW;iBACd,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,YAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACjG,CAAC;IACL,CAAC;CACJ,CAAA;AAvCY,qCAAqC;IADjD,UAAU,EAAE;IAEI,WAAA,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;;GADvC,qCAAqC,CAuCjD"}
@@ -0,0 +1,23 @@
1
+ import { type IJISDelayedSegment } from "#sch/jis/models/interfaces/index";
2
+ import { JISDelayedSegmentsModel } from "#sch/jis/models/JISDelayedSegmentsModel";
3
+ import { type ILogger } from "@golemio/core/dist/helpers/index.js";
4
+ import { type IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector.js";
5
+ import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository.js";
6
+ import type { JSONSchemaValidator as TJSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator.js";
7
+ import type { ModelStatic } from "@golemio/core/dist/shared/sequelize.js";
8
+ export declare class JISDelayedSegmentsRepository extends AbstractValidatableRepository {
9
+ validator: TJSONSchemaValidator;
10
+ schema: string;
11
+ tableName: string;
12
+ sequelizeModel: ModelStatic<JISDelayedSegmentsModel>;
13
+ constructor(connector: IDatabaseConnector, logger: ILogger);
14
+ /**
15
+ * Replaces all delayed segments with the given ones. `updated_at` of every given segment is set to `detectedAt`,
16
+ * `created_at` keeps the time the segment was first detected. Segments absent from the given data are deleted.
17
+ */
18
+ refreshData(segments: IJISDelayedSegment[], detectedAt: Date): Promise<void>;
19
+ /**
20
+ * All attributes except created_at, which keeps the time the segment was first detected
21
+ */
22
+ private getUpdateAttributes;
23
+ }