@golemio/municipal-libraries 1.3.3 → 1.3.4-dev.1568607653
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/docs/asyncapi.yaml +53 -0
- package/docs/implementation_documentation.md +68 -68
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
asyncapi: 3.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: Municipal libraries
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: This module saves data from municipal libraries of the city of Prague
|
|
6
|
+
channels:
|
|
7
|
+
municipallibraries.refreshDataInDB:
|
|
8
|
+
address: dataplatform.municipallibraries.refreshDataInDB
|
|
9
|
+
description: save libraries to the database and update district of each library by calling a separate queue
|
|
10
|
+
bindings:
|
|
11
|
+
amqp:
|
|
12
|
+
is: queue
|
|
13
|
+
queue:
|
|
14
|
+
durable: true
|
|
15
|
+
messages:
|
|
16
|
+
empty:
|
|
17
|
+
$ref: "#/components/messages/emptyMessage"
|
|
18
|
+
municipallibraries.updateDistrict:
|
|
19
|
+
address: dataplatform.municipallibraries.updateDistrict
|
|
20
|
+
description: update district of each library
|
|
21
|
+
bindings:
|
|
22
|
+
amqp:
|
|
23
|
+
is: queue
|
|
24
|
+
queue:
|
|
25
|
+
durable: true
|
|
26
|
+
messages:
|
|
27
|
+
updateDistrictMessage:
|
|
28
|
+
$ref: "#/components/messages/municipallibraries.updateDistrictMessage"
|
|
29
|
+
operations:
|
|
30
|
+
municipallibraries.refreshDataInDB:
|
|
31
|
+
action: "send"
|
|
32
|
+
channel:
|
|
33
|
+
$ref: "#/channels/municipallibraries.refreshDataInDB"
|
|
34
|
+
municipallibraries.updateDistrict:
|
|
35
|
+
action: "send"
|
|
36
|
+
channel:
|
|
37
|
+
$ref: "#/channels/municipallibraries.updateDistrict"
|
|
38
|
+
components:
|
|
39
|
+
messages:
|
|
40
|
+
emptyMessage:
|
|
41
|
+
title: Empty message
|
|
42
|
+
municipallibraries.updateDistrictMessage:
|
|
43
|
+
payload:
|
|
44
|
+
$ref: "#/components/schemas/municipallibraries.updateDistrictMessage"
|
|
45
|
+
schemas:
|
|
46
|
+
municipallibraries.updateDistrictMessage:
|
|
47
|
+
type: object
|
|
48
|
+
properties:
|
|
49
|
+
id:
|
|
50
|
+
type: number
|
|
51
|
+
example: 1
|
|
52
|
+
description: ID of the library
|
|
53
|
+
additionalProperties: false
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
# Implementační dokumentace modulu
|
|
1
|
+
# Implementační dokumentace modulu _municipal-libraries_
|
|
2
2
|
|
|
3
3
|
## Záměr
|
|
4
4
|
|
|
5
5
|
Modul slouží k ukládání a poskytování informací o městských knihovnách v Praze.
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
## Vstupní data
|
|
9
8
|
|
|
10
9
|
**Dostupní poskytovatelé**:
|
|
@@ -13,69 +12,67 @@ Modul slouží k ukládání a poskytování informací o městských knihovnác
|
|
|
13
12
|
|
|
14
13
|
### Data aktivně stahujeme
|
|
15
14
|
|
|
16
|
-
####
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
#### _open data MLP_
|
|
16
|
+
|
|
17
|
+
- zdroj dat
|
|
18
|
+
- url: [config.datasources.MunicipalLibraries](https://www.mlp.cz/cz/pobocky/?export=xml)
|
|
19
|
+
- pozor při načtení url proběhne několik přesměrování na doplnění cookies
|
|
20
|
+
- formát dat
|
|
21
|
+
- protokol: http
|
|
22
|
+
- datový typ: json
|
|
23
|
+
- validační schéma: [municipalLibrariesJsonSchema](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/src/integration-engine/datasources/MunicipalLibrariesDataSource.ts)
|
|
24
|
+
- příklad [vstupních dat](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/test/integration-engine/data/municipallibraries-datasource.json)
|
|
25
|
+
- frekvence stahování
|
|
26
|
+
- cron definice:
|
|
27
|
+
- cron.dataplatform.municipallibraries.refreshDataInDB
|
|
28
|
+
- rabin `0 31 7 * * *`
|
|
29
|
+
- prod `0 25 2 1 * *`
|
|
30
|
+
- název rabbitmq fronty
|
|
31
|
+
- dataplatform.municipallibraries.refreshDataInDB
|
|
35
32
|
|
|
36
33
|
## Zpracování dat / transformace
|
|
37
34
|
|
|
38
35
|
Při transformaci data obohacujeme o atribut `district`, která vychází z polohy dané knihovny a získává se metodou `cityDistrictsModel.getDistrict` v modulu city-district.
|
|
39
36
|
|
|
40
|
-
###
|
|
41
|
-
|
|
42
|
-
####
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
####
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
37
|
+
### _MunicipalLibrariesWorker_
|
|
38
|
+
|
|
39
|
+
#### _task: RefreshDataInDBTask_
|
|
40
|
+
|
|
41
|
+
- vstupní rabbitmq fronta
|
|
42
|
+
- název: dataplatform.municipallibraries.refreshDataInDB
|
|
43
|
+
- bez parametrů
|
|
44
|
+
- závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
|
|
45
|
+
- název: dataplatform.municipallibraries.updateDistrict
|
|
46
|
+
- parametry: `{ id: library.id }`
|
|
47
|
+
- datové zdroje
|
|
48
|
+
- dataSource MPL
|
|
49
|
+
- transformace
|
|
50
|
+
- [MunicipalLibrariesTransformation](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/src/integration-engine/transformations/MunicipalLibrariesTransformation.ts)
|
|
51
|
+
- data modely
|
|
52
|
+
- librariesModel -> (schéma municipal_libraries) `libraries`
|
|
53
|
+
- servicesModel -> (schéma municipal_libraries) `services`
|
|
54
|
+
- libraryServicesModel -> (schéma municipal_libraries) `library_services`
|
|
55
|
+
- openingHoursModel -> (schéma municipal_libraries) `opening_hours`
|
|
56
|
+
|
|
57
|
+
#### _task: UpdateDistrictsTask_
|
|
58
|
+
|
|
59
|
+
- vstupní rabbitmq fronta
|
|
60
|
+
- název: dataplatform.municipallibraries.updateDistrict
|
|
61
|
+
- parametry: `{ id: library.id }`
|
|
62
|
+
- datové zdroje
|
|
63
|
+
- `city-districts` module
|
|
64
|
+
- data modely
|
|
65
|
+
- librariesModel -> (schéma municipal_libraries) `library.district`
|
|
69
66
|
|
|
70
67
|
## Uložení dat
|
|
71
68
|
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
69
|
+
- typ databáze
|
|
70
|
+
- PSQL
|
|
71
|
+
- databázové schéma
|
|
72
|
+
- 
|
|
73
|
+
- retence dat
|
|
74
|
+
- `librariesModel`, `servicesModel` update
|
|
75
|
+
- `openingHoursModel` replace
|
|
79
76
|
|
|
80
77
|
## Output API
|
|
81
78
|
|
|
@@ -83,20 +80,23 @@ Při transformaci data obohacujeme o atribut `district`, která vychází z polo
|
|
|
83
80
|
|
|
84
81
|
### Obecné
|
|
85
82
|
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
|
|
83
|
+
- OpenAPI v3 dokumentace
|
|
84
|
+
- TBD
|
|
85
|
+
- api je veřejné
|
|
86
|
+
- postman kolekce
|
|
87
|
+
- TBD
|
|
88
|
+
- Asyncapi dokumentace RabbitMQ front
|
|
89
|
+
- [AsyncAPI](./asyncapi.yaml)
|
|
91
90
|
|
|
92
91
|
#### _/municipallibraries_
|
|
93
92
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
93
|
+
- zdrojové tabulky
|
|
94
|
+
- `libraries`, `services`, `library_services`, `opening_hours`,
|
|
95
|
+
- dodatečná transformace: Feature
|
|
97
96
|
-
|
|
97
|
+
|
|
98
98
|
#### _/municipallibraries/:id_
|
|
99
99
|
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
100
|
+
- zdrojové tabulky
|
|
101
|
+
- `libraries`, `services`, `library_services`, `opening_hours`,
|
|
102
|
+
- dodatečná transformace: Feature collection
|