@golemio/municipal-libraries 1.3.4-dev.1467124984 → 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.
@@ -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 *municipal-libraries*
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
- #### *open data MLP*
17
-
18
- - zdroj dat
19
- - url: [config.datasources.MunicipalLibraries](https://www.mlp.cz/cz/pobocky/?export=xml)
20
- - pozor při načtení url proběhne několik přesměrování na doplnění cookies
21
- - formát dat
22
- - protokol: http
23
- - datový typ: json
24
- - validační schéma: [municipalLibrariesJsonSchema](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/src/integration-engine/datasources/MunicipalLibrariesDataSource.ts)
25
- - příklad [vstupních dat](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/test/integration-engine/data/municipallibraries-datasource.json)
26
- - frekvence stahování
27
- - cron definice:
28
- - cron.dataplatform.municipallibraries.refreshDataInDB
29
- - rabin `0 31 7 * * *`
30
- - prod `0 25 2 1 * *`
31
- - název rabbitmq fronty
32
- - dataplatform.municipallibraries.refreshDataInDB
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
- ### *MunicipalLibrariesWorker*
41
-
42
- #### *task: RefreshDataInDBTask*
43
-
44
- - vstupní rabbitmq fronta
45
- - název: dataplatform.municipallibraries.refreshDataInDB
46
- - bez parametrů
47
- - závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
48
- - název: dataplatform.municipallibraries.updateDistrict
49
- - parametry: `{ id: library.id }`
50
- - datové zdroje
51
- - dataSource MPL
52
- - transformace
53
- - [MunicipalLibrariesTransformation](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/src/integration-engine/transformations/MunicipalLibrariesTransformation.ts)
54
- - data modely
55
- - librariesModel -> (schéma municipal_libraries) `libraries`
56
- - servicesModel -> (schéma municipal_libraries) `services`
57
- - libraryServicesModel -> (schéma municipal_libraries) `library_services`
58
- - openingHoursModel -> (schéma municipal_libraries) `opening_hours`
59
-
60
- #### *task: UpdateDistrictsTask*
61
-
62
- - vstupní rabbitmq fronta
63
- - název: dataplatform.municipallibraries.updateDistrict
64
- - parametry: `{ id: library.id }`
65
- - datové zdroje
66
- - `city-districts` module
67
- - data modely
68
- - librariesModel -> (schéma municipal_libraries) `library.district`
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
- - typ databáze
73
- - PSQL
74
- - databázové schéma
75
- - ![municipallibraries er diagram](./assets/municipallibraries_erd.png)
76
- - retence dat
77
- - `librariesModel`, `servicesModel` update
78
- - `openingHoursModel` replace
69
+ - typ databáze
70
+ - PSQL
71
+ - databázové schéma
72
+ - ![municipallibraries er diagram](./assets/municipallibraries_erd.png)
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
- - OpenAPI v3 dokumentace
87
- - TBD
88
- - api je veřejné
89
- - postman kolekce
90
- - TBD
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
- - zdrojové tabulky
95
- - `libraries`, `services`, `library_services`, `opening_hours`,
96
- - dodatečná transformace: Feature
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
- - zdrojové tabulky
101
- - `libraries`, `services`, `library_services`, `opening_hours`,
102
- - dodatečná transformace: Feature collection
100
+ - zdrojové tabulky
101
+ - `libraries`, `services`, `library_services`, `opening_hours`,
102
+ - dodatečná transformace: Feature collection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/municipal-libraries",
3
- "version": "1.3.4-dev.1467124984",
3
+ "version": "1.3.4-dev.1568607653",
4
4
  "description": "Golemio Municipal Libraries Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",