@golemio/bicycle-counters 1.0.9-dev.557470479 → 1.0.10-dev.615425828

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 (29) hide show
  1. package/db/example/.config.json +3 -0
  2. package/db/example/__truncate_tables.sql +5 -0
  3. package/db/migrations/postgresql/.config.json +3 -0
  4. package/db/migrations/postgresql/20220726125351-initial.js +53 -0
  5. package/db/migrations/postgresql/20220811100103-analytic.js +53 -0
  6. package/db/migrations/postgresql/package.json +3 -0
  7. package/db/migrations/postgresql/sqls/20220726125351-initial-down.sql +7 -0
  8. package/db/migrations/postgresql/sqls/20220726125351-initial-up.sql +104 -0
  9. package/db/migrations/postgresql/sqls/20220811100103-analytic-down.sql +23 -0
  10. package/db/migrations/postgresql/sqls/20220811100103-analytic-up.sql +343 -0
  11. package/db/migrations/postgresql/sqls/package.json +3 -0
  12. package/dist/integration-engine/BicycleCountersWorker.js +4 -0
  13. package/dist/integration-engine/BicycleCountersWorker.js.map +1 -1
  14. package/dist/output-gateway/models/BicycleCountersDetectionsModel.js +3 -1
  15. package/dist/output-gateway/models/BicycleCountersDetectionsModel.js.map +1 -1
  16. package/dist/output-gateway/models/BicycleCountersDirectionsModel.js +3 -1
  17. package/dist/output-gateway/models/BicycleCountersDirectionsModel.js.map +1 -1
  18. package/dist/output-gateway/models/BicycleCountersLocationsModel.js +3 -1
  19. package/dist/output-gateway/models/BicycleCountersLocationsModel.js.map +1 -1
  20. package/dist/output-gateway/models/BicycleCountersTemperaturesModel.js +4 -1
  21. package/dist/output-gateway/models/BicycleCountersTemperaturesModel.js.map +1 -1
  22. package/dist/schema-definitions/index.d.ts +1 -0
  23. package/dist/schema-definitions/index.js +1 -0
  24. package/dist/schema-definitions/index.js.map +1 -1
  25. package/docs/.gitkeep +0 -0
  26. package/docs/assets/bicycle-counters_erd.png +0 -0
  27. package/docs/implementation_documentation.md +248 -0
  28. package/docs/openapi.yaml +400 -0
  29. package/package.json +8 -7
