@mailwoman/registry 5.8.0 → 5.10.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/out/address-key.d.ts +1 -1
- package/out/geocode-handler.d.ts +2 -2
- package/out/geojson.d.ts +1 -1
- package/out/index.d.ts +10 -10
- package/out/ingest.d.ts +1 -1
- package/out/learned-scorer.d.ts +2 -2
- package/out/learned-scorer.js +1 -1
- package/out/map-html.d.ts +1 -1
- package/out/reconcile.d.ts +2 -2
- package/out/reconcile.js +1 -1
- package/out/resolve.d.ts +1 -1
- package/out/tools/coverage-reconciliation.d.ts +51 -0
- package/out/tools/coverage-reconciliation.d.ts.map +1 -0
- package/out/tools/coverage-reconciliation.js +166 -0
- package/out/tools/coverage-reconciliation.js.map +1 -0
- package/out/tools/cross-dataset-correlation.d.ts +49 -0
- package/out/tools/cross-dataset-correlation.d.ts.map +1 -0
- package/out/tools/cross-dataset-correlation.js +340 -0
- package/out/tools/cross-dataset-correlation.js.map +1 -0
- package/out/tools/cross-source-threshold-sweep.d.ts +52 -0
- package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/cross-source-threshold-sweep.js +328 -0
- package/out/tools/cross-source-threshold-sweep.js.map +1 -0
- package/out/tools/dedup-ceiling.d.ts +21 -3
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +16 -30
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +45 -0
- package/out/tools/eval-geocoder.d.ts.map +1 -0
- package/out/tools/eval-geocoder.js +14 -0
- package/out/tools/eval-geocoder.js.map +1 -0
- package/out/tools/geocoder-namesake-probe.d.ts +26 -0
- package/out/tools/geocoder-namesake-probe.d.ts.map +1 -0
- package/out/tools/geocoder-namesake-probe.js +59 -0
- package/out/tools/geocoder-namesake-probe.js.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts +38 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.js +132 -0
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -0
- package/out/tools/gold-set-sample.d.ts +22 -3
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +17 -32
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +36 -0
- package/out/tools/index.d.ts.map +1 -0
- package/out/tools/index.js +36 -0
- package/out/tools/index.js.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts +54 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.js +368 -0
- package/out/tools/learned-scorer-clustering-eval.js.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts +43 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.js +305 -0
- package/out/tools/learned-scorer-crossstate-eval.js.map +1 -0
- package/out/tools/learned-scorer-eval.d.ts +59 -0
- package/out/tools/learned-scorer-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-eval.js +450 -0
- package/out/tools/learned-scorer-eval.js.map +1 -0
- package/out/tools/matcher-scale.d.ts +17 -3
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +14 -30
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes-dedup-benchmark.d.ts +75 -0
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -0
- package/out/tools/nppes-dedup-benchmark.js +846 -0
- package/out/tools/nppes-dedup-benchmark.js.map +1 -0
- package/out/tools/train-cross-gbt.d.ts +58 -0
- package/out/tools/train-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-cross-gbt.js +324 -0
- package/out/tools/train-cross-gbt.js.map +1 -0
- package/out/tools/train-gbt.d.ts +51 -0
- package/out/tools/train-gbt.d.ts.map +1 -0
- package/out/tools/train-gbt.js +268 -0
- package/out/tools/train-gbt.js.map +1 -0
- package/out/tools/train-org-cross-gbt.d.ts +51 -0
- package/out/tools/train-org-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-org-cross-gbt.js +296 -0
- package/out/tools/train-org-cross-gbt.js.map +1 -0
- package/out/tools/txhhsc-to-oarow.d.ts +14 -3
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +44 -52
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +23 -4
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +42 -46
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +17 -4
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +71 -78
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render-map.d.ts +17 -3
- package/out/tools/viz/render-map.d.ts.map +1 -1
- package/out/tools/viz/render-map.js +26 -26
- package/out/tools/viz/render-map.js.map +1 -1
- package/out/tools/viz/render.d.ts +21 -3
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +43 -39
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +24 -5
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +53 -62
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +11 -3
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +68 -73
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/package.json +50 -10
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* #655 measurement — can a RE-THRESHOLDED dedup GBT beat the FS baseline on the cross-SOURCE link
|
|
7
|
+
* discovery objective? The dedup GBT (#603) is pinned OFF for cross-dataset flows because its
|
|
8
|
+
* over-merge features (`spatial-exact × name/org-disagree`) push true "same facility, different
|
|
9
|
+
* operational name across sources" pairs NEGATIVE — and the GBT logit REPLACES the FS weight, so
|
|
10
|
+
* a threshold can't trivially separate them. This quantifies that.
|
|
11
|
+
*
|
|
12
|
+
* Geocode the three sources ONCE (NPPES + FCC-RHC + TX HHSC, TX-scoped), then resolve repeatedly:
|
|
13
|
+
* the FS baseline (the recall-correct baseline) and the bundled GBT at a fine threshold sweep.
|
|
14
|
+
* For each arm, report cross-source links (entities spanning ≥2 sources), triple-source entities,
|
|
15
|
+
* total entities (an over-merge proxy — fewer = more collapsing), and a LABEL-FREE precision
|
|
16
|
+
* proxy: PHONE corroboration — the fraction of cross-source entities in which two records from
|
|
17
|
+
* DIFFERENT sources carry the same phone number (strong same-facility evidence the scorer didn't
|
|
18
|
+
* directly use as the join key).
|
|
19
|
+
*
|
|
20
|
+
* Verdict logic: if some GBT threshold matches FS's cross-source link count at ≥ FS phone-corrob,
|
|
21
|
+
* the threshold fix (option 1) works → ship a cross-source threshold. If matching FS link count
|
|
22
|
+
* only comes with collapsing total entities and a LOWER phone-corrob (junk over-merges), the
|
|
23
|
+
* threshold is insufficient by construction → FS stays pinned / a cross-objective retrain (#655
|
|
24
|
+
* option 2) is the only lever.
|
|
25
|
+
*
|
|
26
|
+
* Run: `mailwoman registry scorer-eval threshold-sweep [--cap 2000] [--state TX]
|
|
27
|
+
* [--wof <admin.db>] [--data-root <dir>] [--out-md <md>]`
|
|
28
|
+
*/
|
|
29
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
30
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
31
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
32
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return path;
|
|
36
|
+
};
|
|
37
|
+
import { writeFileSync } from "node:fs";
|
|
38
|
+
import { dataRootPath, formatPercent } from "@mailwoman/core/utils";
|
|
39
|
+
import { addressFrequencyKey, buildDefaultModel, createGbtScorer, DEDUP_GBT_META, DEDUP_GBT_MODEL, ingestRows, resolveEntities, streamRows, } from "@mailwoman/registry";
|
|
40
|
+
const norm = (s) => (s ?? "").trim();
|
|
41
|
+
const buildSpecs = (S, STATE) => [
|
|
42
|
+
{
|
|
43
|
+
source: "txhhsc-nursing",
|
|
44
|
+
path: `${S}/txhhsc_nursing-facilities_20260611.tsv`,
|
|
45
|
+
mapping: {
|
|
46
|
+
id: "Facility ID",
|
|
47
|
+
organization: "Facility Name",
|
|
48
|
+
address: ["Physical Address", "Physical Address CITY", "Physical Address State", "Physical Address Zipcode"],
|
|
49
|
+
phone: "Facility Phone Number",
|
|
50
|
+
source: "txhhsc-nursing",
|
|
51
|
+
},
|
|
52
|
+
inState: (r) => norm(r["Physical Address State"]).toUpperCase() === STATE,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
source: "fcc-rhc",
|
|
56
|
+
path: `${S}/fcc-rhc_posted-services_form461-465_20260615.tsv`,
|
|
57
|
+
mapping: {
|
|
58
|
+
id: "HCP Number",
|
|
59
|
+
organization: "HCP Name",
|
|
60
|
+
address: ["Site Address Line 1", "Site City", "Site State", "Site ZIP Code"],
|
|
61
|
+
phone: "Contact Phone",
|
|
62
|
+
email: "Contact E-mail",
|
|
63
|
+
source: "fcc-rhc",
|
|
64
|
+
},
|
|
65
|
+
inState: (r) => norm(r["Site State"]).toUpperCase() === STATE,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
source: "nppes",
|
|
69
|
+
path: `${S}/nppes_npi-registry_20260607.tsv`,
|
|
70
|
+
mapping: {
|
|
71
|
+
id: "NPI",
|
|
72
|
+
organization: "Provider Organization Name (Legal Business Name)",
|
|
73
|
+
address: [
|
|
74
|
+
"Provider First Line Business Practice Location Address",
|
|
75
|
+
"Provider Business Practice Location Address City Name",
|
|
76
|
+
"Provider Business Practice Location Address State Name",
|
|
77
|
+
"Provider Business Practice Location Address Postal Code",
|
|
78
|
+
],
|
|
79
|
+
phone: "Provider Business Practice Location Address Telephone Number",
|
|
80
|
+
source: "nppes",
|
|
81
|
+
},
|
|
82
|
+
inState: (r) => norm(r["Provider Business Practice Location Address State Name"]).toUpperCase() === STATE &&
|
|
83
|
+
norm(r["Entity Type Code"]) === "2" &&
|
|
84
|
+
!!norm(r["Provider Organization Name (Legal Business Name)"]),
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
/** Distinct provenance labels an entity's records span. */
|
|
88
|
+
const entitySources = (e) => new Set(e.records.map((r) => r.source).filter((s) => !!s));
|
|
89
|
+
/** Last-10-digit phone key (drops formatting / country code). */
|
|
90
|
+
const normPhone = (p) => {
|
|
91
|
+
if (!p)
|
|
92
|
+
return "";
|
|
93
|
+
const d = p.replace(/\D/g, "");
|
|
94
|
+
return d.length >= 10 ? d.slice(-10) : "";
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Label-free precision proxy: does this cross-source entity carry the SAME phone in records from two DIFFERENT sources?
|
|
98
|
+
* (Phone isn't the join key, so a match is independent corroboration of same-facility.) Entities where no two
|
|
99
|
+
* cross-source records both have a phone are "unknown" — we only count corroborated / contradicted among those that CAN
|
|
100
|
+
* be checked.
|
|
101
|
+
*/
|
|
102
|
+
function phoneEvidence(e) {
|
|
103
|
+
const bySource = new Map();
|
|
104
|
+
for (const r of e.records) {
|
|
105
|
+
const ph = normPhone(r.phone);
|
|
106
|
+
if (!ph)
|
|
107
|
+
continue;
|
|
108
|
+
const s = r.source ?? "?";
|
|
109
|
+
if (!bySource.has(s)) {
|
|
110
|
+
bySource.set(s, new Set());
|
|
111
|
+
}
|
|
112
|
+
bySource.get(s).add(ph);
|
|
113
|
+
}
|
|
114
|
+
const sources = [...bySource.keys()];
|
|
115
|
+
if (sources.length < 2)
|
|
116
|
+
return "unknown";
|
|
117
|
+
let any = false;
|
|
118
|
+
for (let i = 0; i < sources.length; i++) {
|
|
119
|
+
for (let j = i + 1; j < sources.length; j++) {
|
|
120
|
+
any = true;
|
|
121
|
+
for (const ph of bySource.get(sources[i]))
|
|
122
|
+
if (bySource.get(sources[j]).has(ph))
|
|
123
|
+
return "corroborated";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return any ? "contradicted" : "unknown";
|
|
127
|
+
}
|
|
128
|
+
function measure(label, threshold, entities) {
|
|
129
|
+
let crossSource = 0;
|
|
130
|
+
let tripleSource = 0;
|
|
131
|
+
let phoneCorrob = 0;
|
|
132
|
+
let phoneContradict = 0;
|
|
133
|
+
let phoneCheckable = 0;
|
|
134
|
+
for (const e of entities) {
|
|
135
|
+
const n = entitySources(e).size;
|
|
136
|
+
if (n < 2)
|
|
137
|
+
continue;
|
|
138
|
+
crossSource++;
|
|
139
|
+
if (n >= 3) {
|
|
140
|
+
tripleSource++;
|
|
141
|
+
}
|
|
142
|
+
const ev = phoneEvidence(e);
|
|
143
|
+
if (ev === "corroborated") {
|
|
144
|
+
phoneCorrob++;
|
|
145
|
+
phoneCheckable++;
|
|
146
|
+
}
|
|
147
|
+
else if (ev === "contradicted") {
|
|
148
|
+
phoneContradict++;
|
|
149
|
+
phoneCheckable++;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
label,
|
|
154
|
+
threshold,
|
|
155
|
+
entities: entities.length,
|
|
156
|
+
crossSource,
|
|
157
|
+
tripleSource,
|
|
158
|
+
phoneCorrob,
|
|
159
|
+
phoneContradict,
|
|
160
|
+
phoneCheckable,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** #655 cross-source threshold sweep — see the module doc. Emits the markdown report to stdout. */
|
|
164
|
+
export async function crossSourceThresholdSweep(options, report) {
|
|
165
|
+
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
166
|
+
const CAP = options.cap ?? 2000;
|
|
167
|
+
const STATE = (options.state || "TX").toUpperCase();
|
|
168
|
+
const OUT_MD = options.outMd || "";
|
|
169
|
+
const CANDIDATE = options.candidate || "";
|
|
170
|
+
const SPECS = buildSpecs(`${SOURCES}`, STATE);
|
|
171
|
+
// --- Ingest + geocode each source ONCE. ---
|
|
172
|
+
const rawBySource = new Map();
|
|
173
|
+
for (const spec of SPECS) {
|
|
174
|
+
report?.(`[A] ${spec.source}: streaming + ${STATE} filter (cap ${CAP})…`);
|
|
175
|
+
const kept = [];
|
|
176
|
+
for await (const row of streamRows(spec.path)) {
|
|
177
|
+
if (!spec.inState(row))
|
|
178
|
+
continue;
|
|
179
|
+
kept.push(row);
|
|
180
|
+
if (kept.length >= CAP)
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
rawBySource.set(spec.source, kept);
|
|
184
|
+
report?.(` ${spec.source}: ${kept.length} rows`);
|
|
185
|
+
}
|
|
186
|
+
report?.("[B] building the geocoder…");
|
|
187
|
+
const geocoder = await options.createGeocoder();
|
|
188
|
+
const seam = geocoder.seam;
|
|
189
|
+
report?.("[C] geocoding + ingesting…");
|
|
190
|
+
const records = [];
|
|
191
|
+
for (const spec of SPECS) {
|
|
192
|
+
const recs = await ingestRows(rawBySource.get(spec.source), spec.mapping, { geocodeAddress: seam });
|
|
193
|
+
for (const r of recs) {
|
|
194
|
+
r.id = `${spec.source}:${r.id}`;
|
|
195
|
+
}
|
|
196
|
+
records.push(...recs);
|
|
197
|
+
}
|
|
198
|
+
geocoder.close();
|
|
199
|
+
const geocoded = records.filter((r) => r.address?.geocode).length;
|
|
200
|
+
report?.(` ${records.length} records; geocoded ${geocoded}`);
|
|
201
|
+
// --- The bundled GBT scorer over the input-scoped address-frequency basis (eval convention). ---
|
|
202
|
+
const addrCounts = new Map();
|
|
203
|
+
let addrTotal = 0;
|
|
204
|
+
for (const r of records) {
|
|
205
|
+
if (!r.address?.raw)
|
|
206
|
+
continue;
|
|
207
|
+
addrCounts.set(addressFrequencyKey(r.address.raw), (addrCounts.get(addressFrequencyKey(r.address.raw)) ?? 0) + 1);
|
|
208
|
+
addrTotal++;
|
|
209
|
+
}
|
|
210
|
+
const addressFrequency = {
|
|
211
|
+
total: addrTotal,
|
|
212
|
+
distinct: addrCounts.size,
|
|
213
|
+
frequency: (v) => (v ? (addrCounts.get(addressFrequencyKey(v)) ?? 0) / addrTotal : 0),
|
|
214
|
+
};
|
|
215
|
+
const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons;
|
|
216
|
+
const gbtScorer = createGbtScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency });
|
|
217
|
+
// --- Arm 1: the FS baseline (the recall-correct baseline cross-source flows currently pin). ---
|
|
218
|
+
report?.("[D] resolving — FS baseline baseline…");
|
|
219
|
+
const fs = measure("FS baseline", 0, resolveEntities(records, { trainEM: true, collapseSpatial: true, addressFrequency, learnedScorer: false }).entities);
|
|
220
|
+
// --- Arm 2: the bundled GBT at a fine threshold sweep (down well below the dedup 2.71, since
|
|
221
|
+
// cross-source pairs sit at strongly NEGATIVE logits). ---
|
|
222
|
+
const SWEEP = [-8, -6, -5, -4, -3, -2, -1, 0, 1, 2, DEDUP_GBT_META.recommendedThreshold];
|
|
223
|
+
const gbtArms = [];
|
|
224
|
+
for (const t of SWEEP) {
|
|
225
|
+
report?.(`[D] resolving — GBT @ threshold ${t}…`);
|
|
226
|
+
const { entities } = resolveEntities(records, {
|
|
227
|
+
collapseSpatial: true,
|
|
228
|
+
addressFrequency,
|
|
229
|
+
scorer: gbtScorer,
|
|
230
|
+
threshold: t,
|
|
231
|
+
});
|
|
232
|
+
gbtArms.push(measure(`GBT @ ${t.toFixed(2)}`, t, entities));
|
|
233
|
+
}
|
|
234
|
+
// --- Verdict. The threshold fix WORKS only if some GBT arm dominates FS — more (or equal)
|
|
235
|
+
// cross-source links at ≥ FS phone-corroboration WITHOUT over-merging (entity count must not
|
|
236
|
+
// collapse below ~90% of FS, else the "links" are giant-blob artifacts). Otherwise FS is on the
|
|
237
|
+
// frontier and threshold alone is insufficient. ---
|
|
238
|
+
const pct = (n, d) => formatPercent(n, d, 0);
|
|
239
|
+
// --- Arm 3 (#655 option 2): the cross-source-trained GBT at its own recommended threshold. ---
|
|
240
|
+
const candidateArms = [];
|
|
241
|
+
if (CANDIDATE) {
|
|
242
|
+
const { pathToFileURL } = await import("node:url");
|
|
243
|
+
const { resolve: resolvePath } = await import("node:path");
|
|
244
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(resolvePath(CANDIDATE)).href)));
|
|
245
|
+
const candModel = mod.CROSS_SOURCE_GBT_MODEL ?? mod.ORG_CROSS_SOURCE_GBT_MODEL;
|
|
246
|
+
if (!candModel)
|
|
247
|
+
throw new Error(`--candidate module exports neither CROSS_SOURCE_GBT_MODEL nor ORG_CROSS_SOURCE_GBT_MODEL`);
|
|
248
|
+
const t0 = (mod.CROSS_SOURCE_GBT_META ?? mod.ORG_CROSS_SOURCE_GBT_META)?.recommendedThreshold ?? 0;
|
|
249
|
+
const candScorer = createGbtScorer({ model: candModel, comparisons, addressFrequency });
|
|
250
|
+
report?.(`[E] resolving — cross-source GBT candidate @ ${t0.toFixed(3)} (±)…`);
|
|
251
|
+
for (const t of [t0 - 1, t0, t0 + 1]) {
|
|
252
|
+
candidateArms.push(measure(`cross-GBT @ ${t.toFixed(2)}`, t, resolveEntities(records, {
|
|
253
|
+
trainEM: true,
|
|
254
|
+
collapseSpatial: true,
|
|
255
|
+
addressFrequency,
|
|
256
|
+
scorer: candScorer,
|
|
257
|
+
threshold: t,
|
|
258
|
+
}).entities));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const rate = (a) => (a.phoneCheckable > 0 ? a.phoneCorrob / a.phoneCheckable : 0);
|
|
262
|
+
const fsCorrobRate = rate(fs);
|
|
263
|
+
const minEntities = Math.floor(fs.entities * 0.9);
|
|
264
|
+
const dominating = gbtArms.find((a) => a.crossSource >= fs.crossSource && rate(a) >= fsCorrobRate && a.entities >= minEntities);
|
|
265
|
+
// The candidate (#655 option-2 models) gets its own verdict scan — the hardcoded option-1 verdict
|
|
266
|
+
// below is about the DEDUP GBT and must not silently absorb (or ignore) a candidate arm.
|
|
267
|
+
const candidateDominating = candidateArms.find((a) => a.crossSource >= fs.crossSource && rate(a) >= fsCorrobRate && a.entities >= minEntities);
|
|
268
|
+
const candidateBest = candidateArms.reduce((best, a) => (a.entities >= minEntities && a.crossSource > (best?.crossSource ?? -1) ? a : best), null);
|
|
269
|
+
const rows = [fs, ...gbtArms, ...candidateArms];
|
|
270
|
+
const lines = [];
|
|
271
|
+
lines.push(`# #655 — cross-source threshold sweep: can a re-thresholded GBT beat FS?`);
|
|
272
|
+
lines.push("");
|
|
273
|
+
lines.push(`_TX-scoped, ≤${CAP} rows/source (NPPES org + TX HHSC nursing = eligibility-ish; FCC-RHC = funding), ` +
|
|
274
|
+
`geocoded once then resolved per arm. **Phone-corrob** = of the cross-source entities whose records carry ` +
|
|
275
|
+
`a phone in ≥2 different sources, the fraction where those phones MATCH — a label-free precision proxy ` +
|
|
276
|
+
`(phone is not the join key). Higher cross-source + higher phone-corrob = better._`);
|
|
277
|
+
lines.push("");
|
|
278
|
+
lines.push(`| arm | threshold | total entities | cross-source links | triple-source | phone-corrob (of checkable) |`);
|
|
279
|
+
lines.push(`|---|---:|---:|---:|---:|---|`);
|
|
280
|
+
for (const r of rows) {
|
|
281
|
+
lines.push(`| ${r.label} | ${r.threshold === null ? "—" : r.threshold} | ${r.entities} | ${r.crossSource} | ` +
|
|
282
|
+
`${r.tripleSource} | ${r.phoneCorrob}/${r.phoneCheckable} (${pct(r.phoneCorrob, r.phoneCheckable)}) |`);
|
|
283
|
+
}
|
|
284
|
+
lines.push("");
|
|
285
|
+
lines.push(`## Verdict`);
|
|
286
|
+
if (CANDIDATE) {
|
|
287
|
+
const c = candidateDominating ?? candidateBest;
|
|
288
|
+
lines.push("");
|
|
289
|
+
if (candidateDominating) {
|
|
290
|
+
lines.push(`**The --candidate model DOMINATES FS**: ${candidateDominating.crossSource} cross-source links (FS ${fs.crossSource}) at phone-corrob ${(100 * rate(candidateDominating)).toFixed(0)}% ≥ FS ${(100 * fsCorrobRate).toFixed(0)}%, entities ${candidateDominating.entities} (no collapse). Un-pinning FS for this objective is supported by this run.`);
|
|
291
|
+
}
|
|
292
|
+
else if (c) {
|
|
293
|
+
lines.push(`**--candidate (best non-collapsing arm)**: ${c.crossSource} cross-source links vs FS ${fs.crossSource}, phone-corrob ${(100 * rate(c)).toFixed(0)}% vs FS ${(100 * fsCorrobRate).toFixed(0)}%, entities ${c.entities}. Does not STRICTLY dominate — judge the margins (the phone proxy is one-link noisy at this n).`);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
lines.push(`**--candidate**: no non-collapsing arm (every threshold fell below the entity floor).`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
lines.push("");
|
|
300
|
+
lines.push(`FS baseline: **${fs.crossSource}** cross-source links (${fs.tripleSource} triple), ` +
|
|
301
|
+
`phone-corrob ${pct(fs.phoneCorrob, fs.phoneCheckable)} (${fs.phoneCorrob}/${fs.phoneCheckable}).`);
|
|
302
|
+
if (!dominating) {
|
|
303
|
+
lines.push("");
|
|
304
|
+
lines.push(`**No GBT threshold dominates FS** — none matches FS's ${fs.crossSource} cross-source links at ≥ its ` +
|
|
305
|
+
`${pct(fs.phoneCorrob, fs.phoneCheckable)} phone-corrob without over-merging (entity count collapsing below ` +
|
|
306
|
+
`${minEntities}). At its dedup threshold the GBT finds FEWER cross-source links than FS; lowering the ` +
|
|
307
|
+
`threshold to admit more only over-merges (the over-merge features REPLACE the FS weight, so true ` +
|
|
308
|
+
`cross-source pairs share a logit band with genuine over-merges). Threshold alone (option 1) is ` +
|
|
309
|
+
`**INSUFFICIENT** — FS stays pinned (correct + best-precision for this objective); a cross-objective ` +
|
|
310
|
+
`retrain (option 2), gated on cross-source labels, is the only lever. See #655.`);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
lines.push("");
|
|
314
|
+
lines.push(`**GBT @ ${dominating.threshold} dominates FS**: ${dominating.crossSource} links (vs ${fs.crossSource}) at ` +
|
|
315
|
+
`${pct(dominating.phoneCorrob, dominating.phoneCheckable)} phone-corrob (vs ${pct(fs.phoneCorrob, fs.phoneCheckable)}), ` +
|
|
316
|
+
`${dominating.entities} entities (vs ${fs.entities}). The threshold fix (option 1) WORKS: ship a cross-source ` +
|
|
317
|
+
`threshold ≈ ${dominating.threshold}.`);
|
|
318
|
+
}
|
|
319
|
+
lines.push("");
|
|
320
|
+
const md = lines.join("\n");
|
|
321
|
+
console.log(md);
|
|
322
|
+
if (OUT_MD) {
|
|
323
|
+
writeFileSync(OUT_MD, md);
|
|
324
|
+
report?.(`[written] ${OUT_MD}`);
|
|
325
|
+
}
|
|
326
|
+
return { markdown: md };
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=cross-source-threshold-sweep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-source-threshold-sweep.js","sourceRoot":"","sources":["../../tools/cross-source-threshold-sweep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EACN,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,UAAU,GAKV,MAAM,qBAAqB,CAAA;AAuB5B,MAAM,IAAI,GAAG,C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,CAAC,WAAW,OAAO;YAC3G,GAAG,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC,qBAAqB,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK;YACzH,GAAG,UAAU,CAAC,QAAQ,iBAAiB,EAAE,CAAC,QAAQ,6DAA6D;YAC/G,eAAe,UAAU,CAAC,SAAS,GAAG,CACvC,CAAA;IACF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QACzB,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -26,8 +26,26 @@
|
|
|
26
26
|
* how often the two distinct NPIs ALSO share a phone (so phone over-links, can't separate)
|
|
27
27
|
* …and derives a precision/F1 CEILING under stated assumptions, with the caveats called out.
|
|
28
28
|
*
|
|
29
|
-
* Run:
|
|
30
|
-
* [--
|
|
29
|
+
* Run: `mailwoman registry dedup-ceiling [--cap 50000] [--state TX] [--sources <dir>] [--tau 0.7]
|
|
30
|
+
* [--out-md <md>]`
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
/** Options for {@linkcode dedupCeiling}. */
|
|
33
|
+
export interface DedupCeilingOptions {
|
|
34
|
+
/** Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`. */
|
|
35
|
+
sources?: string;
|
|
36
|
+
/** Providers sampled from the registry. Default 50000. */
|
|
37
|
+
cap?: number;
|
|
38
|
+
/** State filter. Default TX. */
|
|
39
|
+
state?: string;
|
|
40
|
+
/** Org-name Jaccard collision threshold. Default 0.7. */
|
|
41
|
+
tau?: number;
|
|
42
|
+
/** Also write the markdown report here. */
|
|
43
|
+
outMd?: string;
|
|
44
|
+
}
|
|
45
|
+
/** #625 ceiling measurement — see the module doc. Emits the markdown report to stdout. */
|
|
46
|
+
export declare function dedupCeiling(options?: DedupCeilingOptions, report?: (line: string) => void): Promise<{
|
|
47
|
+
markdown: string;
|
|
48
|
+
pairs: number;
|
|
49
|
+
collide: number;
|
|
50
|
+
}>;
|
|
33
51
|
//# sourceMappingURL=dedup-ceiling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedup-ceiling.d.ts","sourceRoot":"","sources":["../../tools/dedup-ceiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG"}
|
|
1
|
+
{"version":3,"file":"dedup-ceiling.d.ts","sourceRoot":"","sources":["../../tools/dedup-ceiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAOH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IACnC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AA6DD,0FAA0F;AAC1F,wBAAsB,YAAY,CACjC,OAAO,GAAE,mBAAwB,EACjC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAgP/D"}
|
|
@@ -26,33 +26,12 @@
|
|
|
26
26
|
* how often the two distinct NPIs ALSO share a phone (so phone over-links, can't separate)
|
|
27
27
|
* …and derives a precision/F1 CEILING under stated assumptions, with the caveats called out.
|
|
28
28
|
*
|
|
29
|
-
* Run:
|
|
30
|
-
* [--
|
|
29
|
+
* Run: `mailwoman registry dedup-ceiling [--cap 50000] [--state TX] [--sources <dir>] [--tau 0.7]
|
|
30
|
+
* [--out-md <md>]`
|
|
31
31
|
*/
|
|
32
32
|
import { writeFileSync } from "node:fs";
|
|
33
|
-
import {
|
|
34
|
-
import { dataRootPath } from "@mailwoman/core/utils";
|
|
33
|
+
import { dataRootPath, formatPercent } from "@mailwoman/core/utils";
|
|
35
34
|
import { addressFrequencyKey, streamRows } from "@mailwoman/registry";
|
|
36
|
-
// Loose scan parity with the retired local argv helpers: unknown flags tolerated.
|
|
37
|
-
const { values: rawValues } = parseArgs({
|
|
38
|
-
options: {
|
|
39
|
-
cap: { type: "string" },
|
|
40
|
-
"out-md": { type: "string" },
|
|
41
|
-
sources: { type: "string" },
|
|
42
|
-
state: { type: "string" },
|
|
43
|
-
tau: { type: "string" },
|
|
44
|
-
},
|
|
45
|
-
strict: false,
|
|
46
|
-
allowPositionals: true,
|
|
47
|
-
});
|
|
48
|
-
// Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
|
|
49
|
-
const values = rawValues;
|
|
50
|
-
const SOURCES = values["sources"] || dataRootPath("record-matcher", "sources");
|
|
51
|
-
const CAP = Number(values["cap"] || "50000");
|
|
52
|
-
const STATE = (values["state"] || "TX").toUpperCase();
|
|
53
|
-
const TAU = Number(values["tau"] || "0.7");
|
|
54
|
-
const OUT_MD = values["out-md"] || "";
|
|
55
|
-
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
56
35
|
const norm = (s) => (s ?? "").trim();
|
|
57
36
|
// Strip only corporate-form tokens + articles — KEEP domain words (health, medical, center…), which
|
|
58
37
|
// carry the distinguishing signal between two co-located providers.
|
|
@@ -94,9 +73,16 @@ const normPhone = (p) => {
|
|
|
94
73
|
const d = (p ?? "").replace(/\D/g, "");
|
|
95
74
|
return d.length >= 10 ? d.slice(-10) : "";
|
|
96
75
|
};
|
|
97
|
-
|
|
76
|
+
/** #625 ceiling measurement — see the module doc. Emits the markdown report to stdout. */
|
|
77
|
+
export async function dedupCeiling(options = {}, report) {
|
|
78
|
+
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
79
|
+
const CAP = options.cap ?? 50000;
|
|
80
|
+
const STATE = (options.state || "TX").toUpperCase();
|
|
81
|
+
const TAU = options.tau ?? 0.7;
|
|
82
|
+
const OUT_MD = options.outMd || "";
|
|
83
|
+
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
98
84
|
// --- Stream TX type-2 (org) providers; one primary record per NPI at its practice address. ---
|
|
99
|
-
|
|
85
|
+
report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`);
|
|
100
86
|
const byAddr = new Map();
|
|
101
87
|
let kept = 0;
|
|
102
88
|
let scanned = 0;
|
|
@@ -136,7 +122,7 @@ async function main() {
|
|
|
136
122
|
if (kept >= CAP)
|
|
137
123
|
break;
|
|
138
124
|
}
|
|
139
|
-
|
|
125
|
+
report?.(` scanned ${scanned} rows → ${kept} ${STATE} org providers at ${byAddr.size} distinct addresses`);
|
|
140
126
|
// --- Over co-located distinct-NPI pairs: the org-similarity distribution + collision rate. ---
|
|
141
127
|
let sharedAddresses = 0;
|
|
142
128
|
let providersAtSharedAddr = 0;
|
|
@@ -202,7 +188,7 @@ async function main() {
|
|
|
202
188
|
// a precision-ceiling BAND (optimistic: only `collide` over-merge; conservative: `collide` + half
|
|
203
189
|
// of `mid`). Recall is NOT the binding constraint here (NPPES same-NPI records almost always share
|
|
204
190
|
// either address or org), so the F1 ceiling tracks the precision ceiling. ---
|
|
205
|
-
const pct =
|
|
191
|
+
const pct = formatPercent;
|
|
206
192
|
const collisionRate = pairs > 0 ? collide / pairs : 0;
|
|
207
193
|
const lines = [];
|
|
208
194
|
lines.push(`# #625 — dedup ceiling: the irreducible over-merge of co-located providers`);
|
|
@@ -279,8 +265,8 @@ async function main() {
|
|
|
279
265
|
console.log(md);
|
|
280
266
|
if (OUT_MD) {
|
|
281
267
|
writeFileSync(OUT_MD, md);
|
|
282
|
-
|
|
268
|
+
report?.(`[written] ${OUT_MD}`);
|
|
283
269
|
}
|
|
270
|
+
return { markdown: md, pairs, collide };
|
|
284
271
|
}
|
|
285
|
-
await main();
|
|
286
272
|
//# sourceMappingURL=dedup-ceiling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedup-ceiling.js","sourceRoot":"","sources":["../../tools/dedup-ceiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"dedup-ceiling.js","sourceRoot":"","sources":["../../tools/dedup-ceiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAgBrE,MAAM,IAAI,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AAExD,oGAAoG;AACpG,oEAAoE;AACpE,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC;IACpB,KAAK;IACL,KAAK;IACL,cAAc;IACd,MAAM;IACN,aAAa;IACb,IAAI;IACJ,KAAK;IACL,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,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Ef,IAAI,MAAM,EAAE,CAAC;QACZ,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QACzB,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The injected-geocoder contract for the record-matcher tools. The registry package deliberately
|
|
7
|
+
* never imports the heavy runtime (neural parser, WOF resolver, per-state shards) — `mailwoman`
|
|
8
|
+
* depends on `@mailwoman/registry`, so the reverse import would cycle the workspace graph. Instead
|
|
9
|
+
* each tool takes an {@linkcode EvalGeocoderFactory} the CLI command constructs from
|
|
10
|
+
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`), mirroring the matcher's own
|
|
11
|
+
* `GeocodeAddress` seam philosophy: ingest never pins the runtime, the caller wires it.
|
|
12
|
+
*/
|
|
13
|
+
import type { ColumnMapping, GeocodeAddress, SourceRecord } from "@mailwoman/registry";
|
|
14
|
+
/** The raw single-address geocode surface (the probe tools) — mirrors `mailwoman/geocode-core`'s wire shape. */
|
|
15
|
+
export interface EvalGeocodeResult {
|
|
16
|
+
lat: number | null;
|
|
17
|
+
lon: number | null;
|
|
18
|
+
/** Wire key — mirrors `GeocodeResult.resolution_tier`. */
|
|
19
|
+
resolution_tier?: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A constructed geocoder: the matcher's ingest seam, the raw geocode, and the handle release. */
|
|
22
|
+
export interface EvalGeocoder {
|
|
23
|
+
/** The matcher's ingest seam (parse + geocode → `PostalAddress`), built via `geocodeAddressVia`. */
|
|
24
|
+
seam: GeocodeAddress;
|
|
25
|
+
/** Raw single-address geocode — lat/lon + resolution tier. */
|
|
26
|
+
geocode: (address: string) => Promise<EvalGeocodeResult>;
|
|
27
|
+
/** Release the DB handles (shards + WOF lookup). */
|
|
28
|
+
close: () => void;
|
|
29
|
+
}
|
|
30
|
+
/** Per-construction toggles a tool may need to control (the command owns model/WOF/data-root wiring). */
|
|
31
|
+
export interface EvalGeocoderInit {
|
|
32
|
+
/** #690 all-caps case normalization. Default on; `nppes-benchmark --legacy-join` turns it off for the A/B. */
|
|
33
|
+
normalizeCase?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Build a geocoder on demand — tools construct late and `close()` as soon as geocoding is done. */
|
|
36
|
+
export type EvalGeocoderFactory = (init?: EvalGeocoderInit) => Promise<EvalGeocoder>;
|
|
37
|
+
/**
|
|
38
|
+
* The threaded geocode surface (`mailwoman/geocode-stream` behind the seam) for `nppes-dedup-benchmark
|
|
39
|
+
* --parallel-geocode`. Yields enriched records in completion order.
|
|
40
|
+
*/
|
|
41
|
+
export type EvalGeocodeStream = (records: SourceRecord[], opts: {
|
|
42
|
+
mapping: ColumnMapping;
|
|
43
|
+
concurrency: number;
|
|
44
|
+
}) => AsyncIterable<SourceRecord>;
|
|
45
|
+
//# sourceMappingURL=eval-geocoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-geocoder.d.ts","sourceRoot":"","sources":["../../tools/eval-geocoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEtF,gHAAgH;AAChH,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,kGAAkG;AAClG,MAAM,WAAW,YAAY;IAC5B,oGAAoG;IACpG,IAAI,EAAE,cAAc,CAAA;IACpB,8DAA8D;IAC9D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACxD,oDAAoD;IACpD,KAAK,EAAE,MAAM,IAAI,CAAA;CACjB;AAED,yGAAyG;AACzG,MAAM,WAAW,gBAAgB;IAChC,8GAA8G;IAC9G,aAAa,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,oGAAoG;AACpG,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AAEpF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC/B,OAAO,EAAE,YAAY,EAAE,EACvB,IAAI,EAAE;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,KACjD,aAAa,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The injected-geocoder contract for the record-matcher tools. The registry package deliberately
|
|
7
|
+
* never imports the heavy runtime (neural parser, WOF resolver, per-state shards) — `mailwoman`
|
|
8
|
+
* depends on `@mailwoman/registry`, so the reverse import would cycle the workspace graph. Instead
|
|
9
|
+
* each tool takes an {@linkcode EvalGeocoderFactory} the CLI command constructs from
|
|
10
|
+
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`), mirroring the matcher's own
|
|
11
|
+
* `GeocodeAddress` seam philosophy: ingest never pins the runtime, the caller wires it.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=eval-geocoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-geocoder.js","sourceRoot":"","sources":["../../tools/eval-geocoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Admin-tier wrong-region probe (#619 tail) — the geocoder-vs-provided-coords eval found an
|
|
7
|
+
* admin-tier tail to 11143 km (p99 2189 km). Hypothesis: when no street shard covers the address,
|
|
8
|
+
* the admin cascade resolves the locality by NAME and (when the region/postcode constraint is
|
|
9
|
+
* weak) picks the population-dominant FOREIGN namesake — Paris→France, Athens→Greece — instead of
|
|
10
|
+
* the in-state Texas city. This probes a curated set of TX namesake cities, with and without ZIP,
|
|
11
|
+
* and flags any result outside the Texas bounding box.
|
|
12
|
+
*
|
|
13
|
+
* Run: `mailwoman registry scorer-eval namesake-probe`
|
|
14
|
+
*/
|
|
15
|
+
import type { EvalGeocoderFactory } from "./eval-geocoder.ts";
|
|
16
|
+
/** Options for {@linkcode geocoderNamesakeProbe}. */
|
|
17
|
+
export interface GeocoderNamesakeProbeOptions {
|
|
18
|
+
/** The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`). */
|
|
19
|
+
createGeocoder: EvalGeocoderFactory;
|
|
20
|
+
}
|
|
21
|
+
/** Admin-tier wrong-region probe (#619 tail) — see the module doc. Prints one line per variant to stdout. */
|
|
22
|
+
export declare function geocoderNamesakeProbe(options: GeocoderNamesakeProbeOptions, report?: (line: string) => void): Promise<{
|
|
23
|
+
wrongRegion: number;
|
|
24
|
+
total: number;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=geocoder-namesake-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocoder-namesake-probe.d.ts","sourceRoot":"","sources":["../../tools/geocoder-namesake-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,qDAAqD;AACrD,MAAM,WAAW,4BAA4B;IAC5C,4GAA4G;IAC5G,cAAc,EAAE,mBAAmB,CAAA;CACnC;AAmBD,6GAA6G;AAC7G,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,4BAA4B,EACrC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCjD"}
|