@mailwoman/zoning 10.0.0 → 10.2.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.
Files changed (101) hide show
  1. package/README.md +169 -163
  2. package/lib/index.ts +103 -135
  3. package/lib/paths.ts +24 -0
  4. package/lib/ring-roles.ts +30 -71
  5. package/lib/rings.ts +2 -13
  6. package/lib/schema.ts +98 -139
  7. package/lib/vocabulary.ts +52 -130
  8. package/out/index.d.ts +81 -101
  9. package/out/index.d.ts.map +1 -1
  10. package/out/index.js +37 -96
  11. package/out/index.js.map +1 -1
  12. package/out/paths.d.ts +19 -0
  13. package/out/paths.d.ts.map +1 -0
  14. package/out/paths.js +21 -0
  15. package/out/paths.js.map +1 -0
  16. package/out/ring-roles.d.ts +16 -50
  17. package/out/ring-roles.d.ts.map +1 -1
  18. package/out/ring-roles.js +18 -51
  19. package/out/ring-roles.js.map +1 -1
  20. package/out/rings.d.ts +2 -13
  21. package/out/rings.d.ts.map +1 -1
  22. package/out/rings.js +2 -13
  23. package/out/rings.js.map +1 -1
  24. package/out/schema.d.ts +90 -132
  25. package/out/schema.d.ts.map +1 -1
  26. package/out/schema.js +17 -45
  27. package/out/schema.js.map +1 -1
  28. package/out/sdk/build-zoning.d.ts +58 -111
  29. package/out/sdk/build-zoning.d.ts.map +1 -1
  30. package/out/sdk/build-zoning.js +50 -139
  31. package/out/sdk/build-zoning.js.map +1 -1
  32. package/out/sdk/cells.d.ts +21 -62
  33. package/out/sdk/cells.d.ts.map +1 -1
  34. package/out/sdk/cells.js +15 -52
  35. package/out/sdk/cells.js.map +1 -1
  36. package/out/sdk/client.d.ts +23 -67
  37. package/out/sdk/client.d.ts.map +1 -1
  38. package/out/sdk/client.js +29 -77
  39. package/out/sdk/client.js.map +1 -1
  40. package/out/sdk/download.d.ts +7 -27
  41. package/out/sdk/download.d.ts.map +1 -1
  42. package/out/sdk/download.js +8 -28
  43. package/out/sdk/download.js.map +1 -1
  44. package/out/sdk/ingest/chunk.d.ts +19 -43
  45. package/out/sdk/ingest/chunk.d.ts.map +1 -1
  46. package/out/sdk/ingest/chunk.js +19 -52
  47. package/out/sdk/ingest/chunk.js.map +1 -1
  48. package/out/sdk/ingest/worker.d.ts +9 -0
  49. package/out/sdk/ingest/worker.d.ts.map +1 -0
  50. package/out/{scripts/ingest-chunk.js → sdk/ingest/worker.js} +8 -10
  51. package/out/sdk/ingest/worker.js.map +1 -0
  52. package/out/sdk/ingest.d.ts +152 -0
  53. package/out/sdk/ingest.d.ts.map +1 -0
  54. package/out/sdk/ingest.js +200 -0
  55. package/out/sdk/ingest.js.map +1 -0
  56. package/out/sdk/measure-resolutions.d.ts +7 -34
  57. package/out/sdk/measure-resolutions.d.ts.map +1 -1
  58. package/out/sdk/measure-resolutions.js +5 -23
  59. package/out/sdk/measure-resolutions.js.map +1 -1
  60. package/out/sdk/test-kit.d.ts +75 -0
  61. package/out/sdk/test-kit.d.ts.map +1 -0
  62. package/out/{test-kit.js → sdk/test-kit.js} +20 -43
  63. package/out/sdk/test-kit.js.map +1 -0
  64. package/out/sdk/verify.d.ts +79 -80
  65. package/out/sdk/verify.d.ts.map +1 -1
  66. package/out/sdk/verify.js +83 -70
  67. package/out/sdk/verify.js.map +1 -1
  68. package/out/vocabulary.d.ts +52 -120
  69. package/out/vocabulary.d.ts.map +1 -1
  70. package/out/vocabulary.js +47 -125
  71. package/out/vocabulary.js.map +1 -1
  72. package/package.json +38 -162
  73. package/{lib/sdk → sdk}/build-zoning.ts +102 -188
  74. package/{lib/sdk → sdk}/cells.ts +27 -66
  75. package/{lib/sdk → sdk}/client.ts +34 -82
  76. package/sdk/download.ts +58 -0
  77. package/{lib/sdk → sdk}/ingest/chunk.ts +36 -65
  78. package/{lib/scripts/ingest-chunk.ts → sdk/ingest/worker.ts} +7 -9
  79. package/sdk/ingest.ts +354 -0
  80. package/sdk/measure-resolutions.ts +72 -0
  81. package/{lib → sdk}/test-kit.ts +21 -44
  82. package/sdk/verify.ts +367 -0
  83. package/lib/sdk/download.ts +0 -78
  84. package/lib/sdk/index.ts +0 -15
  85. package/lib/sdk/ingest/index.ts +0 -393
  86. package/lib/sdk/measure-resolutions.ts +0 -101
  87. package/lib/sdk/verify.ts +0 -357
  88. package/out/scripts/ingest-chunk.d.ts +0 -11
  89. package/out/scripts/ingest-chunk.d.ts.map +0 -1
  90. package/out/scripts/ingest-chunk.js.map +0 -1
  91. package/out/sdk/index.d.ts +0 -15
  92. package/out/sdk/index.d.ts.map +0 -1
  93. package/out/sdk/index.js +0 -15
  94. package/out/sdk/index.js.map +0 -1
  95. package/out/sdk/ingest/index.d.ts +0 -185
  96. package/out/sdk/ingest/index.d.ts.map +0 -1
  97. package/out/sdk/ingest/index.js +0 -232
  98. package/out/sdk/ingest/index.js.map +0 -1
  99. package/out/test-kit.d.ts +0 -96
  100. package/out/test-kit.d.ts.map +0 -1
  101. package/out/test-kit.js.map +0 -1
