text-to-map 1.0.7 → 1.1.0
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/dist/bin/clear-all.js +21 -4
- package/dist/bin/init-db.d.ts +1 -0
- package/dist/bin/init-db.js +18 -0
- package/dist/bin/parse-ordinance.js +56 -42
- package/dist/bin/schools.js +1 -1
- package/dist/db/address-points.d.ts +13 -13
- package/dist/db/address-points.js +93 -77
- package/dist/db/db.d.ts +19 -10
- package/dist/db/db.js +124 -50
- package/dist/db/founders.d.ts +7 -7
- package/dist/db/founders.js +187 -135
- package/dist/db/meta.d.ts +3 -4
- package/dist/db/meta.js +23 -16
- package/dist/db/migrations/20230704125715_initial.d.ts +3 -0
- package/dist/db/migrations/20230704125715_initial.js +251 -0
- package/dist/db/regions.d.ts +5 -5
- package/dist/db/regions.js +40 -28
- package/dist/db/schools.d.ts +3 -2
- package/dist/db/schools.js +30 -14
- package/dist/db/street-sync.d.ts +4 -4
- package/dist/db/street-sync.js +26 -17
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/open-data-sync/address-points.d.ts +0 -1
- package/dist/open-data-sync/address-points.js +35 -25
- package/dist/open-data-sync/regions.js +13 -5
- package/dist/open-data-sync/schools.js +19 -15
- package/dist/open-data-sync/streets.js +46 -33
- package/dist/street-markdown/municipality.d.ts +2 -2
- package/dist/street-markdown/municipality.js +46 -14
- package/dist/street-markdown/smd-line-parser.d.ts +1 -1
- package/dist/street-markdown/smd-line-parser.js +21 -8
- package/dist/street-markdown/smd.d.ts +8 -5
- package/dist/street-markdown/smd.js +100 -86
- package/dist/street-markdown/token-definition.js +6 -6
- package/dist/street-markdown/types.d.ts +8 -3
- package/dist/utils/helpers.d.ts +0 -1
- package/dist/utils/helpers.js +1 -8
- package/package.json +9 -5
|
@@ -109,11 +109,11 @@ const Space = createToken({
|
|
|
109
109
|
longer_alt: [MainSeparator, Separator],
|
|
110
110
|
group: Lexer.SKIPPED,
|
|
111
111
|
});
|
|
112
|
-
const Colon = createToken({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
112
|
+
// const Colon = createToken({
|
|
113
|
+
// name: "Colon",
|
|
114
|
+
// pattern: /:/,
|
|
115
|
+
// group: Lexer.SKIPPED,
|
|
116
|
+
// });
|
|
117
117
|
const smdTokens = [
|
|
118
118
|
MainSeparator,
|
|
119
119
|
Separator,
|
|
@@ -130,7 +130,7 @@ const smdTokens = [
|
|
|
130
130
|
Hyphen,
|
|
131
131
|
Slash,
|
|
132
132
|
Space,
|
|
133
|
-
Colon,
|
|
133
|
+
// Colon,
|
|
134
134
|
StreetName,
|
|
135
135
|
];
|
|
136
136
|
MainSeparator.LABEL = "' - '";
|
|
@@ -2,7 +2,7 @@ import { AddressPoint as CzechAddressPoint } from "czech-address";
|
|
|
2
2
|
import { Municipality as DbMunicipality, Founder } from "../db/types";
|
|
3
3
|
export interface ProcessedSmdLines {
|
|
4
4
|
smdLines: SmdLine[];
|
|
5
|
-
errors:
|
|
5
|
+
errors: SmdError[];
|
|
6
6
|
}
|
|
7
7
|
export interface SmdLine {
|
|
8
8
|
street: string;
|
|
@@ -67,7 +67,7 @@ export interface Municipality {
|
|
|
67
67
|
}
|
|
68
68
|
export interface DbMunicipalityResult {
|
|
69
69
|
municipality: DbMunicipality;
|
|
70
|
-
errors:
|
|
70
|
+
errors: SmdError[];
|
|
71
71
|
}
|
|
72
72
|
export interface MunicipalityWithFounder extends Municipality {
|
|
73
73
|
founder: Founder | null;
|
|
@@ -83,7 +83,7 @@ export interface ProcessLineCallbackParams {
|
|
|
83
83
|
line: string;
|
|
84
84
|
}
|
|
85
85
|
export interface ErrorCallbackParams extends ProcessLineCallbackParams {
|
|
86
|
-
errors:
|
|
86
|
+
errors: SmdError[];
|
|
87
87
|
}
|
|
88
88
|
export interface ProcessLineParams {
|
|
89
89
|
line: string;
|
|
@@ -92,3 +92,8 @@ export interface ProcessLineParams {
|
|
|
92
92
|
onError: (params: ErrorCallbackParams) => void;
|
|
93
93
|
onWarning: (params: ErrorCallbackParams) => void;
|
|
94
94
|
}
|
|
95
|
+
export interface SmdError {
|
|
96
|
+
startOffset: number;
|
|
97
|
+
endOffset: number;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export interface OpenDataSyncOptions {
|
|
|
19
19
|
export type OpenDataSyncOptionsPartial = Partial<OpenDataSyncOptions>;
|
|
20
20
|
export declare const getAppDataDirPath: () => string;
|
|
21
21
|
export declare const prepareOptions: (options: OpenDataSyncOptionsPartial) => OpenDataSyncOptions;
|
|
22
|
-
export declare const initDb: (options: OpenDataSyncOptions) => void;
|
|
23
22
|
export declare const extractMunicipalityName: (founder: Founder) => string;
|
|
24
23
|
export declare const sanitizeMunicipalityName: (name: string) => string;
|
|
25
24
|
export declare const findClosestString: (str: string, arr: string[]) => string;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync } from "fs";
|
|
2
2
|
import { tmpdir } from "os";
|
|
3
3
|
import { dirname, join } from "path";
|
|
4
|
-
import { MunicipalityType } from "../db/types";
|
|
5
|
-
import { setDbConfig } from "../db/db";
|
|
6
4
|
import { fileURLToPath } from "url";
|
|
5
|
+
import { MunicipalityType } from "../db/types";
|
|
7
6
|
const appName = "text-to-map";
|
|
8
7
|
export const getAppDataDirPath = () => join(process.env.APPDATA ||
|
|
9
8
|
(process.platform == "darwin"
|
|
@@ -40,12 +39,6 @@ export const prepareOptions = (options) => {
|
|
|
40
39
|
};
|
|
41
40
|
return Object.assign(Object.assign({}, defaults), options);
|
|
42
41
|
};
|
|
43
|
-
export const initDb = (options) => {
|
|
44
|
-
setDbConfig({
|
|
45
|
-
filePath: options.dbFilePath,
|
|
46
|
-
initFilePath: options.dbInitFilePath,
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
42
|
const cityPatterns = [
|
|
50
43
|
/^[sS]tatutární město +(.*)$/,
|
|
51
44
|
/^[oO]bec +(.*)$/,
|
package/package.json
CHANGED
|
@@ -7,25 +7,28 @@
|
|
|
7
7
|
"chevrotain": "^10.4.2",
|
|
8
8
|
"csv-parse": "^5.3.3",
|
|
9
9
|
"czech-address": "^1.0.1",
|
|
10
|
+
"dotenv": "^16.3.1",
|
|
10
11
|
"feedparser": "^2.2.10",
|
|
11
12
|
"iconv-lite": "^0.6.3",
|
|
13
|
+
"knex": "^2.4.2",
|
|
12
14
|
"node-fetch": "^3.3.0",
|
|
13
15
|
"parsedbf": "^1.1.1",
|
|
16
|
+
"pg": "^8.11.1",
|
|
14
17
|
"sax": "^1.2.4",
|
|
15
18
|
"typescript": "^4.9.4"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"@chevrotain/types": "^10.5.0",
|
|
19
|
-
"@jest/globals": "^29.
|
|
22
|
+
"@jest/globals": "^29.5.0",
|
|
20
23
|
"@types/adm-zip": "^0.5.0",
|
|
21
24
|
"@types/better-sqlite3": "^7.6.3",
|
|
22
25
|
"@types/feedparser": "^2.2.5",
|
|
23
26
|
"@types/node": "^18.11.17",
|
|
24
27
|
"copyfiles": "^2.4.1",
|
|
25
|
-
"jest": "^29.
|
|
26
|
-
"npm-run-all": "^
|
|
28
|
+
"jest": "^29.5.0",
|
|
29
|
+
"npm-run-all": "^1.7.0",
|
|
27
30
|
"rimraf": "^5.0.1",
|
|
28
|
-
"ts-jest": "^29.
|
|
31
|
+
"ts-jest": "^29.1.1",
|
|
29
32
|
"ts-node": "^10.9.1"
|
|
30
33
|
},
|
|
31
34
|
"scripts": {
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
"diagrams": "ts-node --experimental-specifier-resolution=node --esm src/bin/generate-syntax-diagrams.ts",
|
|
38
41
|
"clear-all": "ts-node --experimental-specifier-resolution=node --esm src/bin/clear-all.ts",
|
|
39
42
|
"parse-ordinance": "ts-node --experimental-specifier-resolution=node --esm src/bin/parse-ordinance.ts",
|
|
43
|
+
"knex": "ts-node --experimental-specifier-resolution=node --esm src/bin/knex.ts",
|
|
40
44
|
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm.config.mjs --no-cache",
|
|
41
45
|
"ordinance-to-csv-rules": "node src/smd-to-csv/ordinance-to-csv-rules.js",
|
|
42
46
|
"clean": "rimraf dist",
|
|
@@ -48,7 +52,7 @@
|
|
|
48
52
|
},
|
|
49
53
|
"name": "text-to-map",
|
|
50
54
|
"description": "Text To Map usiluje o lepší, strojově zpracovatelné využití částí vyhlášek s výčtem ulic a dalších lokací. Jde o rozšiřitelnou sadu konceptů a nástrojů, které zajistí hladký převod výčtu ulic a jejich rozsahů v lidsky srozumitelném jazyce do strojově zpracovatelného, uchopitelného formátu.",
|
|
51
|
-
"version": "1.0
|
|
55
|
+
"version": "1.1.0",
|
|
52
56
|
"main": "dist/index.js",
|
|
53
57
|
"types": "dist/index.d.ts",
|
|
54
58
|
"files": [
|