@mailwoman/registry 10.0.0 → 10.1.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 +10 -10
- package/lib/address-key.ts +14 -10
- package/lib/geocode-handler.ts +6 -4
- package/lib/geojson.ts +11 -6
- package/lib/ingest.ts +57 -83
- package/lib/learned-scorer.ts +38 -44
- package/lib/map-html.ts +24 -70
- 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 +43 -53
- package/lib/resolve.ts +180 -124
- package/lib/types.ts +18 -12
- 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 +6 -4
- 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 +11 -6
- package/out/geojson.js.map +1 -1
- package/out/ingest.d.ts +46 -75
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +27 -54
- 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 +9 -62
- 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 +35 -50
- package/out/reconcile.d.ts.map +1 -1
- package/out/reconcile.js +17 -41
- package/out/reconcile.js.map +1 -1
- package/out/resolve.d.ts +150 -90
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +62 -63
- 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 +20 -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 +22 -15
- 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 +22 -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 +21 -41
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes/dedup-benchmark.js +20 -66
- package/out/tools/nppes/dedup-benchmark.js.map +1 -1
- package/out/tools/nppes/org-name.d.ts +5 -4
- package/out/tools/nppes/org-name.d.ts.map +1 -1
- package/out/tools/nppes/org-name.js +2 -2
- 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 +5 -6
- 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 +28 -17
- package/out/tools/nppes/sample.d.ts.map +1 -1
- package/out/tools/nppes/sample.js +23 -26
- 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 +63 -59
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +49 -66
- package/out/tools/shared.js.map +1 -1
- package/out/tools/train/cross-gbt.d.ts +36 -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 +37 -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 +10 -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 +17 -11
- package/out/types.d.ts.map +1 -1
- package/out/types.js +2 -2
- package/out/types.js.map +1 -1
- package/package.json +41 -184
- package/{lib/tools → tools}/coverage-reconciliation.ts +27 -30
- package/{lib/tools → tools}/cross/dataset-correlation.ts +31 -72
- 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 +74 -0
- package/{lib/tools → tools}/geocoder/namesake-probe.ts +9 -8
- package/{lib/tools → tools}/geocoder/vs-provided-coords.ts +39 -30
- 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 +35 -78
- package/{lib/tools → tools}/matcher-scale.ts +21 -33
- package/{lib/tools → tools}/nppes/dedup-benchmark.ts +37 -82
- package/{lib/tools → tools}/nppes/org-name.ts +5 -4
- package/{lib/tools → tools}/nppes/overmerge-packet.ts +15 -11
- package/{lib/tools → tools}/nppes/report.ts +32 -25
- package/{lib/tools → tools}/nppes/sample.ts +41 -36
- 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 +73 -83
- package/{lib/tools → tools}/train/cross-gbt.ts +38 -34
- package/{lib/tools → tools}/train/gbt.ts +55 -41
- package/{lib/tools → tools}/train/org-cross-gbt.ts +39 -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 +28 -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/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
|
@@ -2,27 +2,19 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
* @file The NPPES dedup benchmark's markdown report. Pure: every figure comes from the input, because eval figures are
|
|
6
|
-
* never hand-typed into docs.
|
|
7
5
|
*/
|
|
8
6
|
import { ORG_TAU } from "#tools/nppes/org-name";
|
|
9
7
|
import { COLOCATION_KM } from "#tools/nppes/truth-grains";
|
|
10
8
|
import { pct } from "#tools/shared";
|
|
11
|
-
/**
|
|
12
|
-
* F1 gap within which two blocking strategies are treated as equivalent.
|
|
13
|
-
*/
|
|
14
9
|
const BLOCKING_PARITY_TOLERANCE = 0.015;
|
|
15
10
|
/**
|
|
16
11
|
* Render the run's markdown report.
|
|
17
12
|
*/
|
|
18
13
|
export function renderNPPESDedupReport(input) {
|
|
19
14
|
const { state: STATE, keptNpis, recordCount: N, geocoded: geo, trainEM: TRAIN_EM, addressFrequency, progression, defaultOutOfBox, sweep, best, entityCount, orgCount, orgCoordCount, orgH3Count, fsNPI, fsEntity, fsOrg, fsOrgCoord, gbtNPI, gbtEntity, gbtOrg, gbtOrgCoord, gbtOrgH3, candidate: cand, h3Res: H3_RES, geocodedNpis, } = input;
|
|
20
|
-
const baseline = progression[0];
|
|
21
|
-
// The LAST progression row — the whole A1–A5 stack, never compared on F1 against the others. Named for what it
|
|
22
|
-
// is: a row called `best` invites reading a stack-wide delta as one setting's marginal effect, which is how the
|
|
23
|
-
// authorized-official sentence below came to quote a five-setting number.
|
|
15
|
+
const baseline = progression[0];
|
|
24
16
|
const fullStack = progression.at(-1);
|
|
25
|
-
const base = sweep[0];
|
|
17
|
+
const base = sweep[0];
|
|
26
18
|
const signed = (x) => `${x >= 0 ? "+" : ""}${x.toFixed(1)}pp`;
|
|
27
19
|
const lines = [
|
|
28
20
|
`# NPPES NPI dedup benchmark (#617)`,
|
|
@@ -34,7 +26,7 @@ export function renderNPPESDedupReport(input) {
|
|
|
34
26
|
"",
|
|
35
27
|
`**Headline — org-name truth (the honest grain):** the shipped ` +
|
|
36
28
|
`matcher resolves these records at **F1 ${pct(gbtOrg.f1)}%** against org-name entity-truth — not the NPI-level ` +
|
|
37
|
-
`${pct(gbtNPI.f1)}
|
|
29
|
+
`${pct(gbtNPI.f1)}%. It mostly measures NPI over-segmentation (one organization holds many subpart NPIs. Therefore, ` +
|
|
38
30
|
`correct co-located merges are scored as errors). Same clusters, three rulers: ` +
|
|
39
31
|
`**NPI ${pct(gbtNPI.f1)}% → site ${pct(gbtEntity.f1)}% → org-name ${pct(gbtOrg.f1)}%** ` +
|
|
40
32
|
`(${keptNpis} NPI → ${entityCount} site → ${orgCount} org-name classes); the climb is the yardstick getting honest, ` +
|
|
@@ -64,7 +56,7 @@ export function renderNPPESDedupReport(input) {
|
|
|
64
56
|
`**${pct(defaultOutOfBox.f1)}%** on this sample — essentially the baseline. The default auto-computes the ` +
|
|
65
57
|
`address-frequency table over the INPUT records, and this benchmark deliberately sub-samples ${N} records, so ` +
|
|
66
58
|
`that table is too sparse to carry the inverse-frequency signal (a corpus statistic you can't synthesize from a ` +
|
|
67
|
-
`
|
|
59
|
+
`sample). It's **not a regression**, because it meets the baseline without adding over-merges — it's the honest floor when the input isn't ` +
|
|
68
60
|
`corpus-scale. Fed the corpus-wide table (the \`+ inverse-address-frequency\` row above, what the CLI builds from ` +
|
|
69
61
|
`the full source files) the SAME default reaches the **${pct(progression[2].score.f1)}%** baseline. On a full-dataset ` +
|
|
70
62
|
`dedup the input IS the corpus, so zero-config reaches the baseline on its own.`);
|
|
@@ -80,7 +72,7 @@ export function renderNPPESDedupReport(input) {
|
|
|
80
72
|
lines.push("");
|
|
81
73
|
lines.push(best.t === 0
|
|
82
74
|
? `Best F1 is at the **default threshold** (${pct(base.score.f1)}%): raising it only trades recall away faster ` +
|
|
83
|
-
`than it
|
|
75
|
+
`than it provides precision. So the threshold knob alone can't separate co-located distinct providers — the ` +
|
|
84
76
|
`over-merge is structural, in the comparison model, not the cutoff.`
|
|
85
77
|
: `Best F1 **${pct(best.score.f1)}%** (ARI ${best.score.ari.toFixed(3)}) at threshold ${best.t}, vs **${pct(base.score.f1)}%** at the ` +
|
|
86
78
|
`default — the threshold knob moves it ${(100 * (best.score.f1 - base.score.f1)).toFixed(0)}pp. Higher thresholds trade recall for precision.`);
|
|
@@ -157,7 +149,7 @@ export function renderNPPESDedupReport(input) {
|
|
|
157
149
|
lines.push("");
|
|
158
150
|
lines.push(`Caveats: the programmatic site-truth is CONSERVATIVE (collapses only NPPES-flagged subparts; unflagged same-org pairs still ` +
|
|
159
151
|
`read as over-merge), so it understates the subpart correction. A hand-adjudicated gold set on the ambiguous co-located + ` +
|
|
160
|
-
`two-site
|
|
152
|
+
`two-site stratum is the next refinement (#625).`);
|
|
161
153
|
lines.push("");
|
|
162
154
|
lines.push(`## Reading`);
|
|
163
155
|
lines.push("");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../tools/nppes/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAEnC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AA6FvC;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAuB;IAC7D,MAAM,EACL,KAAK,EAAE,KAAK,EACZ,QAAQ,EACR,WAAW,EAAE,CAAC,EACd,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,QAAQ,EACjB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,MAAM,EACN,SAAS,EACT,MAAM,EACN,WAAW,EACX,QAAQ,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WAAW,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,mBAAmB;QAC/J,mHAAmH;QACnH,sHAAsH;QACtH,mFAAmF,SAAS,CAAC,KAAK,CAAC,kBAAkB,GAAG;QACxH,oHAAoH;QACpH,yGAAyG;QACzG,+GAA+G;QAC/G,mHAAmH;QACnH,+GAA+G;QAC/G,mHAAmH;QACnH,2RAA2R;QAC3R,kGAAkG;QAClG,8GAA8G,CAC/G,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,KAAK,CAAC,IAAI,CACT,kHAAkH;QACjH,qHAAqH;QACrH,yFAAyF,CAC1F,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC"}
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* The NPPES benchmark's input sample: the variation-rich multi-record set per NPI, plus the
|
|
7
|
+
* corpus-wide address-frequency table built in the same pass. One registry pass serves any number
|
|
8
|
+
* of states, so the cross-state eval samples two at once.
|
|
8
9
|
*/
|
|
9
10
|
import type { TermFrequencyTable } from "@mailwoman/match";
|
|
10
11
|
import { type NPIPrimary } from "#tools/nppes/org-name";
|
|
11
12
|
/**
|
|
12
|
-
* One synthetic input row for the matcher
|
|
13
|
-
*
|
|
13
|
+
* One synthetic input row for the matcher.
|
|
14
|
+
*
|
|
15
|
+
* `npi` is the hidden NPI-level truth.
|
|
16
|
+
* `entityID` is the site-level entity-level truth (subpart-collapsed).
|
|
14
17
|
*/
|
|
15
18
|
export interface MessyRow extends Record<string, string> {
|
|
16
19
|
npi: string;
|
|
@@ -19,18 +22,19 @@ export interface MessyRow extends Record<string, string> {
|
|
|
19
22
|
address: string;
|
|
20
23
|
auth: string;
|
|
21
24
|
/**
|
|
22
|
-
* Whitespace-joined taxonomy-code set
|
|
25
|
+
* Whitespace-joined taxonomy-code set, up to 15 slots, used as the code-set discriminator.
|
|
23
26
|
*/
|
|
24
27
|
taxonomy: string;
|
|
25
28
|
entityID: string;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
|
-
* One state's
|
|
31
|
+
* One state's share of the sample pass.
|
|
29
32
|
*/
|
|
30
33
|
export interface NPPESStateSample {
|
|
31
34
|
rows: MessyRow[];
|
|
32
35
|
/**
|
|
33
|
-
* The sampled NPIs
|
|
36
|
+
* The sampled NPIs.
|
|
37
|
+
* Their count is the true-entity count at the NPI grain.
|
|
34
38
|
*/
|
|
35
39
|
keptNpis: Set<string>;
|
|
36
40
|
/**
|
|
@@ -43,8 +47,10 @@ export interface NPPESStateSample {
|
|
|
43
47
|
*/
|
|
44
48
|
export interface NPPESSample extends NPPESStateSample {
|
|
45
49
|
/**
|
|
46
|
-
* Corpus-wide address-frequency table
|
|
47
|
-
*
|
|
50
|
+
* Corpus-wide address-frequency table, the inverse-frequency signal.
|
|
51
|
+
*
|
|
52
|
+
* Counted over every practice address in the registry rather than just the sample,
|
|
53
|
+
* so the sharing structure is a corpus statistic rather than a sampling artifact.
|
|
48
54
|
*/
|
|
49
55
|
addressFrequency: TermFrequencyTable;
|
|
50
56
|
}
|
|
@@ -55,19 +61,22 @@ export interface NPPESSampleOptions {
|
|
|
55
61
|
registryPath: string;
|
|
56
62
|
otherNamesPath: string;
|
|
57
63
|
/**
|
|
58
|
-
* Already upper-cased
|
|
64
|
+
* Already upper-cased.
|
|
65
|
+
* Compared against the practice-location state column.
|
|
59
66
|
*/
|
|
60
67
|
state: string;
|
|
61
68
|
maxNpis: number;
|
|
62
69
|
}
|
|
63
70
|
/**
|
|
64
|
-
* The multi-state shape of {@linkcode NPPESSampleOptions}
|
|
71
|
+
* The multi-state shape of {@linkcode NPPESSampleOptions}, where one registry
|
|
72
|
+
* pass fills every state's bucket.
|
|
65
73
|
*/
|
|
66
74
|
export interface NPPESMultiSampleOptions {
|
|
67
75
|
registryPath: string;
|
|
68
76
|
otherNamesPath: string;
|
|
69
77
|
/**
|
|
70
|
-
* Already upper-cased
|
|
78
|
+
* Already upper-cased.
|
|
79
|
+
* Compared against the practice-location state column.
|
|
71
80
|
*/
|
|
72
81
|
states: readonly string[];
|
|
73
82
|
maxNpisPerState: number;
|
|
@@ -75,16 +84,18 @@ export interface NPPESMultiSampleOptions {
|
|
|
75
84
|
/**
|
|
76
85
|
* Build the benchmark's input records from the real registry, one bucket per requested state.
|
|
77
86
|
*
|
|
78
|
-
* Two passes
|
|
79
|
-
*
|
|
80
|
-
*
|
|
87
|
+
* Two passes read the two files.
|
|
88
|
+
* The second pass cannot break early because the address-frequency table needs
|
|
89
|
+
* every registry row even after the sample is full.
|
|
90
|
+
*
|
|
91
|
+
* The per-bucket `keptNpis.size < maxNpisPerState` test bounds only the sample branch.
|
|
81
92
|
*/
|
|
82
93
|
export declare function buildNPPESStateSamples(options: NPPESMultiSampleOptions, report?: (line: string) => void): Promise<{
|
|
83
94
|
byState: Map<string, NPPESStateSample>;
|
|
84
95
|
addressFrequency: TermFrequencyTable;
|
|
85
96
|
}>;
|
|
86
97
|
/**
|
|
87
|
-
* Build one state's benchmark input records
|
|
98
|
+
* Build one state's benchmark input records using {@linkcode buildNPPESStateSamples} with a single bucket.
|
|
88
99
|
*/
|
|
89
100
|
export declare function buildNPPESSample(options: NPPESSampleOptions, report?: (line: string) => void): Promise<NPPESSample>;
|
|
90
101
|
//# sourceMappingURL=sample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../../tools/nppes/sample.ts"],"names":[],"mappings":"AAA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AAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAAC,gBAAgB,EAAE,kBAAkB,CAAA;CAAE,CAAC,CA2H3F;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,WAAW,CAAC,CAYtB"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* The NPPES benchmark's input sample: the variation-rich multi-record set per NPI, plus the
|
|
7
|
+
* corpus-wide address-frequency table built in the same pass. One registry pass serves any number
|
|
8
|
+
* of states, so the cross-state eval samples two at once.
|
|
8
9
|
*/
|
|
9
10
|
import { isPresent } from "@mailwoman/core/objects";
|
|
10
11
|
import { addressFrequencyKey, streamRows } from "#index";
|
|
@@ -13,13 +14,14 @@ import { addr, MIN_GROUP_SIZE, norm, NPPES_COLUMNS as C } from "#tools/shared";
|
|
|
13
14
|
/**
|
|
14
15
|
* Build the benchmark's input records from the real registry, one bucket per requested state.
|
|
15
16
|
*
|
|
16
|
-
* Two passes
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Two passes read the two files.
|
|
18
|
+
* The second pass cannot break early because the address-frequency table needs
|
|
19
|
+
* every registry row even after the sample is full.
|
|
20
|
+
*
|
|
21
|
+
* The per-bucket `keptNpis.size < maxNpisPerState` test bounds only the sample branch.
|
|
19
22
|
*/
|
|
20
23
|
export async function buildNPPESStateSamples(options, report) {
|
|
21
24
|
const { registryPath, otherNamesPath, states, maxNpisPerState } = options;
|
|
22
|
-
// Select NPIs with at least one alternate organization name.
|
|
23
25
|
report?.("[A] streaming other-names…");
|
|
24
26
|
const altNames = new Map();
|
|
25
27
|
for await (const r of streamRows(otherNamesPath)) {
|
|
@@ -35,8 +37,8 @@ export async function buildNPPESStateSamples(options, report) {
|
|
|
35
37
|
altNames.set(npi, list);
|
|
36
38
|
}
|
|
37
39
|
report?.(` ${altNames.size} NPIs with ≥1 alternate name`);
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
+
// One full registry pass builds the global address-frequency table and collects every state's sample.
|
|
41
|
+
// Each row contributes to the corpus-wide sharing structure, independent of the state sample.
|
|
40
42
|
report?.(`[B] full registry pass: address-frequency table + ${maxNpisPerState} × ${states.join("/")} sample…`);
|
|
41
43
|
const byState = new Map(states.map((state) => [state, { rows: [], keptNpis: new Set(), npiPrimary: new Map() }]));
|
|
42
44
|
const addrCounts = new Map();
|
|
@@ -48,14 +50,12 @@ export async function buildNPPESStateSamples(options, report) {
|
|
|
48
50
|
report?.(` scanned ${scanned / 1e6}M rows, kept ${keptTotal}`);
|
|
49
51
|
}
|
|
50
52
|
const practice = addr(r[C.pAddr], r[C.pCity], r[C.pState], r[C.pZip]);
|
|
51
|
-
// Global address-frequency: count every practice address (one row ≈ one distinct NPI).
|
|
52
53
|
if (practice) {
|
|
53
54
|
const k = addressFrequencyKey(practice);
|
|
54
55
|
addrCounts.set(k, (addrCounts.get(k) ?? 0) + 1);
|
|
55
56
|
addrTotal++;
|
|
56
57
|
}
|
|
57
|
-
//
|
|
58
|
-
// needs the full pass).
|
|
58
|
+
// No early break here, since the table needs the full pass.
|
|
59
59
|
const npi = norm(r[C.npi]);
|
|
60
60
|
const bucket = byState.get(norm(r[C.pState]).toUpperCase());
|
|
61
61
|
if (bucket &&
|
|
@@ -69,19 +69,19 @@ export async function buildNPPESStateSamples(options, report) {
|
|
|
69
69
|
if (primaryName) {
|
|
70
70
|
const org = isOrg ? norm(r[C.orgLegal]) : "";
|
|
71
71
|
const auth = `${norm(r[C.authFirst])} ${norm(r[C.authLast])}`.trim();
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
// it only separates co-located DISTINCT providers whose sets are disjoint.
|
|
72
|
+
// The taxonomy-code set (up to 15 slots) is whitespace-joined and identical
|
|
73
|
+
// across the NPI's records by construction, so it never splits one entity.
|
|
74
|
+
// It only separates co-located distinct providers whose sets are disjoint.
|
|
76
75
|
const taxonomy = C.taxonomy
|
|
77
76
|
.map((col) => norm(r[col]))
|
|
78
77
|
.filter(isPresent)
|
|
79
78
|
.join(" ");
|
|
80
|
-
// Entity-level (site) truth
|
|
81
|
-
// "Is Organization Subpart"
|
|
82
|
-
// charged for correctly fusing one org's many subpart-NPIs at a site
|
|
83
|
-
// practice records stay
|
|
84
|
-
//
|
|
79
|
+
// Entity-level (site) truth is the same org and the same physical address.
|
|
80
|
+
// Subparts (NPPES "Is Organization Subpart" plus parent LBN/TIN) collapse to their parent,
|
|
81
|
+
// so the matcher is not charged for correctly fusing one org's many subpart-NPIs at a site.
|
|
82
|
+
// An NPI's mailing and practice records stay distinct sites.
|
|
83
|
+
// `orgKey` is the parent identity for a subpart, else the NPI,
|
|
84
|
+
// so independent orgs sharing an address stay distinct.
|
|
85
85
|
const isSubpart = norm(r[C.isSubpart]).toUpperCase() === "Y";
|
|
86
86
|
const parentKey = `${norm(r[C.parentLBN])}|${norm(r[C.parentTIN])}`.toLowerCase();
|
|
87
87
|
const orgKey = isSubpart && parentKey !== "|" ? `p:${parentKey}` : `n:${npi}`;
|
|
@@ -92,19 +92,16 @@ export async function buildNPPESStateSamples(options, report) {
|
|
|
92
92
|
bucket.keptNpis.add(npi);
|
|
93
93
|
keptTotal++;
|
|
94
94
|
bucket.rows.push({ npi, name: primaryName, org, address: practice, auth, taxonomy, entityID: eid(practice) });
|
|
95
|
-
// primary
|
|
96
95
|
for (const alt of altNames.get(npi)) {
|
|
97
96
|
bucket.rows.push({ npi, name: alt, org: alt, address: practice, auth, taxonomy, entityID: eid(practice) });
|
|
98
97
|
}
|
|
99
|
-
// name drift
|
|
100
98
|
const mailing = addr(r[C.mAddr], r[C.mCity], r[C.mState], r[C.mZip]);
|
|
101
99
|
if (mailing && mailing !== practice) {
|
|
102
100
|
bucket.rows.push({ npi, name: primaryName, org, address: mailing, auth, taxonomy, entityID: eid(mailing) });
|
|
103
|
-
}
|
|
101
|
+
}
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
|
-
// Corpus-wide address-frequency table — the inverse-frequency signal (#617 fix per the DeepSeek consult).
|
|
108
105
|
const addressFrequency = {
|
|
109
106
|
total: addrTotal,
|
|
110
107
|
distinct: addrCounts.size,
|
|
@@ -117,7 +114,7 @@ export async function buildNPPESStateSamples(options, report) {
|
|
|
117
114
|
return { byState, addressFrequency };
|
|
118
115
|
}
|
|
119
116
|
/**
|
|
120
|
-
* Build one state's benchmark input records
|
|
117
|
+
* Build one state's benchmark input records using {@linkcode buildNPPESStateSamples} with a single bucket.
|
|
121
118
|
*/
|
|
122
119
|
export async function buildNPPESSample(options, report) {
|
|
123
120
|
const { byState, addressFrequency } = await buildNPPESStateSamples({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../tools/nppes/sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,IAAI,CAAC,EAAE,MAAM,eAAe,CAAA;AA+E9E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,OAAgC,EAChC,MAA+B;IAE/B,MAAM,EAAE,YAAY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/B,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,MAAM,sBAAsB,CACjE;QACC,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACvB,eAAe,EAAE,OAAO,CAAC,OAAO;KAChC,EACD,MAAM,CACN,CAAA;IAED,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAE,EAAE,gBAAgB,EAAE,CAAA;AAC5D,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
* @file Pairwise cluster scoring for the NPPES benchmark — precision/recall/F1 and adjusted Rand of recovered clusters
|
|
6
|
-
* against a truth
|
|
6
|
+
* against a truth labeling, plus the over-merge / under-merge shape counts.
|
|
7
7
|
*/
|
|
8
8
|
import type { ResolvedEntity, SourceRecord } from "#index";
|
|
9
9
|
/**
|
|
@@ -11,7 +11,7 @@ import type { ResolvedEntity, SourceRecord } from "#index";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const choose2: (n: number) => number;
|
|
13
13
|
/**
|
|
14
|
-
* One clustering scored against one truth
|
|
14
|
+
* One clustering scored against one truth labeling.
|
|
15
15
|
*/
|
|
16
16
|
export interface Score {
|
|
17
17
|
precision: number;
|
|
@@ -26,11 +26,12 @@ export interface Score {
|
|
|
26
26
|
splitNpis: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Score recovered clusters against a truth
|
|
29
|
+
* Score recovered clusters against a truth labeling.
|
|
30
30
|
*
|
|
31
|
-
* Pairwise
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Pairwise rather than set-matching: a true pair is two records carrying the same `labelOf`,
|
|
32
|
+
* a predicted pair is two records in the same entity.
|
|
33
|
+
* `totalRecords` is the labeled population and only feeds the adjusted-Rand expectation,
|
|
34
|
+
* so it must be the whole record set rather than the clustered subset — a smaller value inflates ARI.
|
|
34
35
|
*/
|
|
35
36
|
export declare function scoreEntities(entities: readonly ResolvedEntity[], labelOf: (rec: SourceRecord) => string, totalRecords: number): Score;
|
|
36
37
|
//# sourceMappingURL=scoring.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../../tools/nppes/scoring.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,OAAO,MAAO,MAAM,KAAG,MAA2B,CAAA;AAE/D;;GAEG;AACH,MAAM,WAAW,KAAK;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,EACtC,YAAY,EAAE,MAAM,GAClB,KAAK,CAuEP"}
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
* @file Pairwise cluster scoring for the NPPES benchmark — precision/recall/F1 and adjusted Rand of recovered clusters
|
|
6
|
-
* against a truth
|
|
6
|
+
* against a truth labeling, plus the over-merge / under-merge shape counts.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Pairs within a group of `n`.
|
|
10
10
|
*/
|
|
11
11
|
export const choose2 = (n) => (n * (n - 1)) / 2;
|
|
12
12
|
/**
|
|
13
|
-
* Score recovered clusters against a truth
|
|
13
|
+
* Score recovered clusters against a truth labeling.
|
|
14
14
|
*
|
|
15
|
-
* Pairwise
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Pairwise rather than set-matching: a true pair is two records carrying the same `labelOf`,
|
|
16
|
+
* a predicted pair is two records in the same entity.
|
|
17
|
+
* `totalRecords` is the labeled population and only feeds the adjusted-Rand expectation,
|
|
18
|
+
* so it must be the whole record set rather than the clustered subset — a smaller value inflates ARI.
|
|
18
19
|
*/
|
|
19
20
|
export function scoreEntities(entities, labelOf, totalRecords) {
|
|
20
21
|
const npiTotals = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../../tools/nppes/scoring.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAkB/D;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAmC,EACnC,OAAsC,EACtC,YAAoB;IAEpB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAA;IAClD,IAAI,KAAK,GAAG,CAAC,CAAA,CAAC,eAAe;IAC7B,IAAI,UAAU,GAAG,CAAC,CAAA,CAAC,gBAAgB;IACnC,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,kBAAkB,GAA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AAC,CAAA;IACnF,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAA;IAE5E,OAAO;QACN,SAAS;QACT,MAAM;QACN,EAAE;QACF,GAAG;QACH,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,UAAU;QACV,kBAAkB;QAClB,mBAAmB;QACnB,YAAY;QACZ,SAAS;KACT,CAAA;AACF,CAAC"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* The comparison-model setting progression the NPPES benchmark walks, where each row turns one
|
|
7
|
+
* setting on so its marginal effect is isolated.
|
|
7
8
|
*/
|
|
8
9
|
import type { TermFrequencyTable } from "@mailwoman/match";
|
|
9
10
|
/**
|
|
@@ -28,11 +29,13 @@ export interface Setting {
|
|
|
28
29
|
/**
|
|
29
30
|
* Build the progression against a corpus-wide address-frequency table.
|
|
30
31
|
*
|
|
31
|
-
* Every row sets
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* Every row sets both `collapseSpatial` and `addressFrequency` explicitly,
|
|
33
|
+
* because the proven settings are default-on in `resolveEntities`.
|
|
34
|
+
* Leave either implicit and the flipped default silently follows the inverse-address-frequency row.
|
|
35
|
+
* That makes the delta read as 0.
|
|
36
|
+
*
|
|
37
|
+
* Every row is fed the corpus-wide table, the realistic deployment, so the zero-config
|
|
38
|
+
* default with its input-scoped table has to be measured separately.
|
|
36
39
|
*/
|
|
37
40
|
export declare function buildSettings(addressFrequency: TermFrequencyTable): Setting[];
|
|
38
41
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../tools/nppes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,gBAAgB,CAAC,EAAE,kBAAkB,GAAG,KAAK,CAAA;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,aAAa,CAAA;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,kBAAkB,GAAG,OAAO,EAAE,CA0D7E"}
|
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* The comparison-model setting progression the NPPES benchmark walks, where each row turns one
|
|
7
|
+
* setting on so its marginal effect is isolated.
|
|
7
8
|
*/
|
|
8
9
|
/**
|
|
9
10
|
* Build the progression against a corpus-wide address-frequency table.
|
|
10
11
|
*
|
|
11
|
-
* Every row sets
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Every row sets both `collapseSpatial` and `addressFrequency` explicitly,
|
|
13
|
+
* because the proven settings are default-on in `resolveEntities`.
|
|
14
|
+
* Leave either implicit and the flipped default silently follows the inverse-address-frequency row.
|
|
15
|
+
* That makes the delta read as 0.
|
|
16
|
+
*
|
|
17
|
+
* Every row is fed the corpus-wide table, the realistic deployment, so the zero-config
|
|
18
|
+
* default with its input-scoped table has to be measured separately.
|
|
16
19
|
*/
|
|
17
20
|
export function buildSettings(addressFrequency) {
|
|
18
21
|
return [
|
|
@@ -26,10 +29,8 @@ export function buildSettings(addressFrequency) {
|
|
|
26
29
|
label: "+ authorized-official discriminator (#625)",
|
|
27
30
|
config: { collapseSpatial: true, addressFrequency, discriminators: ["authorizedOfficial"] },
|
|
28
31
|
},
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
// over-merge precision setting; A3 (phone) is the recall-tail corroborator that should keep A2 from
|
|
32
|
-
// killing name-drift links; A4 (average-linkage) splits a component joined only by a weak bridge.
|
|
32
|
+
// The over-merge settings each build on the collapsed-spatial and discriminator stack,
|
|
33
|
+
// so the marginal effect of each is isolated.
|
|
33
34
|
{
|
|
34
35
|
label: "+ require name/org corroboration (A2, #625)",
|
|
35
36
|
config: {
|
|
@@ -60,11 +61,10 @@ export function buildSettings(addressFrequency) {
|
|
|
60
61
|
linkage: "average",
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// authorized-official; A3 phone + A4 avg-linkage were measured neutral-to-negative and are left off).
|
|
64
|
+
// The taxonomy code-set discriminator uses set-overlap agreement over the NPI's 15 taxonomy slots.
|
|
65
|
+
// Co-located distinct providers usually have disjoint sets, while an entity's
|
|
66
|
+
// own records always share theirs.
|
|
67
|
+
// It is stacked on the best prior classical config.
|
|
68
68
|
{
|
|
69
69
|
label: "+ taxonomy code-set discriminator (A5, #625)",
|
|
70
70
|
config: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../
|
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