@mailwoman/corpus 10.6.0 → 10.7.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 (223) hide show
  1. package/data/PROVENANCE.md +24 -0
  2. package/data/address-source-register.json +18948 -8757
  3. package/data/corpus-source-inputs.json +4756 -0
  4. package/data/license-decisions.json +7260 -0
  5. package/data/licenses/whosonfirst-licenses.md +3 -2
  6. package/data/reviewed-ve-postcode-tuples.json +5 -72
  7. package/data/source-additions.json +2450 -0
  8. package/data/source-resolutions.json +87 -0
  9. package/data/training-manifests/v0.7.10-gb-county.effective.json +2335 -0
  10. package/data/training-manifests/v0.7.10-gb-county.json +1132 -0
  11. package/data/training-manifests/v0.7.2-address-systems.effective.json +3 -2
  12. package/data/training-manifests/v0.7.7-no-ppd.json +550 -0
  13. package/data/training-manifests/v0.7.8-rights-clean.json +538 -0
  14. package/data/training-manifests/v0.7.9-country-gap.json +1132 -0
  15. package/data/us-situs-sources.json +128 -0
  16. package/lib/adapters/cordis/adapter.ts +1 -1
  17. package/lib/adapters/libpostal-dictionary.ts +23 -3
  18. package/lib/adapters/osm/adapter.ts +42 -11
  19. package/lib/adapters.ts +14 -0
  20. package/lib/az/adapters/opendata/adapter.ts +389 -0
  21. package/lib/bs/adapters/gbpa/adapter.ts +248 -0
  22. package/lib/build/types.ts +16 -0
  23. package/lib/build.ts +21 -0
  24. package/lib/ee/adapters/ads/adapter.ts +18 -0
  25. package/lib/fo/adapters/adressur/adapter.ts +242 -0
  26. package/lib/gb/adapters/os-open/adapter.ts +12 -0
  27. package/lib/gb/county.ts +59 -0
  28. package/lib/gb/os-open/open/names.ts +41 -0
  29. package/lib/gu/adapters/bsp/adapter.ts +434 -0
  30. package/lib/im/adapters/land-registry/adapter.ts +340 -0
  31. package/lib/international/recipes/locale.ts +164 -19
  32. package/lib/li/adapters/llv/adapter.ts +246 -0
  33. package/lib/recipes/bare/postcode.ts +10 -34
  34. package/lib/recipes/country-balanced.ts +95 -78
  35. package/lib/recipes/intersection.ts +22 -30
  36. package/lib/recipes/po/box/cedex/recipe.ts +8 -5
  37. package/lib/recipes/po/box/cedex/sources.ts +2 -23
  38. package/lib/recipes/scaffold.ts +28 -3
  39. package/lib/recipes/sources.ts +112 -1
  40. package/lib/recipes/street/affix.ts +17 -29
  41. package/lib/recipes/sub/venue/context.ts +33 -9
  42. package/lib/recipes/sub/venue/sources.ts +54 -13
  43. package/lib/recipes/sub/venue.ts +68 -23
  44. package/lib/recipes/unit.ts +20 -7
  45. package/lib/registers.ts +33 -0
  46. package/lib/source-register/corpus-inputs.ts +528 -0
  47. package/lib/source-register/effective-manifest.ts +37 -5
  48. package/lib/source-register/types.ts +20 -0
  49. package/lib/south-asia/recipes/register.ts +1 -1
  50. package/lib/tools/overlay/manifest.ts +109 -1
  51. package/lib/tools/source-register/build.ts +47 -1
  52. package/lib/tools/variety-sample.ts +633 -0
  53. package/lib/us/adapters/usgov/nad/adapter.ts +39 -10
  54. package/lib/us/recipes/skeleton-sources.ts +156 -0
  55. package/lib/us/tools/nad-skeletons.ts +395 -0
  56. package/lib/uy/adapters/ide/adapter.ts +275 -0
  57. package/lib/ve/recipes/reviewed-postcode-tail.ts +29 -6
  58. package/out/adapters/cordis/adapter.d.ts +1 -1
  59. package/out/adapters/cordis/adapter.js +1 -1
  60. package/out/adapters/libpostal-dictionary.d.ts +9 -0
  61. package/out/adapters/libpostal-dictionary.d.ts.map +1 -1
  62. package/out/adapters/libpostal-dictionary.js +19 -3
  63. package/out/adapters/libpostal-dictionary.js.map +1 -1
  64. package/out/adapters/osm/adapter.d.ts +12 -1
  65. package/out/adapters/osm/adapter.d.ts.map +1 -1
  66. package/out/adapters/osm/adapter.js +30 -13
  67. package/out/adapters/osm/adapter.js.map +1 -1
  68. package/out/adapters.d.ts.map +1 -1
  69. package/out/adapters.js +14 -0
  70. package/out/adapters.js.map +1 -1
  71. package/out/az/adapters/opendata/adapter.d.ts +88 -0
  72. package/out/az/adapters/opendata/adapter.d.ts.map +1 -0
  73. package/out/az/adapters/opendata/adapter.js +282 -0
  74. package/out/az/adapters/opendata/adapter.js.map +1 -0
  75. package/out/bs/adapters/gbpa/adapter.d.ts +64 -0
  76. package/out/bs/adapters/gbpa/adapter.d.ts.map +1 -0
  77. package/out/bs/adapters/gbpa/adapter.js +187 -0
  78. package/out/bs/adapters/gbpa/adapter.js.map +1 -0
  79. package/out/build/types.d.ts +15 -0
  80. package/out/build/types.d.ts.map +1 -1
  81. package/out/build/types.js.map +1 -1
  82. package/out/build.d.ts.map +1 -1
  83. package/out/build.js +17 -0
  84. package/out/build.js.map +1 -1
  85. package/out/ee/adapters/ads/adapter.d.ts +6 -0
  86. package/out/ee/adapters/ads/adapter.d.ts.map +1 -1
  87. package/out/ee/adapters/ads/adapter.js +16 -0
  88. package/out/ee/adapters/ads/adapter.js.map +1 -1
  89. package/out/fo/adapters/adressur/adapter.d.ts +63 -0
  90. package/out/fo/adapters/adressur/adapter.d.ts.map +1 -0
  91. package/out/fo/adapters/adressur/adapter.js +177 -0
  92. package/out/fo/adapters/adressur/adapter.js.map +1 -0
  93. package/out/gb/adapters/os-open/adapter.d.ts +8 -0
  94. package/out/gb/adapters/os-open/adapter.d.ts.map +1 -1
  95. package/out/gb/adapters/os-open/adapter.js +11 -0
  96. package/out/gb/adapters/os-open/adapter.js.map +1 -1
  97. package/out/gb/county.d.ts +30 -0
  98. package/out/gb/county.d.ts.map +1 -0
  99. package/out/gb/county.js +51 -0
  100. package/out/gb/county.js.map +1 -0
  101. package/out/gb/os-open/open/names.d.ts +17 -0
  102. package/out/gb/os-open/open/names.d.ts.map +1 -1
  103. package/out/gb/os-open/open/names.js +19 -0
  104. package/out/gb/os-open/open/names.js.map +1 -1
  105. package/out/gu/adapters/bsp/adapter.d.ts +83 -0
  106. package/out/gu/adapters/bsp/adapter.d.ts.map +1 -0
  107. package/out/gu/adapters/bsp/adapter.js +346 -0
  108. package/out/gu/adapters/bsp/adapter.js.map +1 -0
  109. package/out/im/adapters/land-registry/adapter.d.ts +68 -0
  110. package/out/im/adapters/land-registry/adapter.d.ts.map +1 -0
  111. package/out/im/adapters/land-registry/adapter.js +261 -0
  112. package/out/im/adapters/land-registry/adapter.js.map +1 -0
  113. package/out/international/recipes/locale.d.ts +24 -4
  114. package/out/international/recipes/locale.d.ts.map +1 -1
  115. package/out/international/recipes/locale.js +107 -15
  116. package/out/international/recipes/locale.js.map +1 -1
  117. package/out/li/adapters/llv/adapter.d.ts +69 -0
  118. package/out/li/adapters/llv/adapter.d.ts.map +1 -0
  119. package/out/li/adapters/llv/adapter.js +181 -0
  120. package/out/li/adapters/llv/adapter.js.map +1 -0
  121. package/out/recipes/bare/postcode.d.ts.map +1 -1
  122. package/out/recipes/bare/postcode.js +9 -30
  123. package/out/recipes/bare/postcode.js.map +1 -1
  124. package/out/recipes/country-balanced.d.ts.map +1 -1
  125. package/out/recipes/country-balanced.js +82 -73
  126. package/out/recipes/country-balanced.js.map +1 -1
  127. package/out/recipes/intersection.d.ts +3 -2
  128. package/out/recipes/intersection.d.ts.map +1 -1
  129. package/out/recipes/intersection.js +20 -26
  130. package/out/recipes/intersection.js.map +1 -1
  131. package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -1
  132. package/out/recipes/po/box/cedex/recipe.js +5 -4
  133. package/out/recipes/po/box/cedex/recipe.js.map +1 -1
  134. package/out/recipes/po/box/cedex/sources.d.ts +2 -45
  135. package/out/recipes/po/box/cedex/sources.d.ts.map +1 -1
  136. package/out/recipes/po/box/cedex/sources.js +0 -20
  137. package/out/recipes/po/box/cedex/sources.js.map +1 -1
  138. package/out/recipes/scaffold.d.ts +15 -2
  139. package/out/recipes/scaffold.d.ts.map +1 -1
  140. package/out/recipes/scaffold.js +21 -1
  141. package/out/recipes/scaffold.js.map +1 -1
  142. package/out/recipes/sources.d.ts.map +1 -1
  143. package/out/recipes/sources.js +112 -1
  144. package/out/recipes/sources.js.map +1 -1
  145. package/out/recipes/street/affix.d.ts.map +1 -1
  146. package/out/recipes/street/affix.js +8 -20
  147. package/out/recipes/street/affix.js.map +1 -1
  148. package/out/recipes/sub/venue/context.d.ts +14 -3
  149. package/out/recipes/sub/venue/context.d.ts.map +1 -1
  150. package/out/recipes/sub/venue/context.js +29 -9
  151. package/out/recipes/sub/venue/context.js.map +1 -1
  152. package/out/recipes/sub/venue/sources.d.ts +41 -8
  153. package/out/recipes/sub/venue/sources.d.ts.map +1 -1
  154. package/out/recipes/sub/venue/sources.js +26 -7
  155. package/out/recipes/sub/venue/sources.js.map +1 -1
  156. package/out/recipes/sub/venue.d.ts.map +1 -1
  157. package/out/recipes/sub/venue.js +35 -14
  158. package/out/recipes/sub/venue.js.map +1 -1
  159. package/out/recipes/unit.d.ts +4 -0
  160. package/out/recipes/unit.d.ts.map +1 -1
  161. package/out/recipes/unit.js +7 -6
  162. package/out/recipes/unit.js.map +1 -1
  163. package/out/registers.d.ts +33 -0
  164. package/out/registers.d.ts.map +1 -1
  165. package/out/registers.js +33 -0
  166. package/out/registers.js.map +1 -1
  167. package/out/source-register/corpus-inputs.d.ts +240 -0
  168. package/out/source-register/corpus-inputs.d.ts.map +1 -0
  169. package/out/source-register/corpus-inputs.js +275 -0
  170. package/out/source-register/corpus-inputs.js.map +1 -0
  171. package/out/source-register/effective-manifest.d.ts +2 -0
  172. package/out/source-register/effective-manifest.d.ts.map +1 -1
  173. package/out/source-register/effective-manifest.js +33 -4
  174. package/out/source-register/effective-manifest.js.map +1 -1
  175. package/out/source-register/types.d.ts +21 -1
  176. package/out/source-register/types.d.ts.map +1 -1
  177. package/out/source-register/types.js +20 -0
  178. package/out/source-register/types.js.map +1 -1
  179. package/out/south-asia/recipes/register.js +1 -1
  180. package/out/south-asia/recipes/register.js.map +1 -1
  181. package/out/tools/overlay/manifest.d.ts +7 -0
  182. package/out/tools/overlay/manifest.d.ts.map +1 -1
  183. package/out/tools/overlay/manifest.js +72 -1
  184. package/out/tools/overlay/manifest.js.map +1 -1
  185. package/out/tools/source-register/build.d.ts +9 -0
  186. package/out/tools/source-register/build.d.ts.map +1 -1
  187. package/out/tools/source-register/build.js +25 -3
  188. package/out/tools/source-register/build.js.map +1 -1
  189. package/out/tools/variety-sample.d.ts +196 -0
  190. package/out/tools/variety-sample.d.ts.map +1 -0
  191. package/out/tools/variety-sample.js +417 -0
  192. package/out/tools/variety-sample.js.map +1 -0
  193. package/out/us/adapters/usgov/nad/adapter.d.ts +80 -0
  194. package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
  195. package/out/us/adapters/usgov/nad/adapter.js +27 -8
  196. package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
  197. package/out/us/recipes/skeleton-sources.d.ts +92 -0
  198. package/out/us/recipes/skeleton-sources.d.ts.map +1 -0
  199. package/out/us/recipes/skeleton-sources.js +121 -0
  200. package/out/us/recipes/skeleton-sources.js.map +1 -0
  201. package/out/us/tools/nad-skeletons.d.ts +120 -0
  202. package/out/us/tools/nad-skeletons.d.ts.map +1 -0
  203. package/out/us/tools/nad-skeletons.js +262 -0
  204. package/out/us/tools/nad-skeletons.js.map +1 -0
  205. package/out/uy/adapters/ide/adapter.d.ts +64 -0
  206. package/out/uy/adapters/ide/adapter.d.ts.map +1 -0
  207. package/out/uy/adapters/ide/adapter.js +206 -0
  208. package/out/uy/adapters/ide/adapter.js.map +1 -0
  209. package/out/ve/recipes/reviewed-postcode-tail.d.ts +6 -2
  210. package/out/ve/recipes/reviewed-postcode-tail.d.ts.map +1 -1
  211. package/out/ve/recipes/reviewed-postcode-tail.js +16 -5
  212. package/out/ve/recipes/reviewed-postcode-tail.js.map +1 -1
  213. package/package.json +14 -14
  214. package/lib/recipes/unit/sources.ts +0 -44
  215. package/lib/tools/fetch/ppd.ts +0 -121
  216. package/out/recipes/unit/sources.d.ts +0 -28
  217. package/out/recipes/unit/sources.d.ts.map +0 -1
  218. package/out/recipes/unit/sources.js +0 -30
  219. package/out/recipes/unit/sources.js.map +0 -1
  220. package/out/tools/fetch/ppd.d.ts +0 -15
  221. package/out/tools/fetch/ppd.d.ts.map +0 -1
  222. package/out/tools/fetch/ppd.js +0 -86
  223. package/out/tools/fetch/ppd.js.map +0 -1
