@mailwoman/registry 10.0.0 → 10.2.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/README.md +11 -14
- package/lib/address-key.ts +14 -10
- package/lib/geocode-handler.ts +7 -5
- package/lib/geojson.ts +13 -7
- package/lib/ingest.ts +70 -92
- package/lib/learned-scorer.ts +38 -44
- package/lib/map-html.ts +26 -72
- package/lib/models/crosssource-gbt-en-us.ts +9 -7
- package/lib/models/dedup-gbt-en-us.ts +9 -8
- package/lib/models/org-crosssource-gbt-en-us.ts +10 -8
- package/lib/reconcile.ts +45 -54
- package/lib/resolve.ts +187 -130
- package/lib/types.ts +35 -29
- package/out/address-key.d.ts +14 -10
- package/out/address-key.d.ts.map +1 -1
- package/out/address-key.js +14 -10
- package/out/address-key.js.map +1 -1
- package/out/geocode-handler.d.ts +6 -4
- package/out/geocode-handler.d.ts.map +1 -1
- package/out/geocode-handler.js +7 -5
- package/out/geocode-handler.js.map +1 -1
- package/out/geojson.d.ts +9 -5
- package/out/geojson.d.ts.map +1 -1
- package/out/geojson.js +13 -7
- package/out/geojson.js.map +1 -1
- package/out/ingest.d.ts +49 -76
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +37 -62
- package/out/ingest.js.map +1 -1
- package/out/learned-scorer.d.ts +29 -26
- package/out/learned-scorer.d.ts.map +1 -1
- package/out/learned-scorer.js +31 -39
- package/out/learned-scorer.js.map +1 -1
- package/out/map-html.d.ts +13 -32
- package/out/map-html.d.ts.map +1 -1
- package/out/map-html.js +11 -64
- package/out/map-html.js.map +1 -1
- package/out/models/crosssource-gbt-en-us.d.ts +9 -7
- package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/crosssource-gbt-en-us.js +9 -7
- package/out/models/crosssource-gbt-en-us.js.map +1 -1
- package/out/models/dedup-gbt-en-us.d.ts +9 -8
- package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
- package/out/models/dedup-gbt-en-us.js +9 -8
- package/out/models/dedup-gbt-en-us.js.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts +10 -8
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.js +10 -8
- package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
- package/out/reconcile.d.ts +36 -50
- package/out/reconcile.d.ts.map +1 -1
- package/out/reconcile.js +18 -42
- package/out/reconcile.js.map +1 -1
- package/out/resolve.d.ts +152 -91
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +67 -68
- package/out/resolve.js.map +1 -1
- package/out/tools/coverage-reconciliation.d.ts +23 -23
- package/out/tools/coverage-reconciliation.d.ts.map +1 -1
- package/out/tools/coverage-reconciliation.js +15 -26
- package/out/tools/coverage-reconciliation.js.map +1 -1
- package/out/tools/cross/dataset-correlation.d.ts +23 -27
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -1
- package/out/tools/cross/dataset-correlation.js +9 -61
- package/out/tools/cross/dataset-correlation.js.map +1 -1
- package/out/tools/cross/source-threshold-sweep.d.ts +20 -26
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -1
- package/out/tools/cross/source-threshold-sweep.js +14 -40
- package/out/tools/cross/source-threshold-sweep.js.map +1 -1
- package/out/tools/dedup-ceiling.d.ts +23 -26
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +22 -41
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +25 -16
- package/out/tools/eval-geocoder.d.ts.map +1 -1
- package/out/tools/eval-geocoder.js +5 -6
- package/out/tools/eval-geocoder.js.map +1 -1
- package/out/tools/geocoder/namesake-probe.d.ts +9 -8
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -1
- package/out/tools/geocoder/namesake-probe.js +6 -7
- package/out/tools/geocoder/namesake-probe.js.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts +18 -15
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.js +30 -27
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -1
- package/out/tools/gold-set-sample.d.ts +27 -18
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +18 -22
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/learned/scorer/clustering-eval.d.ts +30 -27
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/clustering-eval.js +28 -38
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts +24 -18
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.js +19 -25
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -1
- package/out/tools/learned/scorer/eval.d.ts +26 -39
- package/out/tools/learned/scorer/eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/eval.js +11 -71
- package/out/tools/learned/scorer/eval.js.map +1 -1
- package/out/tools/matcher-scale.d.ts +12 -17
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +11 -29
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes/dedup-benchmark.d.ts +22 -41
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes/dedup-benchmark.js +21 -67
- package/out/tools/nppes/dedup-benchmark.js.map +1 -1
- package/out/tools/nppes/org-name.d.ts +5 -11
- package/out/tools/nppes/org-name.d.ts.map +1 -1
- package/out/tools/nppes/org-name.js +2 -9
- package/out/tools/nppes/org-name.js.map +1 -1
- package/out/tools/nppes/overmerge-packet.d.ts +15 -11
- package/out/tools/nppes/overmerge-packet.d.ts.map +1 -1
- package/out/tools/nppes/overmerge-packet.js +6 -7
- package/out/tools/nppes/overmerge-packet.js.map +1 -1
- package/out/tools/nppes/report.d.ts +17 -13
- package/out/tools/nppes/report.d.ts.map +1 -1
- package/out/tools/nppes/report.js +6 -14
- package/out/tools/nppes/report.js.map +1 -1
- package/out/tools/nppes/sample.d.ts +29 -18
- package/out/tools/nppes/sample.d.ts.map +1 -1
- package/out/tools/nppes/sample.js +24 -28
- package/out/tools/nppes/sample.js.map +1 -1
- package/out/tools/nppes/scoring.d.ts +7 -6
- package/out/tools/nppes/scoring.d.ts.map +1 -1
- package/out/tools/nppes/scoring.js +6 -5
- package/out/tools/nppes/scoring.js.map +1 -1
- package/out/tools/nppes/settings.d.ts +10 -7
- package/out/tools/nppes/settings.d.ts.map +1 -1
- package/out/tools/nppes/settings.js +16 -16
- package/out/tools/nppes/settings.js.map +1 -1
- package/out/tools/nppes/truth-grains.d.ts +36 -23
- package/out/tools/nppes/truth-grains.d.ts.map +1 -1
- package/out/tools/nppes/truth-grains.js +36 -20
- package/out/tools/nppes/truth-grains.js.map +1 -1
- package/out/tools/shared.d.ts +68 -72
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +50 -67
- package/out/tools/shared.js.map +1 -1
- package/out/tools/train/cross-gbt.d.ts +37 -26
- package/out/tools/train/cross-gbt.d.ts.map +1 -1
- package/out/tools/train/cross-gbt.js +14 -25
- package/out/tools/train/cross-gbt.js.map +1 -1
- package/out/tools/train/gbt.d.ts +36 -20
- package/out/tools/train/gbt.d.ts.map +1 -1
- package/out/tools/train/gbt.js +27 -31
- package/out/tools/train/gbt.js.map +1 -1
- package/out/tools/train/org-cross-gbt.d.ts +38 -24
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -1
- package/out/tools/train/org-cross-gbt.js +18 -22
- package/out/tools/train/org-cross-gbt.js.map +1 -1
- package/out/tools/txhhsc-to-oarow.d.ts +14 -9
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +16 -15
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/browser.d.ts +6 -5
- package/out/tools/viz/browser.d.ts.map +1 -1
- package/out/tools/viz/browser.js +6 -5
- package/out/tools/viz/browser.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +7 -4
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +9 -6
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +11 -5
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +16 -11
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render/map.d.ts +5 -5
- package/out/tools/viz/render/map.d.ts.map +1 -1
- package/out/tools/viz/render/map.js +6 -5
- package/out/tools/viz/render/map.js.map +1 -1
- package/out/tools/viz/{render/index.d.ts → render.d.ts} +13 -9
- package/out/tools/viz/render.d.ts.map +1 -0
- package/out/tools/viz/{render/index.js → render.js} +9 -8
- package/out/tools/viz/render.js.map +1 -0
- package/out/tools/viz/source-provenance-map.d.ts +19 -7
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +11 -8
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +2 -21
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +3 -39
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/out/types.d.ts +35 -29
- package/out/types.d.ts.map +1 -1
- package/out/types.js +2 -2
- package/out/types.js.map +1 -1
- package/package.json +42 -185
- package/{lib/tools → tools}/coverage-reconciliation.ts +27 -30
- package/{lib/tools → tools}/cross/dataset-correlation.ts +35 -73
- package/{lib/tools → tools}/cross/source-threshold-sweep.ts +29 -46
- package/{lib/tools → tools}/dedup-ceiling.ts +34 -45
- package/tools/eval-geocoder.ts +77 -0
- package/{lib/tools → tools}/geocoder/namesake-probe.ts +9 -8
- package/{lib/tools → tools}/geocoder/vs-provided-coords.ts +40 -31
- package/{lib/tools → tools}/gold-set-sample.ts +35 -29
- package/{lib/tools → tools}/learned/scorer/clustering-eval.ts +49 -45
- package/{lib/tools → tools}/learned/scorer/crossstate-eval.ts +34 -30
- package/{lib/tools → tools}/learned/scorer/eval.ts +39 -78
- package/{lib/tools → tools}/matcher-scale.ts +21 -33
- package/{lib/tools → tools}/nppes/dedup-benchmark.ts +39 -83
- package/tools/nppes/org-name.ts +15 -0
- package/{lib/tools → tools}/nppes/overmerge-packet.ts +16 -12
- package/{lib/tools → tools}/nppes/report.ts +32 -25
- package/{lib/tools → tools}/nppes/sample.ts +43 -38
- package/{lib/tools → tools}/nppes/scoring.ts +7 -6
- package/{lib/tools → tools}/nppes/settings.ts +16 -16
- package/{lib/tools → tools}/nppes/truth-grains.ts +46 -26
- package/{lib/tools → tools}/shared.ts +79 -98
- package/{lib/tools → tools}/train/cross-gbt.ts +39 -34
- package/{lib/tools → tools}/train/gbt.ts +55 -41
- package/{lib/tools → tools}/train/org-cross-gbt.ts +40 -30
- package/{lib/tools → tools}/txhhsc-to-oarow.ts +24 -18
- package/{lib/tools → tools}/viz/browser.ts +6 -5
- package/{lib/tools → tools}/viz/cross-dataset-map.ts +15 -9
- package/{lib/tools → tools}/viz/geocode-first-surface.ts +29 -17
- package/{lib/tools → tools}/viz/render/map.ts +7 -6
- package/{lib/tools/viz/render/index.ts → tools/viz/render.ts} +16 -11
- package/{lib/tools → tools}/viz/source-provenance-map.ts +30 -15
- package/{lib/tools → tools}/viz/yardstick-figure.ts +6 -43
- package/lib/tools/eval-geocoder.ts +0 -67
- package/lib/tools/index.ts +0 -31
- package/lib/tools/nppes/org-name.ts +0 -23
- package/out/tools/index.d.ts +0 -31
- package/out/tools/index.d.ts.map +0 -1
- package/out/tools/index.js +0 -31
- package/out/tools/index.js.map +0 -1
- package/out/tools/viz/render/index.d.ts.map +0 -1
- package/out/tools/viz/render/index.js.map +0 -1
|
@@ -3,28 +3,16 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* no name/org feature can separate them, so any address-aware matcher over-merges them. That
|
|
12
|
-
* floor caps PRECISION.
|
|
6
|
+
* Dedup ceiling measurement, answering how good is good enough for dedup from the data rather
|
|
7
|
+
* than from a round number. The residual dedup error is over-merge: distinct co-located providers
|
|
8
|
+
* (different NPIs at one address) fused because a shared address outvotes a disagreeing name. The
|
|
9
|
+
* irreducible part is the set of co-located distinct-NPI pairs whose name text is also near
|
|
10
|
+
* identical, so no name or organization feature can separate them.
|
|
13
11
|
*
|
|
14
|
-
* This measures
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* token Jaccard over the legal business name.
|
|
19
|
-
*
|
|
20
|
-
* Reports, over co-located distinct-NPI pairs (the over-merge population):
|
|
21
|
-
*
|
|
22
|
-
* - Co-location prevalence (addresses hosting ≥2 distinct NPIs; providers at shared addresses)
|
|
23
|
-
* - The org-name-similarity distribution of those pairs
|
|
24
|
-
* - The COLLISION rate: fraction with org-sim ≥ τ (irreducible over-merge) — the precision floor
|
|
25
|
-
* - Whether a shared phone would help (it doesn't: institutional switchboards) — among collisions,
|
|
26
|
-
* how often the two distinct NPIs ALSO share a phone (so phone over-links, can't separate)
|
|
27
|
-
* …and derives a precision/F1 CEILING under stated assumptions, with the caveats called out.
|
|
12
|
+
* This measures that floor directly and without labels, using NPI as the distinctness truth. It
|
|
13
|
+
* is geocode-free on purpose, so it can run at large N in seconds. "Same address" uses the
|
|
14
|
+
* matcher's own `addressFrequencyKey`, and "same name" uses a normalized token Jaccard over the
|
|
15
|
+
* legal business name.
|
|
28
16
|
*
|
|
29
17
|
* Run: `mailwoman registry dedup-ceiling [--cap 50000] [--state TX] [--sources <dir>] [--tau 0.7]
|
|
30
18
|
* [--out-md <md>]`
|
|
@@ -39,7 +27,8 @@ import { colocatedDistinctPairs, scanColocatedProviders, stateOption } from "#to
|
|
|
39
27
|
*/
|
|
40
28
|
const WEAK_SIMILARITY_MIN = 0.3;
|
|
41
29
|
/**
|
|
42
|
-
*
|
|
30
|
+
* Measure the irreducible over-merge of co-located providers.
|
|
31
|
+
* Emit the markdown report to stdout.
|
|
43
32
|
*/
|
|
44
33
|
export async function dedupCeiling(options = {}, report) {
|
|
45
34
|
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
@@ -48,22 +37,18 @@ export async function dedupCeiling(options = {}, report) {
|
|
|
48
37
|
const TAU = options.tau ?? 0.7;
|
|
49
38
|
const OUT_MD = options.outMd || "";
|
|
50
39
|
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
51
|
-
// Stream Texas organization providers, retaining one primary practice-address record per NPI.
|
|
52
40
|
report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`);
|
|
53
41
|
const { byAddr, kept, scanned } = await scanColocatedProviders({ registryPath: REGISTRY, state: STATE, cap: CAP });
|
|
54
42
|
report?.(` scanned ${scanned} rows → ${kept} ${STATE} org providers at ${byAddr.size} distinct addresses`);
|
|
55
|
-
// Measure organization similarity and collision rate for co-located distinct-NPI pairs.
|
|
56
43
|
let sharedAddresses = 0;
|
|
57
44
|
let providersAtSharedAddr = 0;
|
|
58
45
|
let pairs = 0;
|
|
59
|
-
let collide = 0;
|
|
60
|
-
let mid = 0;
|
|
61
|
-
let separable = 0;
|
|
62
|
-
let collideSharePhone = 0;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let collideSameAuth = 0; // share an authorized official ⇒ one org, multiple NPIs ⇒ correct to merge
|
|
66
|
-
let collideDistinct = 0; // different official AND different specialty ⇒ genuinely different providers
|
|
46
|
+
let collide = 0;
|
|
47
|
+
let mid = 0;
|
|
48
|
+
let separable = 0;
|
|
49
|
+
let collideSharePhone = 0;
|
|
50
|
+
let collideSameAuth = 0;
|
|
51
|
+
let collideDistinct = 0;
|
|
67
52
|
const PAIR_BUDGET = 5_000_000;
|
|
68
53
|
// guard against a pathological mega-address (PO-box farms)
|
|
69
54
|
let lastGroup = null;
|
|
@@ -98,14 +83,10 @@ export async function dedupCeiling(options = {}, report) {
|
|
|
98
83
|
separable++;
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
// bounded by how many merges it makes that are correct. We report the collision rate directly and
|
|
106
|
-
// a precision-ceiling BAND (optimistic: only `collide` over-merge; conservative: `collide` + half
|
|
107
|
-
// of `mid`). Recall is NOT the binding constraint here (NPPES same-NPI records almost always share
|
|
108
|
-
// either address or org), so the F1 ceiling tracks the precision ceiling. ---
|
|
86
|
+
// The irreducible false-merge rate among co-located distinct pairs is collide/pairs.
|
|
87
|
+
// Report the collision rate directly with a precision-ceiling band: optimistic counts
|
|
88
|
+
// only `collide`, and conservative counts `collide` plus half of `mid`.
|
|
89
|
+
// Recall is not binding here, so the F1 ceiling tracks the precision ceiling.
|
|
109
90
|
const pct = formatPercent;
|
|
110
91
|
const lines = [
|
|
111
92
|
`# #625 — dedup ceiling: the irreducible over-merge of co-located providers`,
|
|
@@ -165,7 +146,7 @@ export async function dedupCeiling(options = {}, report) {
|
|
|
165
146
|
`Recommendation: drop 0.85. Set the bar against a subpart-aware / adjudicated entity truth, report NPI-level AND ` +
|
|
166
147
|
`entity-level side by side, and target "separate the ~${pct(collideDistinct, pairs)} genuinely-distinct co-located ` +
|
|
167
148
|
`pairs the GBT can still reach" rather than a round F1. The GBT's corroboration-feature work (#625 revised) ` +
|
|
168
|
-
`attacks exactly that separable
|
|
149
|
+
`attacks exactly that separable subset.`,
|
|
169
150
|
"",
|
|
170
151
|
`## Caveats`,
|
|
171
152
|
"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedup-ceiling.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"dedup-ceiling.js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F;QAC/F,EAAE;KACF,CAAA;IAED,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAE3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAChC,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -3,35 +3,37 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The injected-geocoder
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`)
|
|
11
|
-
* `GeocodeAddress` interface philosophy: ingest never pins the runtime, the caller wires it.
|
|
6
|
+
* The injected-geocoder interface for the record-matcher tools. The registry package never imports
|
|
7
|
+
* the heavy runtime (neural parser, WOF resolver, per-state extracts), since `mailwoman` depends on
|
|
8
|
+
* `@mailwoman/registry` and the reverse import would cycle the workspace graph. Each tool instead
|
|
9
|
+
* takes an {@linkcode EvalGeocoderFactory} the CLI command constructs from
|
|
10
|
+
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`).
|
|
12
11
|
*/
|
|
12
|
+
import type { CaseNormalization } from "@mailwoman/core/pipeline";
|
|
13
13
|
import type { ColumnMapping, GeocodeAddress, SourceRecord } from "#index";
|
|
14
14
|
/**
|
|
15
|
-
* The raw single-address geocode surface
|
|
15
|
+
* The raw single-address geocode surface used by the probe tools, mirroring
|
|
16
|
+
* `mailwoman/geocode-core`'s wire shape.
|
|
16
17
|
*/
|
|
17
18
|
export interface EvalGeocodeResult {
|
|
18
19
|
lat: number | null;
|
|
19
20
|
lon: number | null;
|
|
20
21
|
/**
|
|
21
|
-
* Wire key
|
|
22
|
+
* Wire key that mirrors `GeocodeResult.resolution_tier`.
|
|
22
23
|
*/
|
|
23
24
|
resolution_tier?: string | null;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* A constructed geocoder: the matcher's ingest interface, the raw geocode
|
|
27
|
+
* A constructed geocoder: the matcher's ingest interface, the raw geocode and the handle release.
|
|
27
28
|
*/
|
|
28
29
|
export interface EvalGeocoder extends Disposable {
|
|
29
30
|
/**
|
|
30
|
-
* The matcher's ingest interface (parse
|
|
31
|
+
* The matcher's ingest interface (parse and geocode to `PostalAddress`),
|
|
32
|
+
* built through `geocodeAddressVia`.
|
|
31
33
|
*/
|
|
32
34
|
geocodeAddress: GeocodeAddress;
|
|
33
35
|
/**
|
|
34
|
-
* Raw single-address geocode
|
|
36
|
+
* Raw single-address geocode returning lat, lon and resolution tier.
|
|
35
37
|
*/
|
|
36
38
|
geocode: (address: string) => Promise<EvalGeocodeResult>;
|
|
37
39
|
}
|
|
@@ -40,17 +42,24 @@ export interface EvalGeocoder extends Disposable {
|
|
|
40
42
|
*/
|
|
41
43
|
export interface EvalGeocoderInit {
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* All-caps case normalization.
|
|
46
|
+
*
|
|
47
|
+
* `nppes-benchmark --legacy-join` passes `"preserve"` for the A/B.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue `"title-case"`
|
|
44
50
|
*/
|
|
45
|
-
|
|
51
|
+
caseNormalization?: CaseNormalization;
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
48
|
-
* Build a geocoder on demand
|
|
54
|
+
* Build a geocoder on demand.
|
|
55
|
+
*
|
|
56
|
+
* Tools construct it late and dispose it as soon as geocoding is done.
|
|
49
57
|
*/
|
|
50
58
|
export type EvalGeocoderFactory = (init?: EvalGeocoderInit) => Promise<EvalGeocoder>;
|
|
51
59
|
/**
|
|
52
|
-
* The threaded geocode surface (`mailwoman/geocode-stream` behind the interface)
|
|
53
|
-
* --parallel-geocode`.
|
|
60
|
+
* The threaded geocode surface (`mailwoman/geocode-stream` behind the interface)
|
|
61
|
+
* for `nppes-dedup-benchmark --parallel-geocode`.
|
|
62
|
+
* It yields enriched records in completion order.
|
|
54
63
|
*/
|
|
55
64
|
export type EvalGeocodeStream = (records: SourceRecord[], opts: {
|
|
56
65
|
mapping: ColumnMapping;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-geocoder.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"eval-geocoder.d.ts","sourceRoot":"","sources":["../../tools/eval-geocoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC/C;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAA;IAC9B;;OAEG;IACH,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAIxD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CACrC;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AAEpF;;;;GAIG;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"}
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The injected-geocoder
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`)
|
|
11
|
-
* `GeocodeAddress` interface philosophy: ingest never pins the runtime, the caller wires it.
|
|
6
|
+
* The injected-geocoder interface for the record-matcher tools. The registry package never imports
|
|
7
|
+
* the heavy runtime (neural parser, WOF resolver, per-state extracts), since `mailwoman` depends on
|
|
8
|
+
* `@mailwoman/registry` and the reverse import would cycle the workspace graph. Each tool instead
|
|
9
|
+
* takes an {@linkcode EvalGeocoderFactory} the CLI command constructs from
|
|
10
|
+
* `mailwoman/geocode-core` (see `mailwoman/commands/registry/run.tsx`).
|
|
12
11
|
*/
|
|
13
12
|
export {};
|
|
14
13
|
//# sourceMappingURL=eval-geocoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-geocoder.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"eval-geocoder.js","sourceRoot":"","sources":["../../tools/eval-geocoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Admin-tier wrong-region probe
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* and flags any result outside the Texas bounding box.
|
|
6
|
+
* Admin-tier wrong-region probe. When no street extract covers an address, the admin cascade can
|
|
7
|
+
* resolve the locality by name and, when the region or postcode constraint is weak, pick the
|
|
8
|
+
* population-dominant foreign namesake instead of the in-state Texas city. This probes a curated
|
|
9
|
+
* set of TX namesake cities, with and without ZIP. It flags any result outside the Texas bounding
|
|
10
|
+
* box.
|
|
12
11
|
*
|
|
13
12
|
* Run: `mailwoman registry scorer-eval namesake-probe`
|
|
14
13
|
*/
|
|
@@ -18,12 +17,14 @@ import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
|
18
17
|
*/
|
|
19
18
|
export interface GeocoderNamesakeProbeOptions {
|
|
20
19
|
/**
|
|
21
|
-
* The injected geocoder factory
|
|
20
|
+
* The injected geocoder factory.
|
|
21
|
+
*
|
|
22
|
+
* The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
|
|
22
23
|
*/
|
|
23
24
|
createGeocoder: EvalGeocoderFactory;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* Probe a curated set of TX namesake cities and print one line per variant to stdout.
|
|
27
28
|
*/
|
|
28
29
|
export declare function geocoderNamesakeProbe(options: GeocoderNamesakeProbeOptions, report?: (line: string) => void): Promise<{
|
|
29
30
|
wrongRegion: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namesake-probe.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"namesake-probe.d.ts","sourceRoot":"","sources":["../../../tools/geocoder/namesake-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG/D;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;CACnC;AAgBD;;GAEG;AACH,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,CAuCjD"}
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Admin-tier wrong-region probe
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* and flags any result outside the Texas bounding box.
|
|
6
|
+
* Admin-tier wrong-region probe. When no street extract covers an address, the admin cascade can
|
|
7
|
+
* resolve the locality by name and, when the region or postcode constraint is weak, pick the
|
|
8
|
+
* population-dominant foreign namesake instead of the in-state Texas city. This probes a curated
|
|
9
|
+
* set of TX namesake cities, with and without ZIP. It flags any result outside the Texas bounding
|
|
10
|
+
* box.
|
|
12
11
|
*
|
|
13
12
|
* Run: `mailwoman registry scorer-eval namesake-probe`
|
|
14
13
|
*/
|
|
@@ -28,7 +27,7 @@ const CASES = [
|
|
|
28
27
|
{ city: "Odessa", zip: "79761", tx: [31.85, -102.37], namesake: "Odessa, Ukraine (46.48, 30.72)" },
|
|
29
28
|
];
|
|
30
29
|
/**
|
|
31
|
-
*
|
|
30
|
+
* Probe a curated set of TX namesake cities and print one line per variant to stdout.
|
|
32
31
|
*/
|
|
33
32
|
export async function geocoderNamesakeProbe(options, report) {
|
|
34
33
|
report?.("[A] building the geocoder…");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namesake-probe.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"namesake-probe.js","sourceRoot":"","sources":["../../../tools/geocoder/namesake-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAcxC;;GAE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OAAO,QAAQ,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;gBAC3F,IAAI,CAAC,CAAC,eAAe,IAAI,GAAG,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CACjI,CAAA;QACF,CAAC;IACF,CAAC;IAED,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;IAE1B,OAAO,CAAC,GAAG,CAAC,OAAO,WAAW,IAAI,KAAK,kDAAkD,CAAC,CAAA;IAE1F,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -3,18 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Geocoder validation against provided coordinates
|
|
7
|
-
*
|
|
6
|
+
* Geocoder validation against provided coordinates. TX HHSC's nursing-facilities registry ships
|
|
7
|
+
* a `Geo Location` (`lat,lon`) per facility alongside its physical address. Geocode the address
|
|
8
|
+
* with mailwoman's parser and resolver, then measure the great-circle delta to the provided point,
|
|
9
|
+
* broken down by resolution tier.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* tier we assign (address_point / interpolated / admin). This is an independent check of the
|
|
13
|
-
* geocoder on real facility addresses; it does not touch the matcher.
|
|
14
|
-
*
|
|
15
|
-
* The provided coordinate is treated as ground truth for _this_ eval, with the honest caveat that
|
|
16
|
-
* it is itself a third-party geocode of unknown provenance — a large delta is a discrepancy to
|
|
17
|
-
* inspect, not automatically our error.
|
|
11
|
+
* The provided coordinate is treated as ground truth for this eval, with the caveat that it is
|
|
12
|
+
* itself a third-party geocode of unknown provenance. A large delta is a discrepancy to inspect
|
|
13
|
+
* rather than automatically our error.
|
|
18
14
|
*
|
|
19
15
|
* Run: `mailwoman registry scorer-eval vs-provided-coords [--max 1176] [--wof <admin.db>]
|
|
20
16
|
* [--data-root <dir>] [--out-md docs/articles/evals/resolver-geo/<date>-...md]`
|
|
@@ -25,15 +21,21 @@ import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
|
25
21
|
*/
|
|
26
22
|
export interface GeocoderVsProvidedCoordsOptions {
|
|
27
23
|
/**
|
|
28
|
-
* The injected geocoder factory
|
|
24
|
+
* The injected geocoder factory.
|
|
25
|
+
*
|
|
26
|
+
* The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
|
|
29
27
|
*/
|
|
30
28
|
createGeocoder: EvalGeocoderFactory;
|
|
31
29
|
/**
|
|
32
|
-
* Record-matcher sources directory.
|
|
30
|
+
* Record-matcher sources directory.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
|
|
33
33
|
*/
|
|
34
34
|
sources?: string;
|
|
35
35
|
/**
|
|
36
|
-
* Facilities geocoded.
|
|
36
|
+
* Facilities geocoded.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `2000`
|
|
37
39
|
*/
|
|
38
40
|
max?: number;
|
|
39
41
|
/**
|
|
@@ -42,7 +44,8 @@ export interface GeocoderVsProvidedCoordsOptions {
|
|
|
42
44
|
outMd?: string;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
47
|
+
* Geocode each facility's physical address and measure the delta to its provided
|
|
48
|
+
* coordinate, then emit the report to stdout.
|
|
46
49
|
*/
|
|
47
50
|
export declare function geocoderVsProvidedCoords(options: GeocoderVsProvidedCoordsOptions, report?: (line: string) => void): Promise<{
|
|
48
51
|
markdown: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vs-provided-coords.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"vs-provided-coords.d.ts","sourceRoot":"","sources":["../../../tools/geocoder/vs-provided-coords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAa/D;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAqCD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC7C,OAAO,EAAE,+BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0H/B"}
|
|
@@ -3,18 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Geocoder validation against provided coordinates
|
|
7
|
-
*
|
|
6
|
+
* Geocoder validation against provided coordinates. TX HHSC's nursing-facilities registry ships
|
|
7
|
+
* a `Geo Location` (`lat,lon`) per facility alongside its physical address. Geocode the address
|
|
8
|
+
* with mailwoman's parser and resolver, then measure the great-circle delta to the provided point,
|
|
9
|
+
* broken down by resolution tier.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* tier we assign (address_point / interpolated / admin). This is an independent check of the
|
|
13
|
-
* geocoder on real facility addresses; it does not touch the matcher.
|
|
14
|
-
*
|
|
15
|
-
* The provided coordinate is treated as ground truth for _this_ eval, with the honest caveat that
|
|
16
|
-
* it is itself a third-party geocode of unknown provenance — a large delta is a discrepancy to
|
|
17
|
-
* inspect, not automatically our error.
|
|
11
|
+
* The provided coordinate is treated as ground truth for this eval, with the caveat that it is
|
|
12
|
+
* itself a third-party geocode of unknown provenance. A large delta is a discrepancy to inspect
|
|
13
|
+
* rather than automatically our error.
|
|
18
14
|
*
|
|
19
15
|
* Run: `mailwoman registry scorer-eval vs-provided-coords [--max 1176] [--wof <admin.db>]
|
|
20
16
|
* [--data-root <dir>] [--out-md docs/articles/evals/resolver-geo/<date>-...md]`
|
|
@@ -24,6 +20,7 @@ import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
|
24
20
|
import { isPresent } from "@mailwoman/core/objects";
|
|
25
21
|
import { percentile } from "@mailwoman/core/stats";
|
|
26
22
|
import { haversineKm } from "@mailwoman/match";
|
|
23
|
+
import { TextSpliterator } from "spliterator";
|
|
27
24
|
import { streamRows } from "#index";
|
|
28
25
|
import { norm } from "#tools/shared";
|
|
29
26
|
/**
|
|
@@ -35,34 +32,41 @@ const MAX_ABS_LATITUDE = 90;
|
|
|
35
32
|
*/
|
|
36
33
|
const MAX_ABS_LONGITUDE = 180;
|
|
37
34
|
/**
|
|
38
|
-
* Parse a `lat,lon` string into a coordinate, or null if malformed
|
|
35
|
+
* Parse a `lat,lon` string into a coordinate, or null if malformed or out of range.
|
|
36
|
+
*
|
|
37
|
+
* Deliberately strict and deliberately not `GeoPoint.from()`.
|
|
38
|
+
* The provided coordinate is this eval's ground truth, so a row that cannot be read exactly
|
|
39
|
+
* is dropped (counted in `noCoord`) rather than repaired into something plausible.
|
|
40
|
+
*
|
|
41
|
+
* A silently repaired coordinate lands in the delta distribution as geocoder error.
|
|
42
|
+
*
|
|
43
|
+
* This source writes `latitude,longitude`, while `GeoPoint` reads GeoJSON `[longitude, latitude]`,
|
|
44
|
+
* so `31.5,-89.5` is a Mississippi row here and a South-Atlantic point there.
|
|
45
|
+
* `GeoPoint.from` also maps 0,0 to null.
|
|
46
|
+
*
|
|
47
|
+
* This moves Null Island out of the measured outliers and into the skipped bucket.
|
|
48
|
+
*
|
|
49
|
+
* The report attributes part of its p99/max tail to malformed provided coordinates,
|
|
50
|
+
* so those rows have to stay rejected or measured as-is, never rewritten.
|
|
39
51
|
*
|
|
40
|
-
*
|
|
41
|
-
* a row we cannot read exactly has to be _dropped_ (counted in `noCoord`) rather than repaired into something plausible
|
|
42
|
-
* — a silently repaired coordinate lands in the delta distribution as geocoder error. Two of the three divergences that
|
|
43
|
-
* originally justified this parser were defects in `GeoPoint` and were fixed on 2026-08-05: it no longer guesses axis
|
|
44
|
-
* order from the magnitudes, and an out-of-range value is now rejected instead of accepted (`200,-97.74` used to become
|
|
45
|
-
* a point). What remains is not a defect and not negotiable. This source writes `latitude,longitude`; `GeoPoint` reads
|
|
46
|
-
* GeoJSON `[longitude, latitude]`, so `31.5,-89.5` is a Mississippi row here and a South-Atlantic point there — and
|
|
47
|
-
* `GeoPoint.from` maps 0,0 to null, which moves Null Island out of the measured outliers and into the skipped bucket.
|
|
48
|
-
* The report below attributes part of its p99/max tail to malformed provided coordinates, so those rows have to stay
|
|
49
|
-
* rejected or measured as-is, never rewritten. Strictness is the measurement, not an unfinished migration.
|
|
52
|
+
* Strictness is the measurement rather than an unfinished migration.
|
|
50
53
|
*/
|
|
51
54
|
function parseLatLon(raw) {
|
|
52
55
|
if (!raw)
|
|
53
56
|
return null;
|
|
54
|
-
const [a, b] =
|
|
57
|
+
const [a, b] = TextSpliterator.from(raw, { delimiter: "," }).map(Number).toArray();
|
|
55
58
|
if (!Number.isFinite(a) || !Number.isFinite(b))
|
|
56
59
|
return null;
|
|
57
60
|
if (Math.abs(a) > MAX_ABS_LATITUDE || Math.abs(b) > MAX_ABS_LONGITUDE)
|
|
58
61
|
return null;
|
|
59
62
|
return { latitude: a, longitude: b };
|
|
60
63
|
}
|
|
61
|
-
// The core nearest-rank `percentile` (q in [0,100])
|
|
62
|
-
//
|
|
64
|
+
// The core nearest-rank `percentile` (q in [0,100]) uses a floor index and clamping.
|
|
65
|
+
// `?? NaN` returns NaN when the percentile helper returns null for an empty sample.
|
|
63
66
|
const quantile = (xs, q) => percentile(xs, q * 100) ?? Number.NaN;
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
68
|
+
* Geocode each facility's physical address and measure the delta to its provided
|
|
69
|
+
* coordinate, then emit the report to stdout.
|
|
66
70
|
*/
|
|
67
71
|
export async function geocoderVsProvidedCoords(options, report) {
|
|
68
72
|
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
@@ -99,7 +103,6 @@ export async function geocoderVsProvidedCoords(options, report) {
|
|
|
99
103
|
results.push({ deltaM, tier: g.resolution_tier ?? "unknown" });
|
|
100
104
|
}
|
|
101
105
|
geocoder[Symbol.dispose]();
|
|
102
|
-
// Overall + per-tier percentiles.
|
|
103
106
|
const all = results.map((r) => r.deltaM).toSorted((a, b) => a - b);
|
|
104
107
|
const byTier = new Map();
|
|
105
108
|
for (const r of results) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vs-provided-coords.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"vs-provided-coords.js","sourceRoot":"","sources":["../../../tools/geocoder/vs-provided-coords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;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AAA;QAC7C,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,CAAC,MAAM,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7F,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACxB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,KAAK,CAAC,IAAI,CACT,sGAAsG;QACrG,oGAAoG;QACpG,yGAAyG;QACzG,2GAA2G;QAC3G,4GAA4G;QAC5G,6GAA6G;QAC7G,yGAAyG;QACzG,kBAAkB,CACnB,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAE3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAChC,MAAM,EAAE,CAAC,eAAe,MAAM,EAAE,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Gold-set
|
|
7
|
-
* (`nppes-dedup-benchmark.ts`) collapses only NPPES-
|
|
8
|
-
* LBN/TIN)
|
|
9
|
-
* address with near-identical
|
|
10
|
-
*
|
|
11
|
-
* gold set must cover.
|
|
6
|
+
* Gold-set sampling for adjudication. The programmatic entity truth
|
|
7
|
+
* (`nppes-dedup-benchmark.ts`) collapses only NPPES-flagged subparts (Is-Subpart plus parent
|
|
8
|
+
* LBN/TIN), so it cannot settle the genuinely ambiguous co-located collisions: distinct NPIs at
|
|
9
|
+
* one address with near-identical name text and no subpart flag for the same parent.
|
|
10
|
+
* NPI truth and programmatic rules may disagree on these pairs. A frozen
|
|
11
|
+
* adjudicated gold set must cover.
|
|
12
12
|
*
|
|
13
|
-
* This
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* entity? yes/no" and we can MEASURE how often the programmatic truth matches judgment.
|
|
13
|
+
* This scans the full TX registry without geocoding and writes each pair as a JSONL row containing
|
|
14
|
+
* both records' fields (org name, address, authorized official, taxonomy, subpart and parent
|
|
15
|
+
* flags) plus the programmatic verdict. An adjudicator (human or LLM-as-judge, flagged as such)
|
|
16
|
+
* can then label same real-world entity or not.
|
|
18
17
|
*
|
|
19
18
|
* Run: `mailwoman registry gold-set-sample [--cap 200000] [--state TX] [--tau 0.7] [--n 300]
|
|
20
19
|
* [--out-jsonl <path>]`
|
|
@@ -24,32 +23,42 @@
|
|
|
24
23
|
*/
|
|
25
24
|
export interface GoldSetSampleOptions {
|
|
26
25
|
/**
|
|
27
|
-
* Record-matcher sources directory.
|
|
26
|
+
* Record-matcher sources directory.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
|
|
28
29
|
*/
|
|
29
30
|
sources?: string;
|
|
30
31
|
/**
|
|
31
|
-
* Providers sampled from the registry.
|
|
32
|
+
* Providers sampled from the registry.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue `200000`
|
|
32
35
|
*/
|
|
33
36
|
cap?: number;
|
|
34
37
|
/**
|
|
35
|
-
* State filter.
|
|
38
|
+
* State filter.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue TX.
|
|
36
41
|
*/
|
|
37
42
|
state?: string;
|
|
38
43
|
/**
|
|
39
|
-
* Org-name Jaccard collision threshold.
|
|
44
|
+
* Org-name Jaccard collision threshold.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `0.7`
|
|
40
47
|
*/
|
|
41
48
|
tau?: number;
|
|
42
49
|
/**
|
|
43
|
-
* Adjudication sample size.
|
|
50
|
+
* Adjudication sample size.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue `300`
|
|
44
53
|
*/
|
|
45
54
|
n?: number;
|
|
46
55
|
/**
|
|
47
|
-
* Write the sampled pairs here as
|
|
56
|
+
* Write the sampled pairs here as jsonl (otherwise the first 10 print to stdout).
|
|
48
57
|
*/
|
|
49
58
|
outJSONL?: string;
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
|
-
*
|
|
61
|
+
* Sample the hard co-located name-collision stratum for adjudication.
|
|
53
62
|
*/
|
|
54
63
|
export declare function goldSetSample(options?: GoldSetSampleOptions, report?: (line: string) => void): Promise<{
|
|
55
64
|
hardPairs: number;
|