@mailwoman/registry 9.4.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 +13 -17
- 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 +45 -55
- 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 +13 -15
- 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 +19 -43
- 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 +58 -0
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -0
- package/out/tools/{cross-dataset-correlation.js → cross/dataset-correlation.js} +10 -62
- package/out/tools/cross/dataset-correlation.js.map +1 -0
- package/out/tools/cross/source-threshold-sweep.d.ts +60 -0
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/{cross-source-threshold-sweep.js → cross/source-threshold-sweep.js} +15 -41
- package/out/tools/cross/source-threshold-sweep.js.map +1 -0
- 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 +33 -0
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -0
- package/out/tools/{geocoder-namesake-probe.js → geocoder/namesake-probe.js} +7 -8
- package/out/tools/geocoder/namesake-probe.js.map +1 -0
- package/out/tools/geocoder/vs-provided-coords.d.ts +53 -0
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -0
- package/out/tools/{geocoder-vs-provided-coords.js → geocoder/vs-provided-coords.js} +31 -28
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -0
- 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 +77 -0
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-clustering-eval.js → learned/scorer/clustering-eval.js} +29 -39
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -0
- package/out/tools/learned/scorer/crossstate-eval.d.ts +65 -0
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-crossstate-eval.js → learned/scorer/crossstate-eval.js} +20 -26
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -0
- package/out/tools/learned/scorer/eval.d.ts +60 -0
- package/out/tools/learned/scorer/eval.d.ts.map +1 -0
- package/out/tools/{learned-scorer-eval.js → learned/scorer/eval.js} +12 -72
- package/out/tools/learned/scorer/eval.js.map +1 -0
- 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 +81 -0
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -0
- package/out/tools/{nppes-dedup-benchmark.js → nppes/dedup-benchmark.js} +21 -67
- package/out/tools/nppes/dedup-benchmark.js.map +1 -0
- 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 +7 -8
- 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 +88 -0
- package/out/tools/train/cross-gbt.d.ts.map +1 -0
- package/out/tools/{train-cross-gbt.js → train/cross-gbt.js} +15 -26
- package/out/tools/train/cross-gbt.js.map +1 -0
- package/out/tools/train/gbt.d.ts +85 -0
- package/out/tools/train/gbt.d.ts.map +1 -0
- package/out/tools/{train-gbt.js → train/gbt.js} +28 -32
- package/out/tools/train/gbt.js.map +1 -0
- package/out/tools/train/org-cross-gbt.d.ts +84 -0
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -0
- package/out/tools/{train-org-cross-gbt.js → train/org-cross-gbt.js} +19 -23
- package/out/tools/train/org-cross-gbt.js.map +1 -0
- 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 → render/map.d.ts} +6 -6
- package/out/tools/viz/render/map.d.ts.map +1 -0
- package/out/tools/viz/{render-map.js → render/map.js} +7 -6
- package/out/tools/viz/render/map.js.map +1 -0
- package/out/tools/viz/render.d.ts +12 -8
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +8 -7
- package/out/tools/viz/render.js.map +1 -1
- 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/cross-dataset-correlation.ts → tools/cross/dataset-correlation.ts} +31 -72
- package/{lib/tools/cross-source-threshold-sweep.ts → 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/geocoder-namesake-probe.ts → tools/geocoder/namesake-probe.ts} +9 -8
- package/{lib/tools/geocoder-vs-provided-coords.ts → tools/geocoder/vs-provided-coords.ts} +39 -30
- package/{lib/tools → tools}/gold-set-sample.ts +35 -29
- package/{lib/tools/learned-scorer-clustering-eval.ts → tools/learned/scorer/clustering-eval.ts} +49 -45
- package/{lib/tools/learned-scorer-crossstate-eval.ts → tools/learned/scorer/crossstate-eval.ts} +34 -30
- package/{lib/tools/learned-scorer-eval.ts → tools/learned/scorer/eval.ts} +35 -78
- package/{lib/tools → tools}/matcher-scale.ts +21 -33
- package/{lib/tools/nppes-dedup-benchmark.ts → 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 +17 -13
- 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/train-cross-gbt.ts → tools/train/cross-gbt.ts} +38 -34
- package/{lib/tools/train-gbt.ts → tools/train/gbt.ts} +55 -41
- package/{lib/tools/train-org-cross-gbt.ts → 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/viz/render-map.ts → tools/viz/render/map.ts} +7 -6
- package/{lib/tools → 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/cross-dataset-correlation.d.ts +0 -65
- package/out/tools/cross-dataset-correlation.d.ts.map +0 -1
- package/out/tools/cross-dataset-correlation.js.map +0 -1
- package/out/tools/cross-source-threshold-sweep.d.ts +0 -66
- package/out/tools/cross-source-threshold-sweep.d.ts.map +0 -1
- package/out/tools/cross-source-threshold-sweep.js.map +0 -1
- package/out/tools/geocoder-namesake-probe.d.ts +0 -32
- package/out/tools/geocoder-namesake-probe.d.ts.map +0 -1
- package/out/tools/geocoder-namesake-probe.js.map +0 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts +0 -50
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +0 -1
- package/out/tools/geocoder-vs-provided-coords.js.map +0 -1
- package/out/tools/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/learned-scorer-clustering-eval.d.ts +0 -74
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-clustering-eval.js.map +0 -1
- package/out/tools/learned-scorer-crossstate-eval.d.ts +0 -59
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-crossstate-eval.js.map +0 -1
- package/out/tools/learned-scorer-eval.d.ts +0 -77
- package/out/tools/learned-scorer-eval.d.ts.map +0 -1
- package/out/tools/learned-scorer-eval.js.map +0 -1
- package/out/tools/nppes-dedup-benchmark.d.ts +0 -101
- package/out/tools/nppes-dedup-benchmark.d.ts.map +0 -1
- package/out/tools/nppes-dedup-benchmark.js.map +0 -1
- package/out/tools/train-cross-gbt.d.ts +0 -78
- package/out/tools/train-cross-gbt.d.ts.map +0 -1
- package/out/tools/train-cross-gbt.js.map +0 -1
- package/out/tools/train-gbt.d.ts +0 -69
- package/out/tools/train-gbt.d.ts.map +0 -1
- package/out/tools/train-gbt.js.map +0 -1
- package/out/tools/train-org-cross-gbt.d.ts +0 -71
- package/out/tools/train-org-cross-gbt.d.ts.map +0 -1
- package/out/tools/train-org-cross-gbt.js.map +0 -1
- package/out/tools/viz/render-map.d.ts.map +0 -1
- package/out/tools/viz/render-map.js.map +0 -1
|
@@ -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":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlE;;;;;GAKG;AACH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACvD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG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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
|
-
// --- Phase A: the variation set — NPIs that carry ≥1 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,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAA;IAEzE,MAAM,EAAE,CAAC,4BAA4B,CAAC,CAAA;IACtC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAA;IAE5C,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,IAAI,C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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,GAAG,CAAC,CAAA;IAC1B,IAAI,mBAAmB,GAAG,CAAC,CAAA;IAC3B,IAAI,YAAY,GAAG,CAAC,CAAA;IAEpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;QAEvC,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,EAAE,CA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AAM;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":["../../../
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../tools/nppes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyBH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,gBAAoC;IACjE,OAAO;QACN;YACC,KAAK,EAAE,yDAAyD;YAChE,MAAM,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,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2,10 +2,10 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
* @file
|
|
6
|
-
*
|
|
5
|
+
* @file Defines union-find truth labels that group co-located NPIs for one organization.
|
|
6
|
+
* One label uses address strings. Another uses a haversine radius. The third uses H3 cells.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import type { GeoCoordinate } from "@mailwoman/spatial";
|
|
9
9
|
import type { SourceRecord } from "#index";
|
|
10
10
|
import { type NPIPrimary } from "#tools/nppes/org-name";
|
|
11
11
|
/**
|
|
@@ -13,38 +13,51 @@ import { type NPIPrimary } from "#tools/nppes/org-name";
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const COLOCATION_KM = 0.05;
|
|
15
15
|
/**
|
|
16
|
-
* A truth
|
|
16
|
+
* A truth labeling: the entity class a record belongs to.
|
|
17
17
|
*/
|
|
18
18
|
export type TruthLabel = (rec: SourceRecord) => string;
|
|
19
19
|
/**
|
|
20
|
-
* An NPI's primary practice coordinate
|
|
21
|
-
*
|
|
20
|
+
* An NPI's primary practice coordinate.
|
|
21
|
+
*
|
|
22
|
+
* Returns the first geocoded record for the NPI.
|
|
23
|
+
* The sample builder adds this primary row before alternate-name and mailing variants.
|
|
22
24
|
*/
|
|
23
|
-
export declare function collectPrimaryCoordinates(records: readonly SourceRecord[]): Map<string,
|
|
25
|
+
export declare function collectPrimaryCoordinates(records: readonly SourceRecord[]): Map<string, GeoCoordinate>;
|
|
24
26
|
/**
|
|
25
|
-
* The string-keyed org-name truth: same NPI ⇒ same entity
|
|
26
|
-
*
|
|
27
|
+
* The string-keyed org-name truth: same NPI ⇒ same entity
|
|
28
|
+
* (so an NPI's records stay together and recall is preserved), plus union two NPIs
|
|
29
|
+
* at the same address KEY whose primary org names agree.
|
|
30
|
+
*
|
|
31
|
+
* The address-string block provides a conservative lower bound.
|
|
32
|
+
* `1504 Taub loop` and `1504 Taub LP STE 100` key apart even though they are one building,
|
|
33
|
+
* so a correct merge across them is still charged as an error.
|
|
34
|
+
* The coordinate grain below is the tighter reading.
|
|
27
35
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* below is the tighter reading. Neither relies on the NPPES subpart flag, which the gold set showed misses 37%.
|
|
36
|
+
* Neither method uses the NPPES subpart flag.
|
|
37
|
+
* The gold set misses 37% of cases when grouped by that flag.
|
|
31
38
|
*/
|
|
32
39
|
export declare function buildOrgNameGrain(npiPrimary: Map<string, NPIPrimary>): TruthLabel;
|
|
33
40
|
/**
|
|
34
|
-
* The coordinate-keyed org-name truth: union same-org NPIs whose primary practice
|
|
35
|
-
* {@linkcode COLOCATION_KM}.
|
|
36
|
-
* apart, so this F1 is at or above the string grain's; the Jaccard test still blocks distinct co-located orgs.
|
|
41
|
+
* The coordinate-keyed org-name truth: union same-org NPIs whose primary practice
|
|
42
|
+
* coordinates fall within {@linkcode COLOCATION_KM}.
|
|
37
43
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
44
|
+
* A geocoded-building block catches same-building pairs that the address string keys apart,
|
|
45
|
+
* so this F1 is at or above the string grain's.
|
|
46
|
+
* The Jaccard test still blocks distinct co-located orgs.
|
|
47
|
+
*
|
|
48
|
+
* Compares every sampled NPI pair.
|
|
49
|
+
* This is small enough for the sample and has no cell-boundary artifact.
|
|
40
50
|
*/
|
|
41
|
-
export declare function buildOrgNameCoordGrain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string,
|
|
51
|
+
export declare function buildOrgNameCoordGrain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string, GeoCoordinate>): TruthLabel;
|
|
42
52
|
/**
|
|
43
|
-
* The H3-cell org-name truth
|
|
44
|
-
*
|
|
53
|
+
* The H3-cell org-name truth.
|
|
54
|
+
*
|
|
55
|
+
* The same building grain keyed on a cell instead of a radius, so co-location
|
|
56
|
+
* blocking is O(n) rather than O(n²).
|
|
45
57
|
*
|
|
46
|
-
* A robustness check on the coordinate grain
|
|
47
|
-
* into adjacent cells, so this slightly
|
|
58
|
+
* A robustness check on the coordinate grain rather than a replacement: a hard cell boundary can split
|
|
59
|
+
* a same-building pair into adjacent cells, so this slightly under-counts relative to the radius.
|
|
60
|
+
* Coarser resolutions absorb more of that.
|
|
48
61
|
*/
|
|
49
|
-
export declare function buildOrgNameH3Grain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string,
|
|
62
|
+
export declare function buildOrgNameH3Grain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string, GeoCoordinate>, h3Res: number): TruthLabel;
|
|
50
63
|
//# sourceMappingURL=truth-grains.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truth-grains.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"truth-grains.d.ts","sourceRoot":"","sources":["../../../tools/nppes/truth-grains.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,aAAa,OAAO,CAAA;AAEjC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,CAAA;AA2BtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAYtG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,CAoBjF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAClC,UAAU,CAuBZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACpC,KAAK,EAAE,MAAM,GACX,UAAU,CAqBZ"}
|