@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
|
@@ -22,10 +22,13 @@ const SOURCE_LABELS = {
|
|
|
22
22
|
};
|
|
23
23
|
const label = (s) => SOURCE_LABELS[s] ?? s;
|
|
24
24
|
/**
|
|
25
|
-
* Which
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Which agency each source belongs to.
|
|
26
|
+
*
|
|
27
|
+
* The two FCC datasets (RHC posted-services + commitments) are one agency.
|
|
28
|
+
* So an NPPES↔FCC or FCC↔TX link is cross-agency, but an RHC↔commitments link is not.
|
|
29
|
+
*
|
|
30
|
+
* `--cross-agency-only` keeps just the entities whose sources span >1 agency: the harder,
|
|
31
|
+
* more striking "no shared key across agencies" subset (most of the raw links are FCC-internal).
|
|
29
32
|
*/
|
|
30
33
|
const SOURCE_AGENCY = {
|
|
31
34
|
nppes: "CMS",
|
|
@@ -36,7 +39,7 @@ const SOURCE_AGENCY = {
|
|
|
36
39
|
const agencyOf = (s) => SOURCE_AGENCY[s] ?? s;
|
|
37
40
|
const sourcesOf = (f) => Array.isArray(f.properties?.sources) ? f.properties.sources : [];
|
|
38
41
|
/**
|
|
39
|
-
* Render the cross-dataset-links GeoJSON to a bucket-colored MapLibre
|
|
42
|
+
* Render the cross-dataset-links GeoJSON to a bucket-colored MapLibre html page.
|
|
40
43
|
*/
|
|
41
44
|
export async function crossDatasetMap(options = {}, report) {
|
|
42
45
|
const IN = options.in || dataRootPath("record-matcher", "2026-06-16-cross-dataset-links.geojson");
|
|
@@ -48,7 +51,7 @@ export async function crossDatasetMap(options = {}, report) {
|
|
|
48
51
|
? { ...parsed, features: parsed.features.filter((f) => new Set(sourcesOf(f).map(agencyOf)).size > 1) }
|
|
49
52
|
: parsed;
|
|
50
53
|
// Synthesize a `bucket` per entity = its sorted source-combination, so toMapHTML colors by the link
|
|
51
|
-
//
|
|
54
|
+
// type (two-source vs the rarer all-three-source spans) rather than the binary cross/single status.
|
|
52
55
|
let triple = 0;
|
|
53
56
|
const comboCounts = new Map();
|
|
54
57
|
for (const f of geojson.features) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-dataset-map.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"cross-dataset-map.js","sourceRoot":"","sources":["../../../tools/viz/cross-dataset-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAG3D,OAAO,EAAuB,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvD;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAwB/B,MAAM,aAAa,GAA2B;IAC7C,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,SAAS;IACpB,qBAAqB,EAAE,iBAAiB;IACxC,gBAAgB,EAAE,SAAS;CAC3B,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAElD;;;;;;;;GAQG;AACH,MAAM,aAAa,GAA2B;IAC7C,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;IAChB,qBAAqB,EAAE,KAAK;IAC5B,gBAAgB,EAAE,SAAS;CAC3B,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,aAAa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C,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,MAAM,EAAE,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAA;IAEpD,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC7C,CAAC"}
|
|
@@ -4,25 +4,30 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Plot string-only and string-plus-distance match probabilities using the record matcher's
|
|
7
|
-
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained
|
|
7
|
+
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained html.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Options for {@linkcode geocodeFirstSurface}.
|
|
11
11
|
*/
|
|
12
12
|
export interface GeocodeFirstSurfaceOptions {
|
|
13
13
|
/**
|
|
14
|
-
* Illustrative prior λ.
|
|
14
|
+
* Illustrative prior λ.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* Production's record matcher uses λ=1e-4 (calibrated for the full multi-field model with phone
|
|
17
|
+
*
|
|
18
|
+
* - Spatial exact-key); here we want the boundary visible in a two-axis projection.
|
|
19
|
+
* Default 0.02.
|
|
17
20
|
*/
|
|
18
21
|
lambda?: number;
|
|
19
22
|
/**
|
|
20
|
-
* Output
|
|
23
|
+
* Output html path.
|
|
24
|
+
*
|
|
25
|
+
* Default `/tmp/geocode-first-surface.html`.
|
|
21
26
|
*/
|
|
22
27
|
outHTML?: string;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
|
-
* Emit the geocode-first decision-surface Plotly
|
|
30
|
+
* Emit the geocode-first decision-surface Plotly html — see the module doc.
|
|
26
31
|
*/
|
|
27
32
|
export declare function geocodeFirstSurface(options?: GeocodeFirstSurfaceOptions, report?: (line: string) => void): Promise<{
|
|
28
33
|
outHTML: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAuDD;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,GAAE,0BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkN9B"}
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Plot string-only and string-plus-distance match probabilities using the record matcher's
|
|
7
|
-
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained
|
|
7
|
+
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained html.
|
|
8
8
|
*/
|
|
9
9
|
import { tempRootPath } from "@mailwoman/core/data-root";
|
|
10
10
|
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
11
|
+
import { stringifyJSON } from "@mailwoman/core/json";
|
|
11
12
|
/**
|
|
12
13
|
* Registry/resolve.ts → NAME_LEVELS.
|
|
13
14
|
*/
|
|
@@ -48,7 +49,7 @@ function distanceWeight(km) {
|
|
|
48
49
|
return levelWeight(DISTANCE_LEVELS.at(-1));
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
|
-
* Emit the geocode-first decision-surface Plotly
|
|
52
|
+
* Emit the geocode-first decision-surface Plotly html — see the module doc.
|
|
52
53
|
*/
|
|
53
54
|
export async function geocodeFirstSurface(options = {}, report) {
|
|
54
55
|
const LAMBDA = options.lambda ?? 0.02;
|
|
@@ -62,8 +63,10 @@ export async function geocodeFirstSurface(options = {}, report) {
|
|
|
62
63
|
* Geocode-first model: name + distance evidence.
|
|
63
64
|
*/
|
|
64
65
|
const pGeocodeFirst = (sim, km) => probabilityFromWeight(PRIOR + nameWeight(sim) + distanceWeight(km));
|
|
65
|
-
// ── Grid.
|
|
66
|
-
//
|
|
66
|
+
// ── Grid.
|
|
67
|
+
// X = string similarity 0→1.
|
|
68
|
+
// Y = geographic distance, sampled denser near 0 (log-ish) so the meaningful same-building
|
|
69
|
+
// / same-block transitions aren't a single pixel. ────────────────
|
|
67
70
|
const NX = 60;
|
|
68
71
|
const NY = 60;
|
|
69
72
|
const KM_MAX = 50; // 0 → 50 km, log-spaced
|
|
@@ -84,11 +87,12 @@ export async function geocodeFirstSurface(options = {}, report) {
|
|
|
84
87
|
label: "Springfield General — IL vs MA",
|
|
85
88
|
detail: "identical name, ~1500 km apart",
|
|
86
89
|
sim: 1,
|
|
87
|
-
km: 15, // plotted on the far plateau (real distance ~1500 km
|
|
90
|
+
km: 15, // plotted on the far plateau (real distance ~1500 km. clamped into view)
|
|
88
91
|
},
|
|
89
92
|
{
|
|
90
|
-
// "St" → "Street" canonicalizes to a high (not exact) name agreement
|
|
91
|
-
// keeps it off 1.0.
|
|
93
|
+
// "St" → "Street" canonicalizes to a high (not exact) name agreement.
|
|
94
|
+
// The trailing "Apt 2" keeps it off 1.0.
|
|
95
|
+
// Lands in the 0.88 "high" tier — same place, drifted-but-recognizable string.
|
|
92
96
|
label: "123 Main St vs 123 Main Street Apt 2",
|
|
93
97
|
detail: "same building, drifted string",
|
|
94
98
|
sim: 0.9,
|
|
@@ -102,7 +106,7 @@ export async function geocodeFirstSurface(options = {}, report) {
|
|
|
102
106
|
stringP: pStringFirst(t.sim, t.km),
|
|
103
107
|
geoP: pGeocodeFirst(t.sim, t.km),
|
|
104
108
|
}));
|
|
105
|
-
// ──
|
|
109
|
+
// ── html. ───────────────────────────────────────────────────────────────────────────────────────
|
|
106
110
|
const data = {
|
|
107
111
|
simAxis,
|
|
108
112
|
kmAxis,
|
|
@@ -112,9 +116,10 @@ export async function geocodeFirstSurface(options = {}, report) {
|
|
|
112
116
|
lambda: LAMBDA,
|
|
113
117
|
prior: PRIOR,
|
|
114
118
|
};
|
|
115
|
-
//
|
|
116
|
-
// later `</script>` no longer ends the element.
|
|
117
|
-
|
|
119
|
+
// Every `<`, not only `</script>`: `<!--` also leaves script-data state in the html
|
|
120
|
+
// tokenizer, after which a later `</script>` no longer ends the element.
|
|
121
|
+
// `\u003c` is the same string to a JSON reader.
|
|
122
|
+
const safe = stringifyJSON(data).replaceAll("<", "\\u003c");
|
|
118
123
|
const html = `<!doctype html><html><head><meta charset="utf-8"/>
|
|
119
124
|
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>
|
|
120
125
|
<style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAkCpD;;GAEG;AACH,MAAM,WAAW,GAAY;IAC5B,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACrD,EAAE,KAAK,EA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E,CACP,KAAK,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CACxJ,CAAA;IACF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC7B,CAAC"}
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Render a {@link toMapHTML} page (MapLibre GL + Protomaps basemap) to a PNG via headless Chromium
|
|
7
|
-
* — the shared map renderer behind the `registry viz` map figures (an internal helper
|
|
7
|
+
* — the shared map renderer behind the `registry viz` map figures (an internal helper rather than a
|
|
8
8
|
* command).
|
|
9
9
|
*
|
|
10
10
|
* Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
|
|
11
11
|
*
|
|
12
12
|
* - MapLibre needs a real WebGL context — the shared harness (`./browser.ts`) provides one through
|
|
13
13
|
* SwiftShader.
|
|
14
|
-
* - The basemap tiles come from `tiles.mailwoman.ai`, which
|
|
15
|
-
* domains
|
|
14
|
+
* - The basemap tiles come from `tiles.mailwoman.ai`, which cors-restricts to localhost + the docs
|
|
15
|
+
* domains . Therefore, the page must be served over localhost rather than opened as a file (a file:// page
|
|
16
16
|
* renders accurate markers on a blank basemap). Serve the output dir first, e.g. `python3 -m
|
|
17
17
|
* http.server 8899 -d <dir>`, then point this at `http://localhost:8899/<page>.html`.
|
|
18
18
|
*
|
|
19
|
-
* The map paints asynchronously after the network settles
|
|
19
|
+
* The map paints asynchronously after the network settles. we wait for networkidle, then a fixed
|
|
20
20
|
* beat for the basemap tiles + marker layer to finish compositing.
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
export interface RenderMapOptions {
|
|
26
26
|
/**
|
|
27
|
-
* The served localhost URL of the map page (
|
|
27
|
+
* The served localhost URL of the map page (not a file:// path — see the module doc).
|
|
28
28
|
*/
|
|
29
29
|
url: string;
|
|
30
30
|
/**
|
|
@@ -39,4 +39,4 @@ export declare function renderServedMapToPNG(options: RenderMapOptions, report?:
|
|
|
39
39
|
outPNG: string;
|
|
40
40
|
consoleErrors: string[];
|
|
41
41
|
}>;
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../../tools/viz/render/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,gBAAgB,EACzB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAgBtD"}
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Render a {@link toMapHTML} page (MapLibre GL + Protomaps basemap) to a PNG via headless Chromium
|
|
7
|
-
* — the shared map renderer behind the `registry viz` map figures (an internal helper
|
|
7
|
+
* — the shared map renderer behind the `registry viz` map figures (an internal helper rather than a
|
|
8
8
|
* command).
|
|
9
9
|
*
|
|
10
10
|
* Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
|
|
11
11
|
*
|
|
12
12
|
* - MapLibre needs a real WebGL context — the shared harness (`./browser.ts`) provides one through
|
|
13
13
|
* SwiftShader.
|
|
14
|
-
* - The basemap tiles come from `tiles.mailwoman.ai`, which
|
|
15
|
-
* domains
|
|
14
|
+
* - The basemap tiles come from `tiles.mailwoman.ai`, which cors-restricts to localhost + the docs
|
|
15
|
+
* domains . Therefore, the page must be served over localhost rather than opened as a file (a file:// page
|
|
16
16
|
* renders accurate markers on a blank basemap). Serve the output dir first, e.g. `python3 -m
|
|
17
17
|
* http.server 8899 -d <dir>`, then point this at `http://localhost:8899/<page>.html`.
|
|
18
18
|
*
|
|
19
|
-
* The map paints asynchronously after the network settles
|
|
19
|
+
* The map paints asynchronously after the network settles. we wait for networkidle, then a fixed
|
|
20
20
|
* beat for the basemap tiles + marker layer to finish compositing.
|
|
21
21
|
*/
|
|
22
22
|
import { withChromiumPage } from "#tools/viz/browser";
|
|
@@ -26,7 +26,8 @@ import { withChromiumPage } from "#tools/viz/browser";
|
|
|
26
26
|
export async function renderServedMapToPNG(options, report) {
|
|
27
27
|
const { consoleErrors: errors } = await withChromiumPage({ viewport: { width: 1100, height: 760 } }, async (page) => {
|
|
28
28
|
await page.goto(options.url, { waitUntil: "networkidle", timeout: 30_000 });
|
|
29
|
-
// MapLibre composites tiles + the marker layer async after the network settles
|
|
29
|
+
// MapLibre composites tiles + the marker layer async after the network settles.
|
|
30
|
+
// Give it a beat.
|
|
30
31
|
await page.waitForTimeout(4000);
|
|
31
32
|
await page.screenshot({ path: options.outPNG });
|
|
32
33
|
});
|
|
@@ -36,4 +37,4 @@ export async function renderServedMapToPNG(options, report) {
|
|
|
36
37
|
}
|
|
37
38
|
return { outPNG: options.outPNG, consoleErrors: errors };
|
|
38
39
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../../tools/viz/render/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAgBrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,OAAyB,EACzB,MAA+B;IAE/B,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnH,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QAC3E,gFAAgF;QAChF,kBAAkB;QAClB,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC/B,MAAM,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,CAAC,gBAAgB,OAAO,CAAC,MAAM,oBAAoB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IAE3E,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;IACnB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Render a self-contained Plotly
|
|
7
|
-
* the `registry viz` figures (an internal helper
|
|
6
|
+
* Render a self-contained Plotly html to a PNG via headless Chromium — the shared renderer behind
|
|
7
|
+
* the `registry viz` figures (an internal helper rather than a command).
|
|
8
8
|
*
|
|
9
|
-
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context
|
|
10
|
-
* (`./browser.ts`) provides through SwiftShader
|
|
9
|
+
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context. The shared harness
|
|
10
|
+
* (`./browser.ts`) provides through SwiftShader. 2D traces (`contour`/`heatmap`) render on the 2D
|
|
11
11
|
* canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div rather
|
|
12
12
|
* than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export interface RenderPlotlyOptions {
|
|
18
18
|
/**
|
|
19
|
-
* The self-contained Plotly
|
|
19
|
+
* The self-contained Plotly html file.
|
|
20
20
|
*/
|
|
21
21
|
inHTML: string;
|
|
22
22
|
/**
|
|
@@ -24,16 +24,20 @@ export interface RenderPlotlyOptions {
|
|
|
24
24
|
*/
|
|
25
25
|
outPNG: string;
|
|
26
26
|
/**
|
|
27
|
-
* Viewport width.
|
|
27
|
+
* Viewport width.
|
|
28
|
+
*
|
|
29
|
+
* Default 1160.
|
|
28
30
|
*/
|
|
29
31
|
width?: number;
|
|
30
32
|
/**
|
|
31
|
-
* Viewport height.
|
|
33
|
+
* Viewport height.
|
|
34
|
+
*
|
|
35
|
+
* Default 1000.
|
|
32
36
|
*/
|
|
33
37
|
height?: number;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
|
-
* Screenshot a Plotly
|
|
40
|
+
* Screenshot a Plotly html page after every graph div's `plotly_afterplot` fires.
|
|
37
41
|
*/
|
|
38
42
|
export declare function renderPlotlyHTMLToPNG(options: RenderPlotlyOptions, report?: (line: string) => void): Promise<{
|
|
39
43
|
outPNG: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,mBAAmB,EAC5B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAmDtD"}
|
package/out/tools/viz/render.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Render a self-contained Plotly
|
|
7
|
-
* the `registry viz` figures (an internal helper
|
|
6
|
+
* Render a self-contained Plotly html to a PNG via headless Chromium — the shared renderer behind
|
|
7
|
+
* the `registry viz` figures (an internal helper rather than a command).
|
|
8
8
|
*
|
|
9
|
-
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context
|
|
10
|
-
* (`./browser.ts`) provides through SwiftShader
|
|
9
|
+
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context. The shared harness
|
|
10
|
+
* (`./browser.ts`) provides through SwiftShader. 2D traces (`contour`/`heatmap`) render on the 2D
|
|
11
11
|
* canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div rather
|
|
12
12
|
* than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
13
13
|
*/
|
|
@@ -15,13 +15,14 @@ import { pathToFileURL } from "@mailwoman/core/module/file-url";
|
|
|
15
15
|
import { resolvePath as resolve } from "path-ts";
|
|
16
16
|
import { withChromiumPage } from "#tools/viz/browser";
|
|
17
17
|
/**
|
|
18
|
-
* Screenshot a Plotly
|
|
18
|
+
* Screenshot a Plotly html page after every graph div's `plotly_afterplot` fires.
|
|
19
19
|
*/
|
|
20
20
|
export async function renderPlotlyHTMLToPNG(options, report) {
|
|
21
21
|
const { consoleErrors: errors } = await withChromiumPage({ viewport: { width: options.width ?? 1160, height: options.height ?? 1000 } }, async (page) => {
|
|
22
22
|
await page.goto(pathToFileURL(resolve(options.inHTML)).href, { waitUntil: "networkidle" });
|
|
23
|
-
// Resolve once every Plotly graph div has fired plotly_afterplot
|
|
24
|
-
// newPlot's promise resolves), with a per-div fallback
|
|
23
|
+
// Resolve once every Plotly graph div has fired plotly_afterplot
|
|
24
|
+
// (3D paints land async, after newPlot's promise resolves), with a per-div fallback
|
|
25
|
+
// so an already-painted div can't hang us.
|
|
25
26
|
await page.evaluate(async () => {
|
|
26
27
|
const doc = Reflect.get(globalThis, "document");
|
|
27
28
|
const divs = [...doc.querySelectorAll("div")]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAC/D,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AA4BrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,OAA4B,EAC5B,MAA+B;IAE/B,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CACvD,EAAE,QAAQ,EAAE,EAAE,KAAK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AM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IACzE,CAAC,CACD,CAAA;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,EAAE,CAAC,YAAY,MAAM,CAAC,MAAM,oBAAoB,CAAC,CAAA;QAEvD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACpC,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;QACnB,CAAC;IACF,CAAC;IAED,MAAM,EAAE,CAAC,YAAY,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -4,34 +4,46 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
-
* The output requires an
|
|
7
|
+
* The output requires an http origin because the tile server does not serve `file:` origins.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Options for {@linkcode sourceProvenanceMap}.
|
|
11
11
|
*/
|
|
12
12
|
export interface SourceProvenanceMapOptions {
|
|
13
13
|
/**
|
|
14
|
-
* State (lowercase postal).
|
|
14
|
+
* State (lowercase postal).
|
|
15
|
+
*
|
|
16
|
+
* Default ny.
|
|
15
17
|
*/
|
|
16
18
|
state?: string;
|
|
17
19
|
/**
|
|
18
|
-
* Address-point DB path.
|
|
20
|
+
* Address-point DB path.
|
|
21
|
+
*
|
|
22
|
+
* Default `$MAILWOMAN_DATA_ROOT/db/address-points/address-points-us-<state>.db`.
|
|
19
23
|
*/
|
|
20
24
|
db?: string;
|
|
21
25
|
/**
|
|
22
|
-
* Output
|
|
26
|
+
* Output html path.
|
|
27
|
+
*
|
|
28
|
+
* Default `/tmp/source-provenance.html`.
|
|
23
29
|
*/
|
|
24
30
|
outHTML?: string;
|
|
25
31
|
/**
|
|
26
|
-
* Keep ~1/N of NAD points.
|
|
32
|
+
* Keep ~1/N of NAD points.
|
|
33
|
+
*
|
|
34
|
+
* Default 700.
|
|
27
35
|
*/
|
|
28
36
|
nadMod?: number;
|
|
29
37
|
/**
|
|
30
|
-
* Keep ~1/N of OpenAddresses points.
|
|
38
|
+
* Keep ~1/N of OpenAddresses points.
|
|
39
|
+
*
|
|
40
|
+
* Default 120.
|
|
31
41
|
*/
|
|
32
42
|
oaMod?: number;
|
|
33
43
|
/**
|
|
34
|
-
* Per-source marker cap.
|
|
44
|
+
* Per-source marker cap.
|
|
45
|
+
*
|
|
46
|
+
* Default 7000.
|
|
35
47
|
*/
|
|
36
48
|
cap?: number;
|
|
37
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAwBD;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,GAAE,0BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAgE9C"}
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
-
* The output requires an
|
|
7
|
+
* The output requires an http origin because the tile server does not serve `file:` origins.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { tempRootPath } from "@mailwoman/core/data-root";
|
|
10
10
|
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
11
11
|
import { isPresent } from "@mailwoman/core/objects";
|
|
12
|
+
import { addressPointDatabasePath } from "@mailwoman/resolver-wof-sqlite/paths";
|
|
12
13
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
13
14
|
import { toMapHTML } from "#index";
|
|
14
|
-
// Collapse the raw `source` string into a human, mappable category.
|
|
15
|
-
// "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data"
|
|
16
|
-
//
|
|
15
|
+
// Collapse the raw `source` string into a human, mappable category.
|
|
16
|
+
// The address-point DB stores e.g. "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data".
|
|
17
|
+
// The suffix gives the real upstream publisher.
|
|
18
|
+
// Color features by that value (the "overture:" prefix is just the theme it arrived in).
|
|
17
19
|
function categorize(source) {
|
|
18
20
|
if (source === "overture:NAD")
|
|
19
21
|
return { bucket: "National Address Database", publisher: "NAD (federal)" };
|
|
@@ -28,14 +30,15 @@ function categorize(source) {
|
|
|
28
30
|
*/
|
|
29
31
|
export async function sourceProvenanceMap(options = {}, report) {
|
|
30
32
|
const STATE = (options.state || "ny").toLowerCase();
|
|
31
|
-
const DB = options.db ||
|
|
33
|
+
const DB = options.db || addressPointDatabasePath(`address-points-us-${STATE}.db`);
|
|
32
34
|
const OUT = options.outHTML || tempRootPath("source-provenance.html");
|
|
33
35
|
const NAD_MOD = options.nadMod ?? 700; // keep ~1/700 of NAD points
|
|
34
36
|
const OA_MOD = options.oaMod ?? 120; // keep ~1/120 of OpenAddresses points
|
|
35
37
|
const CAP = options.cap ?? 7000; // per-source marker cap
|
|
36
38
|
using db = new DatabaseClient(DB, { readOnly: true });
|
|
37
|
-
// Two stratified samples so the smaller source (OpenAddresses, ~1/6 of NY) stays visible
|
|
38
|
-
// abs(random()) % mod == 0 keeps a spatially-uniform ~1/mod fraction
|
|
39
|
+
// Two stratified samples so the smaller source (OpenAddresses, ~1/6 of NY) stays visible
|
|
40
|
+
// next to NAD. abs(random()) % mod == 0 keeps a spatially-uniform ~1/mod fraction.
|
|
41
|
+
// Limit caps the marker count.
|
|
39
42
|
const sample = (where, mod) => db
|
|
40
43
|
.prepare(`SELECT lat, lon, source, number, street_raw FROM address_point
|
|
41
44
|
WHERE ${where} AND lat IS NOT NULL AND lon IS NOT NULL AND abs(random()) % ${mod} = 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EAAuB,SAAS,EAAE,MAAM,QAAQ,CAAA;AA4CvD,oEAAoE;AACpE,gGAAgG;AAChG,gDAAgD;AAChD,yFAAyF;AACzF,SAAS,UAAU,CAAC,MAAc;IACjC,IAAI,MAAM,KAAK,cAAc;QAAE,OAAO,EAAE,MAAM,EAAE,2BAA2B,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;IAEzG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,OAAO;QACf,OAAO,EAAE,QAAQ;KACjB,CAAC,CAAA;IAEF,MAAM,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/B,MAAM,EAAE,CAAC,aAAa,GAAG,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,CAAA;IAEzD,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -2,33 +2,14 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The yardstick figure — "the dedup F1 climbs as the entity-truth gets honest."
|
|
7
|
-
*
|
|
8
|
-
* The #625 finding, made visual: the matcher's MEASURED dedup quality depends almost entirely on
|
|
9
|
-
* which ruler you grade it against, not on the model. NPI-as-truth OVER-SEGMENTS (one org holds
|
|
10
|
-
* many NPIs), so the matcher's correct co-located same-org merges are scored as errors. Grade the
|
|
11
|
-
* IDENTICAL clusters against a gold-set-validated org-name truth and the F1 climbs — the ruler
|
|
12
|
-
* ceasing to charge for correct merges, not the model changing — peaking when the ruler keys on
|
|
13
|
-
* the geocoded BUILDING (the geocode-first coordinate) rather than the address string (+14.5pp
|
|
14
|
-
* NPI → coord).
|
|
15
|
-
*
|
|
16
|
-
* A slope chart over four rulers (NPI → site → org-name → org-name-coord) for the shipped GBT
|
|
17
|
-
* scorer and the FS baseline. Numbers are the committed measurement in
|
|
18
|
-
* `docs/records/evals/matcher-dedup/2026-06-16-dedup-dual-level-benchmark.md` (1000 TX NPIs → 2757 records).
|
|
19
|
-
*
|
|
20
|
-
* Emits a self-contained SVG (the docs' committed-chart-asset convention — see
|
|
21
|
-
* `docs/records/evals/charts/*.svg`), no browser required.
|
|
22
|
-
*
|
|
23
|
-
* Run: `mailwoman registry viz yardstick-figure
|
|
24
|
-
* [--out-svg docs/records/evals/charts/dedup-yardstick.svg]`
|
|
25
5
|
*/
|
|
26
6
|
/**
|
|
27
7
|
* Options for {@linkcode yardstickFigure}.
|
|
28
8
|
*/
|
|
29
9
|
export interface YardstickFigureOptions {
|
|
30
10
|
/**
|
|
31
|
-
*
|
|
11
|
+
* Sets the output SVG path relative to the working directory, defaulting
|
|
12
|
+
* to `docs/records/evals/charts/dedup-yardstick.svg`.
|
|
32
13
|
*/
|
|
33
14
|
outSVG?: string;
|
|
34
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;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"}
|