@@ -0,0 +1,400 @@
1
+ openapi: 3.0.1
2
+ info:
3
+ title: Bicycle Counter
4
+ description: |
5
+ | Vendor | Vendor id prefix | Measurement time aggregation | Temperature availability |
6
+ | - | - | - | - |
7
+ | Camea | `camea-` | 5 minutes | available |
8
+ | EcoCounter | `ecoCounter-` | 15 minutes | not available |
9
+ ⚠️ Measurements of vendor Camea are every day at 5:00am (UTC) validated and recalculated and can change then.
10
+ version: 1.0.0
11
+ tags:
12
+ - name: Bicycle Counter
13
+ paths:
14
+ /bicyclecounters/:
15
+ get:
16
+ tags:
17
+ - Bicycle Counter
18
+ summary: GET All Bicycle Counters
19
+ parameters:
20
+ - name: latlng
21
+ in: query
22
+ description: Sorting by location (Latitude and Longitude separated by comma,
23
+ latitude first).
24
+ schema:
25
+ type: string
26
+ example: 50.124935,14.457204
27
+ - name: range
28
+ in: query
29
+ description: Filter by distance from latlng in meters (range query). Depends
30
+ on the latlng parameter.
31
+ schema:
32
+ type: number
33
+ example: 5000
34
+ - name: limit
35
+ in: query
36
+ description: Limits number of retrieved items. The maximum is 10000 (default
37
+ value).
38
+ schema:
39
+ type: number
40
+ example: 10
41
+ - name: offset
42
+ in: query
43
+ description: Number of the first items that are skipped.
44
+ schema:
45
+ type: number
46
+ example: 0
47
+ - name: x-access-token
48
+ in: header
49
+ description: e.g. YOUR_ACCESS_TOKEN
50
+ schema:
51
+ type: string
52
+ example: YOUR_ACCESS_TOKEN
53
+ responses:
54
+ 200:
55
+ description: OK
56
+ content:
57
+ application/json; charset=utf-8:
58
+ schema:
59
+ required:
60
+ - type
61
+ type: object
62
+ properties:
63
+ type:
64
+ type: string
65
+ features:
66
+ type: array
67
+ items:
68
+ $ref: '#/components/schemas/FeaturePoint'
69
+ example:
70
+ type: FeatureCollection
71
+ features:
72
+ - geometry:
73
+ type: Point
74
+ coordinates:
75
+ - 14.4633
76
+ - 50.07827
77
+ properties:
78
+ id: camea-BC_AT-STLA
79
+ name: Altetická
80
+ route: A140
81
+ updated_at: "2019-05-18T07:38:37.000Z"
82
+ directions:
83
+ - id: BC_AT_ST
84
+ name: Strahov
85
+ type: Feature
86
+ 404:
87
+ description: Not found
88
+ content:
89
+ application/json; charset=utf-8:
90
+ schema:
91
+ $ref: '#/components/schemas/Error'
92
+ example:
93
+ error_message: Not Found
94
+ error_status: 404
95
+ 403:
96
+ description: Forbidden
97
+ content:
98
+ application/json; charset=utf-8:
99
+ schema:
100
+ $ref: '#/components/schemas/Error'
101
+ example:
102
+ error_message: Forbidden
103
+ error_status: 403
104
+ /bicyclecounters/detections:
105
+ get:
106
+ tags:
107
+ - Bicycle Counter
108
+ summary: GET Bicycle Counters Detections
109
+ parameters:
110
+ - name: limit
111
+ in: query
112
+ description: Limits number of retrieved items. The maximum is 10000 (default
113
+ value).
114
+ schema:
115
+ type: number
116
+ example: 10
117
+ - name: offset
118
+ in: query
119
+ description: Number of the first items that are skipped.
120
+ schema:
121
+ type: number
122
+ example: 0
123
+ - name: from
124
+ in: query
125
+ description: Date in ISO8601, limits data measured from this datetime
126
+ schema:
127
+ type: string
128
+ example: "2019-05-16T04:27:58.000Z"
129
+ - name: to
130
+ in: query
131
+ description: Date in ISO8601, limits data measured up until this datetime
132
+ schema:
133
+ type: string
134
+ example: "2019-05-18T04:27:58.000Z"
135
+ - name: aggregate
136
+ in: query
137
+ description: sum aggregated by directions_id is returned
138
+ schema:
139
+ type: boolean
140
+ example: true
141
+ - name: id
142
+ in: query
143
+ description: direction ids
144
+ schema:
145
+ type: string
146
+ example: camea-BC_ZA-BO
147
+ - name: x-access-token
148
+ in: header
149
+ description: e.g. YOUR_ACCESS_TOKEN
150
+ schema:
151
+ type: string
152
+ example: YOUR_ACCESS_TOKEN
153
+ responses:
154
+ 200:
155
+ description: OK
156
+ content:
157
+ application/json; charset=utf-8:
158
+ schema:
159
+ type: array
160
+ items:
161
+ $ref: '#/components/schemas/BicycleCounterDetections'
162
+ example:
163
+ - id: camea-BC_ZA-BO
164
+ value: 3
165
+ value_pedestrians: 7
166
+ locations_id: camea-BC_PN-VYBR
167
+ measured_from: "2019-05-18T07:38:37.000Z"
168
+ measured_to: "2019-05-18T07:38:37.000Z"
169
+ measurement_count: 1
170
+ 404:
171
+ description: Not found
172
+ content:
173
+ application/json; charset=utf-8:
174
+ schema:
175
+ $ref: '#/components/schemas/Error'
176
+ example:
177
+ error_message: Not Found
178
+ error_status: 404
179
+ 403:
180
+ description: Forbidden
181
+ content:
182
+ application/json; charset=utf-8:
183
+ schema:
184
+ $ref: '#/components/schemas/Error'
185
+ example:
186
+ error_message: Forbidden
187
+ error_status: 403
188
+ /bicyclecounters/temperatures:
189
+ get:
190
+ tags:
191
+ - Bicycle Counter
192
+ summary: GET Bicycle Counters Temperatures
193
+ parameters:
194
+ - name: limit
195
+ in: query
196
+ description: Limits number of retrieved items. The maximum is 10000 (default
197
+ value).
198
+ schema:
199
+ type: number
200
+ example: 10
201
+ - name: offset
202
+ in: query
203
+ description: Number of the first items that are skipped.
204
+ schema:
205
+ type: number
206
+ example: 0
207
+ - name: from
208
+ in: query
209
+ description: Date in ISO8601, limits data measured from this datetime
210
+ schema:
211
+ type: string
212
+ example: "2019-05-16T04:27:58.000Z"
213
+ - name: to
214
+ in: query
215
+ description: Date in ISO8601, limits data measured up until this datetime
216
+ schema:
217
+ type: string
218
+ example: "2019-05-18T04:27:58.000Z"
219
+ - name: aggregate
220
+ in: query
221
+ description: average aggregated by locations_id is returned
222
+ schema:
223
+ type: boolean
224
+ example: true
225
+ - name: id
226
+ in: query
227
+ description: location ids
228
+ schema:
229
+ type: array
230
+ items:
231
+ type: string
232
+ example: camea-BC_ZA-KLBO
233
+ - name: x-access-token
234
+ in: header
235
+ description: e.g. YOUR_ACCESS_TOKEN
236
+ schema:
237
+ type: string
238
+ example: YOUR_ACCESS_TOKEN
239
+ responses:
240
+ 200:
241
+ description: OK
242
+ content:
243
+ application/json; charset=utf-8:
244
+ schema:
245
+ type: array
246
+ items:
247
+ $ref: '#/components/schemas/BicycleCounterTemperatures'
248
+ example:
249
+ - id: camea-BC_AT-STLA
250
+ value: 3
251
+ measured_from: "2019-05-18T07:38:37.000Z"
252
+ measured_to: "2019-05-18T07:38:37.000Z"
253
+ measurement_count: 1
254
+ 404:
255
+ description: Not found
256
+ content:
257
+ application/json; charset=utf-8:
258
+ schema:
259
+ $ref: '#/components/schemas/Error'
260
+ example:
261
+ error_message: Not Found
262
+ error_status: 404
263
+ 403:
264
+ description: Forbidden
265
+ content:
266
+ application/json; charset=utf-8:
267
+ schema:
268
+ $ref: '#/components/schemas/Error'
269
+ example:
270
+ error_message: Forbidden
271
+ error_status: 403
272
+ components:
273
+ schemas:
274
+ Point:
275
+ type: array
276
+ items:
277
+ type: number
278
+ minItems: 2
279
+ maxItems: 2
280
+ example:
281
+ - 14.4633
282
+ - 50.07827
283
+ Error:
284
+ title: Error
285
+ required:
286
+ - error_message
287
+ - error_status
288
+ type: object
289
+ properties:
290
+ error_message:
291
+ type: string
292
+ example: Forbidden
293
+ error_status:
294
+ type: number
295
+ example: 403
296
+ FeaturePoint:
297
+ title: Feature Point
298
+ required:
299
+ - geometry
300
+ - properties
301
+ - type
302
+ type: object
303
+ properties:
304
+ geometry:
305
+ required:
306
+ - coordinates
307
+ - type
308
+ type: object
309
+ properties:
310
+ type:
311
+ type: string
312
+ coordinates:
313
+ $ref: '#/components/schemas/Point'
314
+ properties:
315
+ $ref: '#/components/schemas/BicycleCounter'
316
+ type:
317
+ type: string
318
+ BicycleCounter:
319
+ title: Bicycle Counter
320
+ required:
321
+ - id
322
+ - name
323
+ type: object
324
+ properties:
325
+ id:
326
+ type: string
327
+ example: camea-BC_AT-STLA
328
+ name:
329
+ type: string
330
+ example: Altetická
331
+ route:
332
+ type: string
333
+ example: A140
334
+ updated_at:
335
+ type: string
336
+ example: "2019-05-18T07:38:37.000Z"
337
+ directions:
338
+ type: array
339
+ items:
340
+ $ref: '#/components/schemas/BicycleCounterDirection'
341
+ BicycleCounterDetections:
342
+ title: Bicycle Counter Detections
343
+ type: object
344
+ properties:
345
+ id:
346
+ type: string
347
+ description: direction_id
348
+ example: camea-BC_ZA-BO
349
+ value:
350
+ type: number
351
+ example: 3
352
+ value_pedestrians:
353
+ type: number
354
+ example: 7
355
+ locations_id:
356
+ type: string
357
+ example: camea-BC_PN-VYBR
358
+ measured_from:
359
+ type: string
360
+ example: 2019-05-18T07:38:37.000Z
361
+ measured_to:
362
+ type: string
363
+ example: 2019-05-18T07:38:37.000Z
364
+ measurement_count:
365
+ type: number
366
+ example: 1
367
+ BicycleCounterDirection:
368
+ title: Bicycle Counter Direction
369
+ required:
370
+ - id
371
+ type: object
372
+ properties:
373
+ id:
374
+ type: string
375
+ description: direction ID
376
+ example: BC_AT_ST
377
+ name:
378
+ type: string
379
+ description: direction name
380
+ example: Strahov
381
+ BicycleCounterTemperatures:
382
+ title: Bicycle Counter Temperatures
383
+ type: object
384
+ properties:
385
+ id:
386
+ type: string
387
+ description: location_id
388
+ example: camea-BC_AT-STLA
389
+ value:
390
+ type: number
391
+ example: 3
392
+ measured_from:
393
+ type: string
394
+ example: "2019-05-18T07:38:37.000Z"
395
+ measured_to:
396
+ type: string
397
+ example: "2019-05-18T07:38:37.000Z"
398
+ measurement_count:
399
+ type: number
400
+ example: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/bicycle-counters",
3
- "version": "1.0.9-dev.557470479",
3
+ "version": "1.0.10-dev.615425828",
4
4
  "description": "Golemio Bicycle Counters Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