@@ -3,44 +3,24 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Acquire the Department's bulk GeoJSON export — a 247,452,342-byte file streamed to disk.
7
- *
8
- * THIS IS A FILE TRANSFER, NOT AN API REQUEST, AND IT KEEPS RAW `fetch` ON PURPOSE. The repo's rule sends
9
- * HTTP clients through `@mailwoman/core/api`'s `APIClient`, and the rule draws its line at what that class
10
- * is for: pacing, bounded retry, response caching and error mapping over small bodies and repeated calls.
11
- * None of it applies here. Caching a 247 MB body through a JSON-validating disk cache would write a second,
12
- * unreadable copy of a file already on disk; there is nothing to pace, because this runs once per product
13
- * vintage; and axios buffers any non-stream response type in memory. `packages/osm/lib/sdk/fetch.ts`,
14
- * `packages/tiger/lib/sdk/download.ts`, `packages/flood/lib/sdk/download.ts` and `packages/coastal/lib/sdk/download.ts`
15
- * are the existing transfers that say the same thing in the same place. The JOB that produces this URL, and
16
- * every other metadata read around it, DO go through `APIClient` — see `client.ts`.
17
- *
18
- * THE RESULT URL REDIRECTS AND THE FETCH MUST FOLLOW IT. The Hub download job answers
19
- * `{"status":"Completed","resultUrl":…}`; the result URL itself 302s to the generated file. Node's `fetch`
20
- * follows redirects by default, and the option is passed explicitly anyway — a transfer that stopped at the
21
- * redirect would write a short body to disk and report a successful download.
22
- *
23
- * FRESHNESS IS THE ITEM'S OWN MODIFIED DATE, NEVER A LENGTH PROBE. The cache is keyed on the vintage the
24
- * item declares, so a re-run against the same vintage never re-transfers and a new vintage never overwrites
25
- * the old one in place.
6
+ * Acquire the Department's bulk GeoJSON export with raw `fetch` rather than `APIClient`, following the result URL's redirect and keying the cache on the item's own modified date.
26
7
  */
27
- import { tryStat } from "@mailwoman/core/fs/readers";
8
+ import { tryStat } from "@mailwoman/core/fs/readers/stat";
28
9
  import { makeDirectories } from "@mailwoman/core/fs/writers";
29
10
  import { streamToDisk } from "@mailwoman/core/utils";
30
- import { join } from "path-ts";
11
+ import { PathBuilder } from "path-ts";
31
12
  /**
32
13
  * The file name one vintage's export is kept under.
33
14
  */
34
15
  export const GZT_EXPORT_FILE = "gzt-current-plan.geojson";
35
16
  /**
36
- * Download the bulk export for one product vintage, returning the path of the GeoJSON file.
37
- *
38
- * Downloads to a `.part` file and renames only on a clean finish, so an interrupted transfer never presents as a
39
- * complete export — the same discipline the database build uses, for the same reason.
17
+ * Download the bulk export for one product vintage and return the path of the GeoJSON file, renaming a
18
+ * `.part` file only on a clean finish so an interrupted transfer never presents as a complete export.
40
19
  */
