@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,8 +2,8 @@
|
|
|
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
8
|
import { createUnionFind } from "@mailwoman/core/utils";
|
|
9
9
|
import { haversineKm, jaccard } from "@mailwoman/match";
|
|
@@ -16,8 +16,11 @@ export const COLOCATION_KM = 0.05;
|
|
|
16
16
|
/**
|
|
17
17
|
* Union every pair in each block whose org names agree.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Checks every pair within a block.
|
|
20
|
+
* This preserves the per-pair Jaccard test.
|
|
21
|
+
*
|
|
22
|
+
* Therefore, a chain of near-matches cannot transitively fuse two genuinely distinct
|
|
23
|
+
* co-located orgs unless some pair actually agrees.
|
|
21
24
|
*/
|
|
22
25
|
function unionAgreeingPairs(blocks, npiPrimary, uf) {
|
|
23
26
|
for (const group of blocks) {
|
|
@@ -31,8 +34,10 @@ function unionAgreeingPairs(blocks, npiPrimary, uf) {
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
|
-
* An NPI's primary practice coordinate
|
|
35
|
-
*
|
|
37
|
+
* An NPI's primary practice coordinate.
|
|
38
|
+
*
|
|
39
|
+
* Returns the first geocoded record for the NPI.
|
|
40
|
+
* The sample builder adds this primary row before alternate-name and mailing variants.
|
|
36
41
|
*/
|
|
37
42
|
export function collectPrimaryCoordinates(records) {
|
|
38
43
|
const npiCoord = new Map();
|
|
@@ -45,12 +50,17 @@ export function collectPrimaryCoordinates(records) {
|
|
|
45
50
|
return npiCoord;
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
|
-
* The string-keyed org-name truth: same NPI ⇒ same entity
|
|
49
|
-
*
|
|
53
|
+
* The string-keyed org-name truth: same NPI ⇒ same entity
|
|
54
|
+
* (so an NPI's records stay together and recall is preserved), plus union two NPIs
|
|
55
|
+
* at the same address KEY whose primary org names agree.
|
|
56
|
+
*
|
|
57
|
+
* The address-string block provides a conservative lower bound.
|
|
58
|
+
* `1504 Taub loop` and `1504 Taub LP STE 100` key apart even though they are one building,
|
|
59
|
+
* so a correct merge across them is still charged as an error.
|
|
60
|
+
* The coordinate grain below is the tighter reading.
|
|
50
61
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* below is the tighter reading. Neither relies on the NPPES subpart flag, which the gold set showed misses 37%.
|
|
62
|
+
* Neither method uses the NPPES subpart flag.
|
|
63
|
+
* The gold set misses 37% of cases when grouped by that flag.
|
|
54
64
|
*/
|
|
55
65
|
export function buildOrgNameGrain(npiPrimary) {
|
|
56
66
|
const uf = createUnionFind();
|
|
@@ -69,12 +79,15 @@ export function buildOrgNameGrain(npiPrimary) {
|
|
|
69
79
|
return (rec) => (npiPrimary.has(rec.id) ? uf.find(rec.id) : rec.id);
|
|
70
80
|
}
|
|
71
81
|
/**
|
|
72
|
-
* The coordinate-keyed org-name truth: union same-org NPIs whose primary practice
|
|
73
|
-
* {@linkcode COLOCATION_KM}.
|
|
74
|
-
* apart, so this F1 is at or above the string grain's; the Jaccard test still blocks distinct co-located orgs.
|
|
82
|
+
* The coordinate-keyed org-name truth: union same-org NPIs whose primary practice
|
|
83
|
+
* coordinates fall within {@linkcode COLOCATION_KM}.
|
|
75
84
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
85
|
+
* A geocoded-building block catches same-building pairs that the address string keys apart,
|
|
86
|
+
* so this F1 is at or above the string grain's.
|
|
87
|
+
* The Jaccard test still blocks distinct co-located orgs.
|
|
88
|
+
*
|
|
89
|
+
* Compares every sampled NPI pair.
|
|
90
|
+
* This is small enough for the sample and has no cell-boundary artifact.
|
|
78
91
|
*/
|
|
79
92
|
export function buildOrgNameCoordGrain(npiPrimary, npiCoord) {
|
|
80
93
|
const uf = createUnionFind();
|
|
@@ -97,11 +110,14 @@ export function buildOrgNameCoordGrain(npiPrimary, npiCoord) {
|
|
|
97
110
|
return (rec) => (npiPrimary.has(rec.id) ? uf.find(rec.id) : rec.id);
|
|
98
111
|
}
|
|
99
112
|
/**
|
|
100
|
-
* The H3-cell org-name truth
|
|
101
|
-
*
|
|
113
|
+
* The H3-cell org-name truth.
|
|
114
|
+
*
|
|
115
|
+
* The same building grain keyed on a cell instead of a radius, so co-location
|
|
116
|
+
* blocking is O(n) rather than O(n²).
|
|
102
117
|
*
|
|
103
|
-
* A robustness check on the coordinate grain
|
|
104
|
-
* into adjacent cells, so this slightly
|
|
118
|
+
* A robustness check on the coordinate grain rather than a replacement: a hard cell boundary can split
|
|
119
|
+
* a same-building pair into adjacent cells, so this slightly under-counts relative to the radius.
|
|
120
|
+
* Coarser resolutions absorb more of that.
|
|
105
121
|
*/
|
|
106
122
|
export function buildOrgNameH3Grain(npiPrimary, npiCoord, h3Res) {
|
|
107
123
|
const uf = createUnionFind();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truth-grains.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"truth-grains.js","sourceRoot":"","sources":["../../../tools/nppes/truth-grains.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kB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GAAG,eAAe,EAAE,CAAA;IAC5B,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAA;IAE1C,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;QACnC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,oDAAoD;QAC/D,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAEzB,IAAI,CAAC,CAAC;YAAE,SAAQ;QAChB,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAEzD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACrB,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;IAEnD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACpE,CAAC"}
|
package/out/tools/shared.d.ts
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Shared helpers
|
|
7
|
-
*
|
|
8
|
-
* The rule: anything reused by two or more probes belongs here; anything a single probe needs
|
|
9
|
-
* stays with that probe.
|
|
6
|
+
* Shared helpers used by two or more probes in the `registry/tools` probe battery.
|
|
10
7
|
*/
|
|
11
8
|
import { type TermFrequencyTable } from "@mailwoman/match";
|
|
12
9
|
import { type ColumnMapping } from "#index";
|
|
13
10
|
import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
14
11
|
import type { Score } from "#tools/nppes/scoring";
|
|
15
12
|
/**
|
|
16
|
-
* One source a cross-source probe ingests
|
|
13
|
+
* One source a cross-source probe ingests.
|
|
14
|
+
*
|
|
15
|
+
* Its spec gives the path and column mapping.
|
|
16
|
+
* The spec also provides an in-state filter.
|
|
17
17
|
*/
|
|
18
18
|
export interface SourceSpec {
|
|
19
19
|
source: string;
|
|
@@ -24,7 +24,8 @@ export interface SourceSpec {
|
|
|
24
24
|
*/
|
|
25
25
|
inState: (row: Record<string, string>) => boolean;
|
|
26
26
|
/**
|
|
27
|
-
* Optional: a row
|
|
27
|
+
* Optional: a row carrying ≥1 addressable entity yields each as its own row.
|
|
28
|
+
* Default identity.
|
|
28
29
|
*/
|
|
29
30
|
explode?: (row: Record<string, string>) => Record<string, string>[];
|
|
30
31
|
}
|
|
@@ -33,11 +34,8 @@ export interface SourceSpec {
|
|
|
33
34
|
*/
|
|
34
35
|
export declare const norm: (s: string | undefined) => string;
|
|
35
36
|
/**
|
|
36
|
-
* The token set of an organization name
|
|
37
|
-
*
|
|
38
|
-
* NOT a canonical form — `@mailwoman/record`'s `canonicalizeOrganizationName` is the stronger canonical key
|
|
39
|
-
* (jurisdiction-aware designation stripping, a DBA split). This set serves the probes' cheap Jaccard overlap over raw
|
|
40
|
-
* registry names, never blocking or display.
|
|
37
|
+
* The token set of an organization name for the probes' cheap Jaccard overlap,
|
|
38
|
+
* never blocking or display — not a canonical form.
|
|
41
39
|
*/
|
|
42
40
|
export declare function orgTokens(s: string): Set<string>;
|
|
43
41
|
/**
|
|
@@ -45,17 +43,23 @@ export declare function orgTokens(s: string): Set<string>;
|
|
|
45
43
|
*/
|
|
46
44
|
export declare const addr: (line: string, city: string, st: string, zip: string) => string;
|
|
47
45
|
/**
|
|
48
|
-
* Population standard deviation; `0` on an empty sample, because these feed
|
|
46
|
+
* Population standard deviation; `0` on an empty sample, because these feed
|
|
47
|
+
* report tables that print a number per row.
|
|
49
48
|
*/
|
|
50
49
|
export declare const std: (xs: readonly number[]) => number;
|
|
50
|
+
/**
|
|
51
|
+
* Takes a fraction and omits the percent sign, unlike core `formatPercent`'s
|
|
52
|
+
* numerator/denominator interface.
|
|
53
|
+
* Call sites append their own `%`.
|
|
54
|
+
*/
|
|
51
55
|
export declare const pct: (x: number) => string;
|
|
52
56
|
/**
|
|
53
|
-
* Sign prefix for a signed delta
|
|
57
|
+
* Sign prefix for a signed delta: `"+"` for a non-negative value, since a negative one includes its sign.
|
|
54
58
|
*/
|
|
55
59
|
export declare const sgn: (x: number) => string;
|
|
56
60
|
/**
|
|
57
|
-
* Logistic function with the input clamped to
|
|
58
|
-
* silently becomes a no-op.
|
|
61
|
+
* Logistic function with the input clamped to ±30, past which `Math.exp` underflows to 0
|
|
62
|
+
* and the gradient step silently becomes a no-op.
|
|
59
63
|
*/
|
|
60
64
|
export declare const sigmoid: (z: number) => number;
|
|
61
65
|
/**
|
|
@@ -78,14 +82,8 @@ export declare const TX_BBOX: {
|
|
|
78
82
|
*/
|
|
79
83
|
export declare const inTXBBOX: (lat: number, lon: number) => boolean;
|
|
80
84
|
/**
|
|
81
|
-
* NPPES registry column headers, by the short name the probes read them under.
|
|
82
|
-
*
|
|
83
|
-
* The NPI registry export is a ~330-column TSV with headers this long, so every probe that touches it needs this map,
|
|
84
|
-
* and five of them had grown their own copy. The copies were a NESTED SUPERSET chain, not a disagreement -- each new
|
|
85
|
-
* probe took the previous one's map and appended what it additionally read -- so this is the widest of the five, and no
|
|
86
|
-
* consumer loses a column. Reading extra keys costs nothing: they are inert strings, and nothing enumerates this object
|
|
87
|
-
* (checked: no `Object.keys`/`values`/`entries`/spread over it anywhere in `tools/`), so adding a column can never
|
|
88
|
-
* change a probe's behavior.
|
|
85
|
+
* NPPES registry column headers, by the short name the probes read them under. no code
|
|
86
|
+
* enumerates this object, so adding a column cannot change a probe's behavior.
|
|
89
87
|
*/
|
|
90
88
|
export declare const NPPES_COLUMNS: {
|
|
91
89
|
npi: string;
|
|
@@ -115,12 +113,13 @@ export declare const NPPES_COLUMNS: {
|
|
|
115
113
|
*/
|
|
116
114
|
export declare const MIN_GROUP_SIZE = 5;
|
|
117
115
|
/**
|
|
118
|
-
* Gradient-descent epochs for {@link trainLogisticRegression}
|
|
116
|
+
* Gradient-descent epochs for {@link trainLogisticRegression}, fixed
|
|
117
|
+
* rather than early-stopped so seeds stay comparable.
|
|
119
118
|
*/
|
|
120
119
|
export declare const TRAINING_EPOCHS = 400;
|
|
121
120
|
/**
|
|
122
|
-
* Smallest mean F1 gap counted as a real difference between models rather than seed
|
|
123
|
-
* reported as a tie.
|
|
121
|
+
* Smallest mean F1 gap counted as a real difference between models rather than seed
|
|
122
|
+
* noise. verdicts inside ±this are reported as a tie.
|
|
124
123
|
*/
|
|
125
124
|
export declare const MIN_MEANINGFUL_F1_DELTA = 0.02;
|
|
126
125
|
/**
|
|
@@ -132,20 +131,22 @@ export declare const LR_LEARNING_RATE = 0.1;
|
|
|
132
131
|
*/
|
|
133
132
|
export declare const LR_L2 = 0.001;
|
|
134
133
|
/**
|
|
135
|
-
* L2-regularized logistic regression by batch gradient descent
|
|
136
|
-
*
|
|
137
|
-
*
|
|
134
|
+
* L2-regularized logistic regression by batch gradient descent over {@link TRAINING_EPOCHS}
|
|
135
|
+
* epochs, where `w` stores per-sample class weights, returning the logit rather than
|
|
136
|
+
* the probability so it is threshold-comparable across a fixed feature layout.
|
|
138
137
|
*/
|
|
139
138
|
export declare function trainLogisticRegression(X: readonly (readonly number[])[], y: readonly number[], w: readonly number[], dim: number): (x: readonly number[]) => number;
|
|
140
139
|
/**
|
|
141
|
-
* `n + 1` evenly-spaced order statistics of an already-sorted sample, de-duplicated
|
|
142
|
-
* GBT node considers
|
|
143
|
-
*
|
|
140
|
+
* `n + 1` evenly-spaced order statistics of an already-sorted sample, de-duplicated,
|
|
141
|
+
* that a GBT node considers as candidate splits.
|
|
142
|
+
*
|
|
143
|
+
* An empty sample yields `[0]` so a degenerate feature still yields one threshold
|
|
144
|
+
* rather than an empty split set.
|
|
144
145
|
*/
|
|
145
146
|
export declare function uniqueQuantiles(sorted: readonly number[], n: number): number[];
|
|
146
147
|
/**
|
|
147
|
-
* Link-threshold candidates for a learned scorer: de-duplicated quantiles of the
|
|
148
|
-
* distribution across the 0.2–0.999
|
|
148
|
+
* Link-threshold candidates for a learned scorer: de-duplicated quantiles of the
|
|
149
|
+
* scorer's own eval-pair score distribution across the 0.2–0.999 band.
|
|
149
150
|
*/
|
|
150
151
|
export declare const quantileThresholds: (scores: readonly number[]) => number[];
|
|
151
152
|
/**
|
|
@@ -166,19 +167,18 @@ export declare const toArmScore: (s: Score) => ArmScore;
|
|
|
166
167
|
*/
|
|
167
168
|
export declare function bestOver(thresholds: readonly number[], scoreAt: (threshold: number) => ArmScore): ArmScore;
|
|
168
169
|
/**
|
|
169
|
-
* One organization provider at its practice address, as the geocode-free co-location probes read it
|
|
170
|
-
* `dedup-ceiling` and `gold-set-sample` each collect.
|
|
170
|
+
* One organization provider at its practice address, as the geocode-free co-location probes read it.
|
|
171
171
|
*/
|
|
172
172
|
export interface ColocatedProvider {
|
|
173
173
|
npi: string;
|
|
174
174
|
org: string;
|
|
175
175
|
tokens: Set<string>;
|
|
176
176
|
/**
|
|
177
|
-
* The composed practice address ({@link addr})
|
|
177
|
+
* The composed practice address ({@link addr}).
|
|
178
178
|
*/
|
|
179
179
|
address: string;
|
|
180
180
|
/**
|
|
181
|
-
* Strict last-10-digit phone key; `""` when the column
|
|
181
|
+
* Strict last-10-digit phone key; `""` when the column contains fewer than 10 digits.
|
|
182
182
|
*/
|
|
183
183
|
phone: string;
|
|
184
184
|
/**
|
|
@@ -191,7 +191,7 @@ export interface ColocatedProvider {
|
|
|
191
191
|
taxonomy: string;
|
|
192
192
|
subpart: boolean;
|
|
193
193
|
/**
|
|
194
|
-
* `parentLBN|parentTIN`, lowercased
|
|
194
|
+
* `parentLBN|parentTIN`, lowercased; `"|"` when both are blank.
|
|
195
195
|
*/
|
|
196
196
|
parent: string;
|
|
197
197
|
}
|
|
@@ -207,8 +207,9 @@ export interface ColocatedScan {
|
|
|
207
207
|
scanned: number;
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
|
-
* Stream in-state type-2 (organization) providers from the registry
|
|
211
|
-
*
|
|
210
|
+
* Stream in-state type-2 (organization) providers from the registry,
|
|
211
|
+
* one record per row at its practice address, grouped by `addressFrequencyKey`;
|
|
212
|
+
* geocode-free on purpose so it runs at large caps in seconds.
|
|
212
213
|
*/
|
|
213
214
|
export declare function scanColocatedProviders(options: {
|
|
214
215
|
registryPath: string;
|
|
@@ -222,19 +223,18 @@ export interface ColocatedPair {
|
|
|
222
223
|
a: ColocatedProvider;
|
|
223
224
|
b: ColocatedProvider;
|
|
224
225
|
/**
|
|
225
|
-
* The distinct-NPI providers at the shared address, length ≥ 2
|
|
226
|
-
* group
|
|
226
|
+
* The distinct-NPI providers at the shared address, length ≥ 2, one array reference
|
|
227
|
+
* per group so a consumer can detect the group boundary by identity.
|
|
227
228
|
*/
|
|
228
229
|
group: readonly ColocatedProvider[];
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
|
-
* Every unordered pair of
|
|
232
|
-
*
|
|
232
|
+
* Every unordered pair of distinct NPIs sharing a practice-address key, de-duplicated
|
|
233
|
+
* per address by NPI (first record wins) so single-NPI addresses yield no pair.
|
|
233
234
|
*/
|
|
234
235
|
export declare function colocatedDistinctPairs(byAddr: ReadonlyMap<string, readonly ColocatedProvider[]>): Generator<ColocatedPair>;
|
|
235
236
|
/**
|
|
236
|
-
* The TX facility source specs the cross-source probes share.
|
|
237
|
-
* commitments spec (the exploded two-entity-per-row source).
|
|
237
|
+
* The TX facility source specs the cross-source probes share.
|
|
238
238
|
*/
|
|
239
239
|
export declare const buildSpecs: (S: string, STATE: string) => SourceSpec[];
|
|
240
240
|
/**
|
|
@@ -247,8 +247,10 @@ export interface GBTHyperparameters {
|
|
|
247
247
|
minLeaf: number;
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
250
|
-
* One assembled input row for a cross-source trainer.
|
|
251
|
-
*
|
|
250
|
+
* One assembled input row for a cross-source trainer.
|
|
251
|
+
*
|
|
252
|
+
* Its `npi` field contains the cross-system join key (an NPI or a CCN).
|
|
253
|
+
* The trainer copies that key into `record.id` as the held-out label.
|
|
252
254
|
*/
|
|
253
255
|
export interface CrossSourceRow extends Record<string, string> {
|
|
254
256
|
npi: string;
|
|
@@ -258,7 +260,7 @@ export interface CrossSourceRow extends Record<string, string> {
|
|
|
258
260
|
source: string;
|
|
259
261
|
}
|
|
260
262
|
/**
|
|
261
|
-
* Every figure
|
|
263
|
+
* Every figure passed to {@link TrainCrossSourceModelOptions.meta}.
|
|
262
264
|
*/
|
|
263
265
|
export interface CrossSourceTrainingFigures {
|
|
264
266
|
records: number;
|
|
@@ -279,11 +281,12 @@ export interface TrainCrossSourceModelOptions {
|
|
|
279
281
|
*/
|
|
280
282
|
createGeocoder: EvalGeocoderFactory;
|
|
281
283
|
/**
|
|
282
|
-
* The assembled two-source rows
|
|
284
|
+
* The assembled two-source rows.
|
|
285
|
+
* The caller owns source loading.
|
|
283
286
|
*/
|
|
284
287
|
rows: readonly CrossSourceRow[];
|
|
285
288
|
/**
|
|
286
|
-
* The join keys present in
|
|
289
|
+
* The join keys present in both sources.
|
|
287
290
|
*/
|
|
288
291
|
joined: ReadonlySet<string>;
|
|
289
292
|
addressFrequency: TermFrequencyTable;
|
|
@@ -292,7 +295,7 @@ export interface TrainCrossSourceModelOptions {
|
|
|
292
295
|
*/
|
|
293
296
|
sources: readonly [string, string];
|
|
294
297
|
/**
|
|
295
|
-
*
|
|
298
|
+
* Max cross-source recall subject to this held-out pairwise precision.
|
|
296
299
|
*/
|
|
297
300
|
precisionBar: number;
|
|
298
301
|
/**
|
|
@@ -308,17 +311,18 @@ export interface TrainCrossSourceModelOptions {
|
|
|
308
311
|
*/
|
|
309
312
|
exportPrefix: string;
|
|
310
313
|
/**
|
|
311
|
-
* Assemble the emitted `<prefix>_META` object.
|
|
312
|
-
*
|
|
314
|
+
* Assemble the emitted `<prefix>_META` object.
|
|
315
|
+
*
|
|
316
|
+
* The caller owns field names and order so a retrain diffs cleanly against its committed module.
|
|
313
317
|
*/
|
|
314
318
|
meta: (figures: CrossSourceTrainingFigures) => Record<string, unknown>;
|
|
315
319
|
report?: (line: string) => void;
|
|
316
320
|
}
|
|
317
321
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* inference
|
|
321
|
-
* and emit
|
|
322
|
+
* Geocode and ingest each source under its own provenance label, block the union,
|
|
323
|
+
* keep only cross-source candidate pairs, featurize with `createMatchFeaturizer` so train
|
|
324
|
+
* and inference agree, calibrate the threshold on a held-out split of the join keys,
|
|
325
|
+
* then train and emit the shipped model as a committed TS module.
|
|
322
326
|
*/
|
|
323
327
|
export declare function trainCrossSourceModel(options: TrainCrossSourceModelOptions): Promise<{
|
|
324
328
|
out: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../tools/shared.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAA6B,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAGrF,OAAO,EAQN,KAAK,aAAa,EAElB,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,aAAa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