9
9
  "build-minimal": "run-s 'build --sourceMap false --declaration false'",
10
10
  "build-watch": "run-s 'build --watch --preserveWatchOutput'",
11
- "pretest": "golemio-import-test-data",
11
+ "pretest": "golemio mdb reset --postgres && golemio mdb up --postgres && golemio import-db-data --postgres",
12
12
  "test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r dotenv/config 'test/**/*.test.ts'",
13
13
  "test-debug": "run-s 'test --inspect-brk=9230'",
14
14
  "code-coverage": "nyc run-s 'test -r source-map-support/register'",
@@ -27,9 +27,10 @@
27
27
  "devDependencies": {
28
28
  "@commitlint/cli": "^11.0.0",
29
29
  "@commitlint/config-conventional": "^11.0.0",
30
- "@golemio/core": "1.2.13",
31
- "@golemio/eslint-config": "^1.0.2",
32
- "@golemio/schema-definitions": "2.0.37",
30
+ "@golemio/cli": "1.3.0",
31
+ "@golemio/core": "1.2.14",
32
+ "@golemio/db-common": "1.0.1",
33
+ "@golemio/eslint-config": "^1.1.0",
33
34
  "@ovos-media/ts-transform-paths": "^1.7.18-1",
34
35
  "@types/chai": "4.2.3",
35
36
  "@types/chai-as-promised": "7.1.2",
@@ -42,12 +43,12 @@
42
43
  "chai-as-promised": "7.1.1",
43
44
  "cross-env": "^7.0.3",
44
45
  "dotenv": "^8.2.0",
45
- "eslint": "^7.17.0",
46
+ "eslint": "^8.1.1",
46
47
  "husky": "^4.3.7",
47
48
  "mocha": "^8.2.1",
48
49
  "npm-run-all": "^4.1.5",
49
50
  "nyc": "^15.1.0",
50
- "prettier": "^2.2.1",
51
+ "prettier": "^2.5.1",
51
52
  "pretty-quick": "^3.1.0",
52
53
  "rimraf": "^3.0.2",
53
54
  "sinon": "^9.2.3",