@mailwoman/registry 9.1.0 → 9.3.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 (228) hide show
  1. package/README.md +2 -2
  2. package/{address-key.ts → lib/address-key.ts} +1 -1
  3. package/{geocode-handler.ts → lib/geocode-handler.ts} +7 -7
  4. package/{geojson.ts → lib/geojson.ts} +12 -6
  5. package/{index.ts → lib/index.ts} +10 -10
  6. package/{ingest.ts → lib/ingest.ts} +77 -69
  7. package/{learned-scorer.ts → lib/learned-scorer.ts} +1 -1
  8. package/{map-html.ts → lib/map-html.ts} +10 -16
  9. package/{reconcile.ts → lib/reconcile.ts} +9 -24
  10. package/{resolve.ts → lib/resolve.ts} +31 -13
  11. package/{tools → lib/tools}/coverage-reconciliation.ts +13 -15
  12. package/{tools → lib/tools}/cross-dataset-correlation.ts +64 -139
  13. package/{tools → lib/tools}/cross-source-threshold-sweep.ts +21 -32
  14. package/{tools → lib/tools}/dedup-ceiling.ts +33 -144
  15. package/{tools → lib/tools}/eval-geocoder.ts +10 -11
  16. package/{tools → lib/tools}/geocoder-namesake-probe.ts +5 -12
  17. package/{tools → lib/tools}/geocoder-vs-provided-coords.ts +12 -11
  18. package/lib/tools/gold-set-sample.ts +141 -0
  19. package/lib/tools/index.ts +31 -0
  20. package/{tools → lib/tools}/learned-scorer-clustering-eval.ts +71 -260
  21. package/{tools → lib/tools}/learned-scorer-crossstate-eval.ts +62 -245
  22. package/{tools → lib/tools}/learned-scorer-eval.ts +64 -263
  23. package/{tools → lib/tools}/matcher-scale.ts +5 -5
  24. package/lib/tools/nppes/org-name.ts +23 -0
  25. package/lib/tools/nppes/overmerge-packet.ts +94 -0
  26. package/lib/tools/nppes/report.ts +373 -0
  27. package/lib/tools/nppes/sample.ts +245 -0
  28. package/lib/tools/nppes/scoring.ts +114 -0
  29. package/lib/tools/nppes/settings.ts +102 -0
  30. package/lib/tools/nppes/truth-grains.ts +161 -0
  31. package/lib/tools/nppes-dedup-benchmark.ts +408 -0
  32. package/lib/tools/shared.ts +763 -0
  33. package/lib/tools/train-cross-gbt.ts +209 -0
  34. package/{tools → lib/tools}/train-gbt.ts +38 -156
  35. package/lib/tools/train-org-cross-gbt.ts +179 -0
  36. package/{tools → lib/tools}/txhhsc-to-oarow.ts +10 -28
  37. package/lib/tools/viz/browser.ts +50 -0
  38. package/{tools → lib/tools}/viz/cross-dataset-map.ts +16 -39
  39. package/{tools → lib/tools}/viz/geocode-first-surface.ts +13 -39
  40. package/{tools → lib/tools}/viz/render-map.ts +10 -23
  41. package/lib/tools/viz/render.ts +98 -0
  42. package/{tools → lib/tools}/viz/source-provenance-map.ts +20 -39
  43. package/{tools → lib/tools}/viz/yardstick-figure.ts +6 -5
  44. package/{types.ts → lib/types.ts} +10 -1
  45. package/out/address-key.d.ts +1 -1
  46. package/out/address-key.d.ts.map +1 -1
  47. package/out/address-key.js.map +1 -1
  48. package/out/geocode-handler.d.ts +6 -6
  49. package/out/geocode-handler.d.ts.map +1 -1
  50. package/out/geocode-handler.js +6 -6
  51. package/out/geocode-handler.js.map +1 -1
  52. package/out/geojson.d.ts +7 -2
  53. package/out/geojson.d.ts.map +1 -1
  54. package/out/geojson.js +8 -5
  55. package/out/geojson.js.map +1 -1
  56. package/out/index.d.ts +10 -10
  57. package/out/index.d.ts.map +1 -1
  58. package/out/index.js +10 -10
  59. package/out/index.js.map +1 -1
  60. package/out/ingest.d.ts +64 -46
  61. package/out/ingest.d.ts.map +1 -1
  62. package/out/ingest.js +33 -46
  63. package/out/ingest.js.map +1 -1
  64. package/out/learned-scorer.d.ts +1 -1
  65. package/out/learned-scorer.d.ts.map +1 -1
  66. package/out/learned-scorer.js.map +1 -1
  67. package/out/map-html.d.ts +4 -4
  68. package/out/map-html.d.ts.map +1 -1
  69. package/out/map-html.js +6 -11
  70. package/out/map-html.js.map +1 -1
  71. package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
  72. package/out/models/crosssource-gbt-en-us.js.map +1 -1
  73. package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
  74. package/out/models/dedup-gbt-en-us.js.map +1 -1
  75. package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
  76. package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
  77. package/out/reconcile.d.ts +6 -1
  78. package/out/reconcile.d.ts.map +1 -1
  79. package/out/reconcile.js +7 -21
  80. package/out/reconcile.js.map +1 -1
  81. package/out/resolve.d.ts +19 -7
  82. package/out/resolve.d.ts.map +1 -1
  83. package/out/resolve.js +20 -6
  84. package/out/resolve.js.map +1 -1
  85. package/out/tools/coverage-reconciliation.d.ts +1 -1
  86. package/out/tools/coverage-reconciliation.d.ts.map +1 -1
  87. package/out/tools/coverage-reconciliation.js +12 -12
  88. package/out/tools/coverage-reconciliation.js.map +1 -1
  89. package/out/tools/cross-dataset-correlation.d.ts +4 -4
  90. package/out/tools/cross-dataset-correlation.d.ts.map +1 -1
  91. package/out/tools/cross-dataset-correlation.js +60 -111
  92. package/out/tools/cross-dataset-correlation.js.map +1 -1
  93. package/out/tools/cross-source-threshold-sweep.d.ts +2 -2
  94. package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -1
  95. package/out/tools/cross-source-threshold-sweep.js +19 -27
  96. package/out/tools/cross-source-threshold-sweep.js.map +1 -1
  97. package/out/tools/dedup-ceiling.d.ts.map +1 -1
  98. package/out/tools/dedup-ceiling.js +36 -118
  99. package/out/tools/dedup-ceiling.js.map +1 -1
  100. package/out/tools/eval-geocoder.d.ts +9 -13
  101. package/out/tools/eval-geocoder.d.ts.map +1 -1
  102. package/out/tools/eval-geocoder.js +2 -2
  103. package/out/tools/eval-geocoder.js.map +1 -1
  104. package/out/tools/geocoder-namesake-probe.d.ts +2 -2
  105. package/out/tools/geocoder-namesake-probe.d.ts.map +1 -1
  106. package/out/tools/geocoder-namesake-probe.js +4 -8
  107. package/out/tools/geocoder-namesake-probe.js.map +1 -1
  108. package/out/tools/geocoder-vs-provided-coords.d.ts +1 -1
  109. package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
  110. package/out/tools/geocoder-vs-provided-coords.js +11 -9
  111. package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
  112. package/out/tools/gold-set-sample.d.ts +5 -5
  113. package/out/tools/gold-set-sample.d.ts.map +1 -1
  114. package/out/tools/gold-set-sample.js +37 -121
  115. package/out/tools/gold-set-sample.js.map +1 -1
  116. package/out/tools/index.d.ts +24 -29
  117. package/out/tools/index.d.ts.map +1 -1
  118. package/out/tools/index.js +24 -29
  119. package/out/tools/index.js.map +1 -1
  120. package/out/tools/learned-scorer-clustering-eval.d.ts +1 -1
  121. package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
  122. package/out/tools/learned-scorer-clustering-eval.js +35 -170
  123. package/out/tools/learned-scorer-clustering-eval.js.map +1 -1
  124. package/out/tools/learned-scorer-crossstate-eval.d.ts +5 -5
  125. package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -1
  126. package/out/tools/learned-scorer-crossstate-eval.js +44 -166
  127. package/out/tools/learned-scorer-crossstate-eval.js.map +1 -1
  128. package/out/tools/learned-scorer-eval.d.ts +1 -1
  129. package/out/tools/learned-scorer-eval.d.ts.map +1 -1
  130. package/out/tools/learned-scorer-eval.js +37 -173
  131. package/out/tools/learned-scorer-eval.js.map +1 -1
  132. package/out/tools/matcher-scale.d.ts.map +1 -1
  133. package/out/tools/matcher-scale.js +5 -5
  134. package/out/tools/matcher-scale.js.map +1 -1
  135. package/out/tools/nppes/org-name.d.ts +21 -0
  136. package/out/tools/nppes/org-name.d.ts.map +1 -0
  137. package/out/tools/nppes/org-name.js +13 -0
  138. package/out/tools/nppes/org-name.js.map +1 -0
  139. package/out/tools/nppes/overmerge-packet.d.ts +39 -0
  140. package/out/tools/nppes/overmerge-packet.d.ts.map +1 -0
  141. package/out/tools/nppes/overmerge-packet.js +55 -0
  142. package/out/tools/nppes/overmerge-packet.js.map +1 -0
  143. package/out/tools/nppes/report.d.ts +93 -0
  144. package/out/tools/nppes/report.d.ts.map +1 -0
  145. package/out/tools/nppes/report.js +186 -0
  146. package/out/tools/nppes/report.js.map +1 -0
  147. package/out/tools/nppes/sample.d.ts +90 -0
  148. package/out/tools/nppes/sample.d.ts.map +1 -0
  149. package/out/tools/nppes/sample.js +131 -0
  150. package/out/tools/nppes/sample.js.map +1 -0
  151. package/out/tools/nppes/scoring.d.ts +36 -0
  152. package/out/tools/nppes/scoring.d.ts.map +1 -0
  153. package/out/tools/nppes/scoring.js +80 -0
  154. package/out/tools/nppes/scoring.js.map +1 -0
  155. package/out/tools/nppes/settings.d.ts +38 -0
  156. package/out/tools/nppes/settings.d.ts.map +1 -0
  157. package/out/tools/nppes/settings.js +79 -0
  158. package/out/tools/nppes/settings.js.map +1 -0
  159. package/out/tools/nppes/truth-grains.d.ts +50 -0
  160. package/out/tools/nppes/truth-grains.d.ts.map +1 -0
  161. package/out/tools/nppes/truth-grains.js +123 -0
  162. package/out/tools/nppes/truth-grains.js.map +1 -0
  163. package/out/tools/nppes-dedup-benchmark.d.ts +7 -3
  164. package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
  165. package/out/tools/nppes-dedup-benchmark.js +106 -673
  166. package/out/tools/nppes-dedup-benchmark.js.map +1 -1
  167. package/out/tools/shared.d.ts +244 -7
  168. package/out/tools/shared.d.ts.map +1 -1
  169. package/out/tools/shared.js +353 -21
  170. package/out/tools/shared.js.map +1 -1
  171. package/out/tools/train-cross-gbt.d.ts +7 -7
  172. package/out/tools/train-cross-gbt.d.ts.map +1 -1
  173. package/out/tools/train-cross-gbt.js +47 -145
  174. package/out/tools/train-cross-gbt.js.map +1 -1
  175. package/out/tools/train-gbt.d.ts +7 -7
  176. package/out/tools/train-gbt.d.ts.map +1 -1
  177. package/out/tools/train-gbt.js +31 -111
  178. package/out/tools/train-gbt.js.map +1 -1
  179. package/out/tools/train-org-cross-gbt.d.ts +7 -5
  180. package/out/tools/train-org-cross-gbt.d.ts.map +1 -1
  181. package/out/tools/train-org-cross-gbt.js +45 -141
  182. package/out/tools/train-org-cross-gbt.js.map +1 -1
  183. package/out/tools/txhhsc-to-oarow.d.ts +2 -2
  184. package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
  185. package/out/tools/txhhsc-to-oarow.js +9 -23
  186. package/out/tools/txhhsc-to-oarow.js.map +1 -1
  187. package/out/tools/viz/browser.d.ts +34 -0
  188. package/out/tools/viz/browser.d.ts.map +1 -0
  189. package/out/tools/viz/browser.js +33 -0
  190. package/out/tools/viz/browser.js.map +1 -0
  191. package/out/tools/viz/cross-dataset-map.d.ts +4 -25
  192. package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
  193. package/out/tools/viz/cross-dataset-map.js +12 -33
  194. package/out/tools/viz/cross-dataset-map.js.map +1 -1
  195. package/out/tools/viz/geocode-first-surface.d.ts +6 -35
  196. package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
  197. package/out/tools/viz/geocode-first-surface.js +10 -37
  198. package/out/tools/viz/geocode-first-surface.js.map +1 -1
  199. package/out/tools/viz/render-map.d.ts +3 -6
  200. package/out/tools/viz/render-map.d.ts.map +1 -1
  201. package/out/tools/viz/render-map.js +9 -19
  202. package/out/tools/viz/render-map.js.map +1 -1
  203. package/out/tools/viz/render.d.ts +4 -9
  204. package/out/tools/viz/render.d.ts.map +1 -1
  205. package/out/tools/viz/render.js +24 -39
  206. package/out/tools/viz/render.js.map +1 -1
  207. package/out/tools/viz/source-provenance-map.d.ts +4 -24
  208. package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
  209. package/out/tools/viz/source-provenance-map.js +12 -32
  210. package/out/tools/viz/source-provenance-map.js.map +1 -1
  211. package/out/tools/viz/yardstick-figure.d.ts +2 -2
  212. package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
  213. package/out/tools/viz/yardstick-figure.js +5 -4
  214. package/out/tools/viz/yardstick-figure.js.map +1 -1
  215. package/out/types.d.ts +11 -1
  216. package/out/types.d.ts.map +1 -1
  217. package/out/types.js.map +1 -1
  218. package/package.json +180 -11
  219. package/tools/gold-set-sample.ts +0 -252
  220. package/tools/index.ts +0 -36
  221. package/tools/nppes-dedup-benchmark.ts +0 -1180
  222. package/tools/shared.ts +0 -160
  223. package/tools/train-cross-gbt.ts +0 -358
  224. package/tools/train-org-cross-gbt.ts +0 -329
  225. package/tools/viz/render.ts +0 -113
  226. /package/{models → lib/models}/crosssource-gbt-en-us.ts +0 -0
  227. /package/{models → lib/models}/dedup-gbt-en-us.ts +0 -0
  228. /package/{models → lib/models}/org-crosssource-gbt-en-us.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"address-key.js","sourceRoot":"","sources":["../address-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAA;AACnF,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAI7D;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAA;IACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,CAAA;IAEnC,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAExC,OAAO,qBAAqB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IACnC,OAAO,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;AACrD,CAAC"}
