@mailwoman/registry 10.8.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +28 -0
  13. package/lib/artifacts/iata-airport/membership.ts +28 -0
  14. package/lib/artifacts/iata-airport/records.ts +28 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +28 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +28 -0
  17. package/lib/artifacts/iso3166-1/records.ts +28 -0
  18. package/lib/errors.ts +47 -0
  19. package/lib/iata/airports/records.ts +173 -0
  20. package/lib/iata/airports/validate.ts +50 -0
  21. package/lib/index.ts +32 -18
  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 +150 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +148 -0
  28. package/lib/normalize.ts +35 -0
  29. package/lib/overlap/country-airport.ts +110 -0
  30. package/lib/rgy1/base64.ts +23 -0
  31. package/lib/rgy1/reader.ts +317 -0
  32. package/lib/rgy1/sections.generated.ts +80 -0
  33. package/lib/rgy1/views.ts +266 -0
  34. package/lib/types.ts +92 -77
  35. package/lib/wasm.ts +287 -0
  36. package/out/artifacts/country-airport-collision.d.ts +7 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +22 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +7 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +22 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +7 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +22 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +7 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +22 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +7 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +22 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +7 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +22 -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 +37 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +37 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +135 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +19 -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 +21 -18
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +12 -22
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +35 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +32 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +16 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +40 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +21 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +43 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +27 -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 +13 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +26 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +67 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +123 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +26 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +11 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +43 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +72 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +11 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +20 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +92 -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 +52 -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 +89 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +216 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +49 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +105 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +2 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +19 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +102 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +101 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +5 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +9 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +2 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +207 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +2 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +69 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +2 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +127 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +2 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +115 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +143 -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 +2 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +27 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +91 -79
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +15 -8
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +85 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +138 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +54 -28
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +145 -0
  175. package/sdk/sources.ts +166 -0
  176. package/tools/artifact-path.ts +9 -0
  177. package/tools/bench.run.ts +274 -0
  178. package/tools/build-wasm.run.ts +81 -0
  179. package/tools/generate-sections.run.ts +144 -0
  180. package/tools/generate.run.ts +144 -0
  181. package/tools/normalize.run.ts +35 -0
  182. package/tools/normalize.ts +475 -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,192 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * Coverage reconciliation, the product output that replaces inspecting the map by eye.
