@mailwoman/entity-resolution 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/address-key.ts +14 -12
- package/lib/geocode-handler.ts +6 -5
- package/lib/geojson.ts +8 -8
- package/lib/index.ts +8 -8
- package/lib/ingest.ts +5 -4
- package/lib/learned-scorer.ts +16 -17
- package/lib/map-html.ts +2 -5
- package/lib/models/crosssource-gbt-en-us.ts +8 -7
- package/lib/models/dedup-gbt-en-us.ts +9 -6
- package/lib/models/org-crosssource-gbt-en-us.ts +8 -7
- package/lib/reconcile.ts +3 -0
- package/lib/resolve.ts +5 -6
- package/lib/types.ts +5 -6
- package/out/address-key.d.ts +11 -12
- package/out/address-key.d.ts.map +1 -1
- package/out/address-key.js +13 -12
- package/out/address-key.js.map +1 -1
- package/out/geocode-handler.d.ts +3 -5
- package/out/geocode-handler.d.ts.map +1 -1
- package/out/geocode-handler.js +5 -5
- package/out/geocode-handler.js.map +1 -1
- package/out/geojson.d.ts +0 -11
- package/out/geojson.d.ts.map +1 -1
- package/out/geojson.js +7 -8
- package/out/geojson.js.map +1 -1
- package/out/index.d.ts +5 -8
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -8
- package/out/index.js.map +1 -1
- package/out/ingest.d.ts +0 -7
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +4 -4
- package/out/ingest.js.map +1 -1
- package/out/learned-scorer.d.ts +11 -15
- package/out/learned-scorer.d.ts.map +1 -1
- package/out/learned-scorer.js +15 -17
- package/out/learned-scorer.js.map +1 -1
- package/out/map-html.d.ts +0 -5
- package/out/map-html.d.ts.map +1 -1
- package/out/map-html.js +2 -5
- package/out/map-html.js.map +1 -1
- package/out/models/crosssource-gbt-en-us.d.ts +5 -7
- package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/crosssource-gbt-en-us.js +2 -10
- package/out/models/crosssource-gbt-en-us.js.map +1 -1
- package/out/models/dedup-gbt-en-us.d.ts +6 -6
- package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
- package/out/models/dedup-gbt-en-us.js +2 -11
- package/out/models/dedup-gbt-en-us.js.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts +5 -7
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.js +2 -10
- package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
- package/out/reconcile.d.ts.map +1 -1
- package/out/reconcile.js +2 -0
- package/out/reconcile.js.map +1 -1
- package/out/resolve.d.ts +1 -5
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +3 -5
- package/out/resolve.js.map +1 -1
- package/out/tools/address-pairs/grade.d.ts +74 -0
- package/out/tools/address-pairs/grade.d.ts.map +1 -0
- package/out/tools/address-pairs/grade.js +184 -0
- package/out/tools/address-pairs/grade.js.map +1 -0
- package/out/tools/address-pairs/sample.d.ts +137 -0
- package/out/tools/address-pairs/sample.d.ts.map +1 -0
- package/out/tools/address-pairs/sample.js +262 -0
- package/out/tools/address-pairs/sample.js.map +1 -0
- package/out/tools/coverage-reconciliation.d.ts +0 -21
- package/out/tools/coverage-reconciliation.d.ts.map +1 -1
- package/out/tools/coverage-reconciliation.js +10 -11
- package/out/tools/coverage-reconciliation.js.map +1 -1
- package/out/tools/cross/dataset-correlation.d.ts +0 -5
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -1
- package/out/tools/cross/dataset-correlation.js +2 -5
- package/out/tools/cross/dataset-correlation.js.map +1 -1
- package/out/tools/cross/source-threshold-sweep.d.ts +0 -12
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -1
- package/out/tools/cross/source-threshold-sweep.js +13 -13
- package/out/tools/cross/source-threshold-sweep.js.map +1 -1
- package/out/tools/dedup-ceiling.d.ts +0 -19
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +14 -13
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +6 -8
- package/out/tools/eval-geocoder.d.ts.map +1 -1
- package/out/tools/eval-geocoder.js +2 -11
- package/out/tools/eval-geocoder.js.map +1 -1
- package/out/tools/geocoder/namesake-probe.d.ts +0 -13
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -1
- package/out/tools/geocoder/namesake-probe.js +8 -8
- package/out/tools/geocoder/namesake-probe.js.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts +0 -17
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.js +10 -10
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -1
- package/out/tools/gold-set-sample.d.ts +0 -20
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +11 -12
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/learned/scorer/clustering-eval.d.ts +0 -17
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/clustering-eval.js +12 -10
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -17
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.js +11 -10
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -1
- package/out/tools/learned/scorer/eval.d.ts +0 -5
- package/out/tools/learned/scorer/eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/eval.js +2 -5
- package/out/tools/learned/scorer/eval.js.map +1 -1
- package/out/tools/matcher-scale.d.ts +0 -5
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +2 -5
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes/dedup-benchmark.d.ts +0 -10
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes/dedup-benchmark.js +10 -10
- package/out/tools/nppes/dedup-benchmark.js.map +1 -1
- package/out/tools/nppes/org-name.d.ts.map +1 -1
- package/out/tools/nppes/org-name.js +2 -0
- package/out/tools/nppes/org-name.js.map +1 -1
- package/out/tools/nppes/overmerge-packet.d.ts +0 -6
- package/out/tools/nppes/overmerge-packet.d.ts.map +1 -1
- package/out/tools/nppes/overmerge-packet.js +2 -3
- package/out/tools/nppes/overmerge-packet.js.map +1 -1
- package/out/tools/nppes/report.d.ts +0 -5
- package/out/tools/nppes/report.d.ts.map +1 -1
- package/out/tools/nppes/report.js +2 -5
- package/out/tools/nppes/report.js.map +1 -1
- package/out/tools/nppes/sample.d.ts +0 -9
- package/out/tools/nppes/sample.d.ts.map +1 -1
- package/out/tools/nppes/sample.js +6 -7
- package/out/tools/nppes/sample.js.map +1 -1
- package/out/tools/nppes/scoring.d.ts +0 -3
- package/out/tools/nppes/scoring.d.ts.map +1 -1
- package/out/tools/nppes/scoring.js +2 -7
- package/out/tools/nppes/scoring.js.map +1 -1
- package/out/tools/nppes/settings.d.ts +2 -6
- package/out/tools/nppes/settings.d.ts.map +1 -1
- package/out/tools/nppes/settings.js +2 -8
- package/out/tools/nppes/settings.js.map +1 -1
- package/out/tools/nppes/truth-grains.d.ts +1 -8
- package/out/tools/nppes/truth-grains.d.ts.map +1 -1
- package/out/tools/nppes/truth-grains.js +3 -4
- package/out/tools/nppes/truth-grains.js.map +1 -1
- package/out/tools/shared.d.ts +0 -7
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +5 -9
- package/out/tools/shared.js.map +1 -1
- package/out/tools/train/cross-gbt.d.ts +0 -25
- package/out/tools/train/cross-gbt.d.ts.map +1 -1
- package/out/tools/train/cross-gbt.js +15 -12
- package/out/tools/train/cross-gbt.js.map +1 -1
- package/out/tools/train/gbt.d.ts +0 -17
- package/out/tools/train/gbt.d.ts.map +1 -1
- package/out/tools/train/gbt.js +15 -14
- package/out/tools/train/gbt.js.map +1 -1
- package/out/tools/train/org-cross-gbt.d.ts +0 -24
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -1
- package/out/tools/train/org-cross-gbt.js +14 -9
- package/out/tools/train/org-cross-gbt.js.map +1 -1
- package/out/tools/txhhsc-to-oarow.d.ts +0 -15
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +4 -6
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/browser.d.ts +0 -10
- package/out/tools/viz/browser.d.ts.map +1 -1
- package/out/tools/viz/browser.js +4 -4
- package/out/tools/viz/browser.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +0 -8
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +4 -5
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +0 -8
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +5 -5
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render/map.d.ts +0 -21
- package/out/tools/viz/render/map.d.ts.map +1 -1
- package/out/tools/viz/render/map.js +9 -11
- package/out/tools/viz/render/map.js.map +1 -1
- package/out/tools/viz/render.d.ts +0 -13
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +9 -9
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +0 -8
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +4 -5
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +0 -5
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +2 -5
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/out/types.d.ts +2 -6
- package/out/types.d.ts.map +1 -1
- package/out/types.js +2 -8
- package/out/types.js.map +1 -1
- package/package.json +10 -9
- package/tools/address-pairs/grade.ts +277 -0
- package/tools/address-pairs/sample.ts +451 -0
- package/tools/coverage-reconciliation.ts +11 -11
- package/tools/cross/dataset-correlation.ts +2 -5
- package/tools/cross/source-threshold-sweep.ts +8 -7
- package/tools/dedup-ceiling.ts +15 -13
- package/tools/eval-geocoder.ts +9 -8
- package/tools/geocoder/namesake-probe.ts +9 -8
- package/tools/geocoder/vs-provided-coords.ts +11 -10
- package/tools/gold-set-sample.ts +12 -12
- package/tools/learned/scorer/clustering-eval.ts +13 -10
- package/tools/learned/scorer/crossstate-eval.ts +12 -10
- package/tools/learned/scorer/eval.ts +2 -5
- package/tools/matcher-scale.ts +2 -5
- package/tools/nppes/dedup-benchmark.ts +6 -5
- package/tools/nppes/org-name.ts +3 -0
- package/tools/nppes/overmerge-packet.ts +3 -3
- package/tools/nppes/report.ts +2 -5
- package/tools/nppes/sample.ts +7 -7
- package/tools/nppes/scoring.ts +3 -3
- package/tools/nppes/settings.ts +5 -6
- package/tools/nppes/truth-grains.ts +4 -4
- package/tools/shared.ts +5 -8
- package/tools/train/cross-gbt.ts +16 -12
- package/tools/train/gbt.ts +15 -13
- package/tools/train/org-cross-gbt.ts +15 -9
- package/tools/txhhsc-to-oarow.ts +5 -6
- package/tools/viz/browser.ts +5 -4
- package/tools/viz/cross-dataset-map.ts +5 -5
- package/tools/viz/geocode-first-surface.ts +6 -5
- package/tools/viz/render/map.ts +10 -11
- package/tools/viz/render.ts +10 -9
- package/tools/viz/source-provenance-map.ts +6 -6
- package/tools/viz/yardstick-figure.ts +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;GAIG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["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAmDD;;GAEG;AACH,wBAAsB,eAAe,CACpC,OAAO,GAAE,sBAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAyH7B"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
|
|
7
4
|
import { escapeHTML } from "@mailwoman/core/strings/escape";
|
|
8
5
|
const GRAINS = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yardstick-figure.js","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"yardstick-figure.js","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAoB3D,MAAM,MAAM,GAAY;IACvB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE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AAE,CAAC,iBAAiB,SAAS,CAAC,GAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAEvD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AACvB,CAAC"}
|
package/out/types.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The application's data shapes — the messy record that goes in and the canonical entity that
|
|
7
|
-
* comes out. Plain interfaces over the `@mailwoman/record` types.
|
|
2
|
+
* The application's data shapes — the messy record that goes in and the canonical entity that comes out.
|
|
3
|
+
* Plain interfaces over the `@mailwoman/record` types.
|
|
8
4
|
*/
|
|
9
5
|
import type { ResolutionTier } from "@mailwoman/annotations/geo";
|
|
10
6
|
import type { OrganizationName, PersonName, PostalAddress } from "@mailwoman/record";
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEpF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IACvB;;OAEG;IACH,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;IAC7B,KAA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CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA"}
|
package/out/types.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The application's data shapes — the messy record that goes in and the canonical entity that
|
|
7
|
-
* comes out. Plain interfaces over the `@mailwoman/record` types.
|
|
8
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
9
3
|
export {};
|
|
10
4
|
// #endregion
|
|
11
5
|
//# sourceMappingURL=types.js.map
|
package/out/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;;AA2GlE,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/entity-resolution",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "The geocode-first record-matching application: resolve messy contact/organization records into canonical, geocoded entities (block → score → cluster) and export them as GeoJSON for spatial analysis. The clinic-funding use case mailwoman was built for.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -95,14 +95,15 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@mailwoman/address-id": "11.
|
|
99
|
-
"@mailwoman/annotations": "11.
|
|
100
|
-
"@mailwoman/
|
|
101
|
-
"@mailwoman/
|
|
102
|
-
"@mailwoman/
|
|
103
|
-
"@mailwoman/
|
|
104
|
-
"@mailwoman/
|
|
105
|
-
"@mailwoman/
|
|
98
|
+
"@mailwoman/address-id": "11.2.0",
|
|
99
|
+
"@mailwoman/annotations": "11.2.0",
|
|
100
|
+
"@mailwoman/codex": "11.2.0",
|
|
101
|
+
"@mailwoman/core": "11.2.0",
|
|
102
|
+
"@mailwoman/match": "11.2.0",
|
|
103
|
+
"@mailwoman/record": "11.2.0",
|
|
104
|
+
"@mailwoman/resolver-wof-sqlite": "11.2.0",
|
|
105
|
+
"@mailwoman/spatial": "11.2.0",
|
|
106
|
+
"@mailwoman/sqlite": "11.2.0",
|
|
106
107
|
"@protomaps/basemaps": "^5.7.2",
|
|
107
108
|
"@sister.software/h3": "^1.1.0",
|
|
108
109
|
"spliterator": "^10.1.1"
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Grades duplicate-detection arms against an adjudicated address pair set, per stratum.
|
|
6
|
+
*
|
|
7
|
+
* An arm predicts, for each pair, whether the lower-ranked row repeats the
|
|
8
|
+
* higher-ranked row's delivery point and may be dropped.
|
|
9
|
+
* Each arm reads the unit as a precondition: two rows whose unit identifiers differ,
|
|
10
|
+
* or of which one states a unit and the other none, are different delivery points,
|
|
11
|
+
* because dropping the unit row would lose the unit.
|
|
12
|
+
*
|
|
13
|
+
* - `rule` is the deterministic rule the layer build applies: the same postcode key,
|
|
14
|
+
* the same unit text, and points within 0.002 degrees.
|
|
15
|
+
* - `rule-unit-identifier` is that rule with the unit compared by identifier, so `#2` and `UNIT 2` agree.
|
|
16
|
+
* - `fellegi-sunter` scores the postcode, locality and distance with `@mailwoman/match`.
|
|
17
|
+
* Its `m` and `u` are fitted by EM on an unlabeled population of candidate pairs, never on the labels.
|
|
18
|
+
* A point a source shares among more than five addresses locates none of them,
|
|
19
|
+
* so a pair touching one has no distance evidence.
|
|
20
|
+
*
|
|
21
|
+
* A pair adjudicated `unsure` is left out of every count.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { usUnitIdentifier } from "@mailwoman/codex/us/unit/designator"
|
|
25
|
+
import {
|
|
26
|
+
agreementPattern,
|
|
27
|
+
type Comparison,
|
|
28
|
+
type ComparisonLevel,
|
|
29
|
+
distanceComparison,
|
|
30
|
+
estimateParameters,
|
|
31
|
+
type FellegiSunterModel,
|
|
32
|
+
scorePair,
|
|
33
|
+
} from "@mailwoman/match"
|
|
34
|
+
import { ADDRESS_DUPLICATE_STACK_LIMIT, addressLocalityKeys } from "@mailwoman/resolver-wof-sqlite/address/duplicate"
|
|
35
|
+
|
|
36
|
+
import {
|
|
37
|
+
type AddressPair,
|
|
38
|
+
type AddressPairRecord,
|
|
39
|
+
type AddressPairStratum,
|
|
40
|
+
RULE_DEGREES,
|
|
41
|
+
} from "#tools/address-pairs/sample"
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The counts and rates of one arm over one set of pairs.
|
|
45
|
+
*/
|
|
46
|
+
export interface ArmGrade {
|
|
47
|
+
truePositive: number
|
|
48
|
+
falsePositive: number
|
|
49
|
+
falseNegative: number
|
|
50
|
+
trueNegative: number
|
|
51
|
+
precision: number | null
|
|
52
|
+
recall: number | null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* One arm's predictions and grades.
|
|
57
|
+
*/
|
|
58
|
+
export interface ArmResult {
|
|
59
|
+
arm: string
|
|
60
|
+
overall: ArmGrade
|
|
61
|
+
byStratum: Partial<Record<AddressPairStratum, ArmGrade>>
|
|
62
|
+
/**
|
|
63
|
+
* Every pair the arm got wrong, for inspection.
|
|
64
|
+
*/
|
|
65
|
+
errors: Array<{
|
|
66
|
+
pairID: string
|
|
67
|
+
stratum: AddressPairStratum
|
|
68
|
+
predicted: boolean
|
|
69
|
+
label: boolean
|
|
70
|
+
score: number | null
|
|
71
|
+
}>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A record's unit identifier, read again from its unit text against its own number and street.
|
|
76
|
+
*/
|
|
77
|
+
export function unitIdentifierOf(record: AddressPairRecord): string | null {
|
|
78
|
+
return usUnitIdentifier(record.unit, { number: record.number, street: record.streetRaw })
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether two records state the same unit by identifier, or neither states one.
|
|
83
|
+
*/
|
|
84
|
+
export function unitsAgree(a: AddressPairRecord, b: AddressPairRecord): boolean {
|
|
85
|
+
return unitIdentifierOf(a) === unitIdentifierOf(b)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function grade(outcomes: ReadonlyArray<{ predicted: boolean; label: boolean }>): ArmGrade {
|
|
89
|
+
let truePositive = 0
|
|
90
|
+
let falsePositive = 0
|
|
91
|
+
let falseNegative = 0
|
|
92
|
+
let trueNegative = 0
|
|
93
|
+
|
|
94
|
+
for (const { predicted, label } of outcomes) {
|
|
95
|
+
if (predicted && label) {
|
|
96
|
+
truePositive++
|
|
97
|
+
} else if (predicted) {
|
|
98
|
+
falsePositive++
|
|
99
|
+
} else if (label) {
|
|
100
|
+
falseNegative++
|
|
101
|
+
} else {
|
|
102
|
+
trueNegative++
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
truePositive,
|
|
108
|
+
falsePositive,
|
|
109
|
+
falseNegative,
|
|
110
|
+
trueNegative,
|
|
111
|
+
precision: truePositive + falsePositive ? truePositive / (truePositive + falsePositive) : null,
|
|
112
|
+
recall: truePositive + falseNegative ? truePositive / (truePositive + falseNegative) : null,
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function gradeArm(
|
|
117
|
+
arm: string,
|
|
118
|
+
pairs: readonly AddressPair[],
|
|
119
|
+
predict: (pair: AddressPair) => { predicted: boolean; score: number | null }
|
|
120
|
+
): ArmResult {
|
|
121
|
+
const rows = pairs.map((pair) => ({ pair, label: pair.adjudication === "same-address", ...predict(pair) }))
|
|
122
|
+
const strata = new Set(rows.map((row) => row.pair.stratum))
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
arm,
|
|
126
|
+
overall: grade(rows),
|
|
127
|
+
byStratum: Object.fromEntries(
|
|
128
|
+
[...strata].map((stratum) => [stratum, grade(rows.filter((row) => row.pair.stratum === stratum))])
|
|
129
|
+
),
|
|
130
|
+
errors: rows
|
|
131
|
+
.filter((row) => row.predicted !== row.label)
|
|
132
|
+
.map((row) => ({
|
|
133
|
+
pairID: row.pair.pairID,
|
|
134
|
+
stratum: row.pair.stratum,
|
|
135
|
+
predicted: row.predicted,
|
|
136
|
+
label: row.label,
|
|
137
|
+
score: row.score,
|
|
138
|
+
})),
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const postcodeComparison: Comparison<AddressPairRecord> = {
|
|
143
|
+
name: "postcode",
|
|
144
|
+
levels: [
|
|
145
|
+
{ label: "same", m: 0.9, u: 0.5 },
|
|
146
|
+
{ label: "different", m: 0.1, u: 0.5 },
|
|
147
|
+
],
|
|
148
|
+
assess: (a, b) =>
|
|
149
|
+
a.postcode && b.postcode && a.postcode !== "0" && b.postcode !== "0" ? (a.postcode === b.postcode ? 0 : 1) : -1,
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const localityKeys = (record: AddressPairRecord) => addressLocalityKeys(record.localities)
|
|
153
|
+
|
|
154
|
+
const localityComparison: Comparison<AddressPairRecord> = {
|
|
155
|
+
name: "locality",
|
|
156
|
+
levels: [
|
|
157
|
+
{ label: "shared-name", m: 0.85, u: 0.3 },
|
|
158
|
+
{ label: "no-shared-name", m: 0.15, u: 0.7 },
|
|
159
|
+
],
|
|
160
|
+
assess(a, b) {
|
|
161
|
+
const ka = localityKeys(a)
|
|
162
|
+
const kb = localityKeys(b)
|
|
163
|
+
|
|
164
|
+
if (!ka.size || !kb.size) return -1
|
|
165
|
+
|
|
166
|
+
return [...ka].some((name) => kb.has(name)) ? 0 : 1
|
|
167
|
+
},
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Seed distance levels for address points: one building, one block, one neighborhood, one town, and farther.
|
|
172
|
+
*/
|
|
173
|
+
export const ADDRESS_POINT_DISTANCE_LEVELS: ComparisonLevel[] = [
|
|
174
|
+
{ label: "same-building", maxKm: 0.05, m: 0.6, u: 0.05 },
|
|
175
|
+
{ label: "same-block", maxKm: 0.5, m: 0.3, u: 0.15 },
|
|
176
|
+
{ label: "same-neighborhood", maxKm: 2, m: 0.07, u: 0.2 },
|
|
177
|
+
{ label: "same-town", maxKm: 10, m: 0.02, u: 0.3 },
|
|
178
|
+
{ label: "far", m: 0.01, u: 0.3 },
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Builds the address-point Fellegi-Sunter model over postcode, locality and distance.
|
|
183
|
+
*
|
|
184
|
+
* The house number is left out: every pair of a postcode key group shares it, so it gives no evidence.
|
|
185
|
+
*/
|
|
186
|
+
export function addressPointModel(): FellegiSunterModel<AddressPairRecord> {
|
|
187
|
+
const distance = distanceComparison<AddressPairRecord>({
|
|
188
|
+
name: "distance",
|
|
189
|
+
extract: (r) => ({ latitude: r.lat, longitude: r.lon }),
|
|
190
|
+
levels: ADDRESS_POINT_DISTANCE_LEVELS.map((level) => ({ ...level })),
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
lambda: 0.5,
|
|
195
|
+
comparisons: [
|
|
196
|
+
postcodeComparison,
|
|
197
|
+
localityComparison,
|
|
198
|
+
{
|
|
199
|
+
...distance,
|
|
200
|
+
assess: (a, b) =>
|
|
201
|
+
a.stack > ADDRESS_DUPLICATE_STACK_LIMIT || b.stack > ADDRESS_DUPLICATE_STACK_LIMIT
|
|
202
|
+
? -1
|
|
203
|
+
: distance.assess(a, b),
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Fits the address-point model by EM on the population pairs whose units agree, the pairs the model decides.
|
|
211
|
+
*/
|
|
212
|
+
export function fitAddressPointModel(population: readonly AddressPair[]): {
|
|
213
|
+
model: FellegiSunterModel<AddressPairRecord>
|
|
214
|
+
lambda: number
|
|
215
|
+
converged: boolean
|
|
216
|
+
fittedOn: number
|
|
217
|
+
} {
|
|
218
|
+
const base = addressPointModel()
|
|
219
|
+
const decided = population.filter((pair) => unitsAgree(pair.higher, pair.lower))
|
|
220
|
+
const patterns = decided.map((pair) => agreementPattern(base.comparisons, pair.higher, pair.lower))
|
|
221
|
+
const fitted = estimateParameters(base, patterns)
|
|
222
|
+
|
|
223
|
+
return { model: fitted.model, lambda: fitted.lambda, converged: fitted.converged, fittedOn: decided.length }
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Grades the three arms over the adjudicated pairs.
|
|
228
|
+
*
|
|
229
|
+
* @param population The unlabeled candidate pairs EM is fitted on.
|
|
230
|
+
* @param threshold The match probability at or above which the Fellegi-Sunter arm drops the lower row.
|
|
231
|
+
*/
|
|
232
|
+
export function gradeAddressPairs(
|
|
233
|
+
pairs: readonly AddressPair[],
|
|
234
|
+
population: readonly AddressPair[],
|
|
235
|
+
threshold = 0.5
|
|
236
|
+
): {
|
|
237
|
+
arms: ArmResult[]
|
|
238
|
+
model: FellegiSunterModel<AddressPairRecord>
|
|
239
|
+
lambda: number
|
|
240
|
+
converged: boolean
|
|
241
|
+
fittedOn: number
|
|
242
|
+
graded: number
|
|
243
|
+
unsure: number
|
|
244
|
+
} {
|
|
245
|
+
const graded = pairs.filter(
|
|
246
|
+
(pair) => pair.adjudication === "same-address" || pair.adjudication === "different-address"
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
const fitted = fitAddressPointModel(population)
|
|
250
|
+
const sameKey = (pair: AddressPair) => pair.stratum !== "postcode-differs"
|
|
251
|
+
|
|
252
|
+
const degrees = (pair: AddressPair) =>
|
|
253
|
+
Math.max(Math.abs(pair.higher.lat - pair.lower.lat), Math.abs(pair.higher.lon - pair.lower.lon))
|
|
254
|
+
|
|
255
|
+
const arms = [
|
|
256
|
+
gradeArm("rule", graded, (pair) => ({ predicted: pair.ruleDrops, score: null })),
|
|
257
|
+
gradeArm("rule-unit-identifier", graded, (pair) => ({
|
|
258
|
+
predicted: sameKey(pair) && unitsAgree(pair.higher, pair.lower) && degrees(pair) <= RULE_DEGREES,
|
|
259
|
+
score: null,
|
|
260
|
+
})),
|
|
261
|
+
gradeArm("fellegi-sunter", graded, (pair) => {
|
|
262
|
+
const { probability } = scorePair(fitted.model, pair.higher, pair.lower)
|
|
263
|
+
|
|
264
|
+
return { predicted: unitsAgree(pair.higher, pair.lower) && probability >= threshold, score: probability }
|
|
265
|
+
}),
|
|
266
|
+
]
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
arms,
|
|
270
|
+
model: fitted.model,
|
|
271
|
+
lambda: fitted.lambda,
|
|
272
|
+
converged: fitted.converged,
|
|
273
|
+
fittedOn: fitted.fittedOn,
|
|
274
|
+
graded: graded.length,
|
|
275
|
+
unsure: pairs.length - graded.length,
|
|
276
|
+
}
|
|
277
|
+
}
|