1
+ {"version":3,"file":"address-key.js","sourceRoot":"","sources":["../lib/address-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAA;AACnF,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAI7D;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAA;IACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,CAAA;IAEnC,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAExC,OAAO,qBAAqB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IACnC,OAAO,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;AACrD,CAAC"}
@@ -3,16 +3,16 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The per-record geocode step, factored out of the worker so it unit-tests against a fake seam (no
7
- * neural model / SQLite). `geocode-worker.ts` builds the real seam from config and wraps this.
6
+ * The per-record geocode step, factored out of the worker so it unit-tests against a fake geocoder (no
7
+ * neural model / SQLite). `geocode-worker.ts` builds the real geocoder from config and wraps this.
8
8
  */
9
- import { type ColumnMapping, type GeocodeAddress } from "./ingest.ts";
10
- import type { SourceRecord } from "./types.ts";
9
+ import { type ColumnMapping, type GeocodeAddress } from "#ingest";
10
+ import type { SourceRecord } from "#types";
11
11
  /**
12
12
  * Build the handler `geocodeStream` runs per normalized record: recompute the joined address string from `record.raw` +
13
- * `mapping.address` (the worker can't receive the original closure), geocode it via `seam`, and attach the result.
13
+ * `mapping.address` (the worker can't receive the original closure), geocode it via `geocode`, and attach the result.
14
14
  * Records with no mapped address pass through untouched (no geocode call). The default separator matches
15
15
  * {@link ingestRow}'s `addressSeparator`.
16
16
  */
17
- export declare function makeGeocodeHandler(seam: GeocodeAddress, mapping: ColumnMapping, addressSeparator?: string): (record: SourceRecord) => Promise<SourceRecord>;
17
+ export declare function makeGeocodeHandler(geocode: GeocodeAddress, mapping: ColumnMapping, addressSeparator?: string): (record: SourceRecord) => Promise<SourceRecord>;
18
18
  //# sourceMappingURL=geocode-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geocode-handler.d.ts","sourceRoot":"","sources":["../geocode-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAQ,MAAM,aAAa,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,aAAa,EACtB,gBAAgB,SAAO,GACrB,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAYjD"}
1
+ {"version":3,"file":"geocode-handler.d.ts","sourceRoot":"","sources":["../lib/geocode-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAQ,MAAM,SAAS,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE1C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,aAAa,EACtB,gBAAgB,SAAO,GACrB,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAYjD"}
@@ -3,24 +3,24 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * The per-record geocode step, factored out of the worker so it unit-tests against a fake seam (no
7
- * neural model / SQLite). `geocode-worker.ts` builds the real seam from config and wraps this.
6
+ * The per-record geocode step, factored out of the worker so it unit-tests against a fake geocoder (no
7
+ * neural model / SQLite). `geocode-worker.ts` builds the real geocoder from config and wraps this.
8
8
  */
9
- import { pick } from "./ingest.js";
9
+ import { pick } from "#ingest";
10
10
  /**
11
11
  * Build the handler `geocodeStream` runs per normalized record: recompute the joined address string from `record.raw` +
12
- * `mapping.address` (the worker can't receive the original closure), geocode it via `seam`, and attach the result.
12
+ * `mapping.address` (the worker can't receive the original closure), geocode it via `geocode`, and attach the result.
13
13
  * Records with no mapped address pass through untouched (no geocode call). The default separator matches
14
14
  * {@link ingestRow}'s `addressSeparator`.
15
15
  */
16
- export function makeGeocodeHandler(seam, mapping, addressSeparator = ", ") {
16
+ export function makeGeocodeHandler(geocode, mapping, addressSeparator = ", ") {
17
17
  return async (record) => {
18
18
  if (!record.raw)
19
19
  return record;
20
20
  const addressValue = pick(record.raw, mapping.address, addressSeparator);
21
21
  if (!addressValue)
22
22
  return record;
23
- const address = (await seam(addressValue)) ?? undefined;
23
+ const address = (await geocode(addressValue)) ?? undefined;
24
24
  return { ...record, address };
25
25
  };
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geocode-handler.js","sourceRoot":"","sources":["../geocode-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA2C,IAAI,EAAE,MAAM,aAAa,CAAA;AAG3E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAoB,EACpB,OAAsB,EACtB,gBAAgB,GAAG,IAAI;IAEvB,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG;YAAE,OAAO,MAAM,CAAA;QAE9B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;QAExE,IAAI,CAAC,YAAY;YAAE,OAAO,MAAM,CAAA;QAEhC,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,SAAS,CAAA;QAEvD,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAA;IAC9B,CAAC,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"geocode-handler.js","sourceRoot":"","sources":["../lib/geocode-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA2C,IAAI,EAAE,MAAM,SAAS,CAAA;AAGvE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,OAAuB,EACvB,OAAsB,EACtB,gBAAgB,GAAG,IAAI;IAEvB,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG;YAAE,OAAO,MAAM,CAAA;QAE9B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;QAExE,IAAI,CAAC,YAAY;YAAE,OAAO,MAAM,CAAA;QAEhC,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,SAAS,CAAA;QAE1D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAA;IAC9B,CAAC,CAAA;AACF,CAAC"}
package/out/geojson.d.ts CHANGED
@@ -9,8 +9,13 @@
9
9
  * (so rooftop-precise entities can be styled apart from admin-centroid guesses). Entities without
10
10
  * a coordinate are omitted (a Point feature needs one).
11
11
  */
12
- import type { GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial";
13
- import type { EntityGeoData, ResolvedEntity } from "./types.ts";
12
+ import type { GeoFeature, GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial";
13
+ import type { EntityGeoData, ResolvedEntity } from "#types";
14
+ /**
15
+ * One entity → one GeoJSON Point feature. `extra` merges over (and may override) the standard properties — the
16
+ * reconciliation flow adds its `bucket` and swaps the display name for the representative's org-or-person form.
17
+ */
18
+ export declare function toFeature(entity: ResolvedEntity, extra?: Partial<EntityGeoData>): GeoFeature<PointLiteral, EntityGeoData>;
14
19
  /**
15
20
  * Convert resolved entities into a GeoJSON `FeatureCollection` of points, ready for QGIS. Entities with no resolved
16
21
  * coordinate are skipped.
@@ -1 +1 @@
1
- {"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAc,oBAAoB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAExF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAA;AA8C7E;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,oBAAoB,CAAC,YAAY,EAAE,aAAa,CAAC,CAKhH"}
1
+ {"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../lib/geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAExF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAgB,MAAM,QAAQ,CAAA;AAkBzE;;;GAGG;AACH,wBAAgB,SAAS,CACxB,MAAM,EAAE,cAAc,EACtB,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC5B,UAAU,CAAC,YAAY,EAAE,aAAa,CAAC,CAwBzC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,oBAAoB,CAAC,YAAY,EAAE,aAAa,CAAC,CAKhH"}
package/out/geojson.js CHANGED
@@ -9,6 +9,7 @@
9
9
  * (so rooftop-precise entities can be styled apart from admin-centroid guesses). Entities without
10
10
  * a coordinate are omitted (a Point feature needs one).
11
11
  */
12
+ import { isPresent } from "@mailwoman/core/objects";
12
13
  /**
13
14
  * Assemble a display name from a record's parsed person name, if any.
14
15
  */
@@ -17,15 +18,16 @@ function displayName(record) {
17
18
  if (!name)
18
19
  return null;
19
20
  const joined = [name.prefix, name.given, name.middle, name.familyParticle, name.family, name.suffix]
20
- .filter(Boolean)
21
+ .filter(isPresent)
21
22
  .join(" ")
22
23
  .trim();
23
24
  return joined || null;
24
25
  }
25
26
  /**
26
- * One entity → one GeoJSON Point feature.
27
+ * One entity → one GeoJSON Point feature. `extra` merges over (and may override) the standard properties — the
28
+ * reconciliation flow adds its `bucket` and swaps the display name for the representative's org-or-person form.
27
29
  */
28
- function toFeature(entity) {
30
+ export function toFeature(entity, extra) {
29
31
  const rep = entity.representative;
30
32
  return {
31
33
  type: "Feature",
@@ -38,13 +40,14 @@ function toFeature(entity) {
38
40
  entityID: entity.id,
39
41
  recordCount: entity.records.length,
40
42
  cohesion: entity.cohesion,
41
- sourceIds: entity.records.map((r) => r.id),
43
+ sourceIDs: entity.records.map((r) => r.id),
42
44
  // Distinct provenance labels the entity's records span — an entity with ≥2 is a cross-dataset link.
43
45
  sources: [...new Set(entity.records.map((r) => r.source).filter((s) => !!s))].toSorted(),
44
46
  name: displayName(rep),
45
47
  organization: rep.organization?.canonical ?? null,
46
48
  address: rep.address?.formatted ?? null,
47
49
  geocodeTier: rep.address?.geocode?.tier ?? null,
50
+ ...extra,
48
51
  },
49
52
  };
50
53
  }
@@ -55,7 +58,7 @@ function toFeature(entity) {
55
58
  export function toGeoJSON(entities) {
56
59
  return {
57
60
  type: "FeatureCollection",
58
- features: entities.filter((entity) => entity.coordinate).map(toFeature),
61
+ features: entities.filter((entity) => entity.coordinate).map((entity) => toFeature(entity)),
59
62
  };
60
63
  }
61
64
  //# sourceMappingURL=geojson.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geojson.js","sourceRoot":"","sources":["../geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;GAEG;AACH,SAAS,WAAW,CAAC,MAAoB;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IAExB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAEtB,MAAM,MAAM,G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for, finally standing on a calibrated, label-free matcher.
12
12
  */
13
- export * from "./address-key.ts";
14
- export * from "./geojson.ts";
15
- export * from "./ingest.ts";
16
- export * from "./geocode-handler.ts";
17
- export * from "./learned-scorer.ts";
18
- export * from "./map-html.ts";
19
- export * from "./models/dedup-gbt-en-us.ts";
20
- export * from "./reconcile.ts";
21
- export * from "./resolve.ts";
22
- export * from "./types.ts";
13
+ export * from "#address-key";
14
+ export * from "#geojson";
15
+ export * from "#ingest";
16
+ export * from "#geocode-handler";
17
+ export * from "#learned-scorer";
18
+ export * from "#map-html";
19
+ export * from "#models/dedup-gbt-en-us";
20
+ export * from "#reconcile";
21
+ export * from "#resolve";
22
+ export * from "#types";
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
package/out/index.js CHANGED
@@ -10,14 +10,14 @@
10
10
  * {@link toGeoJSON} exports them for QGIS. This is the clinic-funding use case mailwoman was built
11
11
  * for, finally standing on a calibrated, label-free matcher.
12
12
  */
13
- export * from "./address-key.js";
14
- export * from "./geojson.js";
15
- export * from "./ingest.js";
16
- export * from "./geocode-handler.js";
17
- export * from "./learned-scorer.js";
18
- export * from "./map-html.js";
19
- export * from "./models/dedup-gbt-en-us.js";
20
- export * from "./reconcile.js";
21
- export * from "./resolve.js";
22
- export * from "./types.js";
13
+ export * from "#address-key";
14
+ export * from "#geojson";
15
+ export * from "#ingest";
16
+ export * from "#geocode-handler";
17
+ export * from "#learned-scorer";
18
+ export * from "#map-html";
19
+ export * from "#models/dedup-gbt-en-us";
20
+ export * from "#reconcile";
21
+ export * from "#resolve";
22
+ export * from "#types";
23
23
  //# sourceMappingURL=index.js.map
package/out/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA"}
package/out/ingest.d.ts CHANGED
@@ -12,9 +12,9 @@
12
12
  * hold the name, organization, address, phone, email; each row is normalized with
13
13
  * `@mailwoman/record` (parse the person name, canonicalize the org). This is deterministic
14
14
  * and testable with no heavy runtime.
15
- * 2. **Geocoding** (the heavy part) is an injected seam — a {@link GeocodeAddress} the caller provides.
16
- * Ingest never imports the neural parser, the resolver, or the shards; it just calls the
17
- * seam per address. {@link geocodeAddressVia} builds that seam from mailwoman's real parse +
15
+ * 2. **Geocoding** (the heavy part) is an injected dependency — a {@link GeocodeAddress} the caller provides.
16
+ * Ingest never imports the neural parser, the resolver, or the extracts; it just calls the
17
+ * call per address. {@link geocodeAddressVia} builds that geocoder from mailwoman's real parse +
18
18
  * geocode primitives (which the CLI constructs with the model + data in hand), so the wiring
19
19
  * is concrete and testable without pinning the heavy runtime into this package.
20
20
  *
@@ -23,36 +23,41 @@
23
23
  */
24
24
  import type { AddressGeocode, PostalAddress } from "@mailwoman/record";
25
25
  import { toPostalAddress } from "@mailwoman/record";
26
- import type { SourceRecord } from "./types.ts";
26
+ import { type AsyncSequence } from "spliterator";
27
+ import type { SourceRecord } from "#types";
27
28
  /**
28
- * Resolve a raw address string into a {@link PostalAddress}. The seam to mailwoman's geocoder.
29
+ * Resolve a raw address string into a {@link PostalAddress}. The entry point to mailwoman's geocoder.
29
30
  */
30
31
  export type GeocodeAddress = (raw: string) => Promise<PostalAddress | null> | PostalAddress | null;
32
+ /**
33
+ * The column delimiters a tabular source may declare, by name, each the spliterator's own byte.
34
+ *
35
+ * The `satisfies` clause keys every name to a member of spliterator's `Delimiters` const, so a delimiter this map names
36
+ * that spliterator no longer ships is a compile error rather than a silently parallel vocabulary.
37
+ */
38
+ declare const COLUMN_DELIMITERS: {
39
+ readonly comma: 44;
40
+ readonly tab: 9;
41
+ };
31
42
  /**
32
43
  * Column delimiter of a delimited source.
33
44
  */
34
- export type Delimiter = "comma" | "tab";
45
+ export type Delimiter = keyof typeof COLUMN_DELIMITERS;
35
46
  /**
36
47
  * Infer the delimiter from a path's extension (`.tsv` → tab, else comma).
37
48
  */
38
49
  export declare function delimiterFor(path: string): Delimiter;
39
50
  /**
40
- * Stream a delimited file's rows lazily as header-keyed objects — the same shape {@link parseCSV} returns, but
41
- * **without loading the file into memory**. A multi-GB source (the NPPES registry is ~4.8 GB / 9.6M rows — too big for
42
- * `readFileSync`, which throws `ERR_STRING_TOO_LONG`) streams line by line. Keys are the original header names
43
- * (`normalizeKeys: false`) so a {@link ColumnMapping} written against the source's headers matches. Filter/sample the
44
- * stream before {@link ingestRows} to keep only the rows you geocode.
51
+ * Stream a delimited file's rows lazily as header-keyed objects.
45
52
  *
46
- * `CSVSpliterator` (spliterator ≥ 3.2.0) handles the whole job: empty fields are preserved (a 330-column NPPES row
47
- * stays 330 columns), CRLF row terminators are normalized (RFC 4180 default), and `enableQuoteHandling` makes quoted
48
- * fields — embedded delimiters, embedded newlines, doubled-quote escapes — parse correctly while leaving unquoted files
49
- * untouched. (This replaced a manual `TextSpliterator` + `split` workaround written against the 3.1.0 column tokenizer,
50
- * which dropped empty fields and mis-parsed quotes.) Missing trailing fields land as `""`, matching the header
51
- * contract. For small in-memory parses {@link parseCSV} remains.
53
+ * Returns the spliterator's own {@linkcode AsyncSequence}: nothing is opened until something iterates, a `take` that is
54
+ * satisfied (or a `break` out of `for await`) closes the file handle, and any `map`/`filter` a caller composes fuses
55
+ * into the same pull loop. Wrapping this in an `async function*` would cost an async frame per row and take those
56
+ * operators away.
52
57
  */
53
58
  export declare function streamRows(source: string, opts?: {
54
59
  delimiter?: Delimiter;
55
- }): AsyncGenerator<Record<string, string>>;
60
+ }): AsyncSequence<Record<string, string>>;
56
61
  /**
57
62
  * Maps dataset columns to record fields. A field may draw from several columns (joined with spaces).
58
63
  */
@@ -91,7 +96,7 @@ export declare function inferMapping(header: readonly string[]): ColumnMapping;
91
96
  */
92
97
  export interface IngestOptions {
93
98
  /**
94
- * The geocoding seam. Without it, records carry name/org but no resolved address.
99
+ * The geocoding interface. Without it, records carry name/org but no resolved address.
95
100
  */
96
101
  geocodeAddress?: GeocodeAddress;
97
102
  /**
@@ -105,13 +110,6 @@ export interface IngestOptions {
105
110
  */
106
111
  addressSeparator?: string;
107
112
  }
108
- /**
109
- * Parse a CSV string (with a header row) into row objects keyed by column name.
110
- *
111
- * Keys and values are trimmed, and keys keep the source's own header spelling so a {@link ColumnMapping} written against
112
- * those headers matches — the same contract {@link streamRows} holds for the streaming path.
113
- */
114
- export declare function parseCSV(text: string): Record<string, string>[];
115
113
  /**
116
114
  * Join the named column(s) of a row into a single trimmed string, or undefined if empty.
117
115
  */
@@ -119,13 +117,14 @@ export declare function pick(row: Record<string, string>, columns?: string | str
119
117
  /**
120
118
  * Normalize one tabular row into a {@link SourceRecord} under a {@link ColumnMapping}: parse the person name,
121
119
  * canonicalize the org, and (if `opts.geocodeAddress` is provided) geocode the joined address. `id` falls back to the
122
- * caller-supplied row index. Pure aside from the optional geocode seam, so the deterministic normalization can run
120
+ * caller-supplied row index. Pure aside from the optional geocode interface, so the deterministic normalization can run
123
121
  * single-threaded (see {@link normalizeCSV}) while geocoding is offloaded (see `geocodeStream`).
124
122
  */
125
123
  export declare function ingestRow(row: Record<string, string>, mapping: ColumnMapping, index: number, opts?: IngestOptions): Promise<SourceRecord>;
126
124
  /**
127
- * Normalize tabular rows into {@link SourceRecord}s under a {@link ColumnMapping}. Accepts a sync OR async iterable, so
128
- * {@link parseCSV} (in-memory) and {@link streamRows} (lazy, for huge files) both thread straight through.
125
+ * Normalize tabular rows into {@link SourceRecord}s under a {@link ColumnMapping}.
126
+ *
127
+ * @see {@link streamRows} for the streaming path, which is the preferred way to handle multi-GB files.
129
128
  */
130
129
  export declare function ingestRows(rows: Iterable<Record<string, string>> | AsyncIterable<Record<string, string>>, mapping: ColumnMapping, opts?: IngestOptions): Promise<SourceRecord[]>;
131
130
  /**
@@ -133,11 +132,14 @@ export declare function ingestRows(rows: Iterable<Record<string, string>> | Asyn
133
132
  * This is the single-threaded, "fast enough" ergonomic core: column mapping, name parsing, and org canonicalization for
134
133
  * a multi-GB file, line by line. Geocode separately by piping the output through `geocodeStream` (the only heavy step
135
134
  * worth threading); for a light file (e.g. one that already carries geo cells) just consume this and stop.
135
+ *
136
+ * Records come out in file order: the sequence's `map` settles each row before pulling the next, and its counter is the
137
+ * row's index — the id a row without a mapped `id` column falls back to.
136
138
  */
137
139
  export declare function normalizeCSV(source: string, opts: {
138
140
  mapping: ColumnMapping;
139
141
  delimiter?: Delimiter;
140
- }): AsyncGenerator<SourceRecord>;
142
+ }): AsyncSequence<SourceRecord>;
141
143
  /**
142
144
  * The subset of mailwoman's `GeocodeResult` the adapter consumes — kept structural so this package never imports the
143
145
  * heavy geocoder, yet a real `GeocodeResult` maps straight in.
@@ -154,29 +156,45 @@ export interface RawGeocode {
154
156
  */
155
157
  type GeocodeComponents = Parameters<typeof toPostalAddress>[0];
156
158
  /**
157
- * Build a {@link GeocodeAddress} from mailwoman's real parse + geocode primitives (injected — the CLI constructs the
158
- * neural parser, resolver, and shards and passes them in). Parse → components → {@link toPostalAddress} (which fills
159
- * the canonical key + formatted form) → attach the resolved coordinate. When geocoding can't place the address, the
160
- * parsed-but-unlocated address is still returned.
161
- *
162
- * Two shapes:
163
- *
164
- * - `{ parse, geocode }` — the original: two independent calls. mailwoman's `geocodeAddress` re-parses internally, so
165
- * this parses the address twice (fine when the two callbacks don't share a parser).
166
- * - `{ parseAndGeocode }` — parse the address ONCE and return both the components and the geocode. Use this when the
167
- * parse is the expensive step you'd rather not pay for twice (e.g. share `parseForGeocode`'s tree between the
168
- * PostalAddress and `geocodeAddress`'s `parsedTree`). ~1.3× over the two-call shape on a real geocode pipeline.
159
+ * What every shape of {@link geocodeAddressVia}'s dependencies carries.
169
160
  */
170
- export declare function geocodeAddressVia(deps: {
161
+ export interface GeocodeDepsBase {
162
+ /**
163
+ * Country (ISO-2 or name) the address is formatted under. When omitted, {@link toPostalAddress} reads the parsed
164
+ * `country` component instead.
165
+ */
171
166
  country?: string;
172
- } & ({
167
+ }
168
+ /**
169
+ * Two independent calls: parse the address, then geocode it. mailwoman's `geocodeAddress` re-parses internally, so this
170
+ * shape parses the address twice — fine when the two callbacks don't share a parser.
171
+ */
172
+ export interface TwoStepGeocodeDeps extends GeocodeDepsBase {
173
173
  parse: (raw: string) => Promise<GeocodeComponents> | GeocodeComponents;
174
174
  geocode: (raw: string) => Promise<RawGeocode | null> | RawGeocode | null;
175
- } | {
175
+ }
176
+ /**
177
+ * Parse the address ONCE and answer both the components and the geocode. Use this when the parse is the expensive step
178
+ * you'd rather not pay for twice (e.g. share `parseForGeocode`'s tree between the PostalAddress and `geocodeAddress`'s
179
+ * `parsedTree`). ~1.3× over the two-call shape on a real geocode pipeline.
180
+ */
181
+ export interface OneStepGeocodeDeps extends GeocodeDepsBase {
176
182
  parseAndGeocode: (raw: string) => Promise<{
177
183
  components: GeocodeComponents;
178
184
  geo: RawGeocode | null;
179
185
  }>;
180
- })): GeocodeAddress;
186
+ }
187
+ /**
188
+ * The dependencies {@link geocodeAddressVia} builds a {@link GeocodeAddress} from; `"parseAndGeocode" in deps` tells the
189
+ * two shapes apart.
190
+ */
191
+ export type GeocodeAddressViaDeps = TwoStepGeocodeDeps | OneStepGeocodeDeps;
192
+ /**
193
+ * Build a {@link GeocodeAddress} from mailwoman's real parse + geocode primitives (injected — the CLI constructs the
194
+ * neural parser, resolver, and extracts and passes them in). Parse → components → {@link toPostalAddress} (which fills
195
+ * the canonical key + formatted form) → attach the resolved coordinate. When geocoding can't place the address, the
196
+ * parsed-but-unlocated address is still returned.
197
+ */
198
+ export declare function geocodeAddressVia(deps: GeocodeAddressViaDeps): GeocodeAddress;
181
199
  export {};
182
200
  //# sourceMappingURL=ingest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAA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AiB,CAAA;IACtE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,UAAU,GAAG,IAAI,CAAA;CACxE;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IAC1D,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,UAAU,EAAE,iBAAiB,CAAC;QAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CACpG;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,GAAG,kBAAkB,CAAA;AAE3E;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CA2B7E"}
package/out/ingest.js CHANGED
@@ -12,17 +12,28 @@
12
12
  * hold the name, organization, address, phone, email; each row is normalized with
13
13
  * `@mailwoman/record` (parse the person name, canonicalize the org). This is deterministic
14
14
  * and testable with no heavy runtime.
15
- * 2. **Geocoding** (the heavy part) is an injected seam — a {@link GeocodeAddress} the caller provides.
16
- * Ingest never imports the neural parser, the resolver, or the shards; it just calls the
17
- * seam per address. {@link geocodeAddressVia} builds that seam from mailwoman's real parse +
15
+ * 2. **Geocoding** (the heavy part) is an injected dependency — a {@link GeocodeAddress} the caller provides.
16
+ * Ingest never imports the neural parser, the resolver, or the extracts; it just calls the
17
+ * call per address. {@link geocodeAddressVia} builds that geocoder from mailwoman's real parse +
18
18
  * geocode primitives (which the CLI constructs with the model + data in hand), so the wiring
19
19
  * is concrete and testable without pinning the heavy runtime into this package.
20
20
  *
21
21
  * LLM-assisted column mapping (infer the mapping from a header + samples) is a documented
22
22
  * fast-follow; the mapping is an explicit input here.
23
23
  */
24
+ import { isPresent } from "@mailwoman/core/objects";
24
25
  import { canonicalizeOrganizationName, parsePersonName, toPostalAddress, withGeocode } from "@mailwoman/record";
25
26
  import { CSVSpliterator, Delimiters } from "spliterator";
27
+ /**
28
+ * The column delimiters a tabular source may declare, by name, each the spliterator's own byte.
29
+ *
30
+ * The `satisfies` clause keys every name to a member of spliterator's `Delimiters` const, so a delimiter this map names
31
+ * that spliterator no longer ships is a compile error rather than a silently parallel vocabulary.
32
+ */
33
+ const COLUMN_DELIMITERS = {
34
+ comma: Delimiters.Comma,
35
+ tab: Delimiters.Tab,
36
+ };
26
37
  /**
27
38
  * Infer the delimiter from a path's extension (`.tsv` → tab, else comma).
28
39
  */
@@ -30,24 +41,17 @@ export function delimiterFor(path) {
30
41
  return /\.tsv$/i.test(path) ? "tab" : "comma";
31
42
  }
32
43
  /**
33
- * Stream a delimited file's rows lazily as header-keyed objects — the same shape {@link parseCSV} returns, but
34
- * **without loading the file into memory**. A multi-GB source (the NPPES registry is ~4.8 GB / 9.6M rows — too big for
35
- * `readFileSync`, which throws `ERR_STRING_TOO_LONG`) streams line by line. Keys are the original header names
36
- * (`normalizeKeys: false`) so a {@link ColumnMapping} written against the source's headers matches. Filter/sample the
37
- * stream before {@link ingestRows} to keep only the rows you geocode.
44
+ * Stream a delimited file's rows lazily as header-keyed objects.
38
45
  *
39
- * `CSVSpliterator` (spliterator ≥ 3.2.0) handles the whole job: empty fields are preserved (a 330-column NPPES row
40
- * stays 330 columns), CRLF row terminators are normalized (RFC 4180 default), and `enableQuoteHandling` makes quoted
41
- * fields — embedded delimiters, embedded newlines, doubled-quote escapes — parse correctly while leaving unquoted files
42
- * untouched. (This replaced a manual `TextSpliterator` + `split` workaround written against the 3.1.0 column tokenizer,
43
- * which dropped empty fields and mis-parsed quotes.) Missing trailing fields land as `""`, matching the header
44
- * contract. For small in-memory parses {@link parseCSV} remains.
46
+ * Returns the spliterator's own {@linkcode AsyncSequence}: nothing is opened until something iterates, a `take` that is
47
+ * satisfied (or a `break` out of `for await`) closes the file handle, and any `map`/`filter` a caller composes fuses
48
+ * into the same pull loop. Wrapping this in an `async function*` would cost an async frame per row and take those
49
+ * operators away.
45
50
  */
46
- export async function* streamRows(source, opts = {}) {
47
- const columnDelimiter = (opts.delimiter ?? delimiterFor(source)) === "tab" ? Delimiters.Tab : Delimiters.Comma;
48
- yield* CSVSpliterator.fromAsync(source, {
51
+ export function streamRows(source, opts = {}) {
52
+ return CSVSpliterator.fromAsync(source, {
49
53
  mode: "object",
50
- columnDelimiter,
54
+ columnDelimiter: COLUMN_DELIMITERS[opts.delimiter ?? delimiterFor(source)],
51
55
  normalizeKeys: false,
52
56
  enableQuoteHandling: true,
53
57
  });
@@ -99,15 +103,6 @@ export function inferMapping(header) {
99
103
  }
100
104
  return mapping;
101
105
  }
102
- /**
103
- * Parse a CSV string (with a header row) into row objects keyed by column name.
104
- *
105
- * Keys and values are trimmed, and keys keep the source's own header spelling so a {@link ColumnMapping} written against
106
- * those headers matches — the same contract {@link streamRows} holds for the streaming path.
107
- */
108
- export function parseCSV(text) {
109
- return Array.from(CSVSpliterator.from(text, { mode: "object", normalizeKeys: false, enableQuoteHandling: true }), (row) => Object.fromEntries(Object.entries(row).map(([key, value]) => [key.trim(), String(value ?? "").trim()])));
110
- }
111
106
  /**
112
107
  * Join the named column(s) of a row into a single trimmed string, or undefined if empty.
113
108
  */
@@ -117,7 +112,7 @@ export function pick(row, columns, separator = " ") {
117
112
  const list = Array.isArray(columns) ? columns : [columns];
118
113
  const value = list
119
114
  .map((c) => row[c]?.trim())
120
- .filter(Boolean)
115
+ .filter(isPresent)
121
116
  .join(separator)
122
117
  .trim();
123
118
  return value || undefined;
@@ -125,7 +120,7 @@ export function pick(row, columns, separator = " ") {
125
120
  /**
126
121
  * Normalize one tabular row into a {@link SourceRecord} under a {@link ColumnMapping}: parse the person name,
127
122
  * canonicalize the org, and (if `opts.geocodeAddress` is provided) geocode the joined address. `id` falls back to the
128
- * caller-supplied row index. Pure aside from the optional geocode seam, so the deterministic normalization can run
123
+ * caller-supplied row index. Pure aside from the optional geocode interface, so the deterministic normalization can run
129
124
  * single-threaded (see {@link normalizeCSV}) while geocoding is offloaded (see `geocodeStream`).
130
125
  */
131
126
  export async function ingestRow(row, mapping, index, opts = {}) {
@@ -156,8 +151,9 @@ export async function ingestRow(row, mapping, index, opts = {}) {
156
151
  };
157
152
  }
158
153
  /**
159
- * Normalize tabular rows into {@link SourceRecord}s under a {@link ColumnMapping}. Accepts a sync OR async iterable, so
160
- * {@link parseCSV} (in-memory) and {@link streamRows} (lazy, for huge files) both thread straight through.
154
+ * Normalize tabular rows into {@link SourceRecord}s under a {@link ColumnMapping}.
155
+ *
156
+ * @see {@link streamRows} for the streaming path, which is the preferred way to handle multi-GB files.
161
157
  */
162
158
  export async function ingestRows(rows, mapping, opts = {}) {
163
159
  const records = [];
@@ -173,27 +169,18 @@ export async function ingestRows(rows, mapping, opts = {}) {
173
169
  * This is the single-threaded, "fast enough" ergonomic core: column mapping, name parsing, and org canonicalization for
174
170
  * a multi-GB file, line by line. Geocode separately by piping the output through `geocodeStream` (the only heavy step
175
171
  * worth threading); for a light file (e.g. one that already carries geo cells) just consume this and stop.
172
+ *
173
+ * Records come out in file order: the sequence's `map` settles each row before pulling the next, and its counter is the
174
+ * row's index — the id a row without a mapped `id` column falls back to.
176
175
  */
177
- export async function* normalizeCSV(source, opts) {
178
- let index = 0;
179
- for await (const row of streamRows(source, { delimiter: opts.delimiter })) {
180
- yield await ingestRow(row, opts.mapping, index);
181
- index++;
182
- }
176
+ export function normalizeCSV(source, opts) {
177
+ return streamRows(source, { delimiter: opts.delimiter }).map((row, index) => ingestRow(row, opts.mapping, index));
183
178
  }
184
179
  /**
185
180
  * Build a {@link GeocodeAddress} from mailwoman's real parse + geocode primitives (injected — the CLI constructs the
186
- * neural parser, resolver, and shards and passes them in). Parse → components → {@link toPostalAddress} (which fills
181
+ * neural parser, resolver, and extracts and passes them in). Parse → components → {@link toPostalAddress} (which fills
187
182
  * the canonical key + formatted form) → attach the resolved coordinate. When geocoding can't place the address, the
188
183
  * parsed-but-unlocated address is still returned.
189
- *
190
- * Two shapes:
191
- *
192
- * - `{ parse, geocode }` — the original: two independent calls. mailwoman's `geocodeAddress` re-parses internally, so
193
- * this parses the address twice (fine when the two callbacks don't share a parser).
194
- * - `{ parseAndGeocode }` — parse the address ONCE and return both the components and the geocode. Use this when the
195
- * parse is the expensive step you'd rather not pay for twice (e.g. share `parseForGeocode`'s tree between the
196
- * PostalAddress and `geocodeAddress`'s `parsedTree`). ~1.3× over the two-call shape on a real geocode pipeline.
197
184
  */
198
185
  export function geocodeAddressVia(deps) {
199
186
  return async (raw) => {
package/out/ingest.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAcxD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;AAC9C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,UAAU,CAChC,MAAc,EACd,OAAkC,EAAE;IAEpC,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAA;IAE9G,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,CAAyB,MAAM,EAAE;QAC/D,IAAI,EAAE,QAAQ;QACd,eAAe;QACf,aAAa,EAAE,KAAK;QACpB,mBAAmB,EAAE,IAAI;KACzB,CAAC,CAAA;AACH,CAAC;AA2BD;;;;;;;GA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