@@ -0,0 +1,346 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `bsp-gu`: the address points of Guam, which the Bureau of Statistics & Plans GIS publishes on the
7
+ * Government of Guam GISWEB Portal as the ArcGIS layer `Address_Point_(Public_View)`.
8
+ *
9
+ * The input is the layer's GeoJSON query pages, one file or a directory of them. The adapter reads
10
+ * `HOUSE_NUM` as the house number, `PRE_DIR` as the street prefix, `STREETNAME` as the street (or the
11
+ * assembled `FullRdNm` when `STREETNAME` is blank), `STR_TYPE` as the street suffix, `UNIT` as the unit
12
+ * and `CITY` (or `PLACENAME` when `CITY` is blank) as the locality. Route roads read `ROUTE 10` with the
13
+ * type `HWY`, which is how the layer's own `FullRdNm` writes them.
14
+ *
15
+ * The layer carries no postcode: its NG911 `Post_Code` column is blank on every feature.
16
+ *
17
+ * `HOUSE_NUM` sometimes pairs the number with a building-permit number (`120 / B19000483`); the number is
18
+ * kept and the permit dropped. `CITY` writes Guam's villages with Chamorro and English spellings
19
+ * (`HAGÅTÑA`, `HAGATNA`; `INARAJAN`, `INALAHAN`) and with typing slips (`BARRIGDAA`, `MANGIL.AO`), so a
20
+ * value is kept only when each of its parts is a village, or a community the villages contain,
21
+ * listed in {@link GUAM_PLACE_NAMES}. A road written `(OFF OF) ROUTE 4A HWY` locates a point near a road
22
+ * rather than on it, and a street naming two roads (`AGUILAR RD / RT 17`) states no single street, so both
23
+ * are refused.
24
+ *
25
+ * The layer states no license. Under the United States position in `packages/corpus/lib/us/AGENTS.md`
26
+ * (Feist), a US public body's address file published without terms restricting its use is elected,
27
+ * and the rows carry the label the US public-body adapters use.
28
+ */
29
+ import { formatAddressRow } from "@mailwoman/codex/address/format";
30
+ import { foldToken } from "@mailwoman/codex/normalize";
31
+ import { readLocalTextFile } from "@mailwoman/core/fs/readers";
32
+ import { tryStat } from "@mailwoman/core/fs/readers/stat";
33
+ import { parseJSONStrict } from "@mailwoman/core/json";
34
+ import { resolvePath } from "path-ts";
35
+ import { Globerator } from "spliterator/node/fs";
36
+ import { UnsupportedCountryError } from "#adapters/errors";
37
+ import { stableSourceIDFromParts } from "#adapters/source-id";
38
+ import { SourceRegister } from "#registers";
39
+ import { AddressRole, countDropped, SurfaceOrigin, } from "#types";
40
+ /**
41
+ * Registry id for this adapter, stamped into every row it emits.
42
+ */
43
+ export const BSP_GU_ADAPTER_ID = "bsp-gu";
44
+ /**
45
+ * The label every row carries, matching the US public-body adapters elected under the Feist reading.
46
+ */
47
+ export const BSP_GU_LICENSE = "Public Domain";
48
+ /**
49
+ * Every jurisdiction this adapter emits, checked against a caller's `--country`.
50
+ */
51
+ export const BSP_GU_COUNTRIES = ["GU"];
52
+ /**
53
+ * A value with its whitespace collapsed, or null when the layer leaves it blank.
54
+ * The layer writes an absent string as a single space.
55
+ */
56
+ function present(value) {
57
+ const collapsed = value == null ? "" : String(value).replaceAll(/\s+/gu, " ").trim();
58
+ return collapsed || null;
59
+ }
60
+ /**
61
+ * Upper-cased, with diacritics removed, so `HAGÅTÑA` and `Hagatna` compare equal.
62
+ */
63
+ function upperFold(value) {
64
+ return foldToken(value).toUpperCase();
65
+ }
66
+ /**
67
+ * Guam's nineteen villages under each name the layer writes for them,
68
+ * and the communities within a village that `CITY` names on its own
69
+ * (Tumon and Harmon in Tamuning, Ipan in Talofofo, Paasan in Agana Heights, Anigua in Hagåtña), folded.
70
+ */
71
+ export const GUAM_PLACE_NAMES = new Set([
72
+ "AGANA HEIGHTS",
73
+ "PAASAN",
74
+ "AGAT",
75
+ "HAGAT",
76
+ "ASAN",
77
+ "MAINA",
78
+ "ASAN MAINA",
79
+ "BARRIGADA",
80
+ "BARRIGADA HEIGHTS",
81
+ "CHALAN PAGO",
82
+ "ORDOT",
83
+ "CHALAN PAGO ORDOT",
84
+ "DEDEDO",
85
+ "HAGATNA",
86
+ "AGANA",
87
+ "ANIGUA",
88
+ "INARAJAN",
89
+ "INALAHAN",
90
+ "INALAJAN",
91
+ "MANGILAO",
92
+ "MERIZO",
93
+ "MALESSO",
94
+ "MONGMONG",
95
+ "TOTO",
96
+ "MAITE",
97
+ "MONGMONG TOTO MAITE",
98
+ "PITI",
99
+ "SANTA RITA",
100
+ "SINAJANA",
101
+ "TALOFOFO",
102
+ "IPAN",
103
+ "TAMUNING",
104
+ "TUMON",
105
+ "HARMON",
106
+ "UMATAC",
107
+ "HUMATAC",
108
+ "YIGO",
109
+ "YONA",
110
+ ]);
111
+ /**
112
+ * Whether every part of a place value, split at commas, slashes, hyphens and parentheses,
113
+ * is a listed place: `CHALAN PAGO - ORDOT` and `AGANA HEIGHTS (PAASAN)` are, `RADIO, BARRIGADA` is not.
114
+ */
115
+ export function isGuamPlaceName(value) {
116
+ const parts = upperFold(value)
117
+ .split(/[,/()-]/u)
118
+ .map((part) => part.trim())
119
+ .filter((part) => part.length > 0);
120
+ return parts.length > 0 && parts.every((part) => GUAM_PLACE_NAMES.has(part));
121
+ }
122
+ /**
123
+ * A house number: digits, an optional hyphenated half, and an optional letter written
124
+ * against the number or after a space (`120`, `99-12`, `231A`, `155 A`).
125
+ */
126
+ const HOUSE_NUMBER = /^\d+(?:-\d+)?(?: ?[A-Z])?$/u;
127
+ /**
128
+ * A Guam building-permit number, written beside a house number in `HOUSE_NUM` (`B19000483`, `B22-450`).
129
+ */
130
+ const PERMIT_NUMBER = /^[A-Z]{1,2}\d{2}-?\d{3,}$/iu;
131
+ /**
132
+ * The house number `HOUSE_NUM` states, with a building-permit number written beside
133
+ * it removed, or null when the value is not a house number.
134
+ */
135
+ export function guamHouseNumber(value) {
136
+ if (HOUSE_NUMBER.test(value))
137
+ return value;
138
+ const parts = value
139
+ .split("/")
140
+ .map((part) => part.trim())
141
+ .filter((part) => part.length > 0);
142
+ const numbers = parts.filter((part) => HOUSE_NUMBER.test(part));
143
+ if (numbers.length === 1 && parts.every((part) => numbers.includes(part) || PERMIT_NUMBER.test(part))) {
144
+ return numbers[0];
145
+ }
146
+ return null;
147
+ }
148
+ /**
149
+ * The street types `STR_TYPE` writes, as the layer abbreviates or spells them.
150
+ */
151
+ const STREET_TYPES = new Set([
152
+ "ST",
153
+ "STREET",
154
+ "HWY",
155
+ "HIGHWAY",
156
+ "RD",
157
+ "ROAD",
158
+ "CT",
159
+ "CRT",
160
+ "COURT",
161
+ "DR",
162
+ "DRIVE",
163
+ "LN",
164
+ "LANE",
165
+ "AVE",
166
+ "AVENUE",
167
+ "LOOP",
168
+ "LP",
169
+ "WAY",
170
+ "WY",
171
+ "CIR",
172
+ "CIRCLE",
173
+ "BLVD",
174
+ "BOULEVARD",
175
+ "PL",
176
+ ]);
177
+ const DIRECTIONS = new Set(["N", "S", "E", "W"]);
178
+ /**
179
+ * Maps one record onto the components the corpus asserts, or returns null when the row is refused.
180
+ *
181
+ * Each refusal and each dropped component increments its reason in `dropped`.
182
+ */
183
+ export function componentsForGuamRecord(record, dropped) {
184
+ const tally = dropped ?? {};
185
+ const written = present(record.HOUSE_NUM);
186
+ if (!written) {
187
+ countDropped(tally, "row:no-house-number");
188
+ return null;
189
+ }
190
+ const houseNumber = guamHouseNumber(written);
191
+ if (!houseNumber) {
192
+ countDropped(tally, "row:house-number-not-a-number");
193
+ return null;
194
+ }
195
+ const name = present(record.STREETNAME);
196
+ const street = name ?? present(record.FullRdNm);
197
+ if (!street) {
198
+ countDropped(tally, "row:no-street");
199
+ return null;
200
+ }
201
+ if (/^\(?OFF OF\b/iu.test(street)) {
202
+ countDropped(tally, "row:street-off-of");
203
+ return null;
204
+ }
205
+ if (/[/()]/u.test(street)) {
206
+ countDropped(tally, "row:street-names-two-roads");
207
+ return null;
208
+ }
209
+ const components = { house_number: houseNumber, street };
210
+ // `FullRdNm` already holds the direction and the type, so they are read beside `STREETNAME` only.
211
+ if (name) {
212
+ const direction = present(record.PRE_DIR)?.toUpperCase();
213
+ if (direction && DIRECTIONS.has(direction)) {
214
+ if (upperFold(name).startsWith(`${direction} `)) {
215
+ countDropped(tally, "component:street_prefix:repeats-street");
216
+ }
217
+ else {
218
+ components.street_prefix = direction;
219
+ }
220
+ }
221
+ else if (direction) {
222
+ countDropped(tally, "component:street_prefix:not-a-direction");
223
+ }
224
+ const type = present(record.STR_TYPE)?.toUpperCase().replace(/\.$/u, "");
225
+ if (type && STREET_TYPES.has(type)) {
226
+ if (upperFold(name).endsWith(` ${type}`)) {
227
+ countDropped(tally, "component:street_suffix:repeats-street");
228
+ }
229
+ else {
230
+ components.street_suffix = type;
231
+ }
232
+ }
233
+ else if (type) {
234
+ countDropped(tally, "component:street_suffix:not-a-street-type");
235
+ }
236
+ }
237
+ const unit = present(record.UNIT);
238
+ if (unit && /^[A-Z0-9]{1,4}$/u.test(unit)) {
239
+ // `HOUSE_NUM` sometimes writes the unit letter after the number as well (`155 A` with unit `A`).
240
+ if (houseNumber.endsWith(` ${unit}`) || (/^[A-Z]$/u.test(unit) && houseNumber.endsWith(unit))) {
241
+ countDropped(tally, "component:unit:repeats-house-number");
242
+ }
243
+ else {
244
+ components.unit = unit;
245
+ }
246
+ }
247
+ else if (unit) {
248
+ countDropped(tally, "component:unit:not-a-unit-designator");
249
+ }
250
+ const city = present(record.CITY);
251
+ const place = present(record.PLACENAME);
252
+ if (city && isGuamPlaceName(city)) {
253
+ components.locality = city;
254
+ }
255
+ else if (city) {
256
+ countDropped(tally, "component:locality:not-a-guam-place");
257
+ }
258
+ else if (place && isGuamPlaceName(place)) {
259
+ components.locality = place;
260
+ }
261
+ if (!components.locality) {
262
+ countDropped(tally, "row:no-locality");
263
+ return null;
264
+ }
265
+ return components;
266
+ }
267
+ /**
268
+ * The GeoJSON pages an input names: the file itself, or every `.geojson` in a directory, in name order.
269
+ */
270
+ async function pageFiles(inputPath) {
271
+ const stat = await tryStat(inputPath);
272
+ if (!stat?.isDirectory())
273
+ return [inputPath];
274
+ const names = await Globerator.from("*.geojson", { cwd: inputPath, absolute: false }).toSorted();
275
+ return names.map((name) => `${inputPath}/${name}`);
276
+ }
277
+ export function createGuamAddressPointsAdapter() {
278
+ return {
279
+ id: BSP_GU_ADAPTER_ID,
280
+ defaultLicense: BSP_GU_LICENSE,
281
+ addressRole: AddressRole.Premise,
282
+ register: SourceRegister.GuamAddressPoints,
283
+ surface: SurfaceOrigin.Rendered,
284
+ description: "Address_Point_(Public_View) (Government of Guam, Bureau of Statistics & Plans GIS): Guam's address points.",
285
+ async *rows(opts) {
286
+ if (opts.country && !BSP_GU_COUNTRIES.includes(opts.country)) {
287
+ throw new UnsupportedCountryError(BSP_GU_ADAPTER_ID, BSP_GU_COUNTRIES, opts.country);
288
+ }
289
+ let emitted = 0;
290
+ for (const file of await pageFiles(resolvePath(opts.inputPath))) {
291
+ // A query page holds at most the layer's 2,000-feature maxRecordCount, so each is parsed whole.
292
+ const collection = parseJSONStrict(await readLocalTextFile(file));
293
+ if (!Array.isArray(collection.features)) {
294
+ throw new TypeError(`${BSP_GU_ADAPTER_ID} adapter: ${file} holds no GeoJSON features array`);
295
+ }
296
+ for (const feature of collection.features) {
297
+ if (opts.signal?.aborted)
298
+ return;
299
+ if (opts.limit !== undefined && emitted >= opts.limit)
300
+ return;
301
+ const record = feature.properties;
302
+ if (!record) {
303
+ countDropped(opts, "row:no-properties");
304
+ continue;
305
+ }
306
+ const components = componentsForGuamRecord(record, opts);
307
+ if (!components)
308
+ continue;
309
+ const rendered = formatAddressRow(components, "GU", { singleLine: true });
310
+ if (!rendered) {
311
+ countDropped(opts, "row:render-failed");
312
+ continue;
313
+ }
314
+ for (const tag of rendered.unplaced) {
315
+ countDropped(opts, `component:${tag}:not-rendered`);
316
+ }
317
+ const { raw, components: aligned } = rendered;
318
+ const [lon, lat] = feature.geometry?.coordinates ?? [];
319
+ yield {
320
+ raw,
321
+ components: aligned,
322
+ country: "GU",
323
+ locale: "en-GU",
324
+ source: BSP_GU_ADAPTER_ID,
325
+ // `FID` is the layer's object id, unique per feature.
326
+ // The point separates the units of one building that the rendered components may not.
327
+ source_id: stableSourceIDFromParts(BSP_GU_ADAPTER_ID, {
328
+ ...aligned,
329
+ fid: present(record.FID) ?? "",
330
+ lat: typeof lat === "number" ? String(lat) : "",
331
+ lon: typeof lon === "number" ? String(lon) : "",
332
+ }),
333
+ corpus_version: "",
334
+ license: BSP_GU_LICENSE,
335
+ };
336
+ emitted++;
337
+ }
338
+ }
339
+ },
340
+ };
341
+ }
342
+ /**
343
+ * The configured adapter instance registered with the corpus builder.
344
+ */
345
+ export const guamAddressPointsAdapter = createGuamAddressPointsAdapter();
346
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../lib/gu/adapters/bsp/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EACN,WAAW,EAIX,YAAY,EACZ,aAAa,GACb,MAAM,QAAQ,CAAA;AAEf;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAA;AAEzC;;GAE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ACH,UAAU,EAAE,OAAO;wBACnB,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE,OAAO;wBACf,MAAM,EAAE,iBAAiB;wBACzB,sDAAsD;wBACtD,sFAAsF;wBACtF,SAAS,EAAE,uBAAuB,CAAC,iBAAiB,EAAE;4BACrD,GAAG,OAAO;4BACV,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;4BAC9B,GAAG,EAAE,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;4BAC/C,GAAG,EAAE,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;yBAC/C,CAAC;wBACF,cAAc,EAAE,EAAE;wBAClB,OAAO,EAAE,cAAc;qBACvB,CAAA;oBAED,OAAO,EAAE,CAAA;gBACV,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,EAAE,CAAA"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `landregistry-im`: the property addresses of the Isle of Man Land Registry's land transactions, which the
7
+ * Isle of Man Government publishes on gov.im as one CSV of every registered sale since 2000.
8
+ *
9
+ * Each row is a sale, so one property appears once per sale. The adapter emits each distinct address
10
+ * once, comparing the emitted components case-folded and keeping the first. It reads only the address
11
+ * columns and never the price or date columns.
12
+ *
13
+ * `SubUnit_Name` is the flat or apartment (`Flat 2`, `Apartment 5`), `House_Number` the door number,
14
+ * `House_Name` the house's given name (`Ballacain Farm`) or the building's (`Spectrum Apartments`),
15
+ * `Street_Name` the street, `Locality` the estate or village inside the town, and `Town` the post town.
16
+ * The IM layout prints no region, so `Parish_` is not read.
17
+ *
18
+ * The register also records sales of land that has no postal address. Such a row describes the land
19
+ * (`Field North Of Ballawhannel Farm`, `Parcel Of Land`, `Land Adjacent To Mostyn Ville`) in place of
20
+ * naming a property, and the adapter refuses it, as it refuses a garage, a parking space or a substation
21
+ * sold on its own.
22
+ *
23
+ * The Isle of Man Government publishes the dataset under the Isle of Man Open Government Licence, which
24
+ * requires the attribution statement below. Every row records that license.
25
+ */
26
+ import { type AdapterOptions, type CanonicalRow, type CorpusAdapter } from "#types";
27
+ /**
28
+ * Registry id for this adapter, stamped into every row it emits.
29
+ */
30
+ export declare const LANDREGISTRY_IM_ADAPTER_ID = "landregistry-im";
31
+ /**
32
+ * The Isle of Man Open Government Licence, whose version the dataset page does not state.
33
+ * It has no SPDX identifier.
34
+ */
35
+ export declare const LANDREGISTRY_IM_LICENSE = "LicenseRef-IM-OGL";
36
+ /**
37
+ * The attribution statement the license requires.
38
+ */
39
+ export declare const LANDREGISTRY_IM_ATTRIBUTION = "Contains public sector information licensed under the Isle of Man Open Government Licence";
40
+ /**
41
+ * Every jurisdiction this adapter emits, checked against a caller's `--country`.
42
+ */
43
+ export declare const LANDREGISTRY_IM_COUNTRIES: readonly string[];
44
+ /**
45
+ * The address columns the adapter reads from the land transactions CSV.
46
+ * The price and date columns are not read.
47
+ */
48
+ export interface IsleOfManLandTransactionRecord {
49
+ SubUnit_Name: string;
50
+ House_Number: string;
51
+ House_Name: string;
52
+ Street_Name: string;
53
+ Locality: string;
54
+ Town: string;
55
+ Postcode: string;
56
+ }
57
+ /**
58
+ * Maps one record onto the components the corpus asserts, or returns null when the row is refused.
59
+ *
60
+ * Each refusal and each dropped component increments its reason in `dropped`.
61
+ */
62
+ export declare function componentsForIsleOfManLandTransactionRecord(record: IsleOfManLandTransactionRecord, dropped?: Pick<AdapterOptions, "dropped">): CanonicalRow["components"] | null;
63
+ export declare function createIsleOfManLandRegistryAdapter(): CorpusAdapter;
64
+ /**
65
+ * The configured adapter instance registered with the corpus builder.
66
+ */
67
+ export declare const isleOfManLandRegistryAdapter: CorpusAdapter;
68
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../lib/im/adapters/land-registry/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAWH,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAGlB,MAAM,QAAQ,CAAA;AAEf;;GAEG;AACH,eAAO,MAAM,0BAA0B,oBAAoB,CAAA;AAE3D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,sBAAsB,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,2BAA2B,8FACoD,CAAA;AAE5F;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAAW,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC9C,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CAChB;AA2DD;;;;GAIG;AACH,wBAAgB,2CAA2C,CAC1D,MAAM,EAAE,8BAA8B,EACtC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,GACvC,YAAY,CAAC,YAAY,CAAC,GAAG,IAAI,CAsGnC;AAYD,wBAAgB,kCAAkC,IAAI,aAAa,CA2ElE;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,eAAuC,CAAA"}