41
20
  export async function downloadZoningExport(options) {
42
- const vintageDir = join(options.cacheRoot, options.vintage);
43
- const exportPath = join(vintageDir, GZT_EXPORT_FILE);
21
+ const vintageDir = PathBuilder.from(options.cacheRoot)(options.vintage);
22
+ // A string, because the build records the export path it read.
23
+ const exportPath = vintageDir(GZT_EXPORT_FILE).toString();
44
24
  if (await tryStat(exportPath)) {
45
25
  options.onProgress?.(`export for ${options.vintage} already downloaded`);
46
26
  return exportPath;
@@ -1 +1 @@
1
- {"version":3,"file":"download.js","sourceRoot":"","sources":["../../l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AAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAwB,MAAM,SAAS,CAAA;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAA;AAgBzD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAoC;IAC9E,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACvE,+DAA+D;IAC/D,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAA;IAEzD,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,UAAU,EAAE,CAAC,cAAc,OAAO,CAAC,OAAO,qBAAqB,CAAC,CAAA;QAExE,OAAO,UAAU,CAAA;IAClB,CAAC;IAED,MAAM,eAAe,CAAC,UAAU,CAAC,CAAA;IAEjC,MAAM,YAAY,CAAC;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,iBAAiB;QAC1B,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AAClB,CAAC"}
@@ -3,41 +3,16 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The streaming pass — every feature into `zoning_area` and into `zoning_cell` — as a unit of work that can
7
- * run over PART of the source.
8
- *
9
- * WHY THIS IS A CHUNK RATHER THAN THE WHOLE FILE. h3's WASM heap cannot be reset from JavaScript, and it
10
- * does not survive an unbounded number of polyfill calls: over a sibling product, runs died after roughly
11
- * 510,000 and 798,000 features on geometry that classifies in milliseconds in a fresh process. A build that
12
- * completes only when fragmentation happens to stay low is not a reproducible build, so the classification
13
- * is bounded BY CONSTRUCTION — one process per range of the authority's own feature ids. This product's
14
- * 85,330 features fit inside the default bound; the bound ships anyway, because determinism by construction
15
- * is not the same fact as determinism by luck.
16
- *
17
- * THE VOCABULARY IS A CENSUS, NOT A CHECK. The declared generic-type domain is closed and the source
18
- * already breaks it — `N/A` appears on 4 rows and in no domain — so an undeclared value is RECORDED as
19
- * observed-but-undeclared rather than throwing. That is the opposite of the sibling layers' rule and it is
20
- * the publisher's own doing: refusing here would refuse the Department's own data. What DOES throw is a
21
- * blank local code, because the local code is the claim.
22
- *
23
- * THE CROSSWALK PAIRS ARE COUNTED HERE BECAUSE THEY ARE THE ARGUMENT FOR THE SCHEMA. If a local code
24
- * determined a generic type, the mapping could ship as an edge table and the local column would be
25
- * redundant. It does not: measured nationally, 52 of 795 (authority, local code) pairs take more than one
26
- * generic type. The chunk reports the pairs it saw and the build refuses to write an edge table while any
27
- * such pair exists, so the empty `zoning_crosswalk_edge` is a checked consequence rather than an omission.
28
- *
29
- * THE CHUNK OWNS NO ARTIFACT. It appends rows to a database the parent created and will seal, and returns
30
- * counts the parent adds up. Chunks run one at a time against that file, so there is no concurrent writer
31
- * and no locking to reason about. The jurisdiction, plan and vocabulary rows are RETURNED rather than
32
- * written: they are per-chunk partials that have to be merged before insertion, and 30 authorities, 63
33
- * plans and about 880 vocabulary rows cross a process boundary for nothing.
6
+ * The streaming pass, bounded to one process per range of the authority's own feature ids because h3's wasm heap cannot be reset from JavaScript and a build that completes only by luck is not reproducible.
34
7
  */
35
8
  import type { DatabaseClient } from "@mailwoman/sqlite/client";
36
9
  import type { ZoningDatabase } from "#schema";
37
- import type { ZoningFeatureSource, ZoningSourceFeature } from "#sdk/ingest/index";
10
+ import type { ZoningFeatureSource, ZoningSourceFeature } from "#sdk/ingest";
38
11
  /**
39
- * One observed vocabulary value: which scheme, which code, the publisher's own label for it, and how many rows carry
40
- * it.
12
+ * One observed vocabulary value.
13
+ *
14
+ * It records the scheme and code.
15
+ * It also records the publisher's label and row count.
41
16
  */
42
17
  export type ObservedTerm = [scheme: string, code: string, label: string, rows: number];
43
18
  /**
@@ -45,8 +20,8 @@ export type ObservedTerm = [scheme: string, code: string, label: string, rows: n
45
20
  */
46
21
  export type CrosswalkPair = [authorityCode: string, localCode: string, crosswalkCodes: string[]];
47
22
  /**
48
- * What one chunk produced. Every field is JSON-serializable, because a chunk normally reports across a process
49
- * boundary.
23
+ * What one chunk produced, every field JSON-serializable because a chunk normally
24
+ * reports across a process boundary.
50
25
  */
51
26
  export interface ZoningChunkResult {
52
27
  features: number;
@@ -60,12 +35,17 @@ export interface ZoningChunkResult {
60
35
  wholeCellRows: number;
61
36
  partialCellRows: number;
62
37
  /**
63
- * `[coverageCell, polygonsReachingIt]` pairs — an array rather than a `Map` so it survives the process boundary.
38
+ * `[coverageCell, polygonsReachingIt]` pairs — an array rather than a `Map`
39
+ * so it survives the process boundary.
64
40
  */
65
41
  observedByCoverageCell: Array<[number, number]>;
66
42
  /**
67
- * Square metres. `signed` is the raw ring sum as published; `nested` is the per-polygon hole-aware reading;
68
- * `allExterior` is what the same rings say read WITHOUT their holes.
43
+ * Square-meter area readings from the polygon rings.
44
+ *
45
+ * `signed` is the raw ring sum as published.
46
+ * `nested` accounts for holes in each polygon.
47
+ *
48
+ * `allExterior` reads the same rings as exterior boundaries without holes.
69
49
  */
70
50
  area: {
71
51
  signedM2: number;
@@ -82,8 +62,7 @@ export interface ZoningChunkResult {
82
62
  nestedHoles: number;
83
63
  adjacentHoles: number;
84
64
  /**
85
- * Features whose exterior was chosen by MAGNITUDE because no ring read as one by orientation — measured at one of
86
- * 85,330. See `ResolvedRingRoles.exteriorByMagnitude`.
65
+ * Features whose exterior was chosen by magnitude because no ring read as one by orientation.
87
66
  */
88
67
  exteriorByMagnitude: number;
89
68
  };
@@ -91,9 +70,6 @@ export interface ZoningChunkResult {
91
70
  * The authorities this chunk saw, by their own code.
92
71
  */
93
72
  jurisdictions: Array<[code: string, name: string]>;
94
- /**
95
- * The plans this chunk saw.
96
- */
97
73
  plans: Array<{
98
74
  planID: string;
99
75
  authorityCode: string;
@@ -119,8 +95,8 @@ export interface IngestZoningChunkOptions {
119
95
  */
120
96
  export declare function ingestZoningChunk(database: DatabaseClient<ZoningDatabase>, options: IngestZoningChunkOptions): Promise<ZoningChunkResult>;
121
97
  /**
122
- * One feature's own contribution, for a caller that wants the numbers without a database — the fixture rung's
123
- * arithmetic and nothing else.
98
+ * One feature's own contribution, for a caller that wants the numbers without a database —
99
+ * the fixture rung's arithmetic and no more.
124
100
  */
125
101
  export declare function featureAreaReadings(feature: ZoningSourceFeature): {
126
102
  signed: number;
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../lib/sdk/ingest/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAcjF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAEtF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAA;AAEhG;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,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,CAIA"}
@@ -3,46 +3,16 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The streaming pass — every feature into `zoning_area` and into `zoning_cell` — as a unit of work that can
7
- * run over PART of the source.
8
- *
9
- * WHY THIS IS A CHUNK RATHER THAN THE WHOLE FILE. h3's WASM heap cannot be reset from JavaScript, and it
10
- * does not survive an unbounded number of polyfill calls: over a sibling product, runs died after roughly
11
- * 510,000 and 798,000 features on geometry that classifies in milliseconds in a fresh process. A build that
12
- * completes only when fragmentation happens to stay low is not a reproducible build, so the classification
13
- * is bounded BY CONSTRUCTION — one process per range of the authority's own feature ids. This product's
14
- * 85,330 features fit inside the default bound; the bound ships anyway, because determinism by construction
15
- * is not the same fact as determinism by luck.
16
- *
17
- * THE VOCABULARY IS A CENSUS, NOT A CHECK. The declared generic-type domain is closed and the source
18
- * already breaks it — `N/A` appears on 4 rows and in no domain — so an undeclared value is RECORDED as
19
- * observed-but-undeclared rather than throwing. That is the opposite of the sibling layers' rule and it is
20
- * the publisher's own doing: refusing here would refuse the Department's own data. What DOES throw is a
21
- * blank local code, because the local code is the claim.
22
- *
23
- * THE CROSSWALK PAIRS ARE COUNTED HERE BECAUSE THEY ARE THE ARGUMENT FOR THE SCHEMA. If a local code
24
- * determined a generic type, the mapping could ship as an edge table and the local column would be
25
- * redundant. It does not: measured nationally, 52 of 795 (authority, local code) pairs take more than one
26
- * generic type. The chunk reports the pairs it saw and the build refuses to write an edge table while any
27
- * such pair exists, so the empty `zoning_crosswalk_edge` is a checked consequence rather than an omission.
28
- *
29
- * THE CHUNK OWNS NO ARTIFACT. It appends rows to a database the parent created and will seal, and returns
30
- * counts the parent adds up. Chunks run one at a time against that file, so there is no concurrent writer
31
- * and no locking to reason about. The jurisdiction, plan and vocabulary rows are RETURNED rather than
32
- * written: they are per-chunk partials that have to be merged before insertion, and 30 authorities, 63
33
- * plans and about 880 vocabulary rows cross a process boundary for nothing.
6
+ * The streaming pass, bounded to one process per range of the authority's own feature ids because h3's wasm heap cannot be reset from JavaScript and a build that completes only by luck is not reproducible.
34
7
  */
35
8
  import { addCoverageCells, encodeRings, ringAreaReadings, ringsBoundingBox, classifyFeatureCells, featureCellRows, } from "@mailwoman/spatial";
36
9
  import { beginBatched } from "@mailwoman/sqlite/batched";
37
10
  import { GZT_CROSSWALK_SCHEME, GZT_PROVENANCE_GRADE, GZT_ROLLUP_SCHEME, localSchemeFor } from "#vocabulary";
38
11
  /**
39
- * Rows per bulk-insert transaction. Chosen for the geometry table, whose rows carry a blob: a larger transaction grows
40
- * the write-ahead file without improving throughput.
12
+ * Rows per bulk-insert transaction, chosen for the geometry table whose rows contain a blob
13
+ * because a larger transaction grows the write-ahead file without improving throughput.
41
14
  */
42
15
  const INSERT_TRANSACTION_ROWS = 5000;
43
- /**
44
- * Features between progress reports.
45
- */
46
16
  const PROGRESS_STRIDE = 5000;
47
17
  /**
48
18
  * Stream one chunk of the source into `database`.
@@ -58,9 +28,9 @@ export async function ingestZoningChunk(database, options) {
58
28
  const observedByCoverageCell = new Map();
59
29
  const jurisdictions = new Map();
60
30
  const plans = new Map();
61
- // KEYED ON A NUL-JOINED PAIR AND NEVER SPLIT BACK APART. A local code is free text that routinely contains spaces —
62
- // `Special Policy Area`, `RA - Rural Area` — so a key a reader had to re-split would mangle exactly the vocabulary
63
- // this layer exists to carry verbatim. The parts ride on the value instead.
31
+ // Keyed on a NUL-joined pair and never split back apart, because a local code is
32
+ // free text that routinely contains spaces and a key a reader had to re-split
33
+ // would mangle the vocabulary this layer preserves verbatim.
64
34
  const vocabulary = new Map();
65
35
  const crosswalkPairs = new Map();
66
36
  let features = 0;
@@ -77,8 +47,8 @@ export async function ingestZoningChunk(database, options) {
77
47
  let exteriorByMagnitude = 0;
78
48
  let adjacentHoles = 0;
79
49
  /**
80
- * Record one observed vocabulary value. The FIRST label wins, because a later row's description is the publisher's
81
- * word for the same code and choosing between them would be this package editing the publisher's vocabulary.
50
+ * Record one observed vocabulary value, keeping the first label so a later row's
51
+ * description leaves the publisher's vocabulary unchanged.
82
52
  */
83
53
  const observe = (scheme, code, label) => {
84
54
  const key = `${scheme}\u0000${code}`;
@@ -103,10 +73,10 @@ export async function ingestZoningChunk(database, options) {
103
73
  nestedHoles += feature.rings.nestedHoles;
104
74
  exteriorByMagnitude += feature.rings.exteriorByMagnitude;
105
75
  adjacentHoles += feature.rings.adjacentHoles;
106
- insertArea.run(feature.areaID, feature.authorityCode, feature.planID, feature.localCode, feature.localDescription, feature.localCodeURL, feature.crosswalkCode, feature.crosswalkCode === null ? null : GZT_CROSSWALK_SCHEME, feature.crosswalkDescription, feature.crosswalkRollup,
107
- // ONE GRADE PER CLAIM. Every row of THIS artifact is `authoritative` — a government department republishing
108
- // local authorities' adopted plans — and an observed land-use layer is a different database with a different
109
- // `layer_manifest.name`, never a row with a second grade in this table.
76
+ insertArea.run(feature.areaID, feature.authorityCode, feature.planID, feature.localCode, feature.localDescription, feature.localCodeURL, feature.crosswalkCode, feature.crosswalkCode ? GZT_CROSSWALK_SCHEME : null, feature.crosswalkDescription, feature.crosswalkRollup,
77
+ // One grade per claim: every row of this artifact is `authoritative`,
78
+ // and an observed land-use layer is a different database with a different
79
+ // `layer_manifest.name` rather than a row with a second grade in this table.
110
80
  GZT_PROVENANCE_GRADE, bbox.minLat, bbox.minLon, bbox.maxLat, bbox.maxLon, feature.rings.ringCount, feature.rings.signedAreaM2, encodeRings(feature.rings.polygons));
111
81
  const classified = classifyFeatureCells(feature.rings.polygons, options.indexResolution, feature.areaID, "zoning cells");
112
82
  if (classified.resolution !== options.indexResolution) {
@@ -121,10 +91,8 @@ export async function ingestZoningChunk(database, options) {
121
91
  partialCellRows++;
122
92
  }
123
93
  }
124
- // COVERAGE IS DERIVED FROM THE UNCOMPACTED CLASSIFICATION, not from the stored rows. A compacted parent spans
125
- // several coverage cells and `addCoverageCells` handles that, but the fringe is where this product's cells almost
126
- // all are — so counting off the stored rows and counting off the classification agree here, and the classification
127
- // is the one that cannot be changed by a compaction decision.
94
+ // Coverage is derived from the uncompacted classification rather than the stored rows,
95
+ // since the classification is the one compaction cannot change.
128
96
  const coverageCells = new Set();
129
97
  for (const cell of classified.whole) {
130
98
  addCoverageCells(coverageCells, cell, classified.resolution, options.coverageResolution);
@@ -147,10 +115,9 @@ export async function ingestZoningChunk(database, options) {
147
115
  currentPlan: feature.currentPlan,
148
116
  });
149
117
  }
150
- // The local vocabulary is per AUTHORITY, because the codes collide across them: `Residential` means one thing in
151
- // Cork County Council's plan and another in Westmeath's.
118
+ // The local vocabulary is per authority, because codes collide across them.
152
119
  observe(localSchemeFor(feature.authorityCode), feature.localCode, feature.localDescription ?? feature.localCode);
153
- if (feature.crosswalkCode !== null) {
120
+ if (feature.crosswalkCode) {
154
121
  observe(GZT_CROSSWALK_SCHEME, feature.crosswalkCode, feature.crosswalkDescription ?? feature.crosswalkCode);
155
122
  const key = `${feature.authorityCode}\u0000${feature.localCode}`;
156
123
  const pair = crosswalkPairs.get(key);
@@ -165,7 +132,7 @@ export async function ingestZoningChunk(database, options) {
165
132
  });
166
133
  }
167
134
  }
168
- if (feature.crosswalkRollup !== null) {
135
+ if (feature.crosswalkRollup) {
169
136
  observe(GZT_ROLLUP_SCHEME, feature.crosswalkRollup, feature.crosswalkRollup);
170
137
  }
171
138
  features++;
@@ -195,8 +162,8 @@ export async function ingestZoningChunk(database, options) {
195
162
  };
196
163
  }
197
164
  /**
198
- * One feature's own contribution, for a caller that wants the numbers without a database — the fixture rung's
199
- * arithmetic and nothing else.
165
+ * One feature's own contribution, for a caller that wants the numbers without a database —
166
+ * the fixture rung's arithmetic and no more.
200
167
  */
201
168
  export function featureAreaReadings(feature) {
202
169
  const areas = ringAreaReadings(feature.rings.polygons);
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../lib/sdk/ingest/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,E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AC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAyB,CAClG;KACD,CAAA;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA4B;IAK/D,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAEtD,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAA;AACpG,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * One chunk of the zoning ingest, as its own process — spawned by `buildZoningDatabase`, never run by hand.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../sdk/ingest/worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -3,14 +3,12 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * One chunk of the zoning ingest, as its own process — spawned by `buildZoningDatabase`, never run by
7
- * hand. The process boundary and the stdout contract live with `runIngestChunkScript`; what stays here is
8
- * only this product's flags and its feature-source constructor.
6
+ * One chunk of the zoning ingest, as its own process — spawned by `buildZoningDatabase`, never run by hand.
9
7
  */
10
8
  import { requiredArgument } from "@mailwoman/core/scripting/arguments";
11
9
  import { INGEST_CHUNK_FLAGS, runIngestChunkScript } from "@mailwoman/core/scripting/ingest-chunk-script";
10
+ import { createExportFeatureSource } from "#sdk/ingest";
12
11
  import { ingestZoningChunk } from "#sdk/ingest/chunk";
13
- import { createExportFeatureSource } from "#sdk/ingest/index";
14
12
  await runIngestChunkScript({
15
13
  context: "zoning ingest-chunk",
16
14
  options: {
@@ -21,11 +19,11 @@ await runIngestChunkScript({
21
19
  },
22
20
  run: async (database, values, chunk) => ingestZoningChunk(database, {
23
21
  source: await createExportFeatureSource({
24
- exportPath: requiredArgument("zoning ingest-chunk", "export", values.export),
25
- ...(values["object-id-from"] === undefined ? {} : { objectIDFrom: Number(values["object-id-from"]) }),
26
- ...(values["object-id-to"] === undefined ? {} : { objectIDTo: Number(values["object-id-to"]) }),
27
- // A RANGE's own count is not knowable up front — the source reports a layer's total and nothing narrower — so
28
- // the chunk asserts nothing about its size and the PARENT checks the sum against the whole file.
22
+ exportPath: requiredArgument("zoning ingest-chunk", "export", values.export ?? null),
23
+ ...(values["object-id-from"] ? { objectIDFrom: Number(values["object-id-from"]) } : {}),
24
+ ...(values["object-id-to"] ? { objectIDTo: Number(values["object-id-to"]) } : {}),
25
+ // A range's count is not knowable up front: the source reports only the layer total,
26
+ // so the parent checks the sum against the whole file.
29
27
  declaredFeatureCount: 0,
30
28
  }),
31
29
  indexResolution: chunk.indexResolution,
@@ -33,4 +31,4 @@ await runIngestChunkScript({
33
31
  onProgress: chunk.onProgress,
34
32
  }),
35
33
  });
36
- //# sourceMappingURL=ingest-chunk.js.map
34
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../sdk/ingest/worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AAIxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,oBAAoB,CAAC;IAC1B,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE;QACR,GAAG,kBAAkB;QACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACpC,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAClC;IACD,GAAG,EAAE,KAAK,EAAE,QAAwC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CACtE,iBAAiB,CAAC,QAAQ,EAAE;QAC3B,MAAM,EAAE,MAAM,yBAAyB,CAAC;YACvC,UAAU,EAAE,gBAAgB,CAAC,qBAAqB,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;YACpF,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvF,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjF,qFAAqF;YACrF,uDAAuD;YACvD,oBAAoB,EAAE,CAAC;SACvB,CAAC;QACF,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,UAAU,EAAE,KAAK,CAAC,UAAU;KAC5B,CAAC;CACH,CAAC,CAAA"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Streams the Department's bulk zoning export through ogr2ogr as reprojected WGS84 features.
7
+ *
8
+ * The stream uses CSV with WKT geometry because the source marks holes by ring orientation. GDAL's
9
+ * GeoJSON writer rewinds every ring to RFC 7946 order. That turns holes into zoned areas. The source is
10
+ * in EPSG:2157, declared in a legacy top-level `crs` member that GDAL honors.
11
+ */
12
+ import { type OGRLayerSchema } from "@mailwoman/spatial/tools/ogr";
13
+ import { type ResolvedRingRoles } from "#rings";
14
+ /**
15
+ * One zoning feature, reprojected to WGS84 with its hole roles resolved.
16
+ */
17
+ export interface ZoningSourceFeature {
18
+ /**
19
+ * The authority's `objectid` as a string.
20
+ */
21
+ areaID: string;
22
+ /**
23
+ * The `LA_CODE` value, verbatim.
24
+ * Fingal's unusual `Fl` code is kept as published.
25
+ */
26
+ authorityCode: string;
27
+ authorityName: string;
28
+ planID: string;
29
+ planName: string;
30
+ planLevel: string;
31
+ planFrom: string | null;
32
+ planTo: string | null;
33
+ currentPlan: number;
34
+ /**
35
+ * The `ZONE_ORIG` value, verbatim.
36
+ *
37
+ * Case and trailing spaces are kept because some codes differ only by them.
38
+ */
39
+ localCode: string;
40
+ localDescription: string | null;
41
+ localCodeURL: string | null;
42
+ /**
43
+ * The `ZONE_GZT` value.
44
+ *
45
+ * It is the Department's national generic type for this polygon.
46
+ */
47
+ crosswalkCode: string | null;
48
+ crosswalkDescription: string | null;
49
+ /**
50
+ * The `SZO` value.
51
+ * It is the coarser national code as published.
52
+ */
53
+ crosswalkRollup: string | null;
54
+ /**
55
+ * The rings with hole roles resolved from their orientation, plus a record of that resolution.
56
+ */
57
+ rings: ResolvedRingRoles;
58
+ }
59
+ /**
60
+ * Options for reading the bulk export.
61
+ */
62
+ export interface ZoningIngestOptions {
63
+ /**
64
+ * The path of the bulk GeoJSON export.
65
+ */
66
+ exportPath: string;
67
+ /**
68
+ * The maximum number of features to read.
69
+ * Fixture and smoke runs use it.
70
+ */
71
+ limit?: number;
72
+ /**
73
+ * The EPSG code that the source must declare.
74
+ * A different code means the product has changed.
75
+ */
76
+ expectEPSG?: number;
77
+ /**
78
+ * The extent that every reprojected vertex must fall inside.
79
+ *
80
+ * @defaultValue the Department's declared extent.
81
+ */
82
+ declaredBBox?: readonly [number, number, number, number];
83
+ /**
84
+ * The inclusive range of authority `objectid` values to read.
85
+ *
86
+ * The h3 wasm heap cannot be reset from JavaScript, so the build runs one child process per range.
87
+ * It uses `objectid` ranges because they select the same features on every run.
88
+ *
89
+ * Every range costs a full scan of the export, because the export is one GeoJSON document.
90
+ */
91
+ objectIDFrom?: number;
92
+ objectIDTo?: number;
93
+ /**
94
+ * Restricts the read to one local authority's `LA_CODE`, for smoke runs.
95
+ */
96
+ authorityCode?: string;
97
+ }
98
+ /**
99
+ * The attribute columns that the ingest reads.
100
+ * Every column is required.
101
+ */
102
+ export declare const ZONING_SOURCE_FIELDS: ReadonlyArray<string>;
103
+ /**
104
+ * Reads the source's declared projection, feature count and field list.
105
+ *
106
+ * @throws {Error} When the export is unreadable, when its declared EPSG code differs
107
+ * from `expectEPSG`, or when it lacks a field that the ingest reads.
108
+ */
109
+ export declare function readZoningSourceIdentity(options: ZoningIngestOptions): Promise<OGRLayerSchema>;
110
+ /**
111
+ * Streams the export through ogr2ogr as reprojected WKT and checks every vertex against the declared extent.
112
+ *
113
+ * The extent check catches swapped coordinate axes.
114
+ * The projection check misses that error.
115
+ *
116
+ * @throws {Error} When ogr2ogr fails, when a feature has no geometry or a blank local code, when
117
+ * a reprojected vertex falls outside the declared extent, or when a feature's rings have no exterior.
118
+ */
119
+ export declare function readZoningFeatures(options: ZoningIngestOptions): AsyncGenerator<ZoningSourceFeature>;
120
+ /**
121
+ * Supplies a zoning build with its features and the source's declared identity.
122
+ *
123
+ * The builder takes this instead of a path so that fixtures can run the database
124
+ * build without network access or GDAL.
125
+ */
126
+ export interface ZoningFeatureSource {
127
+ /**
128
+ * The feature count that the source declares.
129
+ *
130
+ * The build throws when its streamed total differs from this count.
131
+ */
132
+ declaredFeatureCount: number;
133
+ epsg: number;
134
+ /**
135
+ * A description of where the features came from, such as the export path.
136
+ */
137
+ origin: string;
138
+ features: () => AsyncIterable<ZoningSourceFeature>;
139
+ }
140
+ /**
141
+ * Options for {@link createExportFeatureSource}.
142
+ */
143
+ export interface ExportSourceOptions extends ZoningIngestOptions {
144
+ declaredFeatureCount?: number;
145
+ }
146
+ /**
147
+ * Creates a {@link ZoningFeatureSource} for the bulk export.
148
+ *
149
+ * It reads the export's identity immediately and streams features when asked.
150
+ */
151
+ export declare function createExportFeatureSource(options: ExportSourceOptions): Promise<ZoningFeatureSource>;
152
+ //# sourceMappingURL=ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../sdk/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAKxF,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAGjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;OAIG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC;;;OAGG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,UAAU,EAAE,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