@mailwoman/registry 10.8.0 → 11.0.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 (399) hide show
  1. package/README.md +93 -98
  2. package/data/manifests/artifacts.json +32 -0
  3. package/data/manifests/coverage.json +56 -0
  4. package/data/manifests/sources.lock.json +48 -0
  5. package/data/normalized/iata-airports.json +126749 -0
  6. package/data/normalized/iso3166-1.json +2035 -0
  7. package/definitions/namespaces.json +63 -0
  8. package/definitions/sections.json +73 -0
  9. package/docs/data-policy.md +81 -0
  10. package/docs/performance.md +146 -0
  11. package/docs/rgy1.md +144 -0
  12. package/lib/artifacts/country-airport-collision.ts +26 -0
  13. package/lib/artifacts/iata-airport/membership.ts +26 -0
  14. package/lib/artifacts/iata-airport/records.ts +26 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +26 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +26 -0
  17. package/lib/artifacts/iso3166-1/records.ts +26 -0
  18. package/lib/errors.ts +44 -0
  19. package/lib/iata/airports/records.ts +174 -0
  20. package/lib/iata/airports/validate.ts +49 -0
  21. package/lib/index.ts +25 -15
  22. package/lib/inspect.ts +56 -0
  23. package/lib/iso3166/alpha2.ts +48 -0
  24. package/lib/iso3166/alpha3.ts +51 -0
  25. package/lib/iso3166/records.ts +149 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +146 -0
  28. package/lib/normalize.ts +31 -0
  29. package/lib/overlap/country-airport.ts +108 -0
  30. package/lib/rgy1/base64.ts +24 -0
  31. package/lib/rgy1/reader.ts +316 -0
  32. package/lib/rgy1/sections.generated.ts +79 -0
  33. package/lib/rgy1/views.ts +267 -0
  34. package/lib/types.ts +88 -74
  35. package/lib/wasm.ts +285 -0
  36. package/out/artifacts/country-airport-collision.d.ts +15 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +21 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +15 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +21 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +15 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +21 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +15 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +21 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +15 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +21 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +15 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +21 -0
  59. package/out/artifacts/iso3166-1/records.js.map +1 -0
  60. package/out/errors.d.ts +38 -0
  61. package/out/errors.d.ts.map +1 -0
  62. package/out/errors.js +35 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +44 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +137 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +27 -0
  69. package/out/iata/airports/validate.d.ts.map +1 -0
  70. package/out/iata/airports/validate.js +42 -0
  71. package/out/iata/airports/validate.js.map +1 -0
  72. package/out/index.d.ts +19 -15
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +14 -15
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +38 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +33 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +24 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +41 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +29 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +44 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +38 -0
  89. package/out/iso3166/records.d.ts.map +1 -0
  90. package/out/iso3166/records.js +105 -0
  91. package/out/iso3166/records.js.map +1 -0
  92. package/out/iso3166/relations.d.ts +20 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +27 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +68 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +122 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +25 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +21 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +57 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +71 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +15 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +22 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +103 -0
  113. package/out/rgy1/reader.d.ts.map +1 -0
  114. package/out/rgy1/reader.js +230 -0
  115. package/out/rgy1/reader.js.map +1 -0
  116. package/out/rgy1/sections.generated.d.ts +54 -0
  117. package/out/rgy1/sections.generated.d.ts.map +1 -0
  118. package/out/rgy1/sections.generated.js +69 -0
  119. package/out/rgy1/sections.generated.js.map +1 -0
  120. package/out/rgy1/views.d.ts +96 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +218 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +53 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +107 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +14 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +20 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +111 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +98 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +10 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +12 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +19 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +204 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +18 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +71 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +13 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +136 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +18 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +118 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +155 -0
  157. package/out/tools/normalize.d.ts.map +1 -0
  158. package/out/tools/normalize.js +303 -0
  159. package/out/tools/normalize.js.map +1 -0
  160. package/out/tools/normalize.run.d.ts +14 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +29 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +90 -76
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +20 -4
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +98 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +137 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +48 -27
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +146 -0
  175. package/sdk/sources.ts +162 -0
  176. package/tools/artifact-path.ts +12 -0
  177. package/tools/bench.run.ts +265 -0
  178. package/tools/build-wasm.run.ts +82 -0
  179. package/tools/generate-sections.run.ts +152 -0
  180. package/tools/generate.run.ts +146 -0
  181. package/tools/normalize.run.ts +36 -0
  182. package/tools/normalize.ts +474 -0
  183. package/wasm/registry-simd.wasm +0 -0
  184. package/wasm/registry.wasm +0 -0
  185. package/lib/address-key.ts +0 -46
  186. package/lib/geocode-handler.ts +0 -37
  187. package/lib/geojson.ts +0 -72
  188. package/lib/ingest.ts +0 -349
  189. package/lib/learned-scorer.ts +0 -134
  190. package/lib/map-html.ts +0 -287
  191. package/lib/models/crosssource-gbt-en-us.ts +0 -43
  192. package/lib/models/dedup-gbt-en-us.ts +0 -47
  193. package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
  194. package/lib/reconcile.ts +0 -239
  195. package/lib/resolve.ts +0 -569
  196. package/out/address-key.d.ts +0 -34
  197. package/out/address-key.d.ts.map +0 -1
  198. package/out/address-key.js +0 -41
  199. package/out/address-key.js.map +0 -1
  200. package/out/geocode-handler.d.ts +0 -20
  201. package/out/geocode-handler.d.ts.map +0 -1
  202. package/out/geocode-handler.js +0 -29
  203. package/out/geocode-handler.js.map +0 -1
  204. package/out/geojson.d.ts +0 -28
  205. package/out/geojson.d.ts.map +0 -1
  206. package/out/geojson.js +0 -62
  207. package/out/geojson.js.map +0 -1
  208. package/out/ingest.d.ts +0 -173
  209. package/out/ingest.d.ts.map +0 -1
  210. package/out/ingest.js +0 -185
  211. package/out/ingest.js.map +0 -1
  212. package/out/learned-scorer.d.ts +0 -61
  213. package/out/learned-scorer.d.ts.map +0 -1
  214. package/out/learned-scorer.js +0 -91
  215. package/out/learned-scorer.js.map +0 -1
  216. package/out/map-html.d.ts +0 -39
  217. package/out/map-html.d.ts.map +0 -1
  218. package/out/map-html.js +0 -220
  219. package/out/map-html.js.map +0 -1
  220. package/out/models/crosssource-gbt-en-us.d.ts +0 -45
  221. package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
  222. package/out/models/crosssource-gbt-en-us.js +0 -40
  223. package/out/models/crosssource-gbt-en-us.js.map +0 -1
  224. package/out/models/dedup-gbt-en-us.d.ts +0 -44
  225. package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
  226. package/out/models/dedup-gbt-en-us.js +0 -44
  227. package/out/models/dedup-gbt-en-us.js.map +0 -1
  228. package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
  229. package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
  230. package/out/models/org-crosssource-gbt-en-us.js +0 -40
  231. package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
  232. package/out/reconcile.d.ts +0 -96
  233. package/out/reconcile.d.ts.map +0 -1
  234. package/out/reconcile.js +0 -127
  235. package/out/reconcile.js.map +0 -1
  236. package/out/resolve.d.ts +0 -264
  237. package/out/resolve.d.ts.map +0 -1
  238. package/out/resolve.js +0 -282
  239. package/out/resolve.js.map +0 -1
  240. package/out/tools/coverage-reconciliation.d.ts +0 -67
  241. package/out/tools/coverage-reconciliation.d.ts.map +0 -1
  242. package/out/tools/coverage-reconciliation.js +0 -113
  243. package/out/tools/coverage-reconciliation.js.map +0 -1
  244. package/out/tools/cross/dataset-correlation.d.ts +0 -61
  245. package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
  246. package/out/tools/cross/dataset-correlation.js +0 -244
  247. package/out/tools/cross/dataset-correlation.js.map +0 -1
  248. package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
  249. package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
  250. package/out/tools/cross/source-threshold-sweep.js +0 -264
  251. package/out/tools/cross/source-threshold-sweep.js.map +0 -1
  252. package/out/tools/dedup-ceiling.d.ts +0 -62
  253. package/out/tools/dedup-ceiling.d.ts.map +0 -1
  254. package/out/tools/dedup-ceiling.js +0 -171
  255. package/out/tools/dedup-ceiling.js.map +0 -1
  256. package/out/tools/eval-geocoder.d.ts +0 -68
  257. package/out/tools/eval-geocoder.d.ts.map +0 -1
  258. package/out/tools/eval-geocoder.js +0 -13
  259. package/out/tools/eval-geocoder.js.map +0 -1
  260. package/out/tools/geocoder/namesake-probe.d.ts +0 -33
  261. package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
  262. package/out/tools/geocoder/namesake-probe.js +0 -60
  263. package/out/tools/geocoder/namesake-probe.js.map +0 -1
  264. package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
  265. package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
  266. package/out/tools/geocoder/vs-provided-coords.js +0 -161
  267. package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
  268. package/out/tools/gold-set-sample.d.ts +0 -67
  269. package/out/tools/gold-set-sample.d.ts.map +0 -1
  270. package/out/tools/gold-set-sample.js +0 -81
  271. package/out/tools/gold-set-sample.js.map +0 -1
  272. package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
  273. package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
  274. package/out/tools/learned/scorer/clustering-eval.js +0 -207
  275. package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
  276. package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
  277. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
  278. package/out/tools/learned/scorer/crossstate-eval.js +0 -168
  279. package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
  280. package/out/tools/learned/scorer/eval.d.ts +0 -64
  281. package/out/tools/learned/scorer/eval.d.ts.map +0 -1
  282. package/out/tools/learned/scorer/eval.js +0 -275
  283. package/out/tools/learned/scorer/eval.js.map +0 -1
  284. package/out/tools/matcher-scale.d.ts +0 -40
  285. package/out/tools/matcher-scale.d.ts.map +0 -1
  286. package/out/tools/matcher-scale.js +0 -111
  287. package/out/tools/matcher-scale.js.map +0 -1
  288. package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
  289. package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
  290. package/out/tools/nppes/dedup-benchmark.js +0 -226
  291. package/out/tools/nppes/dedup-benchmark.js.map +0 -1
  292. package/out/tools/nppes/org-name.d.ts +0 -15
  293. package/out/tools/nppes/org-name.d.ts.map +0 -1
  294. package/out/tools/nppes/org-name.js +0 -6
  295. package/out/tools/nppes/org-name.js.map +0 -1
  296. package/out/tools/nppes/overmerge-packet.d.ts +0 -43
  297. package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
  298. package/out/tools/nppes/overmerge-packet.js +0 -54
  299. package/out/tools/nppes/overmerge-packet.js.map +0 -1
  300. package/out/tools/nppes/report.d.ts +0 -97
  301. package/out/tools/nppes/report.d.ts.map +0 -1
  302. package/out/tools/nppes/report.js +0 -178
  303. package/out/tools/nppes/report.js.map +0 -1
  304. package/out/tools/nppes/sample.d.ts +0 -101
  305. package/out/tools/nppes/sample.d.ts.map +0 -1
  306. package/out/tools/nppes/sample.js +0 -127
  307. package/out/tools/nppes/sample.js.map +0 -1
  308. package/out/tools/nppes/scoring.d.ts +0 -37
  309. package/out/tools/nppes/scoring.d.ts.map +0 -1
  310. package/out/tools/nppes/scoring.js +0 -81
  311. package/out/tools/nppes/scoring.js.map +0 -1
  312. package/out/tools/nppes/settings.d.ts +0 -41
  313. package/out/tools/nppes/settings.d.ts.map +0 -1
  314. package/out/tools/nppes/settings.js +0 -79
  315. package/out/tools/nppes/settings.js.map +0 -1
  316. package/out/tools/nppes/truth-grains.d.ts +0 -63
  317. package/out/tools/nppes/truth-grains.d.ts.map +0 -1
  318. package/out/tools/nppes/truth-grains.js +0 -142
  319. package/out/tools/nppes/truth-grains.js.map +0 -1
  320. package/out/tools/shared.d.ts +0 -325
  321. package/out/tools/shared.d.ts.map +0 -1
  322. package/out/tools/shared.js +0 -453
  323. package/out/tools/shared.js.map +0 -1
  324. package/out/tools/train/cross-gbt.d.ts +0 -89
  325. package/out/tools/train/cross-gbt.d.ts.map +0 -1
  326. package/out/tools/train/cross-gbt.js +0 -132
  327. package/out/tools/train/cross-gbt.js.map +0 -1
  328. package/out/tools/train/gbt.d.ts +0 -85
  329. package/out/tools/train/gbt.d.ts.map +0 -1
  330. package/out/tools/train/gbt.js +0 -155
  331. package/out/tools/train/gbt.js.map +0 -1
  332. package/out/tools/train/org-cross-gbt.d.ts +0 -85
  333. package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
  334. package/out/tools/train/org-cross-gbt.js +0 -122
  335. package/out/tools/train/org-cross-gbt.js.map +0 -1
  336. package/out/tools/txhhsc-to-oarow.d.ts +0 -42
  337. package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
  338. package/out/tools/txhhsc-to-oarow.js +0 -78
  339. package/out/tools/txhhsc-to-oarow.js.map +0 -1
  340. package/out/tools/viz/browser.d.ts +0 -31
  341. package/out/tools/viz/browser.d.ts.map +0 -1
  342. package/out/tools/viz/browser.js +0 -26
  343. package/out/tools/viz/browser.js.map +0 -1
  344. package/out/tools/viz/cross-dataset-map.d.ts +0 -39
  345. package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
  346. package/out/tools/viz/cross-dataset-map.js +0 -84
  347. package/out/tools/viz/cross-dataset-map.js.map +0 -1
  348. package/out/tools/viz/geocode-first-surface.d.ts +0 -36
  349. package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
  350. package/out/tools/viz/geocode-first-surface.js +0 -234
  351. package/out/tools/viz/geocode-first-surface.js.map +0 -1
  352. package/out/tools/viz/render/map.d.ts +0 -42
  353. package/out/tools/viz/render/map.d.ts.map +0 -1
  354. package/out/tools/viz/render/map.js +0 -40
  355. package/out/tools/viz/render/map.js.map +0 -1
  356. package/out/tools/viz/render.d.ts +0 -46
  357. package/out/tools/viz/render.d.ts.map +0 -1
  358. package/out/tools/viz/render.js +0 -49
  359. package/out/tools/viz/render.js.map +0 -1
  360. package/out/tools/viz/source-provenance-map.d.ts +0 -57
  361. package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
  362. package/out/tools/viz/source-provenance-map.js +0 -82
  363. package/out/tools/viz/source-provenance-map.js.map +0 -1
  364. package/out/tools/viz/yardstick-figure.d.ts +0 -22
  365. package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
  366. package/out/tools/viz/yardstick-figure.js +0 -106
  367. package/out/tools/viz/yardstick-figure.js.map +0 -1
  368. package/tools/coverage-reconciliation.ts +0 -192
  369. package/tools/cross/dataset-correlation.ts +0 -380
  370. package/tools/cross/source-threshold-sweep.ts +0 -416
  371. package/tools/dedup-ceiling.ts +0 -225
  372. package/tools/eval-geocoder.ts +0 -77
  373. package/tools/geocoder/namesake-probe.ts +0 -91
  374. package/tools/geocoder/vs-provided-coords.ts +0 -232
  375. package/tools/gold-set-sample.ts +0 -147
  376. package/tools/learned/scorer/clustering-eval.ts +0 -349
  377. package/tools/learned/scorer/crossstate-eval.ts +0 -280
  378. package/tools/learned/scorer/eval.ts +0 -429
  379. package/tools/matcher-scale.ts +0 -185
  380. package/tools/nppes/dedup-benchmark.ts +0 -364
  381. package/tools/nppes/org-name.ts +0 -15
  382. package/tools/nppes/overmerge-packet.ts +0 -98
  383. package/tools/nppes/report.ts +0 -380
  384. package/tools/nppes/sample.ts +0 -250
  385. package/tools/nppes/scoring.ts +0 -115
  386. package/tools/nppes/settings.ts +0 -102
  387. package/tools/nppes/truth-grains.ts +0 -185
  388. package/tools/shared.ts +0 -743
  389. package/tools/train/cross-gbt.ts +0 -214
  390. package/tools/train/gbt.ts +0 -261
  391. package/tools/train/org-cross-gbt.ts +0 -189
  392. package/tools/txhhsc-to-oarow.ts +0 -118
  393. package/tools/viz/browser.ts +0 -41
  394. package/tools/viz/cross-dataset-map.ts +0 -133
  395. package/tools/viz/geocode-first-surface.ts +0 -305
  396. package/tools/viz/render/map.ts +0 -61
  397. package/tools/viz/render.ts +0 -103
  398. package/tools/viz/source-provenance-map.ts +0 -154
  399. package/tools/viz/yardstick-figure.ts +0 -197