7
- *
8
- * Each resolved entity is classified by the kind of source its records come from. An eligibility
9
- * source holds providers and facilities, such as NPPES org NPIs or TX HHSC nursing facilities. A
10
- * funding source holds entities enrolled in a funding program, such as FCC Rural Health Care
11
- * filings.
12
- *
13
- * The buckets are enrolled (both an eligibility and a funding record), eligible rather than
14
- * enrolled (an eligibility record with no funding record resolving to it), and funded rather than
15
- * in the eligibility set (a funding record with no eligibility record resolving to it).
16
- *
17
- * This is strictly a set-membership reconciliation, never an allegation.
18
- *
19
- * Run: `mailwoman registry scorer-eval coverage-reconciliation [--cap 2000] [--wof <admin.db>]
20
- * [--data-root <dir>] [--out-md <md>] [--out-geojson <geojson>]`
21
- */
22
-
23
- import { dataRootPath } from "@mailwoman/core/data-root"
24
- import { writeLocalFile, writeLocalJSONFile } from "@mailwoman/core/fs/writers"
25
-
26
- import {
27
- ingestRows,
28
- reconcileCoverage,
29
- reconciliationGeoJSON,
30
- reconciliationReport,
31
- resolveEntities,
32
- streamRows,
33
- type GeocodeAddress,
34
- type ReconcileConfig,
35
- type SourceRecord,
36
- } from "#index"
37
- import type { EvalGeocoderFactory } from "#tools/eval-geocoder"
38
- import { buildSpecs, stateOption } from "#tools/shared"
39
-
40
- /**
41
- * Options for {@linkcode coverageReconciliation}.
42
- */
43
- export interface CoverageReconciliationOptions {
44
- /**
45
- * The injected geocoder factory.
46
- *
47
- * The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
48
- */
49
- createGeocoder: EvalGeocoderFactory
50
- /**
51
- * Record-matcher sources directory.
52
- *
53
- * @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
54
- */
55
- sources?: string
56
- /**
57
- * Rows kept per source.
58
- *
59
- * @defaultValue `2000`
60
- */
61
- cap?: number
62
- /**
63
- * State filter.
64
- *
65
- * @defaultValue TX.
66
- */
67
- state?: string
68
- /**
69
- * Also write the markdown report here.
70
- */
71
- outMd?: string
72
- /**
73
- * Also write the bucket-tagged GeoJSON here.
74
- */
75
- outGeojson?: string
76
- }
77
-
78
- /**
79
- * Which kind of source a record's provenance label denotes.
80
- */
81
- const ELIGIBILITY = new Set(["nppes", "txhhsc-nursing"])
82
- const FUNDING = new Set(["fcc-rhc"])
83
-
84
- /**
85
- * Reconcile eligibility and funding sources.
86
- * Emit the markdown report to stdout.
87
- */
88
- export async function coverageReconciliation(
89
- options: CoverageReconciliationOptions,
90
- report?: (line: string) => void
91
- ): Promise<{ markdown: string }> {
92
- const SOURCES = options.sources || dataRootPath("record-matcher", "sources")
93
- const CAP = options.cap ?? 2000
94
- const STATE = stateOption(options)
95
- const OUT_MD = options.outMd || ""
96
- const OUT_GEOJSON = options.outGeojson || ""
97
- const SPECS = buildSpecs(`${SOURCES}`, STATE)
98
-
99
- const rawBySource = new Map<string, Record<string, string>[]>()
100
-
101
- for (const spec of SPECS) {
102
- report?.(`[A] ${spec.source}: streaming + ${STATE} filter (cap ${CAP})…`)
103
- const kept: Record<string, string>[] = []
104
-
105
- for await (const row of streamRows(spec.path)) {
106
- if (!spec.inState(row)) continue
107
- kept.push(row)
108
-
109
- if (kept.length >= CAP) break
110
- }
111
-
112
- rawBySource.set(spec.source, kept)
113
- report?.(` ${spec.source}: ${kept.length} rows`)
114
- }
115
-
116
- report?.("[B] building the geocoder…")
117
- const geocoder = await options.createGeocoder()
118
-
119
- let geo = 0
120
- let total = 0
121
-
122
- const geocodeForIngest: GeocodeAddress = async (raw) => {
123
- const g = await geocoder.geocodeAddress(raw)
124
-
125
- total++
126
-
127
- if (g?.geocode) {
128
- geo++
129
- }
130
-
131
- return g
132
- }
133
-
134
- report?.("[C] geocoding + ingesting…")
135
- const records: SourceRecord[] = []
136
-
137
- for (const spec of SPECS) {
138
- const recs = await ingestRows(rawBySource.get(spec.source)!, spec.mapping, { geocodeAddress: geocodeForIngest })
139
-
140
- for (const r of recs) {
141
- r.id = `${spec.source}:${r.id}`
142
- }
143
-
144
- records.push(...recs)
145
- }
146
-
147
- geocoder[Symbol.dispose]()
148
- report?.(` ${records.length} records; geocoded ${geo}/${total} (${((100 * geo) / total).toFixed(1)}%)`)
149
-
150
- report?.("[D] resolving + reconciling…")
151
- // Use the Fellegi-Sunter baseline for this cross-dataset join.
152
- // It is recall-oriented because the signal is the same facility under a different operational name.
153
- // The dedup-calibrated GBT default rejects that pair.
154
- const { entities } = resolveEntities(records, { trainEM: true, collapseSpatial: true, learnedScorer: false })
155
-
156
- // Reconcile through the shared @mailwoman/registry code path, so the script and the CLI agree.
157
- const config: ReconcileConfig = { eligibilitySources: [...ELIGIBILITY], fundingSources: [...FUNDING] }
158
- const result = reconcileCoverage(entities, config)
159
- const geojson = reconciliationGeoJSON(result)
160
-
161
- const md = reconciliationReport(result, {
162
- title: "Coverage reconciliation — eligibility ↔ enrollment (#621)",
163
- scopeNote:
164
- `Generated by \`mailwoman registry scorer-eval coverage-reconciliation\`. ${STATE}-scoped, ≤${CAP} rows per ` +
165
- `source, resolved BLIND across sources. **Eligibility** = NPPES org NPIs + TX HHSC nursing facilities. ` +
166
- `**Funding/enrollment** = FCC Rural Health Care filings. Each resolved entity is classified by which kinds ` +
167
- `of source its records span.`,
168
- scorerNote:
169
- `Scored with the Fellegi-Sunter baseline (\`learnedScorer: false\`): this is a cross-dataset eligibility ↔ ` +
170
- `funding join (recall-oriented), so the dedup-calibrated GBT default (#603) — trained to reject the ` +
171
- `"same place, different operational name" pattern that IS the cross-source signal — is pinned off. See #655.`,
172
- sampleNote:
173
- `This is a **capped sample** (≤${CAP}/source), so "eligible, not enrolled" includes entities that ARE ` +
174
- `enrolled in reality but whose funding record fell outside the sample — a **sampling artifact, not a ` +
175
- `finding**. At full scale the anti-join tightens, but it is STILL only a set of candidates.`,
176
- spotCheckLimit: 15,
177
- })
178
-
179
- console.log(md)
180
-
181
- if (OUT_MD) {
182
- await writeLocalFile(md, OUT_MD)
183
- report?.(`[written] ${OUT_MD}`)
184
- }
185
-
186
- if (OUT_GEOJSON) {
187
- await writeLocalJSONFile(geojson, OUT_GEOJSON)
188
- report?.(`[written] ${OUT_GEOJSON} (${geojson.features.length} features)`)
189
- }
190
-
191
- return { markdown: md }
192
- }
@@ -1,380 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- */
6
-
7
- import { dataRootPath } from "@mailwoman/core/data-root"
8
- import { writeLocalFile, writeLocalJSONFile } from "@mailwoman/core/fs/writers"
9
- import { isPresent } from "@mailwoman/core/objects"
10
-
11
- import {
12
- addressFrequencyKey,
13
- ingestRows,
14
- repName,
15
- resolveEntities,
16
- streamRows,
17
- toGeoJSON,
18
- type GeocodeAddress,
19
- type SourceRecord,
20
- } from "#index"
21
- import type { EvalGeocoderFactory } from "#tools/eval-geocoder"
22
- import { buildSpecs, norm, pct, stateOption, type SourceSpec } from "#tools/shared"
23
-
24
- const MIN_TRIPLE_SOURCES = 3
25
-
26
- /**
27
- * Options for {@linkcode crossDatasetCorrelation}.
28
- */
29
- export interface CrossDatasetCorrelationOptions {
30
- /**
31
- * Creates the geocoder that resolves the sampled rows.
32
- */
33
- createGeocoder: EvalGeocoderFactory
34
-
35
- /**
36
- * The record-matcher sources directory.
37
- *
38
- * @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
39
- */
40
- sources?: string
41
-
42
- /**
43
- * The number of in-state rows sampled per source for geocoding.
44
- *
45
- * @defaultValue `300`
46
- */
47
- cap?: number
48
-
49
- /**
50
- * The state filter.
51
- *
52
- * @defaultValue {@linkcode TX}
53
- */
54
- state?: string
55
-
56
- /**
57
- * Whether to scan every in-state row to build a corpus-wide address-frequency table.
58
- *
59
- * The scan reads the full source files, including the multi-gigabyte NPPES file.
60
- * When it is false, `resolveEntities` computes frequencies from the sample only.
61
- *
62
- * @defaultValue `true`
63
- */
64
- corpusFrequency?: boolean
65
-
66
- /**
67
- * An optional path for the Markdown report.
68
- */
69
- outMd?: string
70
-
71
- /**
72
- * An optional path for the entity GeoJSON FeatureCollection.
73
- */
74
- outGeojson?: string
75
- }
76
-
77
- function composeAddress(row: Record<string, string>, columns: string | string[] | null | undefined): string {
78
- if (!columns) return ""
79
- const list = Array.isArray(columns) ? columns : [columns]
80
-
81
- return list
82
- .map((c) => norm(row[c]))
83
- .filter(isPresent)
84
- .join(" ")
85
- .trim()
86
- }
87
-
88
- const commitmentsSpec = (S: string, STATE: string): SourceSpec => ({
89
- source: "fcc-rhc-commitments",
90
- path: `${S}/fcc-rhc_commitments-disbursements_form462-466-466a_20260615.tsv`,
91
- mapping: {
92
- id: "hcpID",
93
- organization: "hcpName",
94
- address: ["hcpStreet", "hcpCity", "hcpState", "hcpZip"],
95
- source: "fcc-rhc-commitments",
96
- },
97
- inState: (r) =>
98
- norm(r["Filing HCP State"]).toUpperCase() === STATE || norm(r["Participating HCP State"]).toUpperCase() === STATE,
99
- explode: (r) => {
100
- const out: Record<string, string>[] = []
101
-
102
- const add = (prefix: string, role: string): void => {
103
- const id = norm(r[`${prefix} HCP`])
104
- const state = norm(r[`${prefix} HCP State`]).toUpperCase()
105
-
106
- if (id && state === STATE) {
107
- out.push({
108
- hcpID: `${role}-${id}`,
109
- hcpName: norm(r[`${prefix} HCP Name`]),
110
- hcpStreet: norm(r[`${prefix} HCP Street`]),
111
- hcpCity: norm(r[`${prefix} HCP City`]),
112
- hcpState: state,
113
- hcpZip: norm(r[`${prefix} HCP Zip Code`]),
114
- })
115
- }
116
- }
117
-
118
- add("Filing", "filing")
119
- add("Participating", "participating")
120
-
121
- return out
122
- },
123
- })
124
-
125
- /**
126
- * Geocodes a sample of each source dataset in one state, resolves the records into entities across sources.
127
- * It returns a Markdown report of the cross-source links.
128
- *
129
- * Progress lines go to `report`.
130
- * The function also writes the report and GeoJSON when `outMd` or `outGeojson` is set.
131
- */
132
- export async function crossDatasetCorrelation(
133
- options: CrossDatasetCorrelationOptions,
134
- report?: (line: string) => void
135
- ): Promise<{ markdown: string }> {
136
- const SOURCES = options.sources || dataRootPath("record-matcher", "sources")
137
- const CAP = options.cap ?? 300
138
- const STATE = stateOption(options)
139
- const OUT_MD = options.outMd || ""
140
- const OUT_GEOJSON = options.outGeojson || ""
141
- const CORPUS_FREQ = options.corpusFrequency ?? true
142
- const SPECS = [...buildSpecs(`${SOURCES}`, STATE), commitmentsSpec(`${SOURCES}`, STATE)]
143
-
144
- const rawBySource = new Map<string, Record<string, string>[]>()
145
- const addrCounts = new Map<string, number>()
146
- let addrTotal = 0
147
-
148
- for (const spec of SPECS) {
149
- report?.(`[A] ${spec.source}: streaming + ${STATE} filter (sample ${CAP}${CORPUS_FREQ ? ", full freq scan" : ""})…`)
150
- const kept: Record<string, string>[] = []
151
-
152
- for await (const row of streamRows(spec.path)) {
153
- if (!spec.inState(row)) continue
154
- const exploded = spec.explode ? spec.explode(row) : [row]
155
-
156
- for (const e of exploded) {
157
- if (CORPUS_FREQ) {
158
- const a = composeAddress(e, spec.mapping.address)
159
-
160
- if (a) {
161
- const k = addressFrequencyKey(a)
162
- addrCounts.set(k, (addrCounts.get(k) ?? 0) + 1)
163
-
164
- addrTotal++
165
- }
166
- }
167
-
168
- if (kept.length < CAP) {
169
- kept.push(e)
170
- }
171
- }
172
-
173
- if (!CORPUS_FREQ && kept.length >= CAP) break
174
- }
175
-
176
- rawBySource.set(spec.source, kept)
177
- report?.(` ${spec.source}: ${kept.length} sampled`)
178
- }
179
-
180
- const addressFrequency = CORPUS_FREQ
181
- ? {
182
- total: addrTotal,
183
- distinct: addrCounts.size,
184
- frequency: (v: string) => (v ? (addrCounts.get(addressFrequencyKey(v)) ?? 0) / addrTotal : 0),
185
- }
186
- : null
187
-
188
- if (CORPUS_FREQ) {
189
- report?.(` address-frequency table: ${addrCounts.size} distinct over ${addrTotal} ${STATE} addresses`)
190
- }
191
-
192
- report?.("[B] building the geocoder…")
193
- const geocoder = await options.createGeocoder()
194
-
195
- let geo = 0
196
- let total = 0
197
-
198
- const geocodeForIngest: GeocodeAddress = async (raw) => {
199
- const g = await geocoder.geocodeAddress(raw)
200
-
201
- total++
202
-
203
- if (g?.geocode) {
204
- geo++
205
- }
206
-
207
- return g
208
- }
209
-
210
- report?.("[C] geocoding + ingesting all sources…")
211
- const records: SourceRecord[] = []
212
-
213
- for (const spec of SPECS) {
214
- const rows = rawBySource.get(spec.source)!
215
-
216
- const g0 = geo
217
- const t0 = total
218
- const recs = await ingestRows(rows, spec.mapping, { geocodeAddress: geocodeForIngest })
219
- const dg = geo - g0
220
- const dt = total - t0
221
- report?.(` ${spec.source}: geocoded ${dg}/${dt} (${dt ? ((100 * dg) / dt).toFixed(1) : "0"}%)`)
222
-
223
- for (const r of recs) {
224
- r.id = `${spec.source}:${r.id}`
225
- }
226
-
227
- records.push(...recs)
228
- }
229
-
230
- geocoder[Symbol.dispose]()
231
- report?.(` ${records.length} records; geocoded ${geo}/${total} (${((100 * geo) / total).toFixed(1)}%)`)
232
-
233
- report?.("[D] resolving across sources…")
234
-
235
- const { entities, candidatePairs } = resolveEntities(records, {
236
- trainEM: true,
237
- learnedScorer: false,
238
- ...(addressFrequency ? { addressFrequency } : {}),
239
- })
240
-
241
- const sourceOf = (r: SourceRecord) => r.source ?? "?"
242
-
243
- const crossSource = entities
244
- .map((e) => ({ e, sources: new Set(e.records.map(sourceOf)) }))
245
- .filter((x) => x.sources.size >= 2)
246
- .toSorted((a, b) => b.sources.size - a.sources.size || b.e.records.length - a.e.records.length)
247
-
248
- const pairCounts = new Map<string, number>()
249
-
250
- for (const { sources } of crossSource) {
251
- const list = [...sources].toSorted()
252
-
253
- for (let i = 0; i < list.length; i++) {
254
- for (let j = i + 1; j < list.length; j++) {
255
- const k = `${list[i]} ↔ ${list[j]}`
256
- pairCounts.set(k, (pairCounts.get(k) ?? 0) + 1)
257
- }
258
- }
259
- }
260
-
261
- const lines: string[] = [
262
- `# Cross-dataset correlation (#618 / #87 real-data run)`,
263
- "",
264
- `_Generated by \`mailwoman registry scorer-eval cross-dataset\`. ${STATE}-scoped, ≤${CAP} rows per ` +
265
- `source geocoded, resolved BLIND across sources (geo-first block → Fellegi-Sunter + EM → cluster) with the ` +
266
- `proven changes default-on (#86). The sources share no key; an entity spanning ≥2 sources is a cross-dataset ` +
267
- `link we surface for review — interpretation is the consumer's._`,
268
- "",
269
- `## Sources`,
270
- "",
271
- ]
272
-
273
- const blurb: Record<string, string> = {
274
- "txhhsc-nursing": "TX HHSC licensed nursing facilities",
275
- "fcc-rhc": "FCC Rural Health Care posted-services filings",
276
- "fcc-rhc-commitments": "FCC RHC funding commitments (Filing + Participating HCP, exploded)",
277
- nppes: "NPPES organization NPIs",
278
- }
279
-
280
- lines.push(`| source | rows | what it is |`)
281
- lines.push(`|---|---:|---|`)
282
-
283
- for (const spec of SPECS) {
284
- lines.push(`| \`${spec.source}\` | ${rawBySource.get(spec.source)!.length} | ${blurb[spec.source] ?? ""} |`)
285
- }
286
-
287
- lines.push("")
288
-
289
- lines.push(
290
- `Combined: **${records.length} records**, geocoded ${pct(geo / total)}%. Resolved to ` +
291
- `**${entities.length} entities** from ${candidatePairs} candidate pairs.`
292
- )
293
-
294
- lines.push("")
295
-
296
- lines.push(
297
- addressFrequency
298
- ? `Matched with the proven changes default-on (#86): collapsed spatial (A1) + inverse-address-frequency, fed ` +
299
- `a corpus-wide table built from the full source files (**${addressFrequency.distinct.toLocaleString()}** distinct ` +
300
- `addresses over **${addressFrequency.total.toLocaleString()}** ${STATE} rows — a crowded shared campus is ` +
301
- `down-weighted as weak identity evidence).`
302
- : `Matched with the zero-config default (#86): collapsed spatial (A1) + an input-scoped address-frequency table ` +
303
- `(\`--no-corpus-frequency\`; pass nothing to build the corpus-wide table from the full files instead).`
304
- )
305
-
306
- lines.push("")
307
-
308
- lines.push(
309
- `Scored with the Fellegi-Sunter baseline (\`learnedScorer: false\`): cross-dataset link discovery is ` +
310
- `recall-oriented — the same facility under different operational names across sources is the signal — so the ` +
311
- `dedup-calibrated GBT default (#603), which is trained to REJECT "same place, different name," is pinned off ` +
312
- `here. A cross-objective GBT threshold is the follow-up (#655).`
313
- )
314
-
315
- lines.push("")
316
- lines.push(`## Cross-dataset links (entities spanning ≥2 sources)`)
317
- lines.push("")
318
- lines.push(`**${crossSource.length}** entities resolve across ≥2 sources.`)
319
- lines.push("")
320
-
321
- if (pairCounts.size) {
322
- lines.push(`| source pair | entities linked |`)
323
- lines.push(`|---|---:|`)
324
-
325
- for (const [k, v] of [...pairCounts.entries()].toSorted((a, b) => b[1] - a[1])) {
326
- lines.push(`| ${k} | ${v} |`)
327
- }
328
-
329
- lines.push("")
330
- }
331
-
332
- const triple = crossSource.filter((x) => x.sources.size >= MIN_TRIPLE_SOURCES).length
333
-
334
- if (triple) {
335
- lines.push(`Of those, **${triple}** span all three sources.`)
336
- }
337
-
338
- lines.push("")
339
- lines.push(`## Spot-check — the first 12 cross-source entities (verify by eye)`)
340
- lines.push("")
341
- lines.push(`| entity | sources | name (representative) | coordinate |`)
342
- lines.push(`|---|---|---|---|`)
343
-
344
- for (const { e, sources } of crossSource.slice(0, 12)) {
345
- const coord = e.coordinate ? `${e.coordinate.latitude.toFixed(4)}, ${e.coordinate.longitude.toFixed(4)}` : "—"
346
- lines.push(`| ${e.id} | ${[...sources].toSorted().join(", ")} | ${repName(e)} | ${coord} |`)
347
- }
348
-
349
- lines.push("")
350
- lines.push(`## Reading`)
351
- lines.push("")
352
-
353
- lines.push(
354
- `${SPECS.length} datasets with no shared key — a provider registry, a federal funding program (two of its forms, ` +
355
- `the commitments form exploded into its Filing + Participating HCP per row), and a state facility registry — ` +
356
- `resolve into a single entity model where ${crossSource.length} entities are corroborated by ≥2 independent ` +
357
- `sources (${triple} by all three kinds), purely on geocoded location + name/org agreement, in pure Node without ` +
358
- `Elasticsearch or a server. Each cross-source entity is a candidate "same place, multiple records" surfaced for ` +
359
- `review; whether a correlation means anything is the data consumer's call, not ours.`
360
- )
361
-
362
- lines.push("")
363
-
364
- const md = lines.join("\n")
365
-
366
- console.log(md)
367
-
368
- if (OUT_MD) {
369
- await writeLocalFile(md, OUT_MD)
370
- report?.(`\n[written] ${OUT_MD}`)
371
- }
372
-
373
- if (OUT_GEOJSON) {
374
- const fc = toGeoJSON(entities)
375
- await writeLocalJSONFile(fc, OUT_GEOJSON)
376
- report?.(`[written] ${OUT_GEOJSON} — ${fc.features.length} entity features (${crossSource.length} cross-source)`)
377
- }
378
-
379
- return { markdown: md }
380
- }