@mailwoman/zoning 9.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 (82) hide show
  1. package/README.md +315 -0
  2. package/lib/index.ts +616 -0
  3. package/lib/ring-roles.ts +233 -0
  4. package/lib/rings.ts +34 -0
  5. package/lib/schema.ts +449 -0
  6. package/lib/scripts/ingest-chunk.ts +41 -0
  7. package/lib/sdk/build-zoning.ts +790 -0
  8. package/lib/sdk/cells.ts +276 -0
  9. package/lib/sdk/client.ts +335 -0
  10. package/lib/sdk/download.ts +78 -0
  11. package/lib/sdk/index.ts +15 -0
  12. package/lib/sdk/ingest-chunk.ts +360 -0
  13. package/lib/sdk/ingest.ts +402 -0
  14. package/lib/sdk/measure-resolutions.ts +100 -0
  15. package/lib/sdk/verify.ts +350 -0
  16. package/lib/test-kit.ts +207 -0
  17. package/lib/vocabulary.ts +342 -0
  18. package/out/index.d.ts +257 -0
  19. package/out/index.d.ts.map +1 -0
  20. package/out/index.js +325 -0
  21. package/out/index.js.map +1 -0
  22. package/out/ring-roles.d.ts +88 -0
  23. package/out/ring-roles.d.ts.map +1 -0
  24. package/out/ring-roles.js +151 -0
  25. package/out/ring-roles.js.map +1 -0
  26. package/out/rings.d.ts +22 -0
  27. package/out/rings.d.ts.map +1 -0
  28. package/out/rings.js +22 -0
  29. package/out/rings.js.map +1 -0
  30. package/out/schema.d.ts +325 -0
  31. package/out/schema.d.ts.map +1 -0
  32. package/out/schema.js +186 -0
  33. package/out/schema.js.map +1 -0
  34. package/out/scripts/ingest-chunk.d.ts +11 -0
  35. package/out/scripts/ingest-chunk.d.ts.map +1 -0
  36. package/out/scripts/ingest-chunk.js +36 -0
  37. package/out/scripts/ingest-chunk.js.map +1 -0
  38. package/out/sdk/build-zoning.d.ts +283 -0
  39. package/out/sdk/build-zoning.d.ts.map +1 -0
  40. package/out/sdk/build-zoning.js +462 -0
  41. package/out/sdk/build-zoning.js.map +1 -0
  42. package/out/sdk/cells.d.ts +137 -0
  43. package/out/sdk/cells.d.ts.map +1 -0
  44. package/out/sdk/cells.js +176 -0
  45. package/out/sdk/cells.js.map +1 -0
  46. package/out/sdk/client.d.ts +151 -0
  47. package/out/sdk/client.d.ts.map +1 -0
  48. package/out/sdk/client.js +239 -0
  49. package/out/sdk/client.js.map +1 -0
  50. package/out/sdk/download.d.ts +51 -0
  51. package/out/sdk/download.d.ts.map +1 -0
  52. package/out/sdk/download.js +57 -0
  53. package/out/sdk/download.js.map +1 -0
  54. package/out/sdk/index.d.ts +15 -0
  55. package/out/sdk/index.d.ts.map +1 -0
  56. package/out/sdk/index.js +15 -0
  57. package/out/sdk/index.js.map +1 -0
  58. package/out/sdk/ingest-chunk.d.ts +130 -0
  59. package/out/sdk/ingest-chunk.d.ts.map +1 -0
  60. package/out/sdk/ingest-chunk.js +206 -0
  61. package/out/sdk/ingest-chunk.js.map +1 -0
  62. package/out/sdk/ingest.d.ts +191 -0
  63. package/out/sdk/ingest.d.ts.map +1 -0
  64. package/out/sdk/ingest.js +238 -0
  65. package/out/sdk/ingest.js.map +1 -0
  66. package/out/sdk/measure-resolutions.d.ts +51 -0
  67. package/out/sdk/measure-resolutions.d.ts.map +1 -0
  68. package/out/sdk/measure-resolutions.js +64 -0
  69. package/out/sdk/measure-resolutions.js.map +1 -0
  70. package/out/sdk/verify.d.ts +176 -0
  71. package/out/sdk/verify.d.ts.map +1 -0
  72. package/out/sdk/verify.js +202 -0
  73. package/out/sdk/verify.js.map +1 -0
  74. package/out/test-kit.d.ts +97 -0
  75. package/out/test-kit.d.ts.map +1 -0
  76. package/out/test-kit.js +180 -0
  77. package/out/test-kit.js.map +1 -0
  78. package/out/vocabulary.d.ts +221 -0
  79. package/out/vocabulary.d.ts.map +1 -0
  80. package/out/vocabulary.js +299 -0
  81. package/out/vocabulary.js.map +1 -0
  82. package/package.json +245 -0
