@golemio/municipal-libraries 1.2.4-dev.877696546 → 1.2.4-dev.880565674
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.
|
Binary file
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Implementační dokumentace modulu *municipal-libraries*
|
|
2
|
+
|
|
3
|
+
## Záměr
|
|
4
|
+
|
|
5
|
+
Modul slouží k ukládání a poskytování informací o městských knihovnách v Praze.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Vstupní data
|
|
9
|
+
|
|
10
|
+
**Dostupní poskytovatelé**:
|
|
11
|
+
|
|
12
|
+
- opendata mlp.cz
|
|
13
|
+
|
|
14
|
+
### Data aktivně stahujeme
|
|
15
|
+
|
|
16
|
+
#### *open data MLP*
|
|
17
|
+
|
|
18
|
+
- zdroj dat
|
|
19
|
+
- url: [config.datasources.MunicipalLibraries](https://www.mlp.cz/cz/pobocky/?export=xml)
|
|
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
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Zpracování dat / transformace
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
### *MunicipalLibrariesWorker*
|
|
40
|
+
|
|
41
|
+
#### *task: RefreshDataInDBTask*
|
|
42
|
+
|
|
43
|
+
- vstupní rabbitmq fronta
|
|
44
|
+
- název: dataplatform.municipallibraries.refreshDataInDB
|
|
45
|
+
- bez parametrů
|
|
46
|
+
- závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
|
|
47
|
+
- název: dataplatform.municipallibraries.updateDistrict
|
|
48
|
+
- parametry: `{ id: library.id }`
|
|
49
|
+
- datové zdroje
|
|
50
|
+
- dataSource MPL
|
|
51
|
+
- transformace
|
|
52
|
+
- [MunicipalLibrariesTransformation](https://gitlab.com/operator-ict/golemio/code/modules/municipal-libraries/-/blob/development/src/integration-engine/transformations/MunicipalLibrariesTransformation.ts)
|
|
53
|
+
- data modely
|
|
54
|
+
- librariesModel -> (schéma municipal_libraries) `libraries`
|
|
55
|
+
- servicesModel -> (schéma municipal_libraries) `services`
|
|
56
|
+
- libraryServicesModel -> (schéma municipal_libraries) `library_services`
|
|
57
|
+
- departmentsModel -> (schéma municipal_libraries) `departments`
|
|
58
|
+
- libraryDepartmentsModel -> (schéma municipal_libraries) `library_departments`
|
|
59
|
+
- openingHoursModel -> (schéma municipal_libraries) `opening_hours`
|
|
60
|
+
|
|
61
|
+
#### *task: UpdateDistrictsTask*
|
|
62
|
+
|
|
63
|
+
- vstupní rabbitmq fronta
|
|
64
|
+
- název: dataplatform.municipallibraries.updateDistrict
|
|
65
|
+
- parametry: `{ id: library.id }`
|
|
66
|
+
- datové zdroje
|
|
67
|
+
- `city-districts` module
|
|
68
|
+
- data modely
|
|
69
|
+
- librariesModel -> (schéma municipal_libraries) `library.district`
|
|
70
|
+
|
|
71
|
+
## Uložení dat
|
|
72
|
+
|
|
73
|
+
- typ databáze
|
|
74
|
+
- PSQL
|
|
75
|
+
- databázové schéma
|
|
76
|
+
- 
|
|
77
|
+
- retence dat
|
|
78
|
+
- `librariesModel`, `servicesModel`, `departmentsModel` update
|
|
79
|
+
- `openingHoursModel` replace
|
|
80
|
+
|
|
81
|
+
## Output API
|
|
82
|
+
|
|
83
|
+
`MunicipalLibrariesRouter` implementuje `GeoJsonRouter`.
|
|
84
|
+
|
|
85
|
+
### Obecné
|
|
86
|
+
|
|
87
|
+
- OpenAPI v3 dokumentace
|
|
88
|
+
- TBD
|
|
89
|
+
- api je veřejné
|
|
90
|
+
- postman kolekce
|
|
91
|
+
- TBD
|
|
92
|
+
|
|
93
|
+
#### _/municipallibraries_
|
|
94
|
+
|
|
95
|
+
- zdrojové tabulky
|
|
96
|
+
- `libraries`, `services`, `library_departments`, `library_services`, `departments`, `opening_hours`,
|
|
97
|
+
- dodatečná transformace: Feature
|
|
98
|
+
-
|
|
99
|
+
#### _/municipallibraries/:id_
|
|
100
|
+
|
|
101
|
+
- zdrojové tabulky
|
|
102
|
+
- `libraries`, `services`, `library_departments`, `library_services`, `departments`, `opening_hours`,
|
|
103
|
+
- dodatečná transformace: Feature collection
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
|
|
3
|
+
info:
|
|
4
|
+
title: 🏢️ Municipal Libraries
|
|
5
|
+
description: Locations and Description of Municipal Libraries
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
contact:
|
|
8
|
+
name: Golemio Prague Data Platform
|
|
9
|
+
email: golemio@operatorict.cz
|
|
10
|
+
url: https://golemio.cz
|
|
11
|
+
|
|
12
|
+
servers:
|
|
13
|
+
- url: https://api.golemio.cz/v2
|
|
14
|
+
description: Main (production) server
|
|
15
|
+
- url: https://rabin.golemio.cz/v2
|
|
16
|
+
description: Test (development) server
|
|
17
|
+
|
|
18
|
+
tags:
|
|
19
|
+
- name: 🏢️ Municipal Libraries
|
|
20
|
+
description: <img src="https://img.shields.io/badge/opendata-available-green" alt="golemioapi-opendata-badge" /> 💡 Locations and Description of Municipal Libraries
|
|
21
|
+
|
|
22
|
+
paths:
|
|
23
|
+
/municipallibraries:
|
|
24
|
+
get:
|
|
25
|
+
summary: GET All Municipal Libraries
|
|
26
|
+
operationId: GETAllMunicipalLibraries
|
|
27
|
+
description: ""
|
|
28
|
+
tags:
|
|
29
|
+
- 🏢️ Municipal Libraries
|
|
30
|
+
parameters:
|
|
31
|
+
- name: latlng
|
|
32
|
+
in: query
|
|
33
|
+
description: Sorting by location (Latitude and Longitude separated by comma,
|
|
34
|
+
latitude first).
|
|
35
|
+
required: false
|
|
36
|
+
example: 50.124935,14.457204
|
|
37
|
+
schema:
|
|
38
|
+
type: string
|
|
39
|
+
- name: range
|
|
40
|
+
in: query
|
|
41
|
+
description: Filter by distance from latlng in meters (range query). Depends on
|
|
42
|
+
the latlng parameter.
|
|
43
|
+
required: false
|
|
44
|
+
example: "5000"
|
|
45
|
+
schema:
|
|
46
|
+
type: number
|
|
47
|
+
- name: districts
|
|
48
|
+
in: query
|
|
49
|
+
description: Filter by Prague city districts (slug) separated by comma.
|
|
50
|
+
required: false
|
|
51
|
+
example: praha-4
|
|
52
|
+
schema:
|
|
53
|
+
type: array
|
|
54
|
+
items: {}
|
|
55
|
+
- name: limit
|
|
56
|
+
in: query
|
|
57
|
+
description: Limits number of retrieved items. The maximum is 10000 (default
|
|
58
|
+
value).
|
|
59
|
+
required: false
|
|
60
|
+
example: "10"
|
|
61
|
+
schema:
|
|
62
|
+
type: number
|
|
63
|
+
- name: offset
|
|
64
|
+
in: query
|
|
65
|
+
description: Number of the first items that are skipped.
|
|
66
|
+
required: false
|
|
67
|
+
example: "0"
|
|
68
|
+
schema:
|
|
69
|
+
type: number
|
|
70
|
+
- name: updatedSince
|
|
71
|
+
in: query
|
|
72
|
+
description: Filters all results with older updated_at than this parameter
|
|
73
|
+
required: false
|
|
74
|
+
example: 2019-05-18T07:38:37.000Z
|
|
75
|
+
schema:
|
|
76
|
+
type: string
|
|
77
|
+
responses:
|
|
78
|
+
"200":
|
|
79
|
+
description: OK
|
|
80
|
+
headers: {}
|
|
81
|
+
content:
|
|
82
|
+
application/json; charset=utf-8:
|
|
83
|
+
schema:
|
|
84
|
+
type: object
|
|
85
|
+
properties:
|
|
86
|
+
type:
|
|
87
|
+
type: string
|
|
88
|
+
example: FeatureCollection
|
|
89
|
+
features:
|
|
90
|
+
type: array
|
|
91
|
+
items:
|
|
92
|
+
$ref: "#/components/schemas/MunicipalLibrary"
|
|
93
|
+
required:
|
|
94
|
+
- type
|
|
95
|
+
- features
|
|
96
|
+
|
|
97
|
+
"401":
|
|
98
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
99
|
+
"403":
|
|
100
|
+
description: Forbidden
|
|
101
|
+
headers: {}
|
|
102
|
+
content:
|
|
103
|
+
application/json; charset=utf-8:
|
|
104
|
+
schema:
|
|
105
|
+
type: object
|
|
106
|
+
properties:
|
|
107
|
+
error_message:
|
|
108
|
+
type: string
|
|
109
|
+
error_status:
|
|
110
|
+
type: number
|
|
111
|
+
required:
|
|
112
|
+
- error_message
|
|
113
|
+
- error_status
|
|
114
|
+
examples:
|
|
115
|
+
response:
|
|
116
|
+
value:
|
|
117
|
+
error_message: Forbidden
|
|
118
|
+
error_status: 403
|
|
119
|
+
|
|
120
|
+
/municipallibraries/{id}:
|
|
121
|
+
get:
|
|
122
|
+
summary: GET Municipal Library
|
|
123
|
+
operationId: GETMunicipalLibrary
|
|
124
|
+
description: ""
|
|
125
|
+
tags:
|
|
126
|
+
- 🏢️ Municipal Libraries
|
|
127
|
+
parameters:
|
|
128
|
+
- name: id
|
|
129
|
+
in: path
|
|
130
|
+
description: Identifier of the Municipal Library.
|
|
131
|
+
required: true
|
|
132
|
+
example: 5
|
|
133
|
+
schema:
|
|
134
|
+
type: number
|
|
135
|
+
responses:
|
|
136
|
+
"200":
|
|
137
|
+
description: OK
|
|
138
|
+
headers: {}
|
|
139
|
+
content:
|
|
140
|
+
application/json; charset=utf-8:
|
|
141
|
+
schema:
|
|
142
|
+
$ref: "#/components/schemas/MunicipalLibrary"
|
|
143
|
+
"401":
|
|
144
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
145
|
+
"403":
|
|
146
|
+
description: Forbidden
|
|
147
|
+
headers: {}
|
|
148
|
+
content:
|
|
149
|
+
application/json; charset=utf-8:
|
|
150
|
+
schema:
|
|
151
|
+
type: object
|
|
152
|
+
properties:
|
|
153
|
+
error_message:
|
|
154
|
+
type: string
|
|
155
|
+
error_status:
|
|
156
|
+
type: number
|
|
157
|
+
required:
|
|
158
|
+
- error_message
|
|
159
|
+
- error_status
|
|
160
|
+
examples:
|
|
161
|
+
response:
|
|
162
|
+
value:
|
|
163
|
+
error_message: Forbidden
|
|
164
|
+
error_status: 403
|
|
165
|
+
"404":
|
|
166
|
+
description: Not Found
|
|
167
|
+
headers: {}
|
|
168
|
+
content:
|
|
169
|
+
application/json; charset=utf-8:
|
|
170
|
+
schema:
|
|
171
|
+
type: object
|
|
172
|
+
properties:
|
|
173
|
+
error_message:
|
|
174
|
+
type: string
|
|
175
|
+
error_status:
|
|
176
|
+
type: number
|
|
177
|
+
required:
|
|
178
|
+
- error_message
|
|
179
|
+
- error_status
|
|
180
|
+
examples:
|
|
181
|
+
response:
|
|
182
|
+
value:
|
|
183
|
+
error_message: Not Found
|
|
184
|
+
error_status: 404
|
|
185
|
+
|
|
186
|
+
components:
|
|
187
|
+
responses:
|
|
188
|
+
UnauthorizedError:
|
|
189
|
+
description: API key is missing or invalid
|
|
190
|
+
headers:
|
|
191
|
+
WWW_Authenticate:
|
|
192
|
+
schema:
|
|
193
|
+
type: string
|
|
194
|
+
schemas:
|
|
195
|
+
MunicipalLibrary:
|
|
196
|
+
type: object
|
|
197
|
+
properties:
|
|
198
|
+
geometry:
|
|
199
|
+
type: object
|
|
200
|
+
properties:
|
|
201
|
+
type:
|
|
202
|
+
type: string
|
|
203
|
+
example: Point
|
|
204
|
+
coordinates:
|
|
205
|
+
type: array
|
|
206
|
+
items:
|
|
207
|
+
type: number
|
|
208
|
+
example:
|
|
209
|
+
- 14.392211
|
|
210
|
+
- 50.094008
|
|
211
|
+
properties:
|
|
212
|
+
type: object
|
|
213
|
+
properties:
|
|
214
|
+
address:
|
|
215
|
+
type: object
|
|
216
|
+
properties:
|
|
217
|
+
address_formatted:
|
|
218
|
+
type: string
|
|
219
|
+
example: U Brusnice 324/9, 16900 Praha 6 - Hradčany, Česko
|
|
220
|
+
street_address:
|
|
221
|
+
type: string
|
|
222
|
+
example: U Brusnice 324/9
|
|
223
|
+
postal_code:
|
|
224
|
+
type: string
|
|
225
|
+
example: 16900
|
|
226
|
+
address_locality:
|
|
227
|
+
type: string
|
|
228
|
+
example: Praha 6 - Hradčany
|
|
229
|
+
address_region:
|
|
230
|
+
type: string
|
|
231
|
+
example: Hradčany
|
|
232
|
+
address_country:
|
|
233
|
+
type: string
|
|
234
|
+
example: Česko
|
|
235
|
+
email:
|
|
236
|
+
type: string
|
|
237
|
+
example: knihovna@mlp.cz
|
|
238
|
+
id:
|
|
239
|
+
type: number
|
|
240
|
+
example: 68
|
|
241
|
+
name:
|
|
242
|
+
type: string
|
|
243
|
+
example: Sběrný dvůr hlavního města Prahy Proboštská
|
|
244
|
+
opening_hours:
|
|
245
|
+
type: array
|
|
246
|
+
items:
|
|
247
|
+
type: object
|
|
248
|
+
properties:
|
|
249
|
+
closes:
|
|
250
|
+
type: string
|
|
251
|
+
example: 12:00
|
|
252
|
+
day_of_week:
|
|
253
|
+
type: string
|
|
254
|
+
example: Monday
|
|
255
|
+
description:
|
|
256
|
+
type: string
|
|
257
|
+
example: Základní provozní doba
|
|
258
|
+
is_default:
|
|
259
|
+
type: boolean
|
|
260
|
+
example: true
|
|
261
|
+
opens:
|
|
262
|
+
type: string
|
|
263
|
+
example: 09:00
|
|
264
|
+
valid_from:
|
|
265
|
+
type: string
|
|
266
|
+
nullable: true
|
|
267
|
+
example: 2021-12-30T23:00:00.000Z
|
|
268
|
+
valid_through:
|
|
269
|
+
type: string
|
|
270
|
+
nullable: true
|
|
271
|
+
example: 2022-01-01T23:00:00.000Z
|
|
272
|
+
sections_and_departments:
|
|
273
|
+
type: array
|
|
274
|
+
items:
|
|
275
|
+
type: object
|
|
276
|
+
properties:
|
|
277
|
+
id:
|
|
278
|
+
type: string
|
|
279
|
+
example: code-8
|
|
280
|
+
name:
|
|
281
|
+
type: string
|
|
282
|
+
example: Oddělení pro děti a mládež
|
|
283
|
+
type:
|
|
284
|
+
type: string
|
|
285
|
+
example: link
|
|
286
|
+
url:
|
|
287
|
+
type: string
|
|
288
|
+
nullable: true
|
|
289
|
+
example: https://www.mlp.cz/cz/pobocky/ustredni-knihovna-oddeleni-pro-deti-a-mladez/
|
|
290
|
+
services:
|
|
291
|
+
type: array
|
|
292
|
+
items:
|
|
293
|
+
type: object
|
|
294
|
+
properties:
|
|
295
|
+
description:
|
|
296
|
+
type: string
|
|
297
|
+
nullable: true
|
|
298
|
+
example: Bezbariérový přístup pro vozíčkáře i rodiče s kočárky
|
|
299
|
+
id:
|
|
300
|
+
type: number
|
|
301
|
+
example: 1
|
|
302
|
+
name:
|
|
303
|
+
type: string
|
|
304
|
+
example: Bezbariérový přístup
|
|
305
|
+
telephone:
|
|
306
|
+
type: string
|
|
307
|
+
example: +420 770 130 297
|
|
308
|
+
updated_at:
|
|
309
|
+
type: string
|
|
310
|
+
example: 2019-05-18T07:38:37.000Z
|
|
311
|
+
web:
|
|
312
|
+
type: string
|
|
313
|
+
example: https://www.mlp.cz/cz/pobocky/brusnice-vzacne-tisky/
|
|
314
|
+
district:
|
|
315
|
+
type: string
|
|
316
|
+
example: praha-6
|
|
317
|
+
type:
|
|
318
|
+
type: string
|
|
319
|
+
example: Feature
|