@mailwoman/registry 9.1.0 → 9.3.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 +2 -2
- package/{address-key.ts → lib/address-key.ts} +1 -1
- package/{geocode-handler.ts → lib/geocode-handler.ts} +7 -7
- package/{geojson.ts → lib/geojson.ts} +12 -6
- package/{index.ts → lib/index.ts} +10 -10
- package/{ingest.ts → lib/ingest.ts} +77 -69
- package/{learned-scorer.ts → lib/learned-scorer.ts} +1 -1
- package/{map-html.ts → lib/map-html.ts} +10 -16
- package/{reconcile.ts → lib/reconcile.ts} +9 -24
- package/{resolve.ts → lib/resolve.ts} +31 -13
- package/{tools → lib/tools}/coverage-reconciliation.ts +13 -15
- package/{tools → lib/tools}/cross-dataset-correlation.ts +64 -139
- package/{tools → lib/tools}/cross-source-threshold-sweep.ts +21 -32
- package/{tools → lib/tools}/dedup-ceiling.ts +33 -144
- package/{tools → lib/tools}/eval-geocoder.ts +10 -11
- package/{tools → lib/tools}/geocoder-namesake-probe.ts +5 -12
- package/{tools → lib/tools}/geocoder-vs-provided-coords.ts +12 -11
- package/lib/tools/gold-set-sample.ts +141 -0
- package/lib/tools/index.ts +31 -0
- package/{tools → lib/tools}/learned-scorer-clustering-eval.ts +71 -260
- package/{tools → lib/tools}/learned-scorer-crossstate-eval.ts +62 -245
- package/{tools → lib/tools}/learned-scorer-eval.ts +64 -263
- package/{tools → lib/tools}/matcher-scale.ts +5 -5
- package/lib/tools/nppes/org-name.ts +23 -0
- package/lib/tools/nppes/overmerge-packet.ts +94 -0
- package/lib/tools/nppes/report.ts +373 -0
- package/lib/tools/nppes/sample.ts +245 -0
- package/lib/tools/nppes/scoring.ts +114 -0
- package/lib/tools/nppes/settings.ts +102 -0
- package/lib/tools/nppes/truth-grains.ts +161 -0
- package/lib/tools/nppes-dedup-benchmark.ts +408 -0
- package/lib/tools/shared.ts +763 -0
- package/lib/tools/train-cross-gbt.ts +209 -0
- package/{tools → lib/tools}/train-gbt.ts +38 -156
- package/lib/tools/train-org-cross-gbt.ts +179 -0
- package/{tools → lib/tools}/txhhsc-to-oarow.ts +10 -28
- package/lib/tools/viz/browser.ts +50 -0
- package/{tools → lib/tools}/viz/cross-dataset-map.ts +16 -39
- package/{tools → lib/tools}/viz/geocode-first-surface.ts +13 -39
- package/{tools → lib/tools}/viz/render-map.ts +10 -23
- package/lib/tools/viz/render.ts +98 -0
- package/{tools → lib/tools}/viz/source-provenance-map.ts +20 -39
- package/{tools → lib/tools}/viz/yardstick-figure.ts +6 -5
- package/{types.ts → lib/types.ts} +10 -1
- package/out/address-key.d.ts +1 -1
- package/out/address-key.d.ts.map +1 -1
- package/out/address-key.js.map +1 -1
- package/out/geocode-handler.d.ts +6 -6
- package/out/geocode-handler.d.ts.map +1 -1
- package/out/geocode-handler.js +6 -6
- package/out/geocode-handler.js.map +1 -1
- package/out/geojson.d.ts +7 -2
- package/out/geojson.d.ts.map +1 -1
- package/out/geojson.js +8 -5
- package/out/geojson.js.map +1 -1
- package/out/index.d.ts +10 -10
- package/out/index.d.ts.map +1 -1
- package/out/index.js +10 -10
- package/out/index.js.map +1 -1
- package/out/ingest.d.ts +64 -46
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +33 -46
- package/out/ingest.js.map +1 -1
- package/out/learned-scorer.d.ts +1 -1
- package/out/learned-scorer.d.ts.map +1 -1
- package/out/learned-scorer.js.map +1 -1
- package/out/map-html.d.ts +4 -4
- package/out/map-html.d.ts.map +1 -1
- package/out/map-html.js +6 -11
- package/out/map-html.js.map +1 -1
- package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/crosssource-gbt-en-us.js.map +1 -1
- package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
- package/out/models/dedup-gbt-en-us.js.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
- package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
- package/out/reconcile.d.ts +6 -1
- package/out/reconcile.d.ts.map +1 -1
- package/out/reconcile.js +7 -21
- package/out/reconcile.js.map +1 -1
- package/out/resolve.d.ts +19 -7
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +20 -6
- package/out/resolve.js.map +1 -1
- package/out/tools/coverage-reconciliation.d.ts +1 -1
- package/out/tools/coverage-reconciliation.d.ts.map +1 -1
- package/out/tools/coverage-reconciliation.js +12 -12
- package/out/tools/coverage-reconciliation.js.map +1 -1
- package/out/tools/cross-dataset-correlation.d.ts +4 -4
- package/out/tools/cross-dataset-correlation.d.ts.map +1 -1
- package/out/tools/cross-dataset-correlation.js +60 -111
- package/out/tools/cross-dataset-correlation.js.map +1 -1
- package/out/tools/cross-source-threshold-sweep.d.ts +2 -2
- package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -1
- package/out/tools/cross-source-threshold-sweep.js +19 -27
- package/out/tools/cross-source-threshold-sweep.js.map +1 -1
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +36 -118
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +9 -13
- package/out/tools/eval-geocoder.d.ts.map +1 -1
- package/out/tools/eval-geocoder.js +2 -2
- package/out/tools/eval-geocoder.js.map +1 -1
- package/out/tools/geocoder-namesake-probe.d.ts +2 -2
- package/out/tools/geocoder-namesake-probe.d.ts.map +1 -1
- package/out/tools/geocoder-namesake-probe.js +4 -8
- package/out/tools/geocoder-namesake-probe.js.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts +1 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.js +11 -9
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
- package/out/tools/gold-set-sample.d.ts +5 -5
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +37 -121
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +24 -29
- package/out/tools/index.d.ts.map +1 -1
- package/out/tools/index.js +24 -29
- package/out/tools/index.js.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.d.ts +1 -1
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.js +35 -170
- package/out/tools/learned-scorer-clustering-eval.js.map +1 -1
- package/out/tools/learned-scorer-crossstate-eval.d.ts +5 -5
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-crossstate-eval.js +44 -166
- package/out/tools/learned-scorer-crossstate-eval.js.map +1 -1
- package/out/tools/learned-scorer-eval.d.ts +1 -1
- package/out/tools/learned-scorer-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-eval.js +37 -173
- package/out/tools/learned-scorer-eval.js.map +1 -1
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +5 -5
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes/org-name.d.ts +21 -0
- package/out/tools/nppes/org-name.d.ts.map +1 -0
- package/out/tools/nppes/org-name.js +13 -0
- package/out/tools/nppes/org-name.js.map +1 -0
- package/out/tools/nppes/overmerge-packet.d.ts +39 -0
- package/out/tools/nppes/overmerge-packet.d.ts.map +1 -0
- package/out/tools/nppes/overmerge-packet.js +55 -0
- package/out/tools/nppes/overmerge-packet.js.map +1 -0
- package/out/tools/nppes/report.d.ts +93 -0
- package/out/tools/nppes/report.d.ts.map +1 -0
- package/out/tools/nppes/report.js +186 -0
- package/out/tools/nppes/report.js.map +1 -0
- package/out/tools/nppes/sample.d.ts +90 -0
- package/out/tools/nppes/sample.d.ts.map +1 -0
- package/out/tools/nppes/sample.js +131 -0
- package/out/tools/nppes/sample.js.map +1 -0
- package/out/tools/nppes/scoring.d.ts +36 -0
- package/out/tools/nppes/scoring.d.ts.map +1 -0
- package/out/tools/nppes/scoring.js +80 -0
- package/out/tools/nppes/scoring.js.map +1 -0
- package/out/tools/nppes/settings.d.ts +38 -0
- package/out/tools/nppes/settings.d.ts.map +1 -0
- package/out/tools/nppes/settings.js +79 -0
- package/out/tools/nppes/settings.js.map +1 -0
- package/out/tools/nppes/truth-grains.d.ts +50 -0
- package/out/tools/nppes/truth-grains.d.ts.map +1 -0
- package/out/tools/nppes/truth-grains.js +123 -0
- package/out/tools/nppes/truth-grains.js.map +1 -0
- package/out/tools/nppes-dedup-benchmark.d.ts +7 -3
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes-dedup-benchmark.js +106 -673
- package/out/tools/nppes-dedup-benchmark.js.map +1 -1
- package/out/tools/shared.d.ts +244 -7
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +353 -21
- package/out/tools/shared.js.map +1 -1
- package/out/tools/train-cross-gbt.d.ts +7 -7
- package/out/tools/train-cross-gbt.d.ts.map +1 -1
- package/out/tools/train-cross-gbt.js +47 -145
- package/out/tools/train-cross-gbt.js.map +1 -1
- package/out/tools/train-gbt.d.ts +7 -7
- package/out/tools/train-gbt.d.ts.map +1 -1
- package/out/tools/train-gbt.js +31 -111
- package/out/tools/train-gbt.js.map +1 -1
- package/out/tools/train-org-cross-gbt.d.ts +7 -5
- package/out/tools/train-org-cross-gbt.d.ts.map +1 -1
- package/out/tools/train-org-cross-gbt.js +45 -141
- package/out/tools/train-org-cross-gbt.js.map +1 -1
- package/out/tools/txhhsc-to-oarow.d.ts +2 -2
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +9 -23
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/browser.d.ts +34 -0
- package/out/tools/viz/browser.d.ts.map +1 -0
- package/out/tools/viz/browser.js +33 -0
- package/out/tools/viz/browser.js.map +1 -0
- package/out/tools/viz/cross-dataset-map.d.ts +4 -25
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +12 -33
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +6 -35
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +10 -37
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render-map.d.ts +3 -6
- package/out/tools/viz/render-map.d.ts.map +1 -1
- package/out/tools/viz/render-map.js +9 -19
- package/out/tools/viz/render-map.js.map +1 -1
- package/out/tools/viz/render.d.ts +4 -9
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +24 -39
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +4 -24
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +12 -32
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +2 -2
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +5 -4
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/out/types.d.ts +11 -1
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/package.json +180 -11
- package/tools/gold-set-sample.ts +0 -252
- package/tools/index.ts +0 -36
- package/tools/nppes-dedup-benchmark.ts +0 -1180
- package/tools/shared.ts +0 -160
- package/tools/train-cross-gbt.ts +0 -358
- package/tools/train-org-cross-gbt.ts +0 -329
- package/tools/viz/render.ts +0 -113
- /package/{models → lib/models}/crosssource-gbt-en-us.ts +0 -0
- /package/{models → lib/models}/dedup-gbt-en-us.ts +0 -0
- /package/{models → lib/models}/org-crosssource-gbt-en-us.ts +0 -0
|
@@ -3,38 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* What a reader should walk away with: **geography is the primary key; string similarity only
|
|
9
|
-
* refines within a place.** The figure makes that legible as a _landscape_. Two surfaces of
|
|
10
|
-
* P(match) over the same record-pair space (string similarity × geographic distance), scored by
|
|
11
|
-
* the SAME Fellegi-Sunter machinery, differing only in which evidence each model is allowed to
|
|
12
|
-
* see:
|
|
13
|
-
*
|
|
14
|
-
* - **String-first** sees the name agreement only → its decision boundary is _vertical_: high string
|
|
15
|
-
* similarity ⇒ match, at any distance. It fuses `Springfield General (IL)` with `Springfield
|
|
16
|
-
* General (MA)` (identical name, ~1500 km apart) and still misses `123 Main St` ↔ `123 Main
|
|
17
|
-
* Street Apt 2` when the strings drift.
|
|
18
|
-
* - **Geocode-first** also sees the distance agreement → its boundary _bends with geography_: near
|
|
19
|
-
* the same coordinate a modest name match suffices; far apart, even an exact name is
|
|
20
|
-
* rejected. It gets both traps right.
|
|
21
|
-
*
|
|
22
|
-
* Honesty notes (so the figure can't mislead):
|
|
23
|
-
*
|
|
24
|
-
* - The per-level weights are the REAL Bayes factors from the codebase — `NAME_LEVELS`
|
|
25
|
-
* (`registry/resolve.ts`) and `DEFAULT_DISTANCE_LEVELS` (`match/distance.ts`). Geography
|
|
26
|
-
* simply carries the heaviest evidence: ±9.45 bits at the same-building grain vs ±6.32 for an
|
|
27
|
-
* exact name.
|
|
28
|
-
* - The PRIOR is illustrative (λ shown in the caption), not production's λ=1e-4. Production is even
|
|
29
|
-
* more conservative and leans on additional corroboration (phone, the spatial exact-key) that
|
|
30
|
-
* this two-axis slice deliberately omits — the point here is the _shape of the boundary_, not
|
|
31
|
-
* a reproduction of a production score. The caption says so.
|
|
32
|
-
*
|
|
33
|
-
* Emits a self-contained Plotly HTML (twin 3D landscapes + an annotated 2D contour). Render to PNG
|
|
34
|
-
* with `renderPlotlyHTMLToPNG` (`./render.ts` — Playwright + swiftshader for headless WebGL).
|
|
35
|
-
*
|
|
36
|
-
* Run: `mailwoman registry viz geocode-first-surface [--lambda 0.02]
|
|
37
|
-
* [--out-html /tmp/geocode-first-surface.html]`
|
|
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 HTML.
|
|
38
8
|
*/
|
|
39
9
|
/**
|
|
40
10
|
* Options for {@linkcode geocodeFirstSurface}.
|
|
@@ -42,7 +12,8 @@
|
|
|
42
12
|
export interface GeocodeFirstSurfaceOptions {
|
|
43
13
|
/**
|
|
44
14
|
* Illustrative prior λ. Production's record matcher uses λ=1e-4 (calibrated for the full multi-field model with phone
|
|
45
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* - Spatial exact-key); here we want the boundary visible in a two-axis slice. Default 0.02.
|
|
46
17
|
*/
|
|
47
18
|
lambda?: number;
|
|
48
19
|
/**
|
|
@@ -53,7 +24,7 @@ export interface GeocodeFirstSurfaceOptions {
|
|
|
53
24
|
/**
|
|
54
25
|
* Emit the geocode-first decision-surface Plotly HTML — see the module doc.
|
|
55
26
|
*/
|
|
56
|
-
export declare function geocodeFirstSurface(options?: GeocodeFirstSurfaceOptions, report?: (line: string) => void): {
|
|
27
|
+
export declare function geocodeFirstSurface(options?: GeocodeFirstSurfaceOptions, report?: (line: string) => void): Promise<{
|
|
57
28
|
outHTML: string;
|
|
58
|
-
}
|
|
29
|
+
}>;
|
|
59
30
|
//# sourceMappingURL=geocode-first-surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../lib/tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;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,CA6M9B"}
|
|
@@ -3,40 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* What a reader should walk away with: **geography is the primary key; string similarity only
|
|
9
|
-
* refines within a place.** The figure makes that legible as a _landscape_. Two surfaces of
|
|
10
|
-
* P(match) over the same record-pair space (string similarity × geographic distance), scored by
|
|
11
|
-
* the SAME Fellegi-Sunter machinery, differing only in which evidence each model is allowed to
|
|
12
|
-
* see:
|
|
13
|
-
*
|
|
14
|
-
* - **String-first** sees the name agreement only → its decision boundary is _vertical_: high string
|
|
15
|
-
* similarity ⇒ match, at any distance. It fuses `Springfield General (IL)` with `Springfield
|
|
16
|
-
* General (MA)` (identical name, ~1500 km apart) and still misses `123 Main St` ↔ `123 Main
|
|
17
|
-
* Street Apt 2` when the strings drift.
|
|
18
|
-
* - **Geocode-first** also sees the distance agreement → its boundary _bends with geography_: near
|
|
19
|
-
* the same coordinate a modest name match suffices; far apart, even an exact name is
|
|
20
|
-
* rejected. It gets both traps right.
|
|
21
|
-
*
|
|
22
|
-
* Honesty notes (so the figure can't mislead):
|
|
23
|
-
*
|
|
24
|
-
* - The per-level weights are the REAL Bayes factors from the codebase — `NAME_LEVELS`
|
|
25
|
-
* (`registry/resolve.ts`) and `DEFAULT_DISTANCE_LEVELS` (`match/distance.ts`). Geography
|
|
26
|
-
* simply carries the heaviest evidence: ±9.45 bits at the same-building grain vs ±6.32 for an
|
|
27
|
-
* exact name.
|
|
28
|
-
* - The PRIOR is illustrative (λ shown in the caption), not production's λ=1e-4. Production is even
|
|
29
|
-
* more conservative and leans on additional corroboration (phone, the spatial exact-key) that
|
|
30
|
-
* this two-axis slice deliberately omits — the point here is the _shape of the boundary_, not
|
|
31
|
-
* a reproduction of a production score. The caption says so.
|
|
32
|
-
*
|
|
33
|
-
* Emits a self-contained Plotly HTML (twin 3D landscapes + an annotated 2D contour). Render to PNG
|
|
34
|
-
* with `renderPlotlyHTMLToPNG` (`./render.ts` — Playwright + swiftshader for headless WebGL).
|
|
35
|
-
*
|
|
36
|
-
* Run: `mailwoman registry viz geocode-first-surface [--lambda 0.02]
|
|
37
|
-
* [--out-html /tmp/geocode-first-surface.html]`
|
|
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 HTML.
|
|
38
8
|
*/
|
|
39
|
-
import {
|
|
9
|
+
import { tempRootPath } from "@mailwoman/core/data-root";
|
|
10
|
+
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
40
11
|
/**
|
|
41
12
|
* Registry/resolve.ts → NAME_LEVELS.
|
|
42
13
|
*/
|
|
@@ -79,9 +50,9 @@ function distanceWeight(km) {
|
|
|
79
50
|
/**
|
|
80
51
|
* Emit the geocode-first decision-surface Plotly HTML — see the module doc.
|
|
81
52
|
*/
|
|
82
|
-
export function geocodeFirstSurface(options = {}, report) {
|
|
53
|
+
export async function geocodeFirstSurface(options = {}, report) {
|
|
83
54
|
const LAMBDA = options.lambda ?? 0.02;
|
|
84
|
-
const OUT_HTML = options.outHTML || "
|
|
55
|
+
const OUT_HTML = options.outHTML || tempRootPath("geocode-first-surface.html");
|
|
85
56
|
const PRIOR = priorWeight(LAMBDA);
|
|
86
57
|
/**
|
|
87
58
|
* String-first model: name evidence only — distance is invisible to it.
|
|
@@ -141,7 +112,9 @@ export function geocodeFirstSurface(options = {}, report) {
|
|
|
141
112
|
lambda: LAMBDA,
|
|
142
113
|
prior: PRIOR,
|
|
143
114
|
};
|
|
144
|
-
|
|
115
|
+
// EVERY `<`, not only `</script>`: `<!--` also leaves script-data state in the HTML tokenizer, after which a
|
|
116
|
+
// later `</script>` no longer ends the element. `\u003c` is the same string to a JSON reader.
|
|
117
|
+
const safe = JSON.stringify(data).replaceAll("<", "\\u003c");
|
|
145
118
|
const html = `<!doctype html><html><head><meta charset="utf-8"/>
|
|
146
119
|
<script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>
|
|
147
120
|
<style>
|
|
@@ -245,7 +218,7 @@ document.getElementByID("cap").innerHTML =
|
|
|
245
218
|
"Trap ② string-first="+fmt(D.traps[1].stringP)+" (reject ✗) · geocode-first="+fmt(D.traps[1].geoP)+" (MATCH ✓).";
|
|
246
219
|
</script>
|
|
247
220
|
</body></html>`;
|
|
248
|
-
|
|
221
|
+
await writeLocalFile(html, OUT_HTML);
|
|
249
222
|
report?.(`[written] ${OUT_HTML}`);
|
|
250
223
|
report?.(`λ=${LAMBDA} prior=${PRIOR.toFixed(2)} bits`);
|
|
251
224
|
for (const t of trapRows) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../lib/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;AA6B3D;;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,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;IACxD,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EAAE,C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,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"}
|
|
@@ -9,18 +9,15 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
|
|
11
11
|
*
|
|
12
|
-
* - MapLibre needs a real WebGL context
|
|
13
|
-
*
|
|
14
|
-
* - The basemap tiles come from `tiles.
|
|
12
|
+
* - MapLibre needs a real WebGL context — the shared harness (`./browser.ts`) provides one through
|
|
13
|
+
* SwiftShader.
|
|
14
|
+
* - The basemap tiles come from `tiles.mailwoman.ai`, which CORS-restricts to localhost + the docs
|
|
15
15
|
* domains — so the page MUST be SERVED OVER LOCALHOST, not 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
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
|
-
*
|
|
22
|
-
* Playwright (headless Chromium) is a heavy dev-only dependency — lazy-imported inside the entry
|
|
23
|
-
* fn (the corpus-tools lazy-import convention).
|
|
24
21
|
*/
|
|
25
22
|
/**
|
|
26
23
|
* Options for {@linkcode renderServedMapToPNG}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/render-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render-map.d.ts","sourceRoot":"","sources":["../../../lib/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,CAetD"}
|
|
@@ -9,37 +9,27 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
|
|
11
11
|
*
|
|
12
|
-
* - MapLibre needs a real WebGL context
|
|
13
|
-
*
|
|
14
|
-
* - The basemap tiles come from `tiles.
|
|
12
|
+
* - MapLibre needs a real WebGL context — the shared harness (`./browser.ts`) provides one through
|
|
13
|
+
* SwiftShader.
|
|
14
|
+
* - The basemap tiles come from `tiles.mailwoman.ai`, which CORS-restricts to localhost + the docs
|
|
15
15
|
* domains — so the page MUST be SERVED OVER LOCALHOST, not 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
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
|
-
*
|
|
22
|
-
* Playwright (headless Chromium) is a heavy dev-only dependency — lazy-imported inside the entry
|
|
23
|
-
* fn (the corpus-tools lazy-import convention).
|
|
24
21
|
*/
|
|
22
|
+
import { withChromiumPage } from "#tools/viz/browser";
|
|
25
23
|
/**
|
|
26
24
|
* Screenshot a served MapLibre map page once the tiles + marker layer settle.
|
|
27
25
|
*/
|
|
28
26
|
export async function renderServedMapToPNG(options, report) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const { consoleErrors: errors } = await withChromiumPage({ viewport: { width: 1100, height: 760 } }, async (page) => {
|
|
28
|
+
await page.goto(options.url, { waitUntil: "networkidle", timeout: 30_000 });
|
|
29
|
+
// MapLibre composites tiles + the marker layer async after the network settles; give it a beat.
|
|
30
|
+
await page.waitForTimeout(4000);
|
|
31
|
+
await page.screenshot({ path: options.outPNG });
|
|
33
32
|
});
|
|
34
|
-
const page = await browser.newPage({ viewport: { width: 1100, height: 760 }, deviceScaleFactor: 2 });
|
|
35
|
-
const errors = [];
|
|
36
|
-
page.on("console", (m) => m.type() === "error" && errors.push(m.text()));
|
|
37
|
-
page.on("pageerror", (e) => errors.push(String(e)));
|
|
38
|
-
await page.goto(options.url, { waitUntil: "networkidle", timeout: 30_000 });
|
|
39
|
-
// MapLibre composites tiles + the marker layer async after the network settles; give it a beat.
|
|
40
|
-
await page.waitForTimeout(4000);
|
|
41
|
-
await page.screenshot({ path: options.outPNG });
|
|
42
|
-
await browser.close();
|
|
43
33
|
report?.(`[map-render] ${options.outPNG}; console errors=${errors.length}`);
|
|
44
34
|
for (const e of errors.slice(0, 6)) {
|
|
45
35
|
report?.(" " + e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-map.js","sourceRoot":"","sources":["../../../tools/viz/render-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render-map.js","sourceRoot":"","sources":["../../../lib/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,gGAAgG;QAChG,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"}
|
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
* Render a self-contained Plotly HTML to a PNG via headless Chromium — the shared renderer behind
|
|
7
7
|
* the `registry viz` figures (an internal helper, not a command).
|
|
8
8
|
*
|
|
9
|
-
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* rather than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
14
|
-
*
|
|
15
|
-
* Playwright (headless Chromium) is a heavy dev-only dependency — lazy-imported inside the entry
|
|
16
|
-
* fn (the corpus-tools lazy-import convention), so importing `@mailwoman/registry/tools` never
|
|
17
|
-
* pays for it.
|
|
9
|
+
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context, which the shared harness
|
|
10
|
+
* (`./browser.ts`) provides through SwiftShader; 2D traces (`contour`/`heatmap`) render on the 2D
|
|
11
|
+
* canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div rather
|
|
12
|
+
* than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
18
13
|
*/
|
|
19
14
|
/**
|
|
20
15
|
* Options for {@linkcode renderPlotlyHTMLToPNG}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../lib/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;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;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,CAkDtD"}
|
package/out/tools/viz/render.js
CHANGED
|
@@ -6,51 +6,36 @@
|
|
|
6
6
|
* Render a self-contained Plotly HTML to a PNG via headless Chromium — the shared renderer behind
|
|
7
7
|
* the `registry viz` figures (an internal helper, not a command).
|
|
8
8
|
*
|
|
9
|
-
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* rather than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
14
|
-
*
|
|
15
|
-
* Playwright (headless Chromium) is a heavy dev-only dependency — lazy-imported inside the entry
|
|
16
|
-
* fn (the corpus-tools lazy-import convention), so importing `@mailwoman/registry/tools` never
|
|
17
|
-
* pays for it.
|
|
9
|
+
* Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context, which the shared harness
|
|
10
|
+
* (`./browser.ts`) provides through SwiftShader; 2D traces (`contour`/`heatmap`) render on the 2D
|
|
11
|
+
* canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div rather
|
|
12
|
+
* than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
|
|
18
13
|
*/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
14
|
+
import { pathToFileURL } from "@mailwoman/core/module/file-url";
|
|
15
|
+
import { resolvePath as resolve } from "path-ts";
|
|
16
|
+
import { withChromiumPage } from "#tools/viz/browser";
|
|
21
17
|
/**
|
|
22
18
|
* Screenshot a Plotly HTML page after every graph div's `plotly_afterplot` fires.
|
|
23
19
|
*/
|
|
24
20
|
export async function renderPlotlyHTMLToPNG(options, report) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const divs = [...doc.querySelectorAll("div")]
|
|
43
|
-
.map((d) => d)
|
|
44
|
-
.filter((d) => d._fullLayout && typeof d.on === "function");
|
|
45
|
-
await Promise.all(divs.map((d) => new Promise((res) => {
|
|
46
|
-
d.on("plotly_afterplot", () => res());
|
|
47
|
-
setTimeout(() => res(), 2000);
|
|
48
|
-
})));
|
|
21
|
+
const { consoleErrors: errors } = await withChromiumPage({ viewport: { width: options.width ?? 1160, height: options.height ?? 1000 } }, async (page) => {
|
|
22
|
+
await page.goto(pathToFileURL(resolve(options.inHTML)).href, { waitUntil: "networkidle" });
|
|
23
|
+
// Resolve once every Plotly graph div has fired plotly_afterplot (3D paints land async, after
|
|
24
|
+
// newPlot's promise resolves), with a per-div fallback so an already-painted div can't hang us.
|
|
25
|
+
await page.evaluate(async () => {
|
|
26
|
+
const doc = Reflect.get(globalThis, "document");
|
|
27
|
+
const divs = [...doc.querySelectorAll("div")]
|
|
28
|
+
.map((d) => d)
|
|
29
|
+
.filter((d) => d._fullLayout && typeof d.on === "function");
|
|
30
|
+
await Promise.all(divs.map((d) => new Promise((res) => {
|
|
31
|
+
d.on("plotly_afterplot", () => res());
|
|
32
|
+
setTimeout(() => res(), 2000);
|
|
33
|
+
})));
|
|
34
|
+
});
|
|
35
|
+
// Final settle for the software WebGL rasterizer.
|
|
36
|
+
await page.waitForTimeout(800);
|
|
37
|
+
await page.screenshot({ path: resolve(options.outPNG), fullPage: true });
|
|
49
38
|
});
|
|
50
|
-
// Final settle for the software WebGL rasterizer.
|
|
51
|
-
await page.waitForTimeout(800);
|
|
52
|
-
await page.screenshot({ path: resolve(options.outPNG), fullPage: true });
|
|
53
|
-
await browser.close();
|
|
54
39
|
if (errors.length) {
|
|
55
40
|
report?.(`[render] ${errors.length} console error(s):`);
|
|
56
41
|
for (const e of errors.slice(0, 8)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../lib/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;AAwBrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,OAA4B,EAC5B,MAA+B;IAE/B,MAAM,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AM,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,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"}
|
|
@@ -3,28 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Every coordinate Mailwoman resolves to comes from an open dataset, and we keep the provenance on
|
|
9
|
-
* the point. This samples the per-state address-point DB (`address_point.source`) and renders it
|
|
10
|
-
* on the house MapLibre + Protomaps stack via {@link toMapHTML}, each dot COLORED BY its upstream
|
|
11
|
-
* open-data source — the National Address Database (a federal release) vs OpenAddresses (county /
|
|
12
|
-
* municipal open-data publishers). New York is the clean example: NAD blankets the state, and New
|
|
13
|
-
* York City arrives separately from NYC Open Data, so the source split is visible as a
|
|
14
|
-
* geography.
|
|
15
|
-
*
|
|
16
|
-
* No competitor in this space will tell you which open dataset a given coordinate came from — for
|
|
17
|
-
* them the assembled pipeline is the moat. Here the provenance is the point of the map.
|
|
18
|
-
*
|
|
19
|
-
* Streets without a rooftop point are covered by TIGER interpolation (`tiger:edges`), a separate
|
|
20
|
-
* layer not plotted here; this map is the rooftop-point sources only.
|
|
21
|
-
*
|
|
22
|
-
* SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
|
|
23
|
-
* domains). e.g. `python3 -m http.server -d <dir>`, or `renderServedMapToPNG` (`./render-map.ts`)
|
|
24
|
-
* against the served URL.
|
|
25
|
-
*
|
|
26
|
-
* Run: `mailwoman registry viz source-provenance-map [--state ny] [--db <address-points-us-XX.db>]
|
|
27
|
-
* [--out-html /tmp/source-provenance.html] [--nad-mod 700] [--oa-mod 120] [--cap 7000]`
|
|
6
|
+
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
+
* The output requires an HTTP origin because the tile server does not serve `file:` origins.
|
|
28
8
|
*/
|
|
29
9
|
/**
|
|
30
10
|
* Options for {@linkcode sourceProvenanceMap}.
|
|
@@ -58,8 +38,8 @@ export interface SourceProvenanceMapOptions {
|
|
|
58
38
|
/**
|
|
59
39
|
* Render the per-state address-point provenance map — see the module doc.
|
|
60
40
|
*/
|
|
61
|
-
export declare function sourceProvenanceMap(options?: SourceProvenanceMapOptions, report?: (line: string) => void): {
|
|
41
|
+
export declare function sourceProvenanceMap(options?: SourceProvenanceMapOptions, report?: (line: string) => void): Promise<{
|
|
62
42
|
outHTML: string;
|
|
63
43
|
points: number;
|
|
64
|
-
}
|
|
44
|
+
}>;
|
|
65
45
|
//# sourceMappingURL=source-provenance-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../lib/tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAuBD;;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,CA+D9C"}
|
|
@@ -3,33 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Every coordinate Mailwoman resolves to comes from an open dataset, and we keep the provenance on
|
|
9
|
-
* the point. This samples the per-state address-point DB (`address_point.source`) and renders it
|
|
10
|
-
* on the house MapLibre + Protomaps stack via {@link toMapHTML}, each dot COLORED BY its upstream
|
|
11
|
-
* open-data source — the National Address Database (a federal release) vs OpenAddresses (county /
|
|
12
|
-
* municipal open-data publishers). New York is the clean example: NAD blankets the state, and New
|
|
13
|
-
* York City arrives separately from NYC Open Data, so the source split is visible as a
|
|
14
|
-
* geography.
|
|
15
|
-
*
|
|
16
|
-
* No competitor in this space will tell you which open dataset a given coordinate came from — for
|
|
17
|
-
* them the assembled pipeline is the moat. Here the provenance is the point of the map.
|
|
18
|
-
*
|
|
19
|
-
* Streets without a rooftop point are covered by TIGER interpolation (`tiger:edges`), a separate
|
|
20
|
-
* layer not plotted here; this map is the rooftop-point sources only.
|
|
21
|
-
*
|
|
22
|
-
* SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
|
|
23
|
-
* domains). e.g. `python3 -m http.server -d <dir>`, or `renderServedMapToPNG` (`./render-map.ts`)
|
|
24
|
-
* against the served URL.
|
|
25
|
-
*
|
|
26
|
-
* Run: `mailwoman registry viz source-provenance-map [--state ny] [--db <address-points-us-XX.db>]
|
|
27
|
-
* [--out-html /tmp/source-provenance.html] [--nad-mod 700] [--oa-mod 120] [--cap 7000]`
|
|
6
|
+
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
+
* The output requires an HTTP origin because the tile server does not serve `file:` origins.
|
|
28
8
|
*/
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
9
|
+
import { dataRootPath, tempRootPath } from "@mailwoman/core/data-root";
|
|
10
|
+
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
11
|
+
import { isPresent } from "@mailwoman/core/objects";
|
|
12
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
13
|
+
import { toMapHTML } from "#index";
|
|
33
14
|
// Collapse the raw `source` string into a human, mappable category. The address-point DB stores e.g.
|
|
34
15
|
// "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data" — the suffix is the real upstream
|
|
35
16
|
// publisher, which is what we want to color by (the "overture:" prefix is just the theme it arrived in).
|
|
@@ -45,14 +26,14 @@ function categorize(source) {
|
|
|
45
26
|
/**
|
|
46
27
|
* Render the per-state address-point provenance map — see the module doc.
|
|
47
28
|
*/
|
|
48
|
-
export function sourceProvenanceMap(options = {}, report) {
|
|
29
|
+
export async function sourceProvenanceMap(options = {}, report) {
|
|
49
30
|
const STATE = (options.state || "ny").toLowerCase();
|
|
50
31
|
const DB = options.db || String(dataRootPath("address-points", `address-points-us-${STATE}.db`));
|
|
51
|
-
const OUT = options.outHTML || "
|
|
32
|
+
const OUT = options.outHTML || tempRootPath("source-provenance.html");
|
|
52
33
|
const NAD_MOD = options.nadMod ?? 700; // keep ~1/700 of NAD points
|
|
53
34
|
const OA_MOD = options.oaMod ?? 120; // keep ~1/120 of OpenAddresses points
|
|
54
35
|
const CAP = options.cap ?? 7000; // per-source marker cap
|
|
55
|
-
|
|
36
|
+
using db = new DatabaseClient(DB, { readOnly: true });
|
|
56
37
|
// Two stratified samples so the smaller source (OpenAddresses, ~1/6 of NY) stays visible next to NAD.
|
|
57
38
|
// abs(random()) % mod == 0 keeps a spatially-uniform ~1/mod fraction; LIMIT caps the marker count.
|
|
58
39
|
const sample = (where, mod) => db
|
|
@@ -64,12 +45,11 @@ export function sourceProvenanceMap(options = {}, report) {
|
|
|
64
45
|
...sample("source = 'overture:NAD'", NAD_MOD),
|
|
65
46
|
...sample("source LIKE 'overture:OpenAddresses%'", OA_MOD),
|
|
66
47
|
];
|
|
67
|
-
db.close();
|
|
68
48
|
const counts = new Map();
|
|
69
49
|
const features = rows.map((r) => {
|
|
70
50
|
const { bucket, publisher } = categorize(r.source);
|
|
71
51
|
counts.set(bucket, (counts.get(bucket) ?? 0) + 1);
|
|
72
|
-
const addr = [r.number, r.street_raw].filter(
|
|
52
|
+
const addr = [r.number, r.street_raw].filter(isPresent).join(" ").trim();
|
|
73
53
|
return {
|
|
74
54
|
type: "Feature",
|
|
75
55
|
geometry: { type: "Point", coordinates: [r.lon, r.lat] },
|
|
@@ -89,7 +69,7 @@ export function sourceProvenanceMap(options = {}, report) {
|
|
|
89
69
|
flavor: "light",
|
|
90
70
|
colorBy: "bucket",
|
|
91
71
|
});
|
|
92
|
-
|
|
72
|
+
await writeLocalFile(html, OUT);
|
|
93
73
|
report?.(`[written] ${OUT} (${features.length} points)`);
|
|
94
74
|
for (const [bucket, n] of [...counts.entries()].toSorted((a, b) => b[1] - a[1])) {
|
|
95
75
|
report?.(` ${n.toString().padStart(5)} ${bucket}`);
|
|
@@ -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":"","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|
|
36
36
|
* Emit the dedup-yardstick slope chart as a self-contained SVG — see the module doc.
|
|
37
37
|
*/
|
|
38
|
-
export declare function yardstickFigure(options?: YardstickFigureOptions, report?: (line: string) => void): {
|
|
38
|
+
export declare function yardstickFigure(options?: YardstickFigureOptions, report?: (line: string) => void): Promise<{
|
|
39
39
|
outSVG: string;
|
|
40
|
-
}
|
|
40
|
+
}>;
|
|
41
41
|
//# sourceMappingURL=yardstick-figure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../lib/tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AA6DD;;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,CAiI7B"}
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
* Run: `mailwoman registry viz yardstick-figure
|
|
24
24
|
* [--out-svg docs/records/evals/charts/dedup-yardstick.svg]`
|
|
25
25
|
*/
|
|
26
|
-
import {
|
|
26
|
+
import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
|
|
27
|
+
import { escapeHTML } from "@mailwoman/core/strings/escape";
|
|
27
28
|
const GRAINS = [
|
|
28
29
|
{ key: "NPI", label: "NPI", classes: 1000, note: "one entity per registration\n(over-segments orgs)" },
|
|
29
30
|
{ key: "site", label: "site", classes: 1456, note: "subpart-collapse +\naddress-split (conservative)" },
|
|
@@ -65,11 +66,11 @@ const MODELS = [
|
|
|
65
66
|
{ key: "GBT", label: "GBT (shipped default)", color: "#3578e5", width: 3, dash: "" },
|
|
66
67
|
{ key: "FS", label: "FS full stack", color: "#9ca3af", width: 2, dash: "5 4" },
|
|
67
68
|
];
|
|
68
|
-
const esc =
|
|
69
|
+
const esc = escapeHTML;
|
|
69
70
|
/**
|
|
70
71
|
* Emit the dedup-yardstick slope chart as a self-contained SVG — see the module doc.
|
|
71
72
|
*/
|
|
72
|
-
export function yardstickFigure(options = {}, report) {
|
|
73
|
+
export async function yardstickFigure(options = {}, report) {
|
|
73
74
|
const OUT = options.outSVG || "docs/records/evals/charts/dedup-yardstick.svg";
|
|
74
75
|
const parts = [];
|
|
75
76
|
const push = (s) => parts.push(s);
|
|
@@ -132,7 +133,7 @@ export function yardstickFigure(options = {}, report) {
|
|
|
132
133
|
// Footer caveat — the gold-set anchor.
|
|
133
134
|
push(`<text x="${plotL}" y="${H - 10}" font-size="9.5" fill="#9ca3af">Gold set (2026-06-16-dedup-gold-set-tx120): 120/120 hard co-located pairs = same org, 0 genuine over-merges. The coordinate (geocode-first building key) is the tightest honest ruler; NPI charges correct same-org merges as errors.</text>`);
|
|
134
135
|
push(`</svg>`);
|
|
135
|
-
|
|
136
|
+
await writeLocalTextFile(parts.join(""), OUT);
|
|
136
137
|
report?.(`[written] ${OUT}`);
|
|
137
138
|
report?.(` GBT F1: NPI ${F1.GBT[0]} → site ${F1.GBT[1]} → org-name ${F1.GBT[2]} → coord ${F1.GBT[3]} (+${(F1.GBT[3] - F1.GBT[0]).toFixed(1)}pp)`);
|
|
138
139
|
report?.(` over-merge: ${OVERMERGE.GBT.join(" → ")}`);
|