@@ -1,103 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * Render a self-contained Plotly html to a PNG via headless Chromium — the shared renderer behind
7
- * the `registry viz` figures (an internal helper rather than a command).
8
- *
9
- * Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context. The shared harness
10
- * (`./browser.ts`) provides through SwiftShader. 2D traces (`contour`/`heatmap`) render on the 2D
11
- * canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div rather
12
- * than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
13
- */
14
-
15
- import { pathToFileURL } from "@mailwoman/core/module/file-url"
16
- import { resolvePath as resolve } from "path-ts"
17
-
18
- import { withChromiumPage } from "#tools/viz/browser"
19
-
20
- /**
21
- * Options for {@linkcode renderPlotlyHTMLToPNG}.
22
- */
23
- export interface RenderPlotlyOptions {
24
- /**
25
- * The self-contained Plotly html file.
26
- */
27
- inHTML: string
28
- /**
29
- * Output PNG path.
30
- */
31
- outPNG: string
32
- /**
33
- * Viewport width.
34
- *
35
- * @defaultValue `1160`
36
- */
37
- width?: number
38
- /**
39
- * Viewport height.
40
- *
41
- * @defaultValue `1000`
42
- */
43
- height?: number
44
- }
45
-
46
- /**
47
- * Screenshot a Plotly html page after every graph div's `plotly_afterplot` fires.
48
- */
49
- export async function renderPlotlyHTMLToPNG(
50
- options: RenderPlotlyOptions,
51
- report?: (line: string) => void
52
- ): Promise<{ outPNG: string; consoleErrors: string[] }> {
53
- const { consoleErrors: errors } = await withChromiumPage(
54
- { viewport: { width: options.width ?? 1160, height: options.height ?? 1000 } },
55
- async (page) => {
56
- await page.goto(pathToFileURL(resolve(options.inHTML)).href, { waitUntil: "networkidle" })
57
-
58
- // Resolve once every Plotly graph div has fired plotly_afterplot
59
- // (3D paints land async, after newPlot's promise resolves), with a per-div fallback
60
- // so an already-painted div can't hang us.
61
- await page.evaluate(async () => {
62
- // Runs in the browser — reach DOM/Plotly globals via globalThis so the script needs no DOM lib.
63
- interface PlotlyDiv {
64
- _fullLayout?: unknown
65
- on?: (event: string, cb: () => void) => void
66
- }
67
-
68
- const doc = Reflect.get(globalThis, "document") as { querySelectorAll(s: string): Iterable<unknown> }
69
-
70
- const divs = [...doc.querySelectorAll("div")]
71
- .map((d) => d as PlotlyDiv)
72
- .filter((d) => d._fullLayout && typeof d.on === "function")
73
-
74
- await Promise.all(
75
- divs.map(
76
- (d) =>
77
- new Promise<void>((res) => {
78
- d.on!("plotly_afterplot", () => res())
79
- setTimeout(() => res(), 2000)
80
- })
81
- )
82
- )
83
- })
84
-
85
- // Final settle for the software WebGL rasterizer.
86
- await page.waitForTimeout(800)
87
-
88
- await page.screenshot({ path: resolve(options.outPNG), fullPage: true })
89
- }
90
- )
91
-
92
- if (errors.length) {
93
- report?.(`[render] ${errors.length} console error(s):`)
94
-
95
- for (const e of errors.slice(0, 8)) {
96
- report?.(" " + e)
97
- }
98
- }
99
-
100
- report?.(`[render] ${options.outPNG}`)
101
-
102
- return { outPNG: options.outPNG, consoleErrors: errors }
103
- }
@@ -1,154 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * Sample `address_point.source` rows from a state database and render them by source in MapLibre.
7
- * The output requires an http origin because the tile server does not serve `file:` origins.
8
- */
9
-
10
- import { tempRootPath } from "@mailwoman/core/data-root"
11
- import { writeLocalFile } from "@mailwoman/core/fs/writers"
12
- import { isPresent } from "@mailwoman/core/objects"
13
- import type { AddressPointDatabase } from "@mailwoman/resolver-wof-sqlite/address"
14
- import { addressPointDatabasePath } from "@mailwoman/resolver-wof-sqlite/paths"
15
- import type { GeoFeature, GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial"
16
- import { DatabaseClient } from "@mailwoman/sqlite/client"
17
-
18
- import { type MapFeatureData, toMapHTML } from "#index"
19
-
20
- /**
21
- * Options for {@linkcode sourceProvenanceMap}.
22
- */
23
- export interface SourceProvenanceMapOptions {
24
- /**
25
- * State (lowercase postal).
26
- *
27
- * @defaultValue `"ny"`
28
- */
29
- state?: string
30
- /**
31
- * Address-point DB path.
32
- *
33
- * @defaultValue `$MAILWOMAN_DATA_ROOT/db/address-points/address-points-us-<state>.db`
34
- */
35
- db?: string
36
- /**
37
- * Output html path.
38
- *
39
- * @defaultValue `/tmp/source-provenance.html`
40
- */
41
- outHTML?: string
42
- /**
43
- * Keep ~1/N of NAD points.
44
- *
45
- * @defaultValue `700`
46
- */
47
- nadMod?: number
48
- /**
49
- * Keep ~1/N of OpenAddresses points.
50
- *
51
- * @defaultValue `120`
52
- */
53
- oaMod?: number
54
- /**
55
- * Per-source marker cap.
56
- *
57
- * @defaultValue `7000`
58
- */
59
- cap?: number
60
- }
61
-
62
- // Collapse the raw `source` string into a human, mappable category.
63
- // The address-point DB stores e.g. "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data".
64
- // The suffix gives the real upstream publisher.
65
- // Color features by that value (the "overture:" prefix names only the theme it arrived in).
66
- function categorize(source: string): { bucket: string; publisher: string } {
67
- if (source === "overture:NAD") return { bucket: "National Address Database", publisher: "NAD (federal)" }
68
-
69
- if (source.startsWith("overture:OpenAddresses")) {
70
- const publisher = source.split("/").at(-1) || "OpenAddresses"
71
-
72
- return { bucket: "OpenAddresses", publisher: `OpenAddresses · ${publisher}` }
73
- }
74
-
75
- return { bucket: source, publisher: source }
76
- }
77
-
78
- // Must stay a type alias. Rows come back from the driver as `Record<string, SQLOutputValue>[]` and
79
- // are asserted to `Row[]`; an object type alias includes an implicit index signature that makes that
80
- // assertion legal, an interface does not.
81
- // oxlint-disable-next-line typescript/consistent-type-definitions -- needs the implicit index signature
82
- type Row = { lat: number; lon: number; source: string; number: string | null; street_raw: string | null }
83
-
84
- /**
85
- * Render the per-state address-point provenance map — see the module doc.
86
- */
87
- export async function sourceProvenanceMap(
88
- options: SourceProvenanceMapOptions = {},
89
- report?: (line: string) => void
90
- ): Promise<{ outHTML: string; points: number }> {
91
- const STATE = (options.state || "ny").toLowerCase()
92
- const DB = options.db || addressPointDatabasePath(`address-points-us-${STATE}.db`)
93
- const OUT = options.outHTML || tempRootPath("source-provenance.html")
94
- const NAD_MOD = options.nadMod ?? 700 // keep ~1/700 of NAD points
95
- const OA_MOD = options.oaMod ?? 120 // keep ~1/120 of OpenAddresses points
96
- const CAP = options.cap ?? 7000 // per-source marker cap
97
-
98
- using db = new DatabaseClient<AddressPointDatabase>(DB, { readOnly: true })
99
-
100
- // Two stratified samples so the smaller source (OpenAddresses, ~1/6 of NY) stays visible
101
- // next to NAD. abs(random()) % mod == 0 keeps a spatially-uniform ~1/mod fraction.
102
- // Limit caps the marker count.
103
- const sample = (where: string, mod: number): Row[] =>
104
- db
105
- .prepare(
106
- `SELECT lat, lon, source, number, street_raw FROM address_point
107
- WHERE ${where} AND lat IS NOT NULL AND lon IS NOT NULL AND abs(random()) % ${mod} = 0
108
- LIMIT ${CAP}`
109
- )
110
- .all() as Row[]
111
-
112
- const rows = [
113
- ...sample("source = 'overture:NAD'", NAD_MOD),
114
- ...sample("source LIKE 'overture:OpenAddresses%'", OA_MOD),
115
- ]
116
-
117
- const counts = new Map<string, number>()
118
-
119
- const features: GeoFeature<PointLiteral, MapFeatureData>[] = rows.map((r) => {
120
- const { bucket, publisher } = categorize(r.source)
121
- counts.set(bucket, (counts.get(bucket) ?? 0) + 1)
122
- const addr = [r.number, r.street_raw].filter(isPresent).join(" ").trim()
123
-
124
- return {
125
- type: "Feature",
126
- geometry: { type: "Point", coordinates: [r.lon, r.lat] },
127
- properties: {
128
- bucket,
129
- sources: [bucket],
130
- recordCount: 1,
131
- geocodeTier: "address_point",
132
- organization: publisher,
133
- address: addr || null,
134
- },
135
- }
136
- })
137
-
138
- const geojson: GeoFeatureCollection<PointLiteral, MapFeatureData> = { type: "FeatureCollection", features }
139
-
140
- const html = toMapHTML(geojson, {
141
- title: `Address-point provenance — ${STATE.toUpperCase()}, every point colored by its open-data source`,
142
- flavor: "light",
143
- colorBy: "bucket",
144
- })
145
-
146
- await writeLocalFile(html, OUT)
147
- report?.(`[written] ${OUT} (${features.length} points)`)
148
-
149
- for (const [bucket, n] of [...counts.entries()].toSorted((a, b) => b[1] - a[1])) {
150
- report?.(` ${n.toString().padStart(5)} ${bucket}`)
151
- }
152
-
153
- return { outHTML: OUT, points: features.length }
154
- }
@@ -1,197 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- */
6
-
7
- import { writeLocalTextFile } from "@mailwoman/core/fs/writers"
8
- import { escapeHTML } from "@mailwoman/core/strings/escape"
9
-
10
- /**
11
- * Options for {@linkcode yardstickFigure}.
12
- */
13
- export interface YardstickFigureOptions {
14
- /**
15
- * Sets the output SVG path relative to the working directory, defaulting
16
- * to `docs/records/evals/charts/dedup-yardstick.svg`.
17
- */
18
- outSVG?: string
19
- }
20
-
21
- interface Grain {
22
- key: "NPI" | "site" | "org-name" | "org-name-coord"
23
- label: string
24
- classes: number
25
- note: string
26
- }
27
-
28
- const GRAINS: Grain[] = [
29
- { key: "NPI", label: "NPI", classes: 1000, note: "one entity per registration\n(over-segments orgs)" },
30
- { key: "site", label: "site", classes: 1456, note: "subpart-collapse +\naddress-split (conservative)" },
31
- { key: "org-name", label: "org-name", classes: 956, note: "same-org collapse by\naddress STRING key" },
32
- {
33
- key: "org-name-coord",
34
- label: "org-name (coord)",
35
- classes: 928,
36
- note: "collapse by geocoded\nBUILDING (geocode-first key)",
37
- },
38
- ]
39
-
40
- const F1: Record<string, [number, number, number, number]> = {
41
- GBT: [53.6, 55.3, 60.7, 68.1],
42
- FS: [45.1, 42.7, 52.3, 60.3],
43
- }
44
-
45
- const OVERMERGE: Record<string, [number, number, number, number]> = {
46
- GBT: [109, 208, 92, 76],
47
- FS: [144, 253, 129, 114],
48
- }
49
-
50
- const W = 760
51
- const H = 430
52
- const PAD = { top: 64, right: 168, bottom: 92, left: 64 }
53
- const plotL = PAD.left
54
- const plotR = W - PAD.right
55
- const plotT = PAD.top
56
- const plotB = H - PAD.bottom
57
-
58
- const Y_MIN = 40
59
- const Y_MAX = 72
60
- const yFor = (f1: number) => plotB - ((f1 - Y_MIN) / (Y_MAX - Y_MIN)) * (plotB - plotT)
61
- const xFor = (i: number) => plotL + (i / (GRAINS.length - 1)) * (plotR - plotL)
62
-
63
- const MODELS = [
64
- { key: "GBT", label: "GBT (shipped default)", color: "#3578e5", width: 3, dash: "" },
65
- { key: "FS", label: "FS full stack", color: "#9ca3af", width: 2, dash: "5 4" },
66
- ]
67
-
68
- const esc = escapeHTML
69
-
70
- /**
71
- * Emit the dedup-yardstick slope chart as a self-contained SVG — see the module doc.
72
- */
73
- export async function yardstickFigure(
74
- options: YardstickFigureOptions = {},
75
- report?: (line: string) => void
76
- ): Promise<{ outSVG: string }> {
77
- const OUT = options.outSVG || "docs/records/evals/charts/dedup-yardstick.svg"
78
-
79
- const parts: string[] = []
80
- const push = (s: string) => parts.push(s)
81
-
82
- push(
83
- `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" width="${W}" height="${H}" font-family="ui-sans-serif, system-ui, sans-serif" font-size="11"><rect width="${W}" height="${H}" fill="white"/>`
84
- )
85
-
86
- push(
87
- `<text x="${W / 2}" y="24" text-anchor="middle" font-size="15" font-weight="600">The dedup F1 climbs as the entity-truth gets honest</text>`
88
- )
89
-
90
- push(
91
- `<text x="${W / 2}" y="42" text-anchor="middle" font-size="11.5" fill="#555">Identical matcher output (the same clusters) graded against four rulers — 1000 TX NPIs → 2757 records, NPI held out</text>`
92
- )
93
-
94
- for (let v = Y_MIN; v <= Y_MAX; v += 5) {
95
- const y = yFor(v)
96
-
97
- push(
98
- `<line x1="${plotL}" y1="${y.toFixed(1)}" x2="${plotR}" y2="${y.toFixed(1)}" stroke="#e5e7eb" stroke-width="1"/>`
99
- )
100
-
101
- push(`<text x="${plotL - 8}" y="${(y + 3).toFixed(1)}" text-anchor="end" fill="#374151">${v}%</text>`)
102
- }
103
-
104
- push(
105
- `<text transform="translate(20, ${(plotT + plotB) / 2}) rotate(-90)" text-anchor="middle" font-size="12" fill="#374151">entity-resolution F1</text>`
106
- )
107
-
108
- GRAINS.forEach((g, i) => {
109
- const x = xFor(i)
110
-
111
- push(
112
- `<line x1="${x.toFixed(1)}" y1="${plotT}" x2="${x.toFixed(1)}" y2="${plotB}" stroke="#f1f1f1" stroke-width="1"/>`
113
- )
114
-
115
- push(
116
- `<text x="${x.toFixed(1)}" y="${plotB + 20}" text-anchor="middle" font-size="12.5" font-weight="600">${esc(g.label)}</text>`
117
- )
118
-
119
- push(
120
- `<text x="${x.toFixed(1)}" y="${plotB + 36}" text-anchor="middle" font-size="10" fill="#6b7280">${g.classes} classes</text>`
121
- )
122
-
123
- // oxlint-disable-next-line mailwoman/prefer-spliterator -- `g.note` is a literal label from the models table rather than a file.
124
- g.note.split("\n").forEach((line, k) => {
125
- push(
126
- `<text x="${x.toFixed(1)}" y="${plotB + 50 + k * 12}" text-anchor="middle" font-size="9" fill="#9ca3af">${esc(line)}</text>`
127
- )
128
- })
129
- })
130
-
131
- for (const m of MODELS) {
132
- const f1s = F1[m.key]!
133
- const pts = f1s.map((f, i) => `${xFor(i).toFixed(1)},${yFor(f).toFixed(1)}`).join(" ")
134
-
135
- push(
136
- `<polyline points="${pts}" fill="none" stroke="${m.color}" stroke-width="${m.width}"${m.dash ? ` stroke-dasharray="${m.dash}"` : ""}/>`
137
- )
138
-
139
- f1s.forEach((f, i) => {
140
- const x = xFor(i)
141
- const y = yFor(f)
142
- push(`<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="${m.key === "GBT" ? 5 : 4}" fill="${m.color}"/>`)
143
-
144
- const dy = m.key === "GBT" ? -10 : 16
145
-
146
- push(
147
- `<text x="${x.toFixed(1)}" y="${(y + dy).toFixed(1)}" text-anchor="middle" font-size="11" font-weight="${m.key === "GBT" ? 700 : 400}" fill="${m.color}">${f.toFixed(1)}</text>`
148
- )
149
- })
150
- }
151
-
152
- const lx = plotR + 16
153
- let ly = plotT + 6
154
-
155
- for (const m of MODELS) {
156
- push(
157
- `<line x1="${lx}" y1="${ly}" x2="${lx + 22}" y2="${ly}" stroke="${m.color}" stroke-width="${m.width}"${m.dash ? ` stroke-dasharray="${m.dash}"` : ""}/>`
158
- )
159
-
160
- push(`<text x="${lx + 28}" y="${ly + 3.5}" font-size="10.5" fill="#374151">${esc(m.label)}</text>`)
161
- ly += 18
162
- }
163
-
164
- const gCoord = yFor(F1.GBT![3])
165
- const gNPI = yFor(F1.GBT![0])
166
-
167
- push(
168
- `<g font-size="10.5">` +
169
- `<text x="${lx}" y="${ly + 18}" font-weight="700" fill="#3578e5">+14.5pp NPI → coord</text>` +
170
- `<text x="${lx}" y="${ly + 33}" fill="#555">same clusters —</text>` +
171
- `<text x="${lx}" y="${ly + 46}" fill="#555">the ruler, not the model.</text>` +
172
- `<text x="${lx}" y="${ly + 64}" fill="#555">over-merge 109 → 76,</text>` +
173
- `<text x="${lx}" y="${ly + 77}" fill="#555">precision 43.7% → 64.6%.</text>` +
174
- `</g>`
175
- )
176
-
177
- push(
178
- `<path d="M ${(plotR - 4).toFixed(1)} ${gNPI.toFixed(1)} L ${(plotR + 2).toFixed(1)} ${gNPI.toFixed(1)} L ${(plotR + 2).toFixed(1)} ${gCoord.toFixed(1)} L ${(plotR - 4).toFixed(1)} ${gCoord.toFixed(1)}" fill="none" stroke="#3578e5" stroke-width="1" opacity="0.5"/>`
179
- )
180
-
181
- push(
182
- `<text x="${plotL}" y="${H - 10}" font-size="9.5" fill="#9ca3af">Gold set (2026-06-16-dedup-gold-set-tx120): 120/120 hard co-located pairs = same org, 0 genuine over-merges. The coordinate (geocode-first building key) is the tightest honest ruler; NPI charges correct same-org merges as errors.</text>`
183
- )
184
-
185
- push(`</svg>`)
186
-
187
- await writeLocalTextFile(parts.join(""), OUT)
188
- report?.(`[written] ${OUT}`)
189
-
190
- report?.(
191
- ` GBT F1: NPI ${F1.GBT![0]} → site ${F1.GBT![1]} → org-name ${F1.GBT![2]} → coord ${F1.GBT![3]} (+${(F1.GBT![3] - F1.GBT![0]).toFixed(1)}pp)`
192
- )
193
-
194
- report?.(` over-merge: ${OVERMERGE.GBT!.join(" → ")}`)
195
-
196
- return { outSVG: OUT }
197
- }