@mailwoman/registry 9.4.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.
- package/lib/geojson.ts +2 -11
- package/lib/ingest.ts +2 -2
- package/lib/reconcile.ts +2 -2
- package/lib/tools/coverage-reconciliation.ts +2 -2
- package/lib/tools/{cross-dataset-correlation.ts → cross/dataset-correlation.ts} +7 -7
- package/lib/tools/{cross-source-threshold-sweep.ts → cross/source-threshold-sweep.ts} +6 -6
- package/lib/tools/dedup-ceiling.ts +3 -3
- package/lib/tools/index.ts +13 -13
- package/lib/tools/{learned-scorer-clustering-eval.ts → learned/scorer/clustering-eval.ts} +2 -2
- package/lib/tools/{learned-scorer-eval.ts → learned/scorer/eval.ts} +3 -3
- package/lib/tools/{nppes-dedup-benchmark.ts → nppes/dedup-benchmark.ts} +5 -5
- package/lib/tools/nppes/overmerge-packet.ts +2 -2
- package/lib/tools/nppes/sample.ts +2 -2
- package/lib/tools/shared.ts +4 -4
- package/lib/tools/{train-cross-gbt.ts → train/cross-gbt.ts} +3 -3
- package/lib/tools/{train-gbt.ts → train/gbt.ts} +6 -6
- package/lib/tools/{train-org-cross-gbt.ts → train/org-cross-gbt.ts} +3 -3
- package/out/geojson.d.ts.map +1 -1
- package/out/geojson.js +2 -9
- package/out/geojson.js.map +1 -1
- package/out/ingest.js +2 -2
- package/out/ingest.js.map +1 -1
- package/out/map-html.js.map +1 -1
- package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/reconcile.js +2 -2
- package/out/reconcile.js.map +1 -1
- package/out/resolve.js.map +1 -1
- package/out/tools/coverage-reconciliation.js +2 -2
- package/out/tools/coverage-reconciliation.js.map +1 -1
- package/out/tools/{cross-dataset-correlation.d.ts → cross/dataset-correlation.d.ts} +1 -1
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -0
- package/out/tools/{cross-dataset-correlation.js → cross/dataset-correlation.js} +8 -8
- package/out/tools/cross/dataset-correlation.js.map +1 -0
- package/out/tools/{cross-source-threshold-sweep.d.ts → cross/source-threshold-sweep.d.ts} +1 -1
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/{cross-source-threshold-sweep.js → cross/source-threshold-sweep.js} +7 -7
- package/out/tools/cross/source-threshold-sweep.js.map +1 -0
- package/out/tools/dedup-ceiling.js +3 -3
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/{geocoder-namesake-probe.d.ts → geocoder/namesake-probe.d.ts} +1 -1
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -0
- package/out/tools/{geocoder-namesake-probe.js → geocoder/namesake-probe.js} +1 -1
- package/out/tools/geocoder/namesake-probe.js.map +1 -0
- package/out/tools/{geocoder-vs-provided-coords.d.ts → geocoder/vs-provided-coords.d.ts} +1 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -0
- package/out/tools/{geocoder-vs-provided-coords.js → geocoder/vs-provided-coords.js} +1 -1
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -0
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +13 -13
- package/out/tools/index.d.ts.map +1 -1
- package/out/tools/index.js +13 -13
- package/out/tools/index.js.map +1 -1
- package/out/tools/{learned-scorer-clustering-eval.d.ts → learned/scorer/clustering-eval.d.ts} +1 -1
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-clustering-eval.js → learned/scorer/clustering-eval.js} +3 -3
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -0
- package/out/tools/{learned-scorer-crossstate-eval.d.ts → learned/scorer/crossstate-eval.d.ts} +1 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-crossstate-eval.js → learned/scorer/crossstate-eval.js} +1 -1
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -0
- package/out/tools/{learned-scorer-eval.d.ts → learned/scorer/eval.d.ts} +1 -1
- package/out/tools/learned/scorer/eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-eval.js → learned/scorer/eval.js} +4 -4
- package/out/tools/learned/scorer/eval.js.map +1 -0
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/{nppes-dedup-benchmark.d.ts → nppes/dedup-benchmark.d.ts} +1 -1
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -0
- package/out/tools/{nppes-dedup-benchmark.js → nppes/dedup-benchmark.js} +6 -6
- package/out/tools/nppes/dedup-benchmark.js.map +1 -0
- package/out/tools/nppes/overmerge-packet.js +2 -2
- package/out/tools/nppes/overmerge-packet.js.map +1 -1
- package/out/tools/nppes/sample.js +2 -2
- package/out/tools/nppes/sample.js.map +1 -1
- package/out/tools/nppes/scoring.d.ts.map +1 -1
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +4 -4
- package/out/tools/shared.js.map +1 -1
- package/out/tools/{train-cross-gbt.d.ts → train/cross-gbt.d.ts} +1 -1
- package/out/tools/train/cross-gbt.d.ts.map +1 -0
- package/out/tools/{train-cross-gbt.js → train/cross-gbt.js} +4 -4
- package/out/tools/train/cross-gbt.js.map +1 -0
- package/out/tools/{train-gbt.d.ts → train/gbt.d.ts} +1 -1
- package/out/tools/train/gbt.d.ts.map +1 -0
- package/out/tools/{train-gbt.js → train/gbt.js} +7 -7
- package/out/tools/train/gbt.js.map +1 -0
- package/out/tools/{train-org-cross-gbt.d.ts → train/org-cross-gbt.d.ts} +1 -1
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -0
- package/out/tools/{train-org-cross-gbt.js → train/org-cross-gbt.js} +4 -4
- package/out/tools/train/org-cross-gbt.js.map +1 -0
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/{render.d.ts → render/index.d.ts} +1 -1
- package/out/tools/viz/render/index.d.ts.map +1 -0
- package/out/tools/viz/{render.js → render/index.js} +1 -1
- package/out/tools/viz/render/index.js.map +1 -0
- package/out/tools/viz/{render-map.d.ts → render/map.d.ts} +1 -1
- package/out/tools/viz/render/map.d.ts.map +1 -0
- package/out/tools/viz/{render-map.js → render/map.js} +1 -1
- package/out/tools/viz/render/map.js.map +1 -0
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/package.json +9 -9
- package/out/tools/cross-dataset-correlation.d.ts.map +0 -1
- package/out/tools/cross-dataset-correlation.js.map +0 -1
- package/out/tools/cross-source-threshold-sweep.d.ts.map +0 -1
- package/out/tools/cross-source-threshold-sweep.js.map +0 -1
- package/out/tools/geocoder-namesake-probe.d.ts.map +0 -1
- package/out/tools/geocoder-namesake-probe.js.map +0 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +0 -1
- package/out/tools/geocoder-vs-provided-coords.js.map +0 -1
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-clustering-eval.js.map +0 -1
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-crossstate-eval.js.map +0 -1
- package/out/tools/learned-scorer-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-eval.js.map +0 -1
- package/out/tools/nppes-dedup-benchmark.d.ts.map +0 -1
- package/out/tools/nppes-dedup-benchmark.js.map +0 -1
- package/out/tools/train-cross-gbt.d.ts.map +0 -1
- package/out/tools/train-cross-gbt.js.map +0 -1
- package/out/tools/train-gbt.d.ts.map +0 -1
- package/out/tools/train-gbt.js.map +0 -1
- package/out/tools/train-org-cross-gbt.d.ts.map +0 -1
- package/out/tools/train-org-cross-gbt.js.map +0 -1
- package/out/tools/viz/render-map.d.ts.map +0 -1
- package/out/tools/viz/render-map.js.map +0 -1
- package/out/tools/viz/render.d.ts.map +0 -1
- package/out/tools/viz/render.js.map +0 -1
- /package/lib/tools/{geocoder-namesake-probe.ts → geocoder/namesake-probe.ts} +0 -0
- /package/lib/tools/{geocoder-vs-provided-coords.ts → geocoder/vs-provided-coords.ts} +0 -0
- /package/lib/tools/{learned-scorer-crossstate-eval.ts → learned/scorer/crossstate-eval.ts} +0 -0
- /package/lib/tools/viz/{render.ts → render/index.ts} +0 -0
- /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 {
|
|
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
|
-
|
|
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 {
|
|
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 =
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
package/lib/tools/index.ts
CHANGED
|
@@ -7,25 +7,25 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export * from "#tools/coverage-reconciliation"
|
|
10
|
-
export * from "#tools/cross
|
|
11
|
-
export * from "#tools/cross
|
|
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
|
|
15
|
-
export * from "#tools/geocoder
|
|
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
|
|
18
|
-
export * from "#tools/learned
|
|
19
|
-
export * from "#tools/learned
|
|
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
|
|
22
|
-
export * from "#tools/train
|
|
23
|
-
export * from "#tools/train
|
|
24
|
-
export * from "#tools/train
|
|
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
|
|
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"
|
|
@@ -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
|
-
//
|
|
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
|
-
//
|
|
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).
|
|
@@ -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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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 {
|
|
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="${
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
package/lib/tools/shared.ts
CHANGED
|
@@ -610,7 +610,7 @@ export async function trainCrossSourceModel(
|
|
|
610
610
|
): Promise<{ out: string; pairs: number; recommendedThreshold: number }> {
|
|
611
611
|
const { rows, joined, addressFrequency, sources, precisionBar, out, report } = options
|
|
612
612
|
|
|
613
|
-
//
|
|
613
|
+
// Geocode and ingest records, carrying the join-key label in record.id and source on the record.
|
|
614
614
|
// heavy geocoder is injected (see ./eval-geocoder.ts). ---
|
|
615
615
|
report?.("[C] geocoding…")
|
|
616
616
|
const geocoder = await options.createGeocoder()
|
|
@@ -640,7 +640,7 @@ export async function trainCrossSourceModel(
|
|
|
640
640
|
geocoder[Symbol.dispose]()
|
|
641
641
|
report?.(` ${records.length} records, ${records.filter((r) => r.address?.geocode).length} geocoded`)
|
|
642
642
|
|
|
643
|
-
//
|
|
643
|
+
// Block the union, retain cross-source pairs, generate features, and label by join key.
|
|
644
644
|
report?.("[D] blocking + featurizing (cross-source pairs only)…")
|
|
645
645
|
const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons
|
|
646
646
|
const featurize = createMatchFeaturizer({ comparisons, addressFrequency })
|
|
@@ -655,7 +655,7 @@ export async function trainCrossSourceModel(
|
|
|
655
655
|
` ${allPairs.length} blocked pairs → ${pairs.length} cross-source (${(100 * posRate).toFixed(1)}% positive)`
|
|
656
656
|
)
|
|
657
657
|
|
|
658
|
-
//
|
|
658
|
+
// Calibrate the threshold against held-out pairs.
|
|
659
659
|
report?.("[E] held-out calibration…")
|
|
660
660
|
const rnd = makeLcg(655)
|
|
661
661
|
const split = new Map<string, "fit" | "holdout">()
|
|
@@ -725,7 +725,7 @@ export async function trainCrossSourceModel(
|
|
|
725
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)}`
|
|
726
726
|
)
|
|
727
727
|
|
|
728
|
-
//
|
|
728
|
+
// Train the shipped model on all cross-source pairs and emit its committed module.
|
|
729
729
|
report?.("[F] training the shipped model on all pairs…")
|
|
730
730
|
const model = trainGBT(X, Y, W, CROSS_SOURCE_HYPERPARAMS)
|
|
731
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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,
|
package/out/geojson.d.ts.map
CHANGED
|
@@ -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;
|
|
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 {
|
|
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
|
-
|
|
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
|
package/out/geojson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../lib/geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../lib/geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,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AG,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
|
/**
|
package/out/ingest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../lib/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/G,OAAO,EAAsB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAS5E;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG;IACzB,KAAK,EAAE,UAAU,CAAC,KAAK;IACvB,GAAG,EAAE,UAA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