@@ -0,0 +1,325 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed schema for `zoning-ireland.db` — the two-tier polygon layer: the authority's unsimplified rings as
7
+ * the truth table, an H3 cell table above them as the summary, the plan and jurisdiction a zone belongs to,
8
+ * the published vocabularies, and the layer-contract tables from `@mailwoman/core/layers`.
9
+ *
10
+ * THE LOCAL CODE IS `NOT NULL` AND THE CROSSWALK IS NULLABLE, WHICH IS THE VOCABULARY DECISION AS A
11
+ * CONSTRAINT. A source with no crosswalk produces a complete row; a source with no local code does not. The
12
+ * Department's own item description is what this transcribes: its national scheme "complements (rather than
13
+ * replaces) the existing statutory zoning used for each individual plan".
14
+ *
15
+ * `provenance_grade` IS A COLUMN WITH A `CHECK`, NOT A CONVENTION. `NOT NULL` alone accepts `''`, and a
16
+ * blank matches neither half of every read that splits on grade — so the constraint refuses a blank as well
17
+ * as an unknown value. This is `packages/filer`'s discipline applied unchanged, and the reason it is
18
+ * compulsory here is licensing as much as epistemics: an observed land-use layer is ODbL, and merging one
19
+ * of its rows into this table would relicense the table.
20
+ *
21
+ * `signed_area_m2` IS THE INGEST'S OWN RECEIPT AND ITS SIGN IS LOAD-BEARING. The service encodes hole roles
22
+ * by ring orientation with clockwise as the exterior, so a correctly-read feature stores a POSITIVE signed
23
+ * sum; the national total of those sums is what the build compares against the Department's own
24
+ * `Shape__Area` statistic. Read with the holes it is 5,444.5 km²; read without them, 5,666.6 km².
25
+ *
26
+ * `WITHOUT ROWID` ON THE CELL TABLE AND NEVER ON THE GEOMETRY TABLE. Small fixed-width rows probed by their
27
+ * exact primary key belong in the B-tree; a row carrying a geometry blob does not — clustering it into the
28
+ * B-tree makes every index page a geometry page.
29
+ *
30
+ * THE WHOLE-CELL SET IS COMPACTED PER FEATURE, SO IT IS MIXED-RESOLUTION. A row therefore carries its own
31
+ * `resolution`, and a probe walks `cellToParent` from the index resolution up to the coarsest resolution
32
+ * present. `layer_coverage` is NOT compacted and stays single-resolution, because `recoverShortCellResolution`
33
+ * recovers one resolution from the stored cells and throws on a table that mixes them.
34
+ */
35
+ import type { LayerContractDatabase } from "@mailwoman/core/layers";
36
+ import { type Kysely } from "kysely";
37
+ /**
38
+ * Whether an H3 cell lies wholly inside a zoning polygon, or is crossed by its boundary.
39
+ */
40
+ export declare const ZoningCellContainment: {
41
+ /**
42
+ * Every point in the cell is inside the zone. Answered from the index alone, with no geometry read.
43
+ */
44
+ readonly Whole: "whole";
45
+ /**
46
+ * The zone boundary crosses the cell. The index has narrowed the candidate polygons; the point test decides.
47
+ */
48
+ readonly Partial: "partial";
49
+ };
50
+ export type ZoningCellContainment = (typeof ZoningCellContainment)[keyof typeof ZoningCellContainment];
51
+ /**
52
+ * One authority zoning polygon, verbatim. A plain rowid table: it holds a geometry blob, which is the one shape
53
+ * `WITHOUT ROWID` hurts.
54
+ */
55
+ export interface ZoningAreaTable {
56
+ /**
57
+ * The authority's own feature id, as published. Unique across the product — measured, `OBJECTID` runs 1 to 85,330
58
+ * with no repeat — so it needs no scoping prefix, and a prefix would put this package's key into a column that claims
59
+ * to be the publisher's.
60
+ */
61
+ area_id: string;
62
+ /**
63
+ * The authority that adopted the plan. FK to `zoning_jurisdiction`.
64
+ */
65
+ jurisdiction_id: string;
66
+ /**
67
+ * The plan this zone belongs to. FK to `zoning_plan`. A zone without a plan is not a claim: it exists inside a named
68
+ * Development Plan or Local Area Plan with a stated validity window, and a layer that dropped the plan and kept the
69
+ * zone would be answering a question no authority asked.
70
+ */
71
+ plan_id: string;
72
+ /**
73
+ * `ZONE_ORIG` — THE AUTHORITY'S OWN ZONE CODE, VERBATIM, in its own spelling including case and trailing space.
74
+ * Compared case-insensitively where it must be compared; never stored normalized.
75
+ */
76
+ local_code: string;
77
+ /**
78
+ * `ZONE_DESC` — the authority's own description of that code.
79
+ */
80
+ local_description: string | null;
81
+ /**
82
+ * `ZONE_LINK` — the authority's own link to the plan text. A live host, unlike the crosswalk's.
83
+ */
84
+ local_code_url: string | null;
85
+ /**
86
+ * `ZONE_GZT` — the Department's national generic type, BESIDE the local code and never instead of it. NULL where a
87
+ * publisher ships no crosswalk.
88
+ */
89
+ crosswalk_code: string | null;
90
+ /**
91
+ * Which crosswalk `crosswalk_code` belongs to. NULL with the above.
92
+ */
93
+ crosswalk_scheme: string | null;
94
+ /**
95
+ * `GZT_DESC` — the Department's own description of the generic type, as published on the row.
96
+ */
97
+ crosswalk_description: string | null;
98
+ /**
99
+ * `SZO` — a coarser code from the SAME authority, carried as published rather than derived.
100
+ */
101
+ crosswalk_rollup: string | null;
102
+ /**
103
+ * One of {@link ProvenanceGrade}. `NOT NULL` with a `CHECK` that refuses a blank.
104
+ */
105
+ provenance_grade: string;
106
+ min_lat: number;
107
+ min_lon: number;
108
+ max_lat: number;
109
+ max_lon: number;
110
+ /**
111
+ * How many rings the source published for this feature — with `signed_area_m2`, the ingest's own receipt that the
112
+ * orientation was read rather than assumed.
113
+ */
114
+ ring_count: number;
115
+ /**
116
+ * The signed ring sum, in square metres, POSITIVE under this service's clockwise-exterior convention.
117
+ */
118
+ signed_area_m2: number;
119
+ /**
120
+ * The authority's ring coordinates, UNSIMPLIFIED, with hole roles RESOLVED — see `ring-roles.ts` for the resolution
121
+ * and `rings.ts` for the layout and the point test.
122
+ */
123
+ rings: Uint8Array;
124
+ }
125
+ /**
126
+ * The plan a zone lives inside.
127
+ */
128
+ export interface ZoningPlanTable {
129
+ plan_id: string;
130
+ jurisdiction_id: string;
131
+ /**
132
+ * `PLAN_NAME`, verbatim — "Fingal Development Plan 2023-2029".
133
+ */
134
+ plan_name: string;
135
+ /**
136
+ * `PLAN_LEVEL` — the Department's own vocabulary: `DP`, `LAP` or `SDZ`.
137
+ */
138
+ plan_level: string;
139
+ valid_from: string | null;
140
+ /**
141
+ * `PLAN_TO`, the plan's own stated end.
142
+ */
143
+ valid_to: string | null;
144
+ /**
145
+ * `CURRENT_PLAN`, carried as published.
146
+ *
147
+ * IT DOES NOT MEAN "IN FORCE TODAY". Every row of the Current layer carries `1`, which the domain defines as `Current
148
+ * plan` against `Expired and not replaced` and `Expired and replaced` — so it means "not superseded". Whether the
149
+ * plan's own window has closed is `valid_to`, and it is a separate fact.
150
+ */
151
+ current_plan: number;
152
+ }
153
+ /**
154
+ * Who adopted the plan.
155
+ */
156
+ export interface ZoningJurisdictionTable {
157
+ jurisdiction_id: string;
158
+ name: string;
159
+ /**
160
+ * The publisher's own code, verbatim. `Fl` for Fingal against `CL`, `CO`, `DU` for the rest — DO NOT REPAIR.
161
+ */
162
+ source_code: string;
163
+ country: string;
164
+ }
165
+ /**
166
+ * A publisher's declared vocabulary, as shipped, per scheme — plus the values the DATA uses that the publisher never
167
+ * declared.
168
+ */
169
+ export interface ZoningVocabularyTable {
170
+ /**
171
+ * `IE-GZT`, `IE-SZO`, `IE-PLAN-LEVEL`, or `IE-LOCAL:<authority code>`.
172
+ */
173
+ scheme: string;
174
+ code: string;
175
+ /**
176
+ * The publisher's own words. For an observed-but-undeclared code this is the description the data carries on its
177
+ * rows, or the code itself where the data carries none — never a label this package wrote.
178
+ */
179
+ label: string;
180
+ /**
181
+ * The publisher's own definition, where it is retrievable.
182
+ */
183
+ definition: string | null;
184
+ /**
185
+ * NULL for the Irish generic types. Every one of the 85,330 rows links its definition to `viewer.myplan.ie`, which
186
+ * has no A or AAAA record, and three candidate replacements on the live host answer HTTP 404 — so the definitions
187
+ * behind the 54 code-to-label pairs were not retrievable and this column is not filled in with a plausible one.
188
+ */
189
+ definition_url: string | null;
190
+ /**
191
+ * `1` where the publisher DECLARES this code in its own domain, `0` where the code appears only in the data.
192
+ *
193
+ * FOLDING THE TWO WOULD EITHER HIDE A SOURCE-SCHEMA CHANGE OR INVENT A DECLARATION. Ireland declares 54 generic types
194
+ * and its data uses 55: `N/A` appears on 4 rows and in no domain.
195
+ */
196
+ declared: number;
197
+ /**
198
+ * How many rows of this artifact carry the code. A census a reader checks a closed domain against, rather than a
199
+ * claim about the world.
200
+ */
201
+ observed_rows: number;
202
+ }
203
+ /**
204
+ * A publisher's OWN mapping between two schemes, where it publishes one AS A TABLE.
205
+ *
206
+ * EMPTY FOR IRELAND, AND THE EMPTINESS IS A MEASUREMENT. The Department's generic type is assigned PER POLYGON, not per
207
+ * code: 52 of the 795 (authority, local code) pairs take more than one generic type inside a single authority — Cork
208
+ * County Council's `Special Policy Area` takes 14 and its `Green Infrastructure` 12 — so the mapping is not a function
209
+ * of the pair and no edge table can carry it without inventing one. The mapping lives on `zoning_area`, per row, where
210
+ * the Department put it. {@linkcode assertCrosswalkIsNotATable} refuses a build that would write edges while such a
211
+ * pair exists.
212
+ */
213
+ export interface ZoningCrosswalkEdgeTable {
214
+ from_scheme: string;
215
+ from_code: string;
216
+ to_scheme: string;
217
+ to_code: string;
218
+ /**
219
+ * The body that authored THIS edge. Never us.
220
+ */
221
+ authored_by: string;
222
+ }
223
+ /**
224
+ * Per (cell, polygon): does the polygon cover the whole cell, or only part of it?
225
+ *
226
+ * KEYED ON THE POLYGON RATHER THAN ON A CODE, because a zoning answer IS the polygon — its local code, its plan and its
227
+ * authority are per feature, and two authorities' plans can name the same code for different things.
228
+ */
229
+ export interface ZoningCellTable {
230
+ /**
231
+ * 48-bit short H3 cell. Mixed-resolution: `whole` rows are compacted parent-ward, `partial` rows stay at the
232
+ * resolution the feature was indexed at.
233
+ */
234
+ h3_cell: number;
235
+ /**
236
+ * The resolution this row's cell was captured at. A short cell does not name its own resolution, and a table that
237
+ * mixes them cannot be probed without it.
238
+ */
239
+ resolution: number;
240
+ area_id: string;
241
+ /**
242
+ * One of {@link ZoningCellContainment}.
243
+ */
244
+ containment: string;
245
+ }
246
+ /**
247
+ * The authority's own statement of what it MAPPED — one row per statement, never derived from the zoning polygons.
248
+ *
249
+ * EMPTY IN THIS EDITION, AND ITS EMPTINESS IS THE CLAIM. The Department states "Awaiting data for some Local
250
+ * Authorities
251
+ *
252
+ * - Please see map viewer for coverage details" and publishes that detail only inside a map application, so there is no
253
+ * footprint to record and `layer_coverage` carries `basis = source_present`. Donegal County Council's absence — the
254
+ * one local authority of 31 missing from the layer — was recovered by measuring `LA_CODE`, not read from a
255
+ * statement.
256
+ *
257
+ * Deriving a footprint from the union of the zoning polygons is forbidden: the union of zoned areas is not the area the
258
+ * authority examined, and the difference is the whole content of a negative answer. One authority's drafting convention
259
+ * moves the national zoned-area figure by 41% on its own — Meath County Council zones its entire rural remainder as one
260
+ * 2,232 km² polygon, against 32.5 km² for the next largest in the country — so the union is not even a stable shape.
261
+ */
262
+ export interface ZoningMappedExtentTable {
263
+ extent_id: string;
264
+ source: string;
265
+ statement: string;
266
+ statement_url: string;
267
+ effective_date: string | null;
268
+ min_lat: number;
269
+ min_lon: number;
270
+ max_lat: number;
271
+ max_lon: number;
272
+ }
273
+ /**
274
+ * Pass to `new DatabaseClient<ZoningDatabase>(...)`.
275
+ */
276
+ export interface ZoningDatabase extends LayerContractDatabase {
277
+ zoning_area: ZoningAreaTable;
278
+ zoning_plan: ZoningPlanTable;
279
+ zoning_jurisdiction: ZoningJurisdictionTable;
280
+ zoning_vocabulary: ZoningVocabularyTable;
281
+ zoning_crosswalk_edge: ZoningCrosswalkEdgeTable;
282
+ zoning_cell: ZoningCellTable;
283
+ zoning_mapped_extent: ZoningMappedExtentTable;
284
+ }
285
+ /**
286
+ * The slice of a Kysely handle the DDL touches. Same reasoning as `LayerContractHandle`: Kysely is invariant in its
287
+ * schema parameter, so naming only the members these functions call lets a caller pass its own wider handle.
288
+ */
289
+ export type ZoningSchemaHandle = Pick<Kysely<ZoningDatabase>, "schema">;
290
+ /**
291
+ * Create `zoning_area`. A PLAIN rowid table on purpose — the `rings` blob is exactly the payload `WITHOUT ROWID`
292
+ * penalizes.
293
+ */
294
+ export declare function createZoningAreaTable(db: ZoningSchemaHandle): Promise<void>;
295
+ /**
296
+ * Create `zoning_plan`.
297
+ */
298
+ export declare function createZoningPlanTable(db: ZoningSchemaHandle): Promise<void>;
299
+ /**
300
+ * Create `zoning_jurisdiction`.
301
+ */
302
+ export declare function createZoningJurisdictionTable(db: ZoningSchemaHandle): Promise<void>;
303
+ /**
304
+ * Create `zoning_vocabulary`.
305
+ */
306
+ export declare function createZoningVocabularyTable(db: ZoningSchemaHandle): Promise<void>;
307
+ /**
308
+ * Create `zoning_crosswalk_edge`. Created empty for Ireland — see the interface's docstring.
309
+ */
310
+ export declare function createZoningCrosswalkEdgeTable(db: ZoningSchemaHandle): Promise<void>;
311
+ /**
312
+ * Create `zoning_cell` — the summary tier. Small fixed-width rows probed by their exact primary key, which is the
313
+ * `WITHOUT ROWID` shape.
314
+ */
315
+ export declare function createZoningCellTable(db: ZoningSchemaHandle): Promise<void>;
316
+ /**
317
+ * Create `zoning_mapped_extent`. Created empty, and the reader refuses a stronger coverage basis while it stays that
318
+ * way — see the interface's docstring.
319
+ */
320
+ export declare function createZoningMappedExtentTable(db: ZoningSchemaHandle): Promise<void>;
321
+ /**
322
+ * Every domain table this layer owns, in dependency order.
323
+ */
324
+ export declare function createZoningTables(db: ZoningSchemaHandle): Promise<void>;
325
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,qBAAqB;IACjC;;OAEG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAA;AAEtG;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;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CAAA;IACxC,qBAAqB,EAAE,wBAAwB,CAAA;IAC/C,WAAW,EAAE,eAAe,CAAA;IAC5B,oBAAoB,EAAE,uBAAuB,CAAA;CAC7C;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEvE;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjF;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWjF;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzF;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvF;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU1F;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWjF;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAazF;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ9E"}
package/out/schema.js ADDED
@@ -0,0 +1,186 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed schema for `zoning-ireland.db` — the two-tier polygon layer: the authority's unsimplified rings as
7
+ * the truth table, an H3 cell table above them as the summary, the plan and jurisdiction a zone belongs to,
8
+ * the published vocabularies, and the layer-contract tables from `@mailwoman/core/layers`.
9
+ *
10
+ * THE LOCAL CODE IS `NOT NULL` AND THE CROSSWALK IS NULLABLE, WHICH IS THE VOCABULARY DECISION AS A
11
+ * CONSTRAINT. A source with no crosswalk produces a complete row; a source with no local code does not. The
12
+ * Department's own item description is what this transcribes: its national scheme "complements (rather than
13
+ * replaces) the existing statutory zoning used for each individual plan".
14
+ *
15
+ * `provenance_grade` IS A COLUMN WITH A `CHECK`, NOT A CONVENTION. `NOT NULL` alone accepts `''`, and a
16
+ * blank matches neither half of every read that splits on grade — so the constraint refuses a blank as well
17
+ * as an unknown value. This is `packages/filer`'s discipline applied unchanged, and the reason it is
18
+ * compulsory here is licensing as much as epistemics: an observed land-use layer is ODbL, and merging one
19
+ * of its rows into this table would relicense the table.
20
+ *
21
+ * `signed_area_m2` IS THE INGEST'S OWN RECEIPT AND ITS SIGN IS LOAD-BEARING. The service encodes hole roles
22
+ * by ring orientation with clockwise as the exterior, so a correctly-read feature stores a POSITIVE signed
23
+ * sum; the national total of those sums is what the build compares against the Department's own
24
+ * `Shape__Area` statistic. Read with the holes it is 5,444.5 km²; read without them, 5,666.6 km².
25
+ *
26
+ * `WITHOUT ROWID` ON THE CELL TABLE AND NEVER ON THE GEOMETRY TABLE. Small fixed-width rows probed by their
27
+ * exact primary key belong in the B-tree; a row carrying a geometry blob does not — clustering it into the
28
+ * B-tree makes every index page a geometry page.
29
+ *
30
+ * THE WHOLE-CELL SET IS COMPACTED PER FEATURE, SO IT IS MIXED-RESOLUTION. A row therefore carries its own
31
+ * `resolution`, and a probe walks `cellToParent` from the index resolution up to the coarsest resolution
32
+ * present. `layer_coverage` is NOT compacted and stays single-resolution, because `recoverShortCellResolution`
33
+ * recovers one resolution from the stored cells and throws on a table that mixes them.
34
+ */
35
+ import { sql } from "kysely";
36
+ /**
37
+ * Whether an H3 cell lies wholly inside a zoning polygon, or is crossed by its boundary.
38
+ */
39
+ export const ZoningCellContainment = {
40
+ /**
41
+ * Every point in the cell is inside the zone. Answered from the index alone, with no geometry read.
42
+ */
43
+ Whole: "whole",
44
+ /**
45
+ * The zone boundary crosses the cell. The index has narrowed the candidate polygons; the point test decides.
46
+ */
47
+ Partial: "partial",
48
+ };
49
+ /**
50
+ * Create `zoning_area`. A PLAIN rowid table on purpose — the `rings` blob is exactly the payload `WITHOUT ROWID`
51
+ * penalizes.
52
+ */
53
+ export async function createZoningAreaTable(db) {
54
+ await db.schema
55
+ .createTable("zoning_area")
56
+ .addColumn("area_id", "text", (c) => c.primaryKey())
57
+ .addColumn("jurisdiction_id", "text", (c) => c.notNull())
58
+ .addColumn("plan_id", "text", (c) => c.notNull())
59
+ .addColumn("local_code", "text", (c) => c.notNull())
60
+ .addColumn("local_description", "text")
61
+ .addColumn("local_code_url", "text")
62
+ .addColumn("crosswalk_code", "text")
63
+ .addColumn("crosswalk_scheme", "text")
64
+ .addColumn("crosswalk_description", "text")
65
+ .addColumn("crosswalk_rollup", "text")
66
+ .addColumn("provenance_grade", "text", (c) => c.notNull())
67
+ .addColumn("min_lat", "real", (c) => c.notNull())
68
+ .addColumn("min_lon", "real", (c) => c.notNull())
69
+ .addColumn("max_lat", "real", (c) => c.notNull())
70
+ .addColumn("max_lon", "real", (c) => c.notNull())
71
+ .addColumn("ring_count", "integer", (c) => c.notNull())
72
+ .addColumn("signed_area_m2", "real", (c) => c.notNull())
73
+ .addColumn("rings", "blob", (c) => c.notNull())
74
+ // ONE GRADE PER CLAIM, AND A BLANK IS NOT ONE. `NOT NULL` alone accepts `''`, which matches neither half of every
75
+ // read that splits on grade — so the value set and the blank are refused separately, and the second half is the one
76
+ // a schema without it loses.
77
+ .addCheckConstraint("zoning_area_provenance_grade_declared", sql `provenance_grade in ('authoritative', 'inferred') and trim(provenance_grade) != ''`)
78
+ // The local code is what this layer exists to repeat, so an empty one is refused at the storage layer rather than
79
+ // only at the ingest: a blank would read as a zone the authority named nothing.
80
+ .addCheckConstraint("zoning_area_local_code_not_blank", sql `trim(local_code) != ''`)
81
+ .execute();
82
+ }
83
+ /**
84
+ * Create `zoning_plan`.
85
+ */
86
+ export async function createZoningPlanTable(db) {
87
+ await db.schema
88
+ .createTable("zoning_plan")
89
+ .addColumn("plan_id", "text", (c) => c.primaryKey())
90
+ .addColumn("jurisdiction_id", "text", (c) => c.notNull())
91
+ .addColumn("plan_name", "text", (c) => c.notNull())
92
+ .addColumn("plan_level", "text", (c) => c.notNull())
93
+ .addColumn("valid_from", "text")
94
+ .addColumn("valid_to", "text")
95
+ .addColumn("current_plan", "integer", (c) => c.notNull())
96
+ .execute();
97
+ }
98
+ /**
99
+ * Create `zoning_jurisdiction`.
100
+ */
101
+ export async function createZoningJurisdictionTable(db) {
102
+ await db.schema
103
+ .createTable("zoning_jurisdiction")
104
+ .addColumn("jurisdiction_id", "text", (c) => c.primaryKey())
105
+ .addColumn("name", "text", (c) => c.notNull())
106
+ .addColumn("source_code", "text", (c) => c.notNull())
107
+ .addColumn("country", "text", (c) => c.notNull())
108
+ .execute();
109
+ }
110
+ /**
111
+ * Create `zoning_vocabulary`.
112
+ */
113
+ export async function createZoningVocabularyTable(db) {
114
+ await db.schema
115
+ .createTable("zoning_vocabulary")
116
+ .addColumn("scheme", "text", (c) => c.notNull())
117
+ .addColumn("code", "text", (c) => c.notNull())
118
+ .addColumn("label", "text", (c) => c.notNull())
119
+ .addColumn("definition", "text")
120
+ .addColumn("definition_url", "text")
121
+ .addColumn("declared", "integer", (c) => c.notNull())
122
+ .addColumn("observed_rows", "integer", (c) => c.notNull())
123
+ .addPrimaryKeyConstraint("zoning_vocabulary_pk", ["scheme", "code"])
124
+ .execute();
125
+ }
126
+ /**
127
+ * Create `zoning_crosswalk_edge`. Created empty for Ireland — see the interface's docstring.
128
+ */
129
+ export async function createZoningCrosswalkEdgeTable(db) {
130
+ await db.schema
131
+ .createTable("zoning_crosswalk_edge")
132
+ .addColumn("from_scheme", "text", (c) => c.notNull())
133
+ .addColumn("from_code", "text", (c) => c.notNull())
134
+ .addColumn("to_scheme", "text", (c) => c.notNull())
135
+ .addColumn("to_code", "text", (c) => c.notNull())
136
+ .addColumn("authored_by", "text", (c) => c.notNull())
137
+ .addPrimaryKeyConstraint("zoning_crosswalk_edge_pk", ["from_scheme", "from_code", "to_scheme", "to_code"])
138
+ .execute();
139
+ }
140
+ /**
141
+ * Create `zoning_cell` — the summary tier. Small fixed-width rows probed by their exact primary key, which is the
142
+ * `WITHOUT ROWID` shape.
143
+ */
144
+ export async function createZoningCellTable(db) {
145
+ await db.schema
146
+ .createTable("zoning_cell")
147
+ .addColumn("h3_cell", "integer", (c) => c.notNull())
148
+ .addColumn("resolution", "integer", (c) => c.notNull())
149
+ .addColumn("area_id", "text", (c) => c.notNull())
150
+ .addColumn("containment", "text", (c) => c.notNull())
151
+ .addPrimaryKeyConstraint("zoning_cell_pk", ["h3_cell", "area_id"])
152
+ // `WITHOUT ROWID` has no first-class builder; the raw modifier is the idiomatic fallback.
153
+ .modifyEnd(sql `without rowid`)
154
+ .execute();
155
+ }
156
+ /**
157
+ * Create `zoning_mapped_extent`. Created empty, and the reader refuses a stronger coverage basis while it stays that
158
+ * way — see the interface's docstring.
159
+ */
160
+ export async function createZoningMappedExtentTable(db) {
161
+ await db.schema
162
+ .createTable("zoning_mapped_extent")
163
+ .addColumn("extent_id", "text", (c) => c.primaryKey())
164
+ .addColumn("source", "text", (c) => c.notNull())
165
+ .addColumn("statement", "text", (c) => c.notNull())
166
+ .addColumn("statement_url", "text", (c) => c.notNull())
167
+ .addColumn("effective_date", "text")
168
+ .addColumn("min_lat", "real", (c) => c.notNull())
169
+ .addColumn("min_lon", "real", (c) => c.notNull())
170
+ .addColumn("max_lat", "real", (c) => c.notNull())
171
+ .addColumn("max_lon", "real", (c) => c.notNull())
172
+ .execute();
173
+ }
174
+ /**
175
+ * Every domain table this layer owns, in dependency order.
176
+ */
177
+ export async function createZoningTables(db) {
178
+ await createZoningJurisdictionTable(db);
179
+ await createZoningPlanTable(db);
180
+ await createZoningAreaTable(db);
181
+ await createZoningVocabularyTable(db);
182
+ await createZoningCrosswalkEdgeTable(db);
183
+ await createZoningCellTable(db);
184
+ await createZoningMappedExtentTable(db);
185
+ }
186
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,GAAG,EAAe,MAAM,QAAQ,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;OAEG;IACH,OAAO,EAAE,SAAS;CACT,CAAA;AA4PV;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,EAAsB;IACjE,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,aAAa,CAAC;SAC1B,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;SACnD,SAAS,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACxD,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAChD,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnD,SAAS,CAAC,mBAAmB,EAAE,MAAM,CAAC;SACtC,SAAS,CAAC,gBAAgB,EAAE,MAAM,CAAC;SACnC,SAAS,CAAC,gBAAgB,EAAE,MAAM,CAAC;SACnC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACrC,SAAS,CAAC,uBAAuB,EAAE,MAAM,CAAC;SAC1C,SA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11 @@
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
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.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=ingest-chunk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest-chunk.d.ts","sourceRoot":"","sources":["../../lib/scripts/ingest-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,36 @@
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
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.
9
+ */
10
+ import { requiredArgument } from "@mailwoman/core/scripting/arguments";
11
+ import { INGEST_CHUNK_FLAGS, runIngestChunkScript } from "@mailwoman/core/scripting/ingest-chunk-script";
12
+ import { createExportFeatureSource } from "#sdk/ingest";
13
+ import { ingestZoningChunk } from "#sdk/ingest-chunk";
14
+ await runIngestChunkScript({
15
+ context: "zoning ingest-chunk",
16
+ options: {
17
+ ...INGEST_CHUNK_FLAGS,
18
+ export: { type: "string" },
19
+ "object-id-from": { type: "string" },
20
+ "object-id-to": { type: "string" },
21
+ },
22
+ run: async (database, values, chunk) => ingestZoningChunk(database, {
23
+ 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.
29
+ declaredFeatureCount: 0,
30
+ }),
31
+ indexResolution: chunk.indexResolution,
32
+ coverageResolution: chunk.coverageResolution,
33
+ onProgress: chunk.onProgress,
34
+ }),
35
+ });
36
+ //# sourceMappingURL=ingest-chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest-chunk.js","sourceRoot":"","sources":["../../lib/scripts/ingest-chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,CAAC;YAC5E,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;YACrG,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK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