@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
package/out/resolve.js
CHANGED
|
@@ -3,28 +3,22 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The resolve pipeline
|
|
7
|
-
* (geo-first) → score (Fellegi-Sunter) → cluster → canonical entities.
|
|
6
|
+
* The resolve pipeline wires the matching modules over concrete contact and organization records.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* phone / email; score on name, organization, address key, and great-circle distance — and can
|
|
11
|
-
* fit the scorer's `m`/`u` to the data with EM (`trainEM`), so it runs with no labels and no
|
|
12
|
-
* per-dataset tuning. Everything is overridable: pass your own model, blocking keys, or
|
|
13
|
-
* threshold.
|
|
14
|
-
*
|
|
15
|
-
* Geocoding is assumed already done upstream (each `address` carries its coordinate + canonical
|
|
16
|
-
* key). Wiring mailwoman's parser + geocoder to turn raw rows into `SourceRecord`s is the ingest
|
|
17
|
-
* layer that sits in front of this.
|
|
8
|
+
* The upstream pipeline geocodes each `address` and supplies its coordinate and canonical key.
|
|
18
9
|
*/
|
|
19
10
|
import { DEFAULT_DISTANCE_LEVELS, DEFAULT_SPATIAL_LEVELS, agreementPattern, block, buildTermFrequencyTable, cluster, distanceComparison, estimateParameters, exactKey, geoCellKey, representative, scorePair, similarityComparison, spatialComparison, withTermFrequency, } from "@mailwoman/match";
|
|
20
11
|
import { createGBTScorer } from "#learned-scorer";
|
|
21
12
|
import { DEDUP_GBT_META, DEDUP_GBT_MODEL } from "#models/dedup-gbt-en-us";
|
|
22
13
|
/**
|
|
23
|
-
* Cheap, parse-free normalization for the address-frequency key
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
14
|
+
* Cheap, parse-free normalization for the address-frequency key: uppercase,
|
|
15
|
+
* collapse whitespace, drop punctuation.
|
|
16
|
+
*
|
|
17
|
+
* The count covers distinct entities that share an address.
|
|
18
|
+
* It is computable over millions of rows without geocoding.
|
|
19
|
+
*
|
|
20
|
+
* A crowded clinic or billing address is weak identity evidence.
|
|
21
|
+
* A lonely address is strong.
|
|
28
22
|
*/
|
|
29
23
|
export function addressFrequencyKey(raw) {
|
|
30
24
|
return raw
|
|
@@ -34,7 +28,9 @@ export function addressFrequencyKey(raw) {
|
|
|
34
28
|
.replaceAll(/\s+/g, " ");
|
|
35
29
|
}
|
|
36
30
|
/**
|
|
37
|
-
* Default tiered levels for a name-like text field.
|
|
31
|
+
* Default tiered levels for a name-like text field.
|
|
32
|
+
*
|
|
33
|
+
* `m`/`u` are EM-estimable seeds.
|
|
38
34
|
*/
|
|
39
35
|
const NAME_LEVELS = [
|
|
40
36
|
{ label: "exact", minSimilarity: 1, m: 0.8, u: 0.01 },
|
|
@@ -42,38 +38,42 @@ const NAME_LEVELS = [
|
|
|
42
38
|
{ label: "different", minSimilarity: 0, m: 0.05, u: 0.96 },
|
|
43
39
|
];
|
|
44
40
|
/**
|
|
45
|
-
* Exact-vs-different levels for a normalized phone.
|
|
41
|
+
* Exact-vs-different levels for a normalized phone.
|
|
42
|
+
*
|
|
43
|
+
* A shared line is strong, rarely-coincidental evidence.
|
|
46
44
|
*/
|
|
47
45
|
const PHONE_LEVELS = [
|
|
48
46
|
{ label: "exact", minSimilarity: 1, m: 0.6, u: 0.002 },
|
|
49
47
|
{ label: "different", minSimilarity: 0, m: 0.4, u: 0.998 },
|
|
50
48
|
];
|
|
51
49
|
/**
|
|
52
|
-
* Exact-vs-different levels for a closed-vocabulary code
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Exact-vs-different levels for a closed-vocabulary code set
|
|
51
|
+
* ({@link DefaultModelOptions.exactDiscriminators}), such as NPPES taxonomy codes or license numbers.
|
|
52
|
+
*
|
|
53
|
+
* These are seeds only, since EM refits.
|
|
54
|
+
* `u` starts well above phone's 0.002, because two random providers share a
|
|
55
|
+
* specialty far more often than a phone line.
|
|
55
56
|
*/
|
|
56
57
|
const CODE_SET_LEVELS = [
|
|
57
58
|
{ label: "exact", minSimilarity: 1, m: 0.75, u: 0.08 },
|
|
58
59
|
{ label: "different", minSimilarity: 0, m: 0.25, u: 0.92 },
|
|
59
60
|
];
|
|
60
|
-
/**
|
|
61
|
-
* 1 when the whitespace-joined code sets share ANY code, else 0 (order/count-insensitive, case-folded).
|
|
62
|
-
*/
|
|
63
61
|
function codeSetOverlap(a, b) {
|
|
64
62
|
const sa = new Set(a
|
|
65
63
|
.toUpperCase()
|
|
66
64
|
.split(/\s+/)
|
|
67
|
-
.filter((value) => value.length
|
|
65
|
+
.filter((value) => value.length));
|
|
68
66
|
for (const t of b.toUpperCase().split(/\s+/))
|
|
69
67
|
if (t && sa.has(t))
|
|
70
68
|
return 1;
|
|
71
69
|
return 0;
|
|
72
70
|
}
|
|
73
71
|
/**
|
|
74
|
-
* Last-10-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* Last-10-digit normalization for phone agreement, dropping country code, punctuation and extensions.
|
|
73
|
+
*
|
|
74
|
+
* A shorter digit string is kept as-is, since partial agreement still contributes
|
|
75
|
+
* weight in the comparison model.
|
|
76
|
+
* `null` means no digits at all.
|
|
77
77
|
*/
|
|
78
78
|
export function normalizePhone(raw) {
|
|
79
79
|
if (!raw)
|
|
@@ -82,26 +82,31 @@ export function normalizePhone(raw) {
|
|
|
82
82
|
return digits.length >= 10 ? digits.slice(-10) : digits || null;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* {@link normalizePhone} under the probes' stricter
|
|
86
|
-
*
|
|
87
|
-
*
|
|
85
|
+
* {@link normalizePhone} under the probes' stricter interface, where only a full line counts.
|
|
86
|
+
*
|
|
87
|
+
* Returns the last 10 digits when the input contains at least 10.
|
|
88
|
+
* Returns `""` for shorter input, so callers never receive a partial digit string.
|
|
89
|
+
*
|
|
90
|
+
* Callers guard on truthiness, so `""` reads as no comparable phone rather than a weaker key.
|
|
88
91
|
*/
|
|
89
92
|
export function normalizePhoneStrict(raw) {
|
|
90
93
|
const digits = normalizePhone(raw);
|
|
91
94
|
return digits && digits.length === 10 ? digits : "";
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
|
-
* The identity-corroborating comparisons
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
97
|
+
* The identity-corroborating comparisons: person name, organization and phone.
|
|
98
|
+
*
|
|
99
|
+
* At least one must positively agree before a pair may link, since a shared
|
|
100
|
+
* address provides no identity evidence by itself.
|
|
101
|
+
* Phone is the secondary identifier that rescues a true same-entity link across name drift.
|
|
98
102
|
*/
|
|
99
103
|
const CORROBORATING_FIELDS = new Set(["given", "family", "organization", "phone"]);
|
|
100
104
|
/**
|
|
101
|
-
* The default geocode-first scoring model: name
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
+
* The default geocode-first scoring model: name, organization and a spatial signal.
|
|
106
|
+
*
|
|
107
|
+
* The spatial signal is either two comparisons (address-key similarity and great-circle distance)
|
|
108
|
+
* or, with {@link DefaultModelOptions.collapseSpatial}, one collapsed {@link spatialComparison}.
|
|
109
|
+
* `addressFrequency` down-weights agreement on a crowded address either way.
|
|
105
110
|
*/
|
|
106
111
|
export function buildDefaultModel(opts = {}) {
|
|
107
112
|
const identity = [
|
|
@@ -117,7 +122,7 @@ export function buildDefaultModel(opts = {}) {
|
|
|
117
122
|
identity.push(similarityComparison({
|
|
118
123
|
name: "phone",
|
|
119
124
|
extract: (r) => normalizePhone(r.phone),
|
|
120
|
-
similarity: (a, b) => (a === b ? 1 : 0),
|
|
125
|
+
similarity: (a, b) => (a === b ? 1 : 0),
|
|
121
126
|
levels: PHONE_LEVELS,
|
|
122
127
|
}));
|
|
123
128
|
}
|
|
@@ -132,7 +137,7 @@ export function buildDefaultModel(opts = {}) {
|
|
|
132
137
|
identity.push(similarityComparison({
|
|
133
138
|
name: `attr:${key}`,
|
|
134
139
|
extract: (r) => r.attributes?.[key],
|
|
135
|
-
similarity: codeSetOverlap,
|
|
140
|
+
similarity: codeSetOverlap,
|
|
136
141
|
levels: CODE_SET_LEVELS,
|
|
137
142
|
}));
|
|
138
143
|
}
|
|
@@ -147,12 +152,11 @@ export function buildDefaultModel(opts = {}) {
|
|
|
147
152
|
spatial = withTermFrequency(spatial, {
|
|
148
153
|
table: opts.addressFrequency,
|
|
149
154
|
value: (a) => a.address?.raw ?? null,
|
|
150
|
-
levels: [0],
|
|
155
|
+
levels: [0],
|
|
151
156
|
});
|
|
152
157
|
}
|
|
153
158
|
return { lambda: 0.0001, comparisons: [...identity, spatial] };
|
|
154
159
|
}
|
|
155
|
-
// Legacy two-signal spatial: address-key similarity + great-circle distance (redundant; A1 collapses it).
|
|
156
160
|
let address = similarityComparison({
|
|
157
161
|
name: "address",
|
|
158
162
|
extract: (r) => r.address?.canonicalKey,
|
|
@@ -175,7 +179,8 @@ export function buildDefaultModel(opts = {}) {
|
|
|
175
179
|
};
|
|
176
180
|
}
|
|
177
181
|
/**
|
|
178
|
-
* The default blocking keys
|
|
182
|
+
* The default blocking keys include location and canonical address.
|
|
183
|
+
* They also include phone and email.
|
|
179
184
|
*/
|
|
180
185
|
export function defaultBlockingKeys() {
|
|
181
186
|
return [
|
|
@@ -186,13 +191,12 @@ export function defaultBlockingKeys() {
|
|
|
186
191
|
];
|
|
187
192
|
}
|
|
188
193
|
/**
|
|
189
|
-
* Resolve source records into canonical entities: block
|
|
190
|
-
*
|
|
194
|
+
* Resolve source records into canonical entities: block, score, cluster.
|
|
195
|
+
*
|
|
196
|
+
* Every record belongs to exactly one entity.
|
|
197
|
+
* A record without a confident link forms a singleton entity.
|
|
191
198
|
*/
|
|
192
199
|
export function resolveEntities(records, config = {}) {
|
|
193
|
-
// The proven changes are DEFAULT-ON (#625): the address-frequency down-weight (auto-computed over the
|
|
194
|
-
// input records when not supplied; `false` disables) + the collapsed spatial signal (A1). A new
|
|
195
|
-
// caller gets the strong config out of the box; pass explicit values to override.
|
|
196
200
|
const addressFrequency = config.addressFrequency === false
|
|
197
201
|
? undefined
|
|
198
202
|
: (config.addressFrequency ??
|
|
@@ -207,11 +211,6 @@ export function resolveEntities(records, config = {}) {
|
|
|
207
211
|
exactDiscriminators: config.exactDiscriminators,
|
|
208
212
|
});
|
|
209
213
|
const blockingKeys = config.blockingKeys ?? defaultBlockingKeys();
|
|
210
|
-
// #603: the learned scorer is DEFAULT-ON. An explicit `scorer` overrides everything; otherwise
|
|
211
|
-
// `learnedScorer === false` opts out to the FS baseline, a GBT supplies a custom model, and
|
|
212
|
-
// `true`/omitted uses the bundled DEDUP_GBT_MODEL. The scorer is built over the FIXED
|
|
213
|
-
// collapsed-spatial + address-frequency feature model (matching training, independent of this call's
|
|
214
|
-
// comparison config), using the resolved address-frequency table.
|
|
215
214
|
let scorer = config.scorer;
|
|
216
215
|
let usingBundledModel = false;
|
|
217
216
|
if (!scorer && config.learnedScorer !== false) {
|
|
@@ -223,8 +222,10 @@ export function resolveEntities(records, config = {}) {
|
|
|
223
222
|
addressFrequency: addressFrequency ?? buildTermFrequencyTable([], { normalize: addressFrequencyKey }),
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
|
-
//
|
|
227
|
-
//
|
|
225
|
+
// An explicit threshold wins.
|
|
226
|
+
// Otherwise the bundled model uses its calibrated threshold, because its logit
|
|
227
|
+
// is not in FS-weight units and 0 would over-merge.
|
|
228
|
+
// The FS baseline or a custom model uses 0.
|
|
228
229
|
const threshold = config.threshold ?? (usingBundledModel ? DEDUP_GBT_META.recommendedThreshold : 0);
|
|
229
230
|
const { pairs, droppedBlocks } = block(records, blockingKeys, { maxBlockSize: config.maxBlockSize });
|
|
230
231
|
let scoringModel = model;
|
|
@@ -234,11 +235,9 @@ export function resolveEntities(records, config = {}) {
|
|
|
234
235
|
}
|
|
235
236
|
const links = pairs.map(([a, b]) => {
|
|
236
237
|
const score = scorePair(scoringModel, a, b);
|
|
237
|
-
// #603: a learned scorer (explicit `scorer` or the opt-in `learnedScorer`) replaces the FS weight
|
|
238
|
-
// (same clustering + threshold semantics).
|
|
239
238
|
let weight = scorer ? scorer(a, b) : score.weight;
|
|
240
|
-
//
|
|
241
|
-
// address
|
|
239
|
+
// A link requires positive name or organization corroboration, since a shared
|
|
240
|
+
// address provides no identity evidence by itself.
|
|
242
241
|
if (config.requireCorroboration) {
|
|
243
242
|
const corroborated = score.contributions.some((c) => (CORROBORATING_FIELDS.has(c.name) || c.name.startsWith("attr:")) && c.weight > 0);
|
|
244
243
|
if (!corroborated) {
|
|
@@ -248,9 +247,9 @@ export function resolveEntities(records, config = {}) {
|
|
|
248
247
|
return { a, b, weight };
|
|
249
248
|
});
|
|
250
249
|
const clusters = cluster(records, links, { threshold, linkage: config.linkage });
|
|
251
|
-
// Cohesion
|
|
252
|
-
// in
|
|
253
|
-
//
|
|
250
|
+
// Cohesion is the weakest within-cluster link weight.
|
|
251
|
+
// Compute it in one pass over links with a record-to-cluster index, because filtering
|
|
252
|
+
// every link for every cluster is O(clusters x links) and dominates the resolve at scale.
|
|
254
253
|
const clusterOf = new Map();
|
|
255
254
|
clusters.forEach((group, i) => {
|
|
256
255
|
for (const record of group) {
|
package/out/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../lib/resolve.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../lib/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAON,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,E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AC;IACF,CAAC;IAED,MAAM,QAAQ,GAAqB,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAE,CAAA;QAE9C,OAAO;YACN,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,GAAG;YACnB,UAAU,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS;YACzD,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,CAAC,CAAC,CAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI;SACzF,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,CAAA;AACjE,CAAC"}
|
|
@@ -3,27 +3,18 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Coverage reconciliation
|
|
6
|
+
* Coverage reconciliation, the product output that replaces inspecting the map by eye.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Each resolved entity is classified by the kind of source its records come from. An eligibility
|
|
9
|
+
* source holds providers and facilities, such as NPPES org NPIs or TX HHSC nursing facilities. A
|
|
10
|
+
* funding source holds entities enrolled in a funding program, such as FCC Rural Health Care
|
|
11
|
+
* filings.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* The buckets are enrolled (both an eligibility and a funding record), eligible rather than
|
|
14
|
+
* enrolled (an eligibility record with no funding record resolving to it), and funded rather than
|
|
15
|
+
* in the eligibility set (a funding record with no eligibility record resolving to it).
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - **enrolled** — resolves to BOTH an eligibility and a funding record.
|
|
18
|
-
* - **eligible, not enrolled** — an eligibility record with NO funding record resolving to it (the
|
|
19
|
-
* ANTI-JOIN: the set you currently find by eye).
|
|
20
|
-
* - **funded, not in the eligibility set** — a funding record with no eligibility record resolving to
|
|
21
|
-
* it.
|
|
22
|
-
*
|
|
23
|
-
* Output: GeoJSON (drops on the same map) + a table, each entity tagged with its bucket + source
|
|
24
|
-
* memberships. We produce the reconciled join; what a gap MEANS — and whether it's real or a
|
|
25
|
-
* sampling artifact — is the consumer's call, not ours. This is strictly a set-membership
|
|
26
|
-
* reconciliation, never an allegation.
|
|
17
|
+
* This is strictly a set-membership reconciliation, never an allegation.
|
|
27
18
|
*
|
|
28
19
|
* Run: `mailwoman registry scorer-eval coverage-reconciliation [--cap 2000] [--wof <admin.db>]
|
|
29
20
|
* [--data-root <dir>] [--out-md <md>] [--out-geojson <geojson>]`
|
|
@@ -34,19 +25,27 @@ import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
|
34
25
|
*/
|
|
35
26
|
export interface CoverageReconciliationOptions {
|
|
36
27
|
/**
|
|
37
|
-
* The injected geocoder factory
|
|
28
|
+
* The injected geocoder factory.
|
|
29
|
+
*
|
|
30
|
+
* The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
|
|
38
31
|
*/
|
|
39
32
|
createGeocoder: EvalGeocoderFactory;
|
|
40
33
|
/**
|
|
41
|
-
* Record-matcher sources directory.
|
|
34
|
+
* Record-matcher sources directory.
|
|
35
|
+
*
|
|
36
|
+
* Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`.
|
|
42
37
|
*/
|
|
43
38
|
sources?: string;
|
|
44
39
|
/**
|
|
45
|
-
* Rows kept per source.
|
|
40
|
+
* Rows kept per source.
|
|
41
|
+
*
|
|
42
|
+
* Default 2000.
|
|
46
43
|
*/
|
|
47
44
|
cap?: number;
|
|
48
45
|
/**
|
|
49
|
-
* State filter.
|
|
46
|
+
* State filter.
|
|
47
|
+
*
|
|
48
|
+
* Default TX.
|
|
50
49
|
*/
|
|
51
50
|
state?: string;
|
|
52
51
|
/**
|
|
@@ -59,7 +58,8 @@ export interface CoverageReconciliationOptions {
|
|
|
59
58
|
outGeojson?: string;
|
|
60
59
|
}
|
|
61
60
|
/**
|
|
62
|
-
*
|
|
61
|
+
* Reconcile eligibility and funding sources.
|
|
62
|
+
* Emit the markdown report to stdout.
|
|
63
63
|
*/
|
|
64
64
|
export declare function coverageReconciliation(options: CoverageReconciliationOptions, report?: (line: string) => void): Promise<{
|
|
65
65
|
markdown: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-reconciliation.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"coverage-reconciliation.d.ts","sourceRoot":"","sources":["../../tools/coverage-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG/D;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,6BAA6B,EACtC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqG/B"}
|
|
@@ -3,27 +3,18 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Coverage reconciliation
|
|
6
|
+
* Coverage reconciliation, the product output that replaces inspecting the map by eye.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Each resolved entity is classified by the kind of source its records come from. An eligibility
|
|
9
|
+
* source holds providers and facilities, such as NPPES org NPIs or TX HHSC nursing facilities. A
|
|
10
|
+
* funding source holds entities enrolled in a funding program, such as FCC Rural Health Care
|
|
11
|
+
* filings.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* The buckets are enrolled (both an eligibility and a funding record), eligible rather than
|
|
14
|
+
* enrolled (an eligibility record with no funding record resolving to it), and funded rather than
|
|
15
|
+
* in the eligibility set (a funding record with no eligibility record resolving to it).
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - **enrolled** — resolves to BOTH an eligibility and a funding record.
|
|
18
|
-
* - **eligible, not enrolled** — an eligibility record with NO funding record resolving to it (the
|
|
19
|
-
* ANTI-JOIN: the set you currently find by eye).
|
|
20
|
-
* - **funded, not in the eligibility set** — a funding record with no eligibility record resolving to
|
|
21
|
-
* it.
|
|
22
|
-
*
|
|
23
|
-
* Output: GeoJSON (drops on the same map) + a table, each entity tagged with its bucket + source
|
|
24
|
-
* memberships. We produce the reconciled join; what a gap MEANS — and whether it's real or a
|
|
25
|
-
* sampling artifact — is the consumer's call, not ours. This is strictly a set-membership
|
|
26
|
-
* reconciliation, never an allegation.
|
|
17
|
+
* This is strictly a set-membership reconciliation, never an allegation.
|
|
27
18
|
*
|
|
28
19
|
* Run: `mailwoman registry scorer-eval coverage-reconciliation [--cap 2000] [--wof <admin.db>]
|
|
29
20
|
* [--data-root <dir>] [--out-md <md>] [--out-geojson <geojson>]`
|
|
@@ -38,7 +29,8 @@ import { buildSpecs, stateOption } from "#tools/shared";
|
|
|
38
29
|
const ELIGIBILITY = new Set(["nppes", "txhhsc-nursing"]);
|
|
39
30
|
const FUNDING = new Set(["fcc-rhc"]);
|
|
40
31
|
/**
|
|
41
|
-
*
|
|
32
|
+
* Reconcile eligibility and funding sources.
|
|
33
|
+
* Emit the markdown report to stdout.
|
|
42
34
|
*/
|
|
43
35
|
export async function coverageReconciliation(options, report) {
|
|
44
36
|
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
@@ -47,7 +39,6 @@ export async function coverageReconciliation(options, report) {
|
|
|
47
39
|
const OUT_MD = options.outMd || "";
|
|
48
40
|
const OUT_GEOJSON = options.outGeojson || "";
|
|
49
41
|
const SPECS = buildSpecs(`${SOURCES}`, STATE);
|
|
50
|
-
// --- Ingest each source into one combined record set (geo-first resolve). ---
|
|
51
42
|
const rawBySource = new Map();
|
|
52
43
|
for (const spec of SPECS) {
|
|
53
44
|
report?.(`[A] ${spec.source}: streaming + ${STATE} filter (cap ${CAP})…`);
|
|
@@ -66,7 +57,6 @@ export async function coverageReconciliation(options, report) {
|
|
|
66
57
|
const geocoder = await options.createGeocoder();
|
|
67
58
|
let geo = 0;
|
|
68
59
|
let total = 0;
|
|
69
|
-
// Count placements at the boundary (parity with the retired in-script counter).
|
|
70
60
|
const geocodeForIngest = async (raw) => {
|
|
71
61
|
const g = await geocoder.geocodeAddress(raw);
|
|
72
62
|
total++;
|
|
@@ -87,12 +77,11 @@ export async function coverageReconciliation(options, report) {
|
|
|
87
77
|
geocoder[Symbol.dispose]();
|
|
88
78
|
report?.(` ${records.length} records; geocoded ${geo}/${total} (${((100 * geo) / total).toFixed(1)}%)`);
|
|
89
79
|
report?.("[D] resolving + reconciling…");
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
// GBT default rejects
|
|
80
|
+
// Use the Fellegi-Sunter baseline for this cross-dataset join.
|
|
81
|
+
// It is recall-oriented because the signal is the same facility under a different operational name.
|
|
82
|
+
// The dedup-calibrated GBT default rejects that pair.
|
|
93
83
|
const { entities } = resolveEntities(records, { trainEM: true, collapseSpatial: true, learnedScorer: false });
|
|
94
|
-
//
|
|
95
|
-
// `mailwoman registry --reconcile`, so the script and the CLI can't drift. ---
|
|
84
|
+
// Reconcile through the shared @mailwoman/registry code path, so the script and the CLI agree.
|
|
96
85
|
const config = { eligibilitySources: [...ELIGIBILITY], fundingSources: [...FUNDING] };
|
|
97
86
|
const result = reconcileCoverage(entities, config);
|
|
98
87
|
const geojson = reconciliationGeoJSON(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-reconciliation.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"coverage-reconciliation.js","sourceRoot":"","sources":["../../tools/coverage-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,UAAU,GAIV,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAwCvD;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;AACxD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;AAEpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,OAAsC,EACtC,MAA+B;IAE/B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;IAC5E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI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AAG,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAA;IACtG,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAClD,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAE7C,MAAM,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE;QACvC,KAAK,EAAE,2DAA2D;QAClE,SAAS,EACR,4EAA4E,KAAK,aAAa,GAAG,YAAY;YAC7G,wGAAwG;YACxG,4GAA4G;YAC5G,6BAA6B;QAC9B,UAAU,EACT,4GAA4G;YAC5G,qGAAqG;YACrG,6GAA6G;QAC9G,UAAU,EACT,iCAAiC,GAAG,mEAAmE;YACvG,sGAAsG;YACtG,4FAA4F;QAC7F,cAAc,EAAE,EAAE;KAClB,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAChC,MAAM,EAAE,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QAC9C,MAAM,EAAE,CAAC,aAAa,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,MAAM,YAAY,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
7
|
+
/**
|
|
8
|
+
* Options for {@linkcode crossDatasetCorrelation}.
|
|
9
|
+
*/
|
|
10
|
+
export interface CrossDatasetCorrelationOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Creates the geocoder that resolves the sampled rows.
|
|
13
|
+
*/
|
|
14
|
+
createGeocoder: EvalGeocoderFactory;
|
|
15
|
+
/**
|
|
16
|
+
* The record-matcher sources directory.
|
|
17
|
+
*
|
|
18
|
+
* It defaults to `$MAILWOMAN_DATA_ROOT/record-matcher/sources`.
|
|
19
|
+
*/
|
|
20
|
+
sources?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The number of in-state rows sampled per source for geocoding.
|
|
23
|
+
* It defaults to 300.
|
|
24
|
+
*/
|
|
25
|
+
cap?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The state filter.
|
|
28
|
+
* It defaults to `TX`.
|
|
29
|
+
*/
|
|
30
|
+
state?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to scan every in-state row to build a corpus-wide address-frequency table.
|
|
33
|
+
* It defaults to true.
|
|
34
|
+
*
|
|
35
|
+
* The scan reads the full source files, including the multi-gigabyte NPPES file.
|
|
36
|
+
* When it is false, `resolveEntities` computes frequencies from the sample only.
|
|
37
|
+
*/
|
|
38
|
+
corpusFrequency?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* An optional path for the Markdown report.
|
|
41
|
+
*/
|
|
42
|
+
outMd?: string;
|
|
43
|
+
/**
|
|
44
|
+
* An optional path for the entity GeoJSON FeatureCollection.
|
|
45
|
+
*/
|
|
46
|
+
outGeojson?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Geocodes a sample of each source dataset in one state, resolves the records into entities across sources.
|
|
50
|
+
* It returns a Markdown report of the cross-source links.
|
|
51
|
+
*
|
|
52
|
+
* Progress lines go to `report`.
|
|
53
|
+
* The function also writes the report and GeoJSON when `outMd` or `outGeojson` is set.
|
|
54
|
+
*/
|
|
55
|
+
export declare function crossDatasetCorrelation(options: CrossDatasetCorrelationOptions, report?: (line: string) => void): Promise<{
|
|
56
|
+
markdown: string;
|
|
57
|
+
}>;
|
|
58
|
+
//# sourceMappingURL=dataset-correlation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset-correlation.d.ts","sourceRoot":"","sources":["../../../tools/cross/dataset-correlation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAK/D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,cAAc,EAAE,mBAAmB,CAAA;IAEnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAkDD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,8BAA8B,EACvC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqP/B"}
|