@mailwoman/registry 9.3.0 → 10.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 (137) hide show
  1. package/lib/geojson.ts +2 -11
  2. package/lib/ingest.ts +2 -2
  3. package/lib/reconcile.ts +2 -2
  4. package/lib/tools/coverage-reconciliation.ts +2 -2
  5. package/lib/tools/{cross-dataset-correlation.ts → cross/dataset-correlation.ts} +7 -7
  6. package/lib/tools/{cross-source-threshold-sweep.ts → cross/source-threshold-sweep.ts} +6 -6
  7. package/lib/tools/dedup-ceiling.ts +3 -3
  8. package/lib/tools/index.ts +13 -13
  9. package/lib/tools/{learned-scorer-clustering-eval.ts → learned/scorer/clustering-eval.ts} +3 -3
  10. package/lib/tools/{learned-scorer-eval.ts → learned/scorer/eval.ts} +5 -5
  11. package/lib/tools/{nppes-dedup-benchmark.ts → nppes/dedup-benchmark.ts} +5 -5
  12. package/lib/tools/nppes/overmerge-packet.ts +2 -2
  13. package/lib/tools/nppes/sample.ts +2 -2
  14. package/lib/tools/shared.ts +4 -6
  15. package/lib/tools/{train-cross-gbt.ts → train/cross-gbt.ts} +3 -3
  16. package/lib/tools/{train-gbt.ts → train/gbt.ts} +6 -6
  17. package/lib/tools/{train-org-cross-gbt.ts → train/org-cross-gbt.ts} +3 -3
  18. package/out/geojson.d.ts.map +1 -1
  19. package/out/geojson.js +2 -9
  20. package/out/geojson.js.map +1 -1
  21. package/out/ingest.js +2 -2
  22. package/out/ingest.js.map +1 -1
  23. package/out/map-html.js.map +1 -1
  24. package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
  25. package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
  26. package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
  27. package/out/reconcile.js +2 -2
  28. package/out/reconcile.js.map +1 -1
  29. package/out/resolve.js.map +1 -1
  30. package/out/tools/coverage-reconciliation.js +2 -2
  31. package/out/tools/coverage-reconciliation.js.map +1 -1
  32. package/out/tools/{cross-dataset-correlation.d.ts → cross/dataset-correlation.d.ts} +1 -1
  33. package/out/tools/cross/dataset-correlation.d.ts.map +1 -0
  34. package/out/tools/{cross-dataset-correlation.js → cross/dataset-correlation.js} +8 -8
  35. package/out/tools/cross/dataset-correlation.js.map +1 -0
  36. package/out/tools/{cross-source-threshold-sweep.d.ts → cross/source-threshold-sweep.d.ts} +1 -1
  37. package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -0
  38. package/out/tools/{cross-source-threshold-sweep.js → cross/source-threshold-sweep.js} +7 -7
  39. package/out/tools/cross/source-threshold-sweep.js.map +1 -0
  40. package/out/tools/dedup-ceiling.js +3 -3
  41. package/out/tools/dedup-ceiling.js.map +1 -1
  42. package/out/tools/{geocoder-namesake-probe.d.ts → geocoder/namesake-probe.d.ts} +1 -1
  43. package/out/tools/geocoder/namesake-probe.d.ts.map +1 -0
  44. package/out/tools/{geocoder-namesake-probe.js → geocoder/namesake-probe.js} +1 -1
  45. package/out/tools/geocoder/namesake-probe.js.map +1 -0
  46. package/out/tools/{geocoder-vs-provided-coords.d.ts → geocoder/vs-provided-coords.d.ts} +1 -1
  47. package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -0
  48. package/out/tools/{geocoder-vs-provided-coords.js → geocoder/vs-provided-coords.js} +1 -1
  49. package/out/tools/geocoder/vs-provided-coords.js.map +1 -0
  50. package/out/tools/gold-set-sample.js.map +1 -1
  51. package/out/tools/index.d.ts +13 -13
  52. package/out/tools/index.d.ts.map +1 -1
  53. package/out/tools/index.js +13 -13
  54. package/out/tools/index.js.map +1 -1
  55. package/out/tools/{learned-scorer-clustering-eval.d.ts → learned/scorer/clustering-eval.d.ts} +1 -1
  56. package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -0
  57. package/out/tools/{learned-scorer-clustering-eval.js → learned/scorer/clustering-eval.js} +5 -4
  58. package/out/tools/learned/scorer/clustering-eval.js.map +1 -0
  59. package/out/tools/{learned-scorer-crossstate-eval.d.ts → learned/scorer/crossstate-eval.d.ts} +1 -1
  60. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -0
  61. package/out/tools/{learned-scorer-crossstate-eval.js → learned/scorer/crossstate-eval.js} +1 -1
  62. package/out/tools/learned/scorer/crossstate-eval.js.map +1 -0
  63. package/out/tools/{learned-scorer-eval.d.ts → learned/scorer/eval.d.ts} +1 -1
  64. package/out/tools/learned/scorer/eval.d.ts.map +1 -0
  65. package/out/tools/{learned-scorer-eval.js → learned/scorer/eval.js} +6 -5
  66. package/out/tools/learned/scorer/eval.js.map +1 -0
  67. package/out/tools/matcher-scale.js.map +1 -1
  68. package/out/tools/{nppes-dedup-benchmark.d.ts → nppes/dedup-benchmark.d.ts} +1 -1
  69. package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -0
  70. package/out/tools/{nppes-dedup-benchmark.js → nppes/dedup-benchmark.js} +6 -6
  71. package/out/tools/nppes/dedup-benchmark.js.map +1 -0
  72. package/out/tools/nppes/overmerge-packet.js +2 -2
  73. package/out/tools/nppes/overmerge-packet.js.map +1 -1
  74. package/out/tools/nppes/sample.js +2 -2
  75. package/out/tools/nppes/sample.js.map +1 -1
  76. package/out/tools/nppes/scoring.d.ts.map +1 -1
  77. package/out/tools/shared.d.ts +0 -1
  78. package/out/tools/shared.d.ts.map +1 -1
  79. package/out/tools/shared.js +4 -5
  80. package/out/tools/shared.js.map +1 -1
  81. package/out/tools/{train-cross-gbt.d.ts → train/cross-gbt.d.ts} +1 -1
  82. package/out/tools/train/cross-gbt.d.ts.map +1 -0
  83. package/out/tools/{train-cross-gbt.js → train/cross-gbt.js} +4 -4
  84. package/out/tools/train/cross-gbt.js.map +1 -0
  85. package/out/tools/{train-gbt.d.ts → train/gbt.d.ts} +1 -1
  86. package/out/tools/train/gbt.d.ts.map +1 -0
  87. package/out/tools/{train-gbt.js → train/gbt.js} +7 -7
  88. package/out/tools/train/gbt.js.map +1 -0
  89. package/out/tools/{train-org-cross-gbt.d.ts → train/org-cross-gbt.d.ts} +1 -1
  90. package/out/tools/train/org-cross-gbt.d.ts.map +1 -0
  91. package/out/tools/{train-org-cross-gbt.js → train/org-cross-gbt.js} +4 -4
  92. package/out/tools/train/org-cross-gbt.js.map +1 -0
  93. package/out/tools/txhhsc-to-oarow.js.map +1 -1
  94. package/out/tools/viz/cross-dataset-map.js.map +1 -1
  95. package/out/tools/viz/geocode-first-surface.js.map +1 -1
  96. package/out/tools/viz/{render.d.ts → render/index.d.ts} +1 -1
  97. package/out/tools/viz/render/index.d.ts.map +1 -0
  98. package/out/tools/viz/{render.js → render/index.js} +1 -1
  99. package/out/tools/viz/render/index.js.map +1 -0
  100. package/out/tools/viz/{render-map.d.ts → render/map.d.ts} +1 -1
  101. package/out/tools/viz/render/map.d.ts.map +1 -0
  102. package/out/tools/viz/{render-map.js → render/map.js} +1 -1
  103. package/out/tools/viz/render/map.js.map +1 -0
  104. package/out/tools/viz/source-provenance-map.js.map +1 -1
  105. package/out/tools/viz/yardstick-figure.js.map +1 -1
  106. package/package.json +9 -9
  107. package/out/tools/cross-dataset-correlation.d.ts.map +0 -1
  108. package/out/tools/cross-dataset-correlation.js.map +0 -1
  109. package/out/tools/cross-source-threshold-sweep.d.ts.map +0 -1
  110. package/out/tools/cross-source-threshold-sweep.js.map +0 -1
  111. package/out/tools/geocoder-namesake-probe.d.ts.map +0 -1
  112. package/out/tools/geocoder-namesake-probe.js.map +0 -1
  113. package/out/tools/geocoder-vs-provided-coords.d.ts.map +0 -1
  114. package/out/tools/geocoder-vs-provided-coords.js.map +0 -1
  115. package/out/tools/learned-scorer-clustering-eval.d.ts.map +0 -1
  116. package/out/tools/learned-scorer-clustering-eval.js.map +0 -1
  117. package/out/tools/learned-scorer-crossstate-eval.d.ts.map +0 -1
  118. package/out/tools/learned-scorer-crossstate-eval.js.map +0 -1
  119. package/out/tools/learned-scorer-eval.d.ts.map +0 -1
  120. package/out/tools/learned-scorer-eval.js.map +0 -1
  121. package/out/tools/nppes-dedup-benchmark.d.ts.map +0 -1
  122. package/out/tools/nppes-dedup-benchmark.js.map +0 -1
  123. package/out/tools/train-cross-gbt.d.ts.map +0 -1
  124. package/out/tools/train-cross-gbt.js.map +0 -1
  125. package/out/tools/train-gbt.d.ts.map +0 -1
  126. package/out/tools/train-gbt.js.map +0 -1
  127. package/out/tools/train-org-cross-gbt.d.ts.map +0 -1
  128. package/out/tools/train-org-cross-gbt.js.map +0 -1
  129. package/out/tools/viz/render-map.d.ts.map +0 -1
  130. package/out/tools/viz/render-map.js.map +0 -1
  131. package/out/tools/viz/render.d.ts.map +0 -1
  132. package/out/tools/viz/render.js.map +0 -1
  133. /package/lib/tools/{geocoder-namesake-probe.ts → geocoder/namesake-probe.ts} +0 -0
  134. /package/lib/tools/{geocoder-vs-provided-coords.ts → geocoder/vs-provided-coords.ts} +0 -0
  135. /package/lib/tools/{learned-scorer-crossstate-eval.ts → learned/scorer/crossstate-eval.ts} +0 -0
  136. /package/lib/tools/viz/{render.ts → render/index.ts} +0 -0
  137. /package/lib/tools/viz/{render-map.ts → render/map.ts} +0 -0
