@golemio/rush-hour-aggregation 1.0.0 → 1.0.1-dev.532695480

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 (53) hide show
  1. package/README.md +15 -13
  2. package/db/migrations/postgresql/20220505053742-addMaterialViews.js +53 -0
  3. package/db/migrations/postgresql/sqls/20220505053742-addMaterialViews-down.sql +10 -0
  4. package/db/migrations/postgresql/sqls/20220505053742-addMaterialViews-up.sql +565 -0
  5. package/dist/integration-engine/AggregationWorker.d.ts +2 -0
  6. package/dist/integration-engine/AggregationWorker.js +14 -2
  7. package/dist/integration-engine/AggregationWorker.js.map +1 -1
  8. package/dist/integration-engine/dataAccess/AbstractEventsRepository.d.ts +9 -0
  9. package/dist/integration-engine/dataAccess/AbstractEventsRepository.js +35 -0
  10. package/dist/integration-engine/dataAccess/AbstractEventsRepository.js.map +1 -0
  11. package/dist/integration-engine/dataAccess/FcdEventsRepository.d.ts +4 -2
  12. package/dist/integration-engine/dataAccess/FcdEventsRepository.js +4 -2
  13. package/dist/integration-engine/dataAccess/FcdEventsRepository.js.map +1 -1
  14. package/dist/integration-engine/dataAccess/NdicEventRepository.d.ts +4 -2
  15. package/dist/integration-engine/dataAccess/NdicEventRepository.js +4 -2
  16. package/dist/integration-engine/dataAccess/NdicEventRepository.js.map +1 -1
  17. package/dist/integration-engine/dataAccess/TskEventsRepository.d.ts +4 -2
  18. package/dist/integration-engine/dataAccess/TskEventsRepository.js +4 -2
  19. package/dist/integration-engine/dataAccess/TskEventsRepository.js.map +1 -1
  20. package/dist/integration-engine/dataAccess/WazeJamsRepository.d.ts +4 -2
  21. package/dist/integration-engine/dataAccess/WazeJamsRepository.js +4 -2
  22. package/dist/integration-engine/dataAccess/WazeJamsRepository.js.map +1 -1
  23. package/dist/integration-engine/dataAccess/WazeReconstructionsRepository.d.ts +4 -2
  24. package/dist/integration-engine/dataAccess/WazeReconstructionsRepository.js +4 -2
  25. package/dist/integration-engine/dataAccess/WazeReconstructionsRepository.js.map +1 -1
  26. package/dist/integration-engine/queueDefinitions.js +10 -0
  27. package/dist/integration-engine/queueDefinitions.js.map +1 -1
  28. package/dist/integration-engine/service/AggregationFactory.d.ts +2 -2
  29. package/dist/integration-engine/service/AggregationFactory.js.map +1 -1
  30. package/dist/integration-engine/service/aggregators/AbstractAggregator.d.ts +7 -3
  31. package/dist/integration-engine/service/aggregators/AbstractAggregator.js +8 -0
  32. package/dist/integration-engine/service/aggregators/AbstractAggregator.js.map +1 -1
  33. package/dist/integration-engine/service/aggregators/FcdEventsAggregator.d.ts +3 -3
  34. package/dist/integration-engine/service/aggregators/FcdEventsAggregator.js +0 -4
  35. package/dist/integration-engine/service/aggregators/FcdEventsAggregator.js.map +1 -1
  36. package/dist/integration-engine/service/aggregators/NdicEventsAggregator.d.ts +3 -3
  37. package/dist/integration-engine/service/aggregators/NdicEventsAggregator.js +0 -4
  38. package/dist/integration-engine/service/aggregators/NdicEventsAggregator.js.map +1 -1
  39. package/dist/integration-engine/service/aggregators/TskEventsAggregator.d.ts +3 -3
  40. package/dist/integration-engine/service/aggregators/TskEventsAggregator.js +0 -4
  41. package/dist/integration-engine/service/aggregators/TskEventsAggregator.js.map +1 -1
  42. package/dist/integration-engine/service/aggregators/WazeJamsAggregator.d.ts +3 -3
  43. package/dist/integration-engine/service/aggregators/WazeJamsAggregator.js +0 -4
  44. package/dist/integration-engine/service/aggregators/WazeJamsAggregator.js.map +1 -1
  45. package/dist/integration-engine/service/aggregators/WazeReconstructionsAggregator.d.ts +3 -3
  46. package/dist/integration-engine/service/aggregators/WazeReconstructionsAggregator.js +0 -4
  47. package/dist/integration-engine/service/aggregators/WazeReconstructionsAggregator.js.map +1 -1
  48. package/dist/integration-engine/service/aggregators/interfaces/IAbstractAggregator.d.ts +6 -0
  49. package/dist/integration-engine/service/aggregators/interfaces/IAbstractAggregator.js +3 -0
  50. package/dist/integration-engine/service/aggregators/interfaces/IAbstractAggregator.js.map +1 -0
  51. package/package.json +61 -61
  52. package/templates/sqlQueries/FcdEvents.sql +1 -1
  53. package/templates/sqlQueries/NdicEventsFull.sql +2 -2
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- [![pipeline status](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregator/module/badges/master/pipeline.svg)](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregator/module/commits/master)
2
- [![coverage report](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregator/module/badges/master/coverage.svg)](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregator/module/commits/master)
1
+ [![pipeline status](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregation/badges/master/pipeline.svg)](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregation/commits/master)
2
+ [![coverage report](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregation/badges/master/coverage.svg)](https://gitlab.com/operator-ict/golemio/code/modules/rush-hour-aggregation/commits/master)
3
3
 
4
4
  # @golemio/rush-hour-aggregation
5
5
 
@@ -11,10 +11,11 @@ The module aggregates traffic data for Praha Zasekana project. It takes differen
11
11
  Developed by http://operatorict.cz
12
12
 
13
13
  # Datasources
14
- - Waze
15
- - SDDŘ
16
- - FCD
17
- - NDIC
14
+
15
+ - Waze
16
+ - SDDŘ
17
+ - FCD
18
+ - NDIC
18
19
 
19
20
  # Current setup
20
21
 
@@ -27,21 +28,22 @@ E.g. to insert data for Fcd for first month in 2022 use following message:
27
28
 
28
29
  ```json
29
30
  {
30
- "from":"2020-01-01T00:00:00Z",
31
- "to":"2020-01-31T23:59:59Z",
32
- "type":"fcd"
31
+ "from": "2020-01-01T00:00:00Z",
32
+ "to": "2020-01-31T23:59:59Z",
33
+ "type": "fcd"
33
34
  }
34
35
  ```
35
36
 
36
37
  # Message building blocks
38
+
37
39
  Message has to be in json format and supports following fields:
38
40
 
39
- *from* - Required date time setting when the aggregation has to start. It is formatted in ISO 8601 preferably UTC format with Z at the end
41
+ _from_ - Required date time setting when the aggregation has to start. It is formatted in ISO 8601 preferably UTC format with Z at the end
40
42
 
41
- *to* - Required date time setting when the aggregation has is ending. It is formatted in ISO 8601 preferably UTC format with Z at the end
43
+ _to_ - Required date time setting when the aggregation has is ending. It is formatted in ISO 8601 preferably UTC format with Z at the end
42
44
 
43
- *type* - Required setting which aggregation should be run. Possible values: WAZEJ, WAZER, SDDR, FCD, NDIC. (Case insensitive)
45
+ _type_ - Required setting which aggregation should be run. Possible values: WAZEJ, WAZER, SDDR, FCD, NDIC. (Case insensitive)
44
46
 
45
- *updateOnDuplicate* - Optional setting for situation when upgrade of already aggregated data is required. Possible values "true", "false". Default value is false. (Note: automatic 5 minute updates have the setting to true)
47
+ _updateOnDuplicate_ - Optional setting for situation when upgrade of already aggregated data is required. Possible values "true", "false". Default value is false. (Note: automatic 5 minute updates have the setting to true)
46
48
 
47
49
  To initiate automatic 5 minute aggregation manually it is possible to send empty message.
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20220505053742-addMaterialViews-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20220505053742-addMaterialViews-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,10 @@
1
+ DROP MATERIALIZED VIEW IF EXISTS waze_reconstructions_snapshots_history;
2
+ DROP MATERIALIZED VIEW IF EXISTS waze_reconstructions_snapshots_latest;
3
+ DROP MATERIALIZED VIEW IF EXISTS waze_jams_snapshots_history;
4
+ DROP MATERIALIZED VIEW IF EXISTS waze_jams_snapshots_latest;
5
+ DROP MATERIALIZED VIEW IF EXISTS tsk_std_last_30min_snapshots_history;
6
+ DROP MATERIALIZED VIEW IF EXISTS tsk_std_last_30min_snapshots_latest;
7
+ DROP MATERIALIZED VIEW IF EXISTS ndic_events_full_snapshots_history;
8
+ DROP MATERIALIZED VIEW IF EXISTS ndic_events_full_snapshots_latest;
9
+ DROP MATERIALIZED VIEW IF EXISTS fcd_events_snapshots_history;
10
+ DROP MATERIALIZED VIEW IF EXISTS fcd_events_snapshots_latest;