@golemio/ndic 1.0.7 → 1.0.8-dev.525554702

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,157 @@
1
+ # Implementační dokumentace modulu *Ndic*
2
+
3
+ ## Záměr
4
+
5
+ Stručný popis, k čemu modul slouží.
6
+
7
+ Pokud má modul více oblastí, každá oblast je popsána zvlášť. Dále jsem popsány vazby mezi jednotlivými oblastmi.
8
+
9
+
10
+
11
+ ## Vstupní data
12
+
13
+ ### Data nám jsou posílána
14
+
15
+ Popis dat, jak nám jsou posíláná na input-gateway. Pokud je vystaveno více endpointů (pro různé datové sady), každý endpoint je popsán zvlášť.
16
+
17
+ #### */traffic-info / NdicTrafficInfo*
18
+
19
+ - formát dat
20
+ - protokol http
21
+ - datový typ xml
22
+ - [odkaz na validační schéma](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/schemas/traffic_info_schema.xsd)
23
+ - [příklad vstupních dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/test/data/traffic_info_data.xml)
24
+ - endpoint v input-gateway `/traffic-info`
25
+ - příchozí xml je na input gateway pomocí obecného middlewaru rozparsováno body parsererem z xml na json. Již předpřipravený request se dostane skrze NdicRouter do TrafficInfoController a je zvalidován oproti json schématu [link](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/src/schema-definitions/schemas/traffic_info_datasource_schema.ts)
26
+ - (volitelně) nastavení práv v permission-proxy
27
+ - zvláštní požadaky na řízení přístupu
28
+ - TBD
29
+ - transformace raw dat
30
+ - standardní body parser xml->json
31
+ - název rabbitmq fronty
32
+ - `dataplatform.ndic.saveTrafficInfo` - zprávy v queue obsahují přichozí data v json formátu
33
+ - (volitelně) odhadovaná zátěž
34
+ - n/a
35
+
36
+ #### */traffic-restrictions / NdicTrafficRestrictions*
37
+
38
+ - formát dat
39
+ - protokol http
40
+ - datový typ xml
41
+ - [odkaz na validační schéma](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/schemas/traffic_restrictions_schema.xsd)
42
+ - [příklad vstupních dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/test/data/traffic_restrictions_data.xml)
43
+ - endpoint v input-gateway
44
+ - popis endpointu /traffic-restrictions
45
+ - (volitelně) nastavení práv v permission-proxy
46
+ - zvláštní požadaky na řízení přístupu
47
+ - transformace raw dat
48
+ - body parser xml->json
49
+ - název rabbitmq fronty
50
+ - `dataplatform.ndic.saveTrafficRestrictions` - zprávy v queue obsahují přichozí data v json formátu
51
+ - (volitelně) odhadovaná zátěž
52
+ - n/a
53
+
54
+
55
+
56
+ ## Zpracování dat / transformace
57
+
58
+ Popis transformace a případného obohacení dat. Zaměřeno hlavně na workery a jejich metody.
59
+
60
+ ### *NdicWorker*
61
+
62
+ Worker slouží pro zpracování příchozích dat NdicTrafficInfo a NdicTrafficRestrictions.
63
+
64
+ #### *saveTrafficInfo*
65
+
66
+ - vstupní rabbitmq fronta
67
+ - `dataplatform.ndic.saveTrafficInfo`
68
+ - (volitelně) závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
69
+ - žádné
70
+ - datové zdroje
71
+ - rsdTmcPointsModel - pro zjištění geo souřadnic
72
+ - transformace
73
+ - [odkaz na transformaci dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/development/src/integration-engine/transformations/TrafficInfoTransformation.ts)
74
+ - (volitelně) obohacení dat
75
+ - po tranformaci se data obohacují o geosouřadnice (např. úsek silnice), kdy data z alertCLinear části slouží jako filtrovací parametry pro lookup datasource rsdTmcPointsModel
76
+ - data modely
77
+ - `ndicTrafficInfoModel` - ukládá se do tabulky `ndic_traffic_info`
78
+
79
+ #### *saveTrafficRestrictions*
80
+
81
+ - vstupní rabbitmq fronta
82
+ - `dataplatform.ndic.saveTrafficRestrictions`
83
+ - (volitelně) závislé fronty (do kterých jsou odesílány zprávy z metody workeru)
84
+ - žádné
85
+ - datové zdroje
86
+ - `rsdTmcPointsModel` - pro zjištění geo souřadnic
87
+ - transformace
88
+ - [odkaz na transformaci dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/src/integration-engine/transformations/TrafficRestrictionsTransformation.ts)
89
+ - (volitelně) obohacení dat
90
+ - stejné jako u předešlé metody *`saveTrafficInfo`*
91
+ - data modely
92
+ - `ndicTrafficRestrictionsModel` se ukládá do tabulky ndic_traffic_restrictions
93
+
94
+
95
+ ## Uložení dat
96
+
97
+ Popis ukládání dat.
98
+
99
+ ### Obecné
100
+
101
+ - typ databáze
102
+ - PSQL
103
+ - datábázové schéma
104
+ - tabulka `ndic_traffic_info`
105
+ - tabulka `ndic_traffic_restrictions`
106
+ ![ndic er diagram](ndic_erdiagram.png "ERD")
107
+ - retence dat
108
+ - n/a
109
+
110
+ ### *ndicTrafficInfoModel*
111
+
112
+ - schéma a název tabulky / kolekce
113
+ - `public.ndic_traffic_info`
114
+ - struktura tabulky / kolekce
115
+ - odkaz na schéma, případně na migrační skripty
116
+ - schéma viz výše
117
+ - [odkaz na migrační skripty](https://gitlab.com/operator-ict/golemio/code/modules/schema-definitions/-/tree/development/db/postgresql-migrations)
118
+ - ukázka dat
119
+ n/a
120
+
121
+ ### *ndicTrafficInfoModel*
122
+
123
+ - schéma a název tabulky / kolekce
124
+ - `public.ndic_traffic_restrictions`
125
+ - struktura tabulky / kolekce
126
+ - odkaz na schéma, případně na migrační skripty
127
+ - schéma viz výše
128
+ - [odkaz na migrační skripty](https://gitlab.com/operator-ict/golemio/code/modules/schema-definitions/-/tree/development/db/postgresql-migrations)
129
+ - [ukázka dat](https://gitlab.com/operator-ict/golemio/code/modules/ndic/-/blob/master/db/example/sql_dump.sql)
130
+
131
+
132
+ ## Output API
133
+
134
+ Popis output-api.
135
+
136
+ ### Obecné
137
+
138
+ - API Blueprint / OpenAPI dokumentace
139
+ - [odkaz na dokumentaci](./openapi.yaml)
140
+ - veřejné / neveřejné endpointy
141
+ - api je neveřejné, endpoint /restrictions je přístupný pro uživatele s rolí NDIC
142
+ - (volitelně) ACL
143
+ - postman kolekce
144
+ - TBD
145
+
146
+ #### */restrictions*
147
+
148
+ - zdrojové tabulky
149
+ - `ndic_traffic_restrictions`
150
+ - (volitlně) nestandardní dodatečná transformace
151
+ - vrací pouze poslední známe stavy ( max `situation_record_version_time` ) všech dopravních situací podle klíče `situation_record_id`, které jsou platné ve vybraný čas
152
+ - (volitelně) nestandardní url a query parametry
153
+
154
+ | query parameter | popis |
155
+ | --- |---|
156
+ | reqMoment | datum a čas pro který zobrazit platné situace ve formátu ISO8601 |
157
+ | situationRecordType | filtruje podle typu situace |
Binary file
package/package.json CHANGED
@@ -1,80 +1,84 @@
1
1
  {
2
- "name": "@golemio/ndic",
3
- "version": "1.0.7",
4
- "description": "Golemio NDIC Module",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
9
- "build-minimal": "run-s 'build --sourceMap false --declaration false'",
10
- "build-watch": "run-s 'build --watch --preserveWatchOutput'",
11
- "pretest": "golemio-import-test-data",
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
- "apidocs-test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' ts-node -r dotenv/config test/api-docs/index.ts",
14
- "test-debug": "run-s 'test --inspect-brk=9230'",
15
- "code-coverage": "nyc run-s 'test -r source-map-support/register'",
16
- "generate-docs": "typedoc --out docs/typedoc src",
17
- "lint": "eslint '{src,test}/**/*.ts'"
18
- },
19
- "keywords": [
20
- "golemio"
21
- ],
22
- "author": "Operator ICT, a.s.",
23
- "license": "MIT",
24
- "repository": {
25
- "type": "git",
26
- "url": "https://gitlab.com/operator-ict/golemio/code/modules/ndic"
27
- },
28
- "devDependencies": {
29
- "@commitlint/cli": "^11.0.0",
30
- "@commitlint/config-conventional": "^11.0.0",
31
- "@golemio/core": "1.2.6",
32
- "@golemio/eslint-config": "^1.1.0",
33
- "@golemio/schema-definitions": "2.0.31",
34
- "@types/body-parser-xml": "^1.1.0",
35
- "@types/chai": "4.2.3",
36
- "@types/chai-as-promised": "7.1.2",
37
- "@types/mocha": "^8.2.0",
38
- "@types/node": "^14.14.20",
39
- "@types/sinon": "^9.0.10",
40
- "@types/supertest": "^2.0.10",
41
- "@zerollup/ts-transform-paths": "^1.7.18",
42
- "body-parser": "^1.19.0",
43
- "body-parser-xml": "^2.0.0",
44
- "chai": "4.2.0",
45
- "chai-as-promised": "7.1.1",
46
- "cross-env": "^7.0.3",
47
- "dotenv": "^8.2.0",
48
- "eslint": "^8.1.1",
49
- "husky": "^4.3.7",
50
- "mocha": "^8.2.1",
51
- "npm-run-all": "^4.1.5",
52
- "nyc": "^15.1.0",
53
- "prettier": "^2.5.1",
54
- "pretty-quick": "^3.1.3",
55
- "rimraf": "^3.0.2",
56
- "sinon": "^9.2.3",
57
- "source-map-support": "0.5.19",
58
- "supertest": "^6.0.1",
59
- "ts-node": "^9.1.1",
60
- "ttypescript": "^1.5.13",
61
- "typedoc": "^0.21.4",
62
- "typescript": "4.4.4"
63
- },
64
- "peerDependencies": {
65
- "@golemio/core": "^1.0.5"
66
- },
67
- "dependencies": {
68
- "@apideck/portman": "^1.13.0",
69
- "ajv": "^8.2.0",
70
- "xsd2jsonschema": "^0.3.7"
71
- },
72
- "resolutions": {
73
- "xmldom": "github:xmldom/xmldom#0.7.0",
74
- "minimist": "^1.2.6",
75
- "mpath": "^0.8.4",
76
- "apicache": "1.6.3",
77
- "axios": "^0.21.2",
78
- "follow-redirects": "^1.14.7"
79
- }
2
+ "name": "@golemio/ndic",
3
+ "version": "1.0.8-dev.525554702",
4
+ "description": "Golemio NDIC Module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
9
+ "build-minimal": "run-s 'build --sourceMap false --declaration false'",
10
+ "build-watch": "run-s 'build --watch --preserveWatchOutput'",
11
+ "pretest": "golemio-import-test-data",
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
+ "apidocs-test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' ts-node -r dotenv/config test/api-docs/index.ts",
14
+ "test-debug": "run-s 'test --inspect-brk=9230'",
15
+ "code-coverage": "nyc run-s 'test -r source-map-support/register'",
16
+ "generate-docs": "typedoc --out docs/typedoc src",
17
+ "lint": "eslint \"{src,test}/**/*.ts\""
18
+ },
19
+ "keywords": [
20
+ "golemio"
21
+ ],
22
+ "author": "Operator ICT, a.s.",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://gitlab.com/operator-ict/golemio/code/modules/ndic"
27
+ },
28
+ "devDependencies": {
29
+ "@commitlint/cli": "^11.0.0",
30
+ "@commitlint/config-conventional": "^11.0.0",
31
+ "@golemio/core": "1.2.6",
32
+ "@golemio/eslint-config": "^1.1.0",
33
+ "@golemio/schema-definitions": "2.0.31",
34
+ "@types/body-parser-xml": "^1.1.0",
35
+ "@types/chai": "4.2.3",
36
+ "@types/chai-as-promised": "7.1.2",
37
+ "@types/mocha": "^8.2.0",
38
+ "@types/node": "^14.14.20",
39
+ "@types/sinon": "^9.0.10",
40
+ "@types/supertest": "^2.0.10",
41
+ "@zerollup/ts-transform-paths": "^1.7.18",
42
+ "body-parser": "^1.19.0",
43
+ "body-parser-xml": "^2.0.0",
44
+ "chai": "4.2.0",
45
+ "chai-as-promised": "7.1.1",
46
+ "cross-env": "^7.0.3",
47
+ "dotenv": "^8.2.0",
48
+ "eslint": "^8.1.1",
49
+ "husky": "^4.3.7",
50
+ "mocha": "^8.2.1",
51
+ "npm-run-all": "^4.1.5",
52
+ "nyc": "^15.1.0",
53
+ "prettier": "^2.5.1",
54
+ "pretty-quick": "^3.1.3",
55
+ "rimraf": "^3.0.2",
56
+ "sinon": "^9.2.3",
57
+ "source-map-support": "0.5.19",
58
+ "supertest": "^6.0.1",
59
+ "ts-node": "^9.1.1",
60
+ "ttypescript": "^1.5.13",
61
+ "typedoc": "^0.21.4",
62
+ "typescript": "4.4.4"
63
+ },
64
+ "peerDependencies": {
65
+ "@golemio/core": "^1.0.5"
66
+ },
67
+ "dependencies": {
68
+ "@apideck/portman": "^1.13.0",
69
+ "ajv": "^8.2.0",
70
+ "xsd2jsonschema": "^0.3.7"
71
+ },
72
+ "resolutions": {
73
+ "xmldom": "github:xmldom/xmldom#0.7.0",
74
+ "minimist": "^1.2.6",
75
+ "mpath": "^0.8.4",
76
+ "apicache": "1.6.3",
77
+ "axios": "^0.21.2",
78
+ "follow-redirects": "^1.14.7",
79
+ "ansi-regex": "^5.0.1",
80
+ "validator": "^13.7.0",
81
+ "json-schema": "^0.4.0",
82
+ "urijs": "^1.19.10"
83
+ }
80
84
  }