package/lib/geojson.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * a coordinate are omitted (a Point feature needs one).
11
11
  */
12
12
 
13
- import { isPresent } from "@mailwoman/core/objects"
13
+ import { formatPersonName } from "@mailwoman/record/name"
14
14
  import type { GeoFeature, GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial"
15
15
 
16
16
  import type { EntityGeoData, ResolvedEntity, SourceRecord } from "#types"
@@ -19,16 +19,7 @@ import type { EntityGeoData, ResolvedEntity, SourceRecord } from "#types"
19
19
  * Assemble a display name from a record's parsed person name, if any.
20
20
  */
21
21
  function displayName(record: SourceRecord): string | null {
22
- const name = record.name
23
-
24
- if (!name) return null
25
-
26
- const joined = [name.prefix, name.given, name.middle, name.familyParticle, name.family, name.suffix]
27
- .filter(isPresent)
28
- .join(" ")
29
- .trim()
30
-
31
- return joined || null
22
+ return formatPersonName(record.name) || null
32
23
  }
33
24
 
34
25
  /**
package/lib/ingest.ts CHANGED
@@ -70,10 +70,10 @@ export function streamRows(
70
70
  opts: { delimiter?: Delimiter } = {}
71
71
  ): AsyncSequence<Record<string, string>> {
72
72
  return CSVSpliterator.fromAsync<Record<string, string>>(source, {
73
- mode: "object",
74
73
  columnDelimiter: COLUMN_DELIMITERS[opts.delimiter ?? delimiterFor(source)],
74
+ // A {@linkcode ColumnMapping} names columns in the PUBLISHER's spelling — `Facility Name`, not
75
+ // `facility_name` — so the keys must arrive as the file writes them. The reader's default normalizes.
75
76
  normalizeKeys: false,
76
- enableQuoteHandling: true,
77
77
  })
78
78
  }
79
79
 
package/lib/reconcile.ts CHANGED
@@ -27,7 +27,7 @@
27
27
  * which the map auto-detects and colors categorically.
28
28
  */
29
29
 
30
- import { isPresent } from "@mailwoman/core/objects"
30
+ import { formatPersonName } from "@mailwoman/record/name"
31
31
  import type { GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial"
32
32
 
33
33
  import { toFeature } from "#geojson"
@@ -130,7 +130,7 @@ export function reconcileCoverage(entities: readonly ResolvedEntity[], config: R
130
130
  */
131
131
  export function repName(entity: ResolvedEntity): string {
132
132
  const rep = entity.representative
133
- const person = [rep.name?.given, rep.name?.family].filter(isPresent).join(" ")
133
+ const person = formatPersonName(rep.name, "short")
134
134
 
135
135
  return rep.organization?.canonical ?? (person || rep.id)
136
136
  }
@@ -96,7 +96,7 @@ export async function coverageReconciliation(
96
96
  const OUT_GEOJSON = options.outGeojson || ""
97
97
  const SPECS = buildSpecs(`${SOURCES}`, STATE)
98
98
 
99
- // --- Ingest each source into one combined record set (geo-first resolve). ---
99
+ // Ingest every source into one combined, geo-resolved record set.
100
100
  const rawBySource = new Map<string, Record<string, string>[]>()
101
101
 
102
102
  for (const spec of SPECS) {
@@ -155,7 +155,7 @@ export async function coverageReconciliation(
155
155
  // GBT default rejects (measured: "enrolled" overlap 22→6). Use the FS baseline for this cross-dataset join.
156
156
  const { entities } = resolveEntities(records, { trainEM: true, collapseSpatial: true, learnedScorer: false })
157
157
 
158
- // --- Reconcile across sources via the shared @mailwoman/registry library — the SAME code path as
158
+ // Reconcile sources through the shared @mailwoman/registry code path.
159
159
  // `mailwoman registry --reconcile`, so the script and the CLI can't drift. ---
160
160
  const config: ReconcileConfig = { eligibilitySources: [...ELIGIBILITY], fundingSources: [...FUNDING] }
161
161
  const result = reconcileCoverage(entities, config)
@@ -152,7 +152,7 @@ export async function crossDatasetCorrelation(
152
152
  const CORPUS_FREQ = options.corpusFrequency ?? true
153
153
  const SPECS = [...buildSpecs(`${SOURCES}`, STATE), commitmentsSpec(`${SOURCES}`, STATE)]
154
154
 
155
- // --- Phase A: stream each source, TX-filter, explode → keep the first CAP rows for geocoding AND
155
+ // Stream each source, filter Texas rows, and retain the first capped rows for geocoding.
156
156
  // (when --corpus-frequency, the default) count EVERY in-state address into a corpus-wide table. The
157
157
  // sample is the matched set; the frequency table reflects the full TX population, so the proven
158
158
  // inverse-frequency change down-weights a genuinely-crowded shared campus even when it appears once in
@@ -207,7 +207,7 @@ export async function crossDatasetCorrelation(
207
207
  report?.(` address-frequency table: ${addrCounts.size} distinct over ${addrTotal} ${STATE} addresses`)
208
208
  }
209
209
 
210
- // --- Phase B: geocoder (injected — see ./eval-geocoder.ts). ---
210
+ // Construct the injected geocoder used by this evaluation.
211
211
  report?.("[B] building the geocoder…")
212
212
  const geocoder = await options.createGeocoder()
213
213
 
@@ -227,7 +227,7 @@ export async function crossDatasetCorrelation(
227
227
  return g
228
228
  }
229
229
 
230
- // --- Phase C: ingest each source (its own mapping + source label) into one combined record set. ---
230
+ // Ingest each mapped source into one combined labeled record set.
231
231
  report?.("[C] geocoding + ingesting all sources…")
232
232
  const records: SourceRecord[] = []
233
233
 
@@ -253,7 +253,7 @@ export async function crossDatasetCorrelation(
253
253
  geocoder[Symbol.dispose]()
254
254
  report?.(` ${records.length} records; geocoded ${geo}/${total} (${((100 * geo) / total).toFixed(1)}%)`)
255
255
 
256
- // --- Phase D: resolve to canonical entities. The proven changes are default-on (#86): collapsed
256
+ // Resolve records to canonical entities using the default-on proven changes.
257
257
  // spatial (A1) + inverse-address-frequency. We feed the corpus-wide table when we built one; otherwise
258
258
  // resolveEntities auto-computes the input-scoped default. ---
259
259
  report?.("[D] resolving across sources…")
@@ -270,7 +270,7 @@ export async function crossDatasetCorrelation(
270
270
  ...(addressFrequency ? { addressFrequency } : {}),
271
271
  })
272
272
 
273
- // --- Phase E: find the cross-source entities — members spanning ≥2 distinct sources. ---
273
+ // Find entities whose members span at least two distinct sources.
274
274
  const sourceOf = (r: SourceRecord) => r.source ?? "?"
275
275
 
276
276
  const crossSource = entities
@@ -292,7 +292,7 @@ export async function crossDatasetCorrelation(
292
292
  }
293
293
  }
294
294
 
295
- // --- Report. ---
295
+ // Report the resulting cross-source correlations.
296
296
  const lines: string[] = [
297
297
  `# Cross-dataset correlation (#618 / #87 real-data run)`,
298
298
  "",
@@ -405,7 +405,7 @@ export async function crossDatasetCorrelation(
405
405
  report?.(`\n[written] ${OUT_MD}`)
406
406
  }
407
407
 
408
- // --- The reconciliation artifact: a GeoJSON FeatureCollection of every resolved entity. Each feature
408
+ // Emit a GeoJSON FeatureCollection for every resolved entity.
409
409
  // carries `sources` + `sourceIDs` (so an analyst filters the cross-dataset links by `sources` length ≥ 2)
410
410
  // and the geocode tier. QGIS-ready; this is the operator-verifiable output of the matcher. ---
411
411
  if (OUT_GEOJSON) {
@@ -198,7 +198,7 @@ export async function crossSourceThresholdSweep(
198
198
  const CANDIDATE = options.candidate || ""
199
199
  const SPECS = buildSpecs(`${SOURCES}`, STATE)
200
200
 
201
- // --- Ingest + geocode each source ONCE. ---
201
+ // Ingest and geocode each source once before sweeping thresholds.
202
202
  const rawBySource = new Map<string, Record<string, string>[]>()
203
203
 
204
204
  for (const spec of SPECS) {
@@ -237,7 +237,7 @@ export async function crossSourceThresholdSweep(
237
237
  const geocoded = records.filter((r) => r.address?.geocode).length
238
238
  report?.(` ${records.length} records; geocoded ${geocoded}`)
239
239
 
240
- // --- The bundled GBT scorer over the input-scoped address-frequency basis (eval convention). ---
240
+ // Score with the bundled GBT over the input-scoped address-frequency basis.
241
241
  const addrCounts = new Map<string, number>()
242
242
  let addrTotal = 0
243
243
 
@@ -257,7 +257,7 @@ export async function crossSourceThresholdSweep(
257
257
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons
258
258
  const gbtScorer = createGBTScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency })
259
259
 
260
- // --- Arm 1: the FS baseline (the recall-correct baseline cross-source flows currently pin). ---
260
+ // Evaluate the FS recall-correct baseline.
261
261
  report?.("[D] resolving — FS baseline baseline…")
262
262
 
263
263
  const fs = await measure(
@@ -266,7 +266,7 @@ export async function crossSourceThresholdSweep(
266
266
  resolveEntities(records, { trainEM: true, collapseSpatial: true, addressFrequency, learnedScorer: false }).entities
267
267
  )
268
268
 
269
- // --- Arm 2: the bundled GBT at a fine threshold sweep (down well below the dedup 2.71, since
269
+ // Evaluate the bundled GBT over a fine threshold sweep.
270
270
  // cross-source pairs sit at strongly NEGATIVE logits). ---
271
271
  const SWEEP = [-8, -6, -5, -4, -3, -2, -1, 0, 1, 2, DEDUP_GBT_META.recommendedThreshold]
272
272
  const gbtArms: ArmMetrics[] = []
@@ -284,12 +284,12 @@ export async function crossSourceThresholdSweep(
284
284
  gbtArms.push(await measure(`GBT @ ${t.toFixed(2)}`, t, entities))
285
285
  }
286
286
 
287
- // --- Verdict. The threshold fix WORKS only if some GBT arm dominates FS — more (or equal)
287
+ // The threshold fix passes only when a GBT arm dominates FS.
288
288
  // cross-source links at ≥ FS phone-corroboration WITHOUT over-merging (entity count must not
289
289
  // collapse below ~90% of FS, else the "links" are giant-blob artifacts). Otherwise FS is on the
290
290
  // frontier and threshold alone is insufficient. ---
291
291
  const pct = (n: number, d: number) => formatPercent(n, d, 0)
292
- // --- Arm 3 (#655 option 2): the cross-source-trained GBT at its own recommended threshold. ---
292
+ // Evaluate the cross-source-trained GBT at its recommended threshold.
293
293
  const candidateArms: ArmMetrics[] = []
294
294
 
295
295
  if (CANDIDATE) {
@@ -82,12 +82,12 @@ export async function dedupCeiling(
82
82
  const OUT_MD = options.outMd || ""
83
83
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
84
84
 
85
- // --- Stream TX type-2 (org) providers; one primary record per NPI at its practice address. ---
85
+ // Stream Texas organization providers, retaining one primary practice-address record per NPI.
86
86
  report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`)
87
87
  const { byAddr, kept, scanned } = await scanColocatedProviders({ registryPath: REGISTRY, state: STATE, cap: CAP })
88
88
  report?.(` scanned ${scanned} rows → ${kept} ${STATE} org providers at ${byAddr.size} distinct addresses`)
89
89
 
90
- // --- Over co-located distinct-NPI pairs: the org-similarity distribution + collision rate. ---
90
+ // Measure organization similarity and collision rate for co-located distinct-NPI pairs.
91
91
  let sharedAddresses = 0
92
92
  let providersAtSharedAddr = 0
93
93
  let pairs = 0
@@ -140,7 +140,7 @@ export async function dedupCeiling(
140
140
  }
141
141
  }
142
142
 
143
- // --- Derive the precision ceiling. An address-aware matcher must, on co-located distinct-NPI
143
+ // Derive the precision ceiling from co-located distinct-NPI records.
144
144
  // pairs, either merge (wrong) or hold them apart using name/org. It CAN separate the `separable`
145
145
  // (and most `mid`) pairs but NOT the `collide` ones. So the irreducible false-merge rate among
146
146
  // co-located distinct pairs is collide/pairs; an oracle's precision on the co-located decision is
@@ -7,25 +7,25 @@
7
7
  */
8
8
 
9
9
  export * from "#tools/coverage-reconciliation"
10
- export * from "#tools/cross-dataset-correlation"
11
- export * from "#tools/cross-source-threshold-sweep"
10
+ export * from "#tools/cross/dataset-correlation"
11
+ export * from "#tools/cross/source-threshold-sweep"
12
12
  export * from "#tools/dedup-ceiling"
13
13
  export * from "#tools/eval-geocoder"
14
- export * from "#tools/geocoder-namesake-probe"
15
- export * from "#tools/geocoder-vs-provided-coords"
14
+ export * from "#tools/geocoder/namesake-probe"
15
+ export * from "#tools/geocoder/vs-provided-coords"
16
16
  export * from "#tools/gold-set-sample"
17
- export * from "#tools/learned-scorer-clustering-eval"
18
- export * from "#tools/learned-scorer-crossstate-eval"
19
- export * from "#tools/learned-scorer-eval"
17
+ export * from "#tools/learned/scorer/clustering-eval"
18
+ export * from "#tools/learned/scorer/crossstate-eval"
19
+ export * from "#tools/learned/scorer/eval"
20
20
  export * from "#tools/matcher-scale"
21
- export * from "#tools/nppes-dedup-benchmark"
22
- export * from "#tools/train-cross-gbt"
23
- export * from "#tools/train-gbt"
24
- export * from "#tools/train-org-cross-gbt"
21
+ export * from "#tools/nppes/dedup-benchmark"
22
+ export * from "#tools/train/cross-gbt"
23
+ export * from "#tools/train/gbt"
24
+ export * from "#tools/train/org-cross-gbt"
25
25
  export * from "#tools/txhhsc-to-oarow"
26
26
  export * from "#tools/viz/cross-dataset-map"
27
27
  export * from "#tools/viz/geocode-first-surface"
28
- export * from "#tools/viz/render-map"
29
- export * from "#tools/viz/render"
28
+ export * from "#tools/viz/render/map"
29
+ export * from "#tools/viz/render/index"
30
30
  export * from "#tools/viz/source-provenance-map"
31
31
  export * from "#tools/viz/yardstick-figure"
@@ -31,6 +31,7 @@
31
31
  import { dataRootPath } from "@mailwoman/core/data-root"
32
32
  import { writeLocalFile } from "@mailwoman/core/fs/writers"
33
33
  import { makeLcg } from "@mailwoman/core/random"
34
+ import { mean } from "@mailwoman/core/utils"
34
35
  import { block, gbtScore, trainGBT } from "@mailwoman/match"
35
36
 
36
37
  import {
@@ -47,7 +48,6 @@ import { buildNPPESSample } from "#tools/nppes/sample"
47
48
  import { scoreEntities } from "#tools/nppes/scoring"
48
49
  import {
49
50
  bestOver,
50
- mean,
51
51
  MIN_MEANINGFUL_F1_DELTA,
52
52
  pct,
53
53
  quantileThresholds,
@@ -114,7 +114,7 @@ export async function scorerClusteringEval(
114
114
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
115
115
  const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`
116
116
 
117
- // --- Data-gen: the same NPI-keyed records as the dedup benchmark + the pairwise probe (the SHARED
117
+ // Build the NPI-keyed benchmark sample and pairwise probe.
118
118
  // sample builder). ---
119
119
  const {
120
120
  rows,
@@ -145,7 +145,7 @@ export async function scorerClusteringEval(
145
145
 
146
146
  geocoder[Symbol.dispose]()
147
147
 
148
- // --- The feature basis: address-frequency + collapsed-spatial model (the baseline). The agreement
148
+ // Use address frequency and the collapsed-spatial model as the baseline feature basis.
149
149
  // pattern is EM-independent, so the same featurize() is consistent at train and inference time. ---
150
150
  // The featurizer is the SHARED production one (createMatchFeaturizer) — train ≡ eval ≡ inference, one
151
151
  // definition. Feed the collapsed-spatial + address-frequency comparison set (the benchmark baseline).
@@ -38,13 +38,13 @@
38
38
  import { dataRootPath } from "@mailwoman/core/data-root"
39
39
  import { writeLocalFile } from "@mailwoman/core/fs/writers"
40
40
  import { makeLcg } from "@mailwoman/core/random"
41
+ import { mean } from "@mailwoman/core/utils"
41
42
  import { agreementPattern, block, estimateParameters, gbtScore, scorePair, trainGBT } from "@mailwoman/match"
42
43
 
43
44
  import { buildDefaultModel, createMatchFeaturizer, defaultBlockingKeys, ingestRows, type ColumnMapping } from "#index"
44
45
  import type { EvalGeocoderFactory } from "#tools/eval-geocoder"
45
46
  import { buildNPPESSample } from "#tools/nppes/sample"
46
- import { mean, pct, sgn, stateOption, std, trainLogisticRegression } from "#tools/shared"
47
-
47
+ import { pct, sgn, stateOption, std, trainLogisticRegression } from "#tools/shared"
48
48
  /**
49
49
  * Smallest mean gap counted as a real difference rather than seed noise.
50
50
  */
@@ -120,7 +120,7 @@ export async function scorerPairwiseEval(
120
120
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
121
121
  const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`
122
122
 
123
- // --- Data-gen: the same NPI-keyed records as the dedup benchmark (the SHARED sample builder). ---
123
+ // Build the same NPI-keyed sample used by the dedup benchmark.
124
124
  const { rows, keptNpis, addressFrequency } = await buildNPPESSample(
125
125
  { registryPath: REGISTRY, otherNamesPath: OTHER_NAMES, state: STATE, maxNpis: NPIS },
126
126
  report
@@ -146,7 +146,7 @@ export async function scorerPairwiseEval(
146
146
 
147
147
  geocoder[Symbol.dispose]()
148
148
 
149
- // --- Block + feature extraction. The model (collapsed spatial + address-frequency) defines the
149
+ // Block records and extract the collapsed-spatial and address-frequency features.
150
150
  // comparisons; EM-fit it for the FS baseline. ---
151
151
  report?.("[D] blocking + features…")
152
152
  const model = buildDefaultModel({ collapseSpatial: true, addressFrequency })
@@ -239,7 +239,7 @@ export async function scorerPairwiseEval(
239
239
  }
240
240
  }
241
241
 
242
- // --- Eval on the held-out test pairs: ROC-AUC + best-threshold F1, for LR vs FS. ---
242
+ // Evaluate LR and FS on held-out pairs with ROC-AUC and best-threshold F1.
243
243
  function auc(scored: Array<{ s: number; y: number }>): number {
244
244
  const pos = scored.filter((d) => d.y === 1)
245
245
  const neg = scored.filter((d) => d.y === 0)
@@ -139,7 +139,7 @@ export async function nppesDedupBenchmark(
139
139
  const PARALLEL_GEOCODE = options.parallelGeocode ?? false
140
140
  const GEO_CONC = options.geoConcurrency ?? 2
141
141
 
142
- // --- Phases A + B: the variation-rich sample plus the corpus-wide address-frequency table. ---
142
+ // Build the variation-rich sample and corpus-wide address-frequency table.
143
143
  const { rows, keptNpis, npiPrimary, addressFrequency } = await buildNPPESSample(
144
144
  {
145
145
  registryPath: `${SOURCES}/nppes_npi-registry_20260607.tsv`,
@@ -150,7 +150,7 @@ export async function nppesDedupBenchmark(
150
150
  report
151
151
  )
152
152
 
153
- // --- Phase C: geocode + ingest (the NPI rides on record.id as the held-out label). The heavy
153
+ // Geocode and ingest records, carrying the held-out NPI in record.id.
154
154
  // geocoder is injected (see ./eval-geocoder.ts); model-swap for a multi-version curve rides the
155
155
  // command's factory config (--model/--tokenizer/--model-card; modelCardPath is MANDATORY when
156
156
  // modelPath is set — without it a STAGE3 model silently mis-decodes into empty parses). ---
@@ -217,7 +217,7 @@ export async function nppesDedupBenchmark(
217
217
 
218
218
  report?.(` geocoded ${geo}/${rows.length} (${((100 * geo) / rows.length).toFixed(1)}%)`)
219
219
 
220
- // --- Phase E: score recovered clusters against each truth grain (record.id = the held-out NPI). ---
220
+ // Score recovered clusters against each truth grain using the held-out NPI.
221
221
  const N = records.length
222
222
 
223
223
  // Every grain scores against the SAME record population, so the ARI expectation is fixed for the run.
@@ -237,7 +237,7 @@ export async function nppesDedupBenchmark(
237
237
  const H3_RES = options.h3Res ?? 11 // res 11 ≈ 25 m edge; res 10 ≈ 65 m (block scale)
238
238
  const orgNameH3Label = buildOrgNameH3Grain(npiPrimary, npiCoord, H3_RES)
239
239
 
240
- // --- Phase D: the comparison-model setting progression — toggle each setting ON in turn at the default
240
+ // Progressively enable comparison-model settings at the default threshold.
241
241
  // threshold to isolate its marginal effect, then sweep the link threshold on the best config (geocode
242
242
  // once, resolve many — config is cheap). ---
243
243
  report?.(`[D] resolving the setting progression${TRAIN_EM ? " (EM-trained)" : ""}…`)
@@ -292,7 +292,7 @@ export async function nppesDedupBenchmark(
292
292
  ` default F1 ${(100 * base.score.f1).toFixed(1)}% → best F1 ${(100 * best.score.f1).toFixed(1)}% @ threshold ${best.t}`
293
293
  )
294
294
 
295
- // --- Phase F: NPI-level vs ENTITY-level truth. Score the SAME clusters against both yardsticks to
295
+ // Score the same clusters against NPI-level and entity-level truth.
296
296
  // reveal how much of the apparent over-merge is NPI over-segmentation (one org / many subpart-NPIs,
297
297
  // where merging is CORRECT) rather than model error. Two production configs: the FS full setting stack
298
298
  // and the shipped default (GBT, default-on) — each fed the corpus-wide address-frequency table. ---
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { writeLocalTextFile } from "@mailwoman/core/fs/writers"
10
- import { isPresent } from "@mailwoman/core/objects"
10
+ import { formatPersonName } from "@mailwoman/record/name"
11
11
 
12
12
  import type { ResolvedEntity, SourceRecord } from "#index"
13
13
  import type { MessyRow } from "#tools/nppes/sample"
@@ -80,7 +80,7 @@ export async function writeOvermergePacket(path: string, input: OvermergePacketI
80
80
  const src = rowByID.get(rec.id)
81
81
 
82
82
  out.push(
83
- ` - npi=${rec.id} · name="${[rec.name?.given, rec.name?.family].filter(isPresent).join(" ")}" · org="${rec.organization?.canonical ?? ""}" · addr="${rec.address?.raw ?? ""}" · auth="${src?.auth ?? ""}" · taxonomy="${src?.taxonomy ?? ""}"`
83
+ ` - npi=${rec.id} · name="${formatPersonName(rec.name, "short")}" · org="${rec.organization?.canonical ?? ""}" · addr="${rec.address?.raw ?? ""}" · auth="${src?.auth ?? ""}" · taxonomy="${src?.taxonomy ?? ""}"`
84
84
  )
85
85
  }
86
86
  }
@@ -96,7 +96,7 @@ export async function buildNPPESStateSamples(
96
96
  ): Promise<{ byState: Map<string, NPPESStateSample>; addressFrequency: TermFrequencyTable }> {
97
97
  const { registryPath, otherNamesPath, states, maxNpisPerState } = options
98
98
 
99
- // --- Phase A: the variation set — NPIs that carry ≥1 alternate organization name. ---
99
+ // Select NPIs with at least one alternate organization name.
100
100
  report?.("[A] streaming other-names…")
101
101
  const altNames = new Map<string, string[]>()
102
102
 
@@ -117,7 +117,7 @@ export async function buildNPPESStateSamples(
117
117
 
118
118
  report?.(` ${altNames.size} NPIs with ≥1 alternate name`)
119
119
 
120
- // --- Phase B: ONE full registry pass — build the GLOBAL address-frequency table (every practice
120
+ // Make one full registry pass to build the global address-frequency table.
121
121
  // address, so the sharing structure is corpus-wide, not sample-biased) AND collect every state's sample. ---
122
122
  report?.(`[B] full registry pass: address-frequency table + ${maxNpisPerState} × ${states.join("/")} sample…`)
123
123
 
@@ -29,8 +29,6 @@ import {
29
29
  import type { EvalGeocoderFactory } from "#tools/eval-geocoder"
30
30
  import type { Score } from "#tools/nppes/scoring"
31
31
 
32
- export { mean } from "@mailwoman/core/utils"
33
-
34
32
  /**
35
33
  * One source a cross-source probe ingests: where it lives, the column mapping, and an in-state filter.
36
34
  */
@@ -612,7 +610,7 @@ export async function trainCrossSourceModel(
612
610
  ): Promise<{ out: string; pairs: number; recommendedThreshold: number }> {
613
611
  const { rows, joined, addressFrequency, sources, precisionBar, out, report } = options
614
612
 
615
- // --- Phase C: geocode + ingest (record.id = the join-key label; `source` rides the record). The
613
+ // Geocode and ingest records, carrying the join-key label in record.id and source on the record.
616
614
  // heavy geocoder is injected (see ./eval-geocoder.ts). ---
617
615
  report?.("[C] geocoding…")
618
616
  const geocoder = await options.createGeocoder()
@@ -642,7 +640,7 @@ export async function trainCrossSourceModel(
642
640
  geocoder[Symbol.dispose]()
643
641
  report?.(` ${records.length} records, ${records.filter((r) => r.address?.geocode).length} geocoded`)
644
642
 
645
- // --- Phase D: block over the UNION; keep only CROSS-source pairs; featurize; label by join key. ---
643
+ // Block the union, retain cross-source pairs, generate features, and label by join key.
646
644
  report?.("[D] blocking + featurizing (cross-source pairs only)…")
647
645
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons
648
646
  const featurize = createMatchFeaturizer({ comparisons, addressFrequency })
@@ -657,7 +655,7 @@ export async function trainCrossSourceModel(
657
655
  ` ${allPairs.length} blocked pairs → ${pairs.length} cross-source (${(100 * posRate).toFixed(1)}% positive)`
658
656
  )
659
657
 
660
- // --- Phase E: held-out calibration — the #655 threshold rule. ---
658
+ // Calibrate the threshold against held-out pairs.
661
659
  report?.("[E] held-out calibration…")
662
660
  const rnd = makeLcg(655)
663
661
  const split = new Map<string, "fit" | "holdout">()
@@ -727,7 +725,7 @@ export async function trainCrossSourceModel(
727
725
  ` held-out (${holdIdx.length} pairs, ${totalPos} pos): precision-bar ${precisionBar} → threshold ${recommendedThreshold.toFixed(3)} (recall ${(100 * barRecall).toFixed(1)}%); F1-max ${(100 * bestF1).toFixed(1)}% @ ${f1MaxThreshold.toFixed(3)}`
728
726
  )
729
727
 
730
- // --- Phase F: train the SHIPPED model on ALL cross-source pairs; emit the committed module. ---
728
+ // Train the shipped model on all cross-source pairs and emit its committed module.
731
729
  report?.("[F] training the shipped model on all pairs…")
732
730
  const model = trainGBT(X, Y, W, CROSS_SOURCE_HYPERPARAMS)
733
731
 
@@ -94,7 +94,7 @@ export async function trainCrossSourceGBT(
94
94
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
95
95
  const OP_PROFILE = `${SOURCES}/openpayments_covered-recipient-profile_20260603.csv`
96
96
 
97
- // --- Phase A: Open Payments TX practitioners (NPI + profile name + profile address). ---
97
+ // Build Open Payments practitioner records with NPI, profile name, and profile address.
98
98
  report?.(`[A] streaming the OP profile supplement (${STATE})…`)
99
99
  const opByNPI = new Map<string, CrossSourceRow>()
100
100
 
@@ -121,7 +121,7 @@ export async function trainCrossSourceGBT(
121
121
 
122
122
  report?.(` ${opByNPI.size} OP ${STATE} practitioners`)
123
123
 
124
- // --- Phase B: the SAME NPIs from NPPES (practice address + legal name) + the corpus-wide
124
+ // Join the same NPPES NPIs with practice address, legal name, and corpus-wide
125
125
  // address-frequency table (one full registry pass, identical to train-gbt). ---
126
126
  report?.("[B] full registry pass: address-frequency table + the NPI-joined NPPES rows…")
127
127
  const rows: CrossSourceRow[] = []
@@ -170,7 +170,7 @@ export async function trainCrossSourceGBT(
170
170
 
171
171
  report?.(` ${joined.size} NPI-joined pairs → ${rows.length} records`)
172
172
 
173
- // --- Phases C–F: the SHARED cross-source trainer (geocode → cross-source pairs → #655 calibration
173
+ // Run the shared cross-source trainer: geocode, form pairs, calibrate, and train.
174
174
  // → shipped model → committed module). ---
175
175
  return trainCrossSourceModel({
176
176
  createGeocoder: options.createGeocoder,
@@ -102,14 +102,14 @@ export async function trainDedupGBT(
102
102
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
103
103
  const OTHER_NAMES = `${SOURCES}/nppes_other-names_20260607.tsv`
104
104
 
105
- // --- Phases A + B: the variation-rich sample + the corpus-wide address-frequency table (the SHARED
105
+ // Build the variation-rich sample and corpus-wide address-frequency table.
106
106
  // sample builder — the same records the dedup benchmark and the learned-scorer evals see). ---
107
107
  const { rows, keptNpis, addressFrequency } = await buildNPPESSample(
108
108
  { registryPath: REGISTRY, otherNamesPath: OTHER_NAMES, state: STATE, maxNpis: NPIS },
109
109
  report
110
110
  )
111
111
 
112
- // --- Phase C: geocode + ingest (NPI rides on record.id as the label). The heavy geocoder is
112
+ // Geocode and ingest records, carrying the NPI in record.id as the label.
113
113
  // injected (see ./eval-geocoder.ts) — the registry package never imports the runtime. ---
114
114
  report?.("[C] geocoding…")
115
115
  const geocoder = await options.createGeocoder()
@@ -131,7 +131,7 @@ export async function trainDedupGBT(
131
131
  const geocoded = records.filter((r) => r.address?.geocode).length
132
132
  report?.(` ${records.length} records, ${geocoded} geocoded`)
133
133
 
134
- // --- Phase D: block → features (the SHARED featurizer) → labels. ---
134
+ // Block records, generate shared features, then assign labels.
135
135
  report?.("[D] blocking + featurizing…")
136
136
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons
137
137
  const featurize = createMatchFeaturizer({ comparisons, addressFrequency })
@@ -146,7 +146,7 @@ export async function trainDedupGBT(
146
146
  report?.(` cost-sensitive: negative class weighted ×${COST} (penalize over-merge)`)
147
147
  }
148
148
 
149
- // --- Phase E: calibrate the default link threshold. The GBT logit is NOT in FS-weight units — it's
149
+ // Calibrate the default link threshold; the GBT logit is not in FS-weight units.
150
150
  // trained with class-balanced weights, so logit 0 (the balanced boundary) ignores the ~1% match base
151
151
  // rate and over-merges. Split the NPIs 80/20, fit a calibration GBT on the 80%, and sweep the
152
152
  // CLUSTERING threshold on the held-out 20% (the metric resolveEntities actually optimizes) for F1-max.
@@ -196,12 +196,12 @@ export async function trainDedupGBT(
196
196
  ` recommended link threshold ${recommendedThreshold.toFixed(3)} (held-out clustering F1 ${(100 * bestF1).toFixed(1)}%)`
197
197
  )
198
198
 
199
- // --- Phase F: train the SHIPPED model on ALL pairs. ---
199
+ // Train the shipped model on every available pair.
200
200
  report?.("[F] training the shipped model on all pairs…")
201
201
  const model = trainGBT(X, Y, W, hyperparams)
202
202
  report?.(` ${pairs.length} pairs (${(100 * posRate).toFixed(1)}% positive), ${model.trees.length} trees`)
203
203
 
204
- // --- Emit the model as a committed TS module. The literal is single-line + prettier-ignored so a
204
+ // Emit the model as a committed TypeScript module with a prettier-stable literal.
205
205
  // retrain produces a clean one-line diff, not a thousand reformatted lines. ---
206
206
  const meta = {
207
207
  version: "1.0.0",
@@ -86,7 +86,7 @@ export async function trainOrgCrossSourceGBT(
86
86
  const POS = `${SOURCES}/cms-pos_hospital-other_2026q1.csv`
87
87
  const CARE_COMPARE = `${SOURCES}/cms-carecompare_hospital-general_20260706.csv`
88
88
 
89
- // --- Phase A: Care Compare (Facility ID + name + address). ---
89
+ // Build Care Compare facility records with facility ID, name, and address.
90
90
  report?.("[A] streaming Care Compare…")
91
91
  const ccByID = new Map<string, CrossSourceRow>()
92
92
 
@@ -102,7 +102,7 @@ export async function trainOrgCrossSourceGBT(
102
102
 
103
103
  report?.(` ${ccByID.size} Care Compare facilities`)
104
104
 
105
- // --- Phase B: the SAME CCNs from the POS file + the corpus-wide address-frequency table. ---
105
+ // Join the same CCNs from POS with the corpus-wide address-frequency table.
106
106
  report?.("[B] streaming POS + building the frequency table…")
107
107
  const rows: CrossSourceRow[] = []
108
108
  const joined = new Set<string>()
@@ -141,7 +141,7 @@ export async function trainOrgCrossSourceGBT(
141
141
 
142
142
  report?.(` ${joined.size} CCN-joined facilities → ${rows.length} records`)
143
143
 
144
- // --- Phases C–F: the SHARED cross-source trainer (geocode → cross-source pairs → #655 calibration
144
+ // Run the shared cross-source trainer: geocode, form pairs, calibrate, and train.
145
145
  // → shipped model → committed module). ---
146
146
  return trainCrossSourceModel({
147
147
  createGeocoder: options.createGeocoder,
@@ -1 +1 @@
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"}
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;AASzE;;;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,19 +9,12 @@
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
+ import { formatPersonName } from "@mailwoman/record/name";
13
13
  /**
14
14
  * Assemble a display name from a record's parsed person name, if any.
15
15
  */
16
16
  function displayName(record) {
17
- const name = record.name;
18
- if (!name)
19
- return null;
20
- const joined = [name.prefix, name.given, name.middle, name.familyParticle, name.family, name.suffix]
21
- .filter(isPresent)
22
- .join(" ")
23
- .trim();
24
- return joined || null;
17
+ return formatPersonName(record.name) || null;
25
18
  }
26
19
  /**
27
20
  * One entity → one GeoJSON Point feature. `extra` merges over (and may override) the standard properties — the
@@ -1 +1 @@
1
- {"version":3,"file":"geojson.js","sourceRoot":"","sources":["../lib/geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAKnD;;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,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;SAClG,MAAM,CAAC,SAAS,CAAC;SACjB,IAAI,CAAC,GAAG,CAAC;SACT,IAAI,EAAE,CAAA;IAER,OAAO,MAAM,IAAI,IAAI,CAAA;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACxB,MAAsB,EACtB,KAA8B;IAE9B,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAA;IAEjC,OAAO;QACN,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,SAAS,EAAE,iCAAiC;QAChD,QAAQ,EAAE;YACT,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC,MAAM,CAAC,UAAW,CAAC,SAAS,EAAE,MAAM,CAAC,UAAW,CAAC,QAAQ,CAAC;SACxE;QACD,UAAU,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC,EAAE;YACnB,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM;YAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1C,oGAAoG;YACpG,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;YACrG,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC;YACtB,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,SAAS,IAAI,IAAI;YACjD,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,IAAI,IAAI;YACvC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI;YAC/C,GAAG,KAAK;SACR;KACD,CAAA;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,QAAmC;IAC5D,OAAO;QACN,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC3F,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"geojson.js","sourceRoot":"","sources":["../lib/geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAKzD;;GAEG;AACH,SAAS,WAAW,CAAC,MAAoB;IACxC,OAAO,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACxB,MAAsB,EACtB,KAA8B;IAE9B,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAA;IAEjC,OAAO;QACN,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,SAAS,EAAE,iCAAiC;QAChD,QAAQ,EAAE;YACT,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC,MAAM,CAAC,UAAW,CAAC,SAAS,EAAE,MAAM,CAAC,UAAW,CAAC,QAAQ,CAAC;SACxE;QACD,UAAU,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC,EAAE;YACnB,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM;YAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1C,oGAAoG;YACpG,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;YACrG,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC;YACtB,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,SAAS,IAAI,IAAI;YACjD,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,IAAI,IAAI;YACvC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI;YAC/C,GAAG,KAAK;SACR;KACD,CAAA;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,QAAmC;IAC5D,OAAO;QACN,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC3F,CAAA;AACF,CAAC"}
package/out/ingest.js CHANGED
@@ -50,10 +50,10 @@ export function delimiterFor(path) {
50
50
  */
51
51
  export function streamRows(source, opts = {}) {
52
52
  return CSVSpliterator.fromAsync(source, {
53
- mode: "object",
54
53
  columnDelimiter: COLUMN_DELIMITERS[opts.delimiter ?? delimiterFor(source)],
54
+ // A {@linkcode ColumnMapping} names columns in the PUBLISHER's spelling — `Facility Name`, not
55
+ // `facility_name` — so the keys must arrive as the file writes them. The reader's default normalizes.
55
56
  normalizeKeys: false,
56
- enableQuoteHandling: true,
57
57
  });
58
58
  }
59
59
  /**