@mailwoman/registry 10.0.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 +11 -6
- 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 +43 -53
- 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 +11 -6
- 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 +17 -41
- 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 +20 -27
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -1
- package/out/tools/cross/dataset-correlation.js +9 -61
- package/out/tools/cross/dataset-correlation.js.map +1 -1
- package/out/tools/cross/source-threshold-sweep.d.ts +20 -26
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -1
- package/out/tools/cross/source-threshold-sweep.js +14 -40
- package/out/tools/cross/source-threshold-sweep.js.map +1 -1
- 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 +9 -8
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -1
- package/out/tools/geocoder/namesake-probe.js +6 -7
- package/out/tools/geocoder/namesake-probe.js.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts +18 -15
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder/vs-provided-coords.js +30 -27
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -1
- 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 +30 -27
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/clustering-eval.js +28 -38
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts +24 -18
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/crossstate-eval.js +19 -25
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -1
- package/out/tools/learned/scorer/eval.d.ts +22 -39
- package/out/tools/learned/scorer/eval.d.ts.map +1 -1
- package/out/tools/learned/scorer/eval.js +11 -71
- package/out/tools/learned/scorer/eval.js.map +1 -1
- 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 +21 -41
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes/dedup-benchmark.js +20 -66
- package/out/tools/nppes/dedup-benchmark.js.map +1 -1
- 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 +5 -6
- 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 +36 -26
- package/out/tools/train/cross-gbt.d.ts.map +1 -1
- package/out/tools/train/cross-gbt.js +14 -25
- package/out/tools/train/cross-gbt.js.map +1 -1
- package/out/tools/train/gbt.d.ts +36 -20
- package/out/tools/train/gbt.d.ts.map +1 -1
- package/out/tools/train/gbt.js +27 -31
- package/out/tools/train/gbt.js.map +1 -1
- package/out/tools/train/org-cross-gbt.d.ts +37 -24
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -1
- package/out/tools/train/org-cross-gbt.js +18 -22
- package/out/tools/train/org-cross-gbt.js.map +1 -1
- 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 +5 -5
- package/out/tools/viz/render/map.d.ts.map +1 -1
- package/out/tools/viz/render/map.js +6 -5
- package/out/tools/viz/render/map.js.map +1 -1
- package/out/tools/viz/{render/index.d.ts → render.d.ts} +13 -9
- package/out/tools/viz/render.d.ts.map +1 -0
- package/out/tools/viz/{render/index.js → render.js} +9 -8
- package/out/tools/viz/render.js.map +1 -0
- 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 → tools}/cross/dataset-correlation.ts +31 -72
- package/{lib/tools → 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 → tools}/geocoder/namesake-probe.ts +9 -8
- package/{lib/tools → tools}/geocoder/vs-provided-coords.ts +39 -30
- package/{lib/tools → tools}/gold-set-sample.ts +35 -29
- package/{lib/tools → tools}/learned/scorer/clustering-eval.ts +49 -45
- package/{lib/tools → tools}/learned/scorer/crossstate-eval.ts +34 -30
- package/{lib/tools → tools}/learned/scorer/eval.ts +35 -78
- package/{lib/tools → tools}/matcher-scale.ts +21 -33
- package/{lib/tools → 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 +15 -11
- 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 → tools}/train/cross-gbt.ts +38 -34
- package/{lib/tools → tools}/train/gbt.ts +55 -41
- package/{lib/tools → 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 → tools}/viz/render/map.ts +7 -6
- package/{lib/tools/viz/render/index.ts → 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/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/viz/render/index.d.ts.map +0 -1
- package/out/tools/viz/render/index.js.map +0 -1
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* = `lat,lon` per facility
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Convert the TX hhsc nursing-facilities source into the OaRow jsonl the resolver eval consumes.
|
|
7
|
+
* The source ships an authoritative `Geo Location` = `lat,lon` per facility, so the geocoder is
|
|
8
|
+
* graded against the provided coordinates on real facility addresses. `oa-resolver-eval
|
|
9
|
+
* --address-points` reports a great-circle delta and a tier breakdown.
|
|
10
10
|
*
|
|
11
|
-
* Neutral scope: this measures
|
|
11
|
+
* Neutral scope: this measures geocoder accuracy on real public addresses and makes no claim about
|
|
12
12
|
* the facilities themselves.
|
|
13
13
|
*
|
|
14
14
|
* Run: `mailwoman registry convert tx-hhsc [--src <tsv>] [--out /tmp/txhhsc-oarow.jsonl]`
|
|
@@ -16,26 +16,27 @@
|
|
|
16
16
|
import { dataRootPath, tempRootPath } from "@mailwoman/core/data-root";
|
|
17
17
|
import { readLocalTextFile } from "@mailwoman/core/fs/readers";
|
|
18
18
|
import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
|
|
19
|
+
import { stringifyJSON } from "@mailwoman/core/json";
|
|
19
20
|
import { TSVSpliterator } from "spliterator";
|
|
20
21
|
import { inTXBBOX } from "#tools/shared";
|
|
21
22
|
const GEO = /^\s*(-?\d+\.\d+)\s*,\s*(-?\d+\.\d+)\s*$/;
|
|
22
23
|
/**
|
|
23
|
-
* Convert the TX
|
|
24
|
+
* Convert the TX hhsc nursing-facilities TSV into OaRow jsonl for `oa-resolver-eval`.
|
|
24
25
|
*/
|
|
25
26
|
export async function convertTXHHSC(options = {}, report) {
|
|
26
|
-
const src = options.src
|
|
27
|
+
const src = options.src ?? dataRootPath("record-matcher", "sources", "txhhsc_nursing-facilities_20260611.tsv");
|
|
27
28
|
const out = options.out || tempRootPath("txhhsc-oarow.jsonl");
|
|
28
29
|
const records = [];
|
|
29
30
|
let skipped = 0;
|
|
30
|
-
// Column indices
|
|
31
|
-
// blank-row guard below applies to it
|
|
31
|
+
// Column indices come from the first non-blank row.
|
|
32
|
+
// `header: false` keeps that row in the stream, so the blank-row guard below applies to it.
|
|
32
33
|
let cAddr = -1;
|
|
33
34
|
let cCity = -1;
|
|
34
35
|
let cZip = -1;
|
|
35
36
|
let cGeo = -1;
|
|
36
37
|
let sawHeader = false;
|
|
37
38
|
for (const f of TSVSpliterator.from(await readLocalTextFile(src), { header: false })) {
|
|
38
|
-
if (f.every((value) => !value
|
|
39
|
+
if (f.every((value) => !value))
|
|
39
40
|
continue;
|
|
40
41
|
if (!sawHeader) {
|
|
41
42
|
sawHeader = true;
|
|
@@ -46,9 +47,9 @@ export async function convertTXHHSC(options = {}, report) {
|
|
|
46
47
|
cGeo = col("Geo Location");
|
|
47
48
|
continue;
|
|
48
49
|
}
|
|
49
|
-
const addr =
|
|
50
|
-
const city =
|
|
51
|
-
const zip =
|
|
50
|
+
const addr = f[cAddr] ?? "";
|
|
51
|
+
const city = f[cCity] ?? "";
|
|
52
|
+
const zip = f[cZip] ?? "";
|
|
52
53
|
const m = GEO.exec(f[cGeo] ?? "");
|
|
53
54
|
if (!addr || !city || !m) {
|
|
54
55
|
skipped++;
|
|
@@ -61,7 +62,7 @@ export async function convertTXHHSC(options = {}, report) {
|
|
|
61
62
|
skipped++;
|
|
62
63
|
continue;
|
|
63
64
|
}
|
|
64
|
-
records.push(
|
|
65
|
+
records.push(stringifyJSON({
|
|
65
66
|
input: `${addr}, ${city}, TX ${zip}`,
|
|
66
67
|
lat,
|
|
67
68
|
lon,
|
|
@@ -70,7 +71,7 @@ export async function convertTXHHSC(options = {}, report) {
|
|
|
70
71
|
source: "txhhsc:nursing-facilities",
|
|
71
72
|
}));
|
|
72
73
|
}
|
|
73
|
-
await writeLocalTextFile(records
|
|
74
|
+
await writeLocalTextFile(records, out);
|
|
74
75
|
report?.(`wrote ${records.length} rows (skipped ${skipped}) → ${out}`);
|
|
75
76
|
return { written: records.length, skipped, out };
|
|
76
77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T,CAAC;QAED,OAAO,CAAC,IAAI,CACX,aAAa,CAAC;YACb,KAAK,EAAE,GAAG,IAAI,KAAK,IAAI,QAAQ,GAAG,EAAE;YACpC,GAAG;YACH,GAAG;YACH,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;YACzD,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,2BAA2B;SACnC,CAAC,CACF,CAAA;IACF,CAAC;IAED,MAAM,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IACtC,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,MAAM,kBAAkB,OAAO,OAAO,GAAG,EAAE,CAAC,CAAA;IAEtE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAA;AACjD,CAAC"}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The shared headless-Chromium harness behind the `registry viz` renderers (an internal helper,
|
|
7
|
-
*
|
|
8
|
-
* the browser launches on ANGLE's SwiftShader software rasterizer (`--use-gl=angle
|
|
6
|
+
* The shared headless-Chromium harness behind the `registry viz` renderers (an internal helper rather than a command). The WebGL consumers (Plotly 3D, MapLibre) get no GPU in headless Chromium, so
|
|
7
|
+
* the browser launches on angle's SwiftShader software rasterizer (`--use-gl=angle
|
|
9
8
|
* --use-angle=swiftshader --enable-unsafe-swiftshader`); each caller owns its own navigation +
|
|
10
9
|
* wait strategy and screenshots inside the callback.
|
|
11
10
|
*
|
|
@@ -24,8 +23,10 @@ export interface ChromiumPageOptions {
|
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
* Launch headless Chromium (SwiftShader WebGL), open one page at `deviceScaleFactor: 2`,
|
|
28
|
-
* run `fn`, and dispose the browser.
|
|
26
|
+
* Launch headless Chromium (SwiftShader WebGL), open one page at `deviceScaleFactor: 2`,
|
|
27
|
+
* collect console + page errors, run `fn`, and dispose the browser.
|
|
28
|
+
*
|
|
29
|
+
* The callback owns navigation, waits and the screenshot.
|
|
29
30
|
*/
|
|
30
31
|
export declare function withChromiumPage<T>(options: ChromiumPageOptions, fn: (page: Page) => Promise<T>): Promise<{
|
|
31
32
|
result: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../tools/viz/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3C;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACvC,OAAO,EAAE,mBAAmB,EAC5B,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAC5B,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiBjD"}
|
package/out/tools/viz/browser.js
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The shared headless-Chromium harness behind the `registry viz` renderers (an internal helper,
|
|
7
|
-
*
|
|
8
|
-
* the browser launches on ANGLE's SwiftShader software rasterizer (`--use-gl=angle
|
|
6
|
+
* The shared headless-Chromium harness behind the `registry viz` renderers (an internal helper rather than a command). The WebGL consumers (Plotly 3D, MapLibre) get no GPU in headless Chromium, so
|
|
7
|
+
* the browser launches on angle's SwiftShader software rasterizer (`--use-gl=angle
|
|
9
8
|
* --use-angle=swiftshader --enable-unsafe-swiftshader`); each caller owns its own navigation +
|
|
10
9
|
* wait strategy and screenshots inside the callback.
|
|
11
10
|
*
|
|
@@ -14,8 +13,10 @@
|
|
|
14
13
|
* it.
|
|
15
14
|
*/
|
|
16
15
|
/**
|
|
17
|
-
* Launch headless Chromium (SwiftShader WebGL), open one page at `deviceScaleFactor: 2`,
|
|
18
|
-
* run `fn`, and dispose the browser.
|
|
16
|
+
* Launch headless Chromium (SwiftShader WebGL), open one page at `deviceScaleFactor: 2`,
|
|
17
|
+
* collect console + page errors, run `fn`, and dispose the browser.
|
|
18
|
+
*
|
|
19
|
+
* The callback owns navigation, waits and the screenshot.
|
|
19
20
|
*/
|
|
20
21
|
export async function withChromiumPage(options, fn) {
|
|
21
22
|
const { chromium } = await import("playwright");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../tools/viz/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,OAA4B,EAC5B,EAA8B;IAE9B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;IAE/C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,CAAC,gBAAgB,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,wBAAwB,CAAC;KAC5G,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAA;IAExF,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACxE,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEnD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;IAC7B,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAA;IAEpC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export interface CrossDatasetMapOptions {
|
|
13
13
|
/**
|
|
14
|
-
* The `cross-dataset-links` GeoJSON.
|
|
15
|
-
*
|
|
14
|
+
* The `cross-dataset-links` GeoJSON.
|
|
15
|
+
*
|
|
16
|
+
* Default `$MAILWOMAN_DATA_ROOT/record-matcher/2026-06-16-cross-dataset-links.geojson`.
|
|
16
17
|
*/
|
|
17
18
|
in?: string;
|
|
18
19
|
/**
|
|
19
|
-
* Output
|
|
20
|
+
* Output html path.
|
|
21
|
+
*
|
|
22
|
+
* Default `/tmp/cross-dataset-map.html`.
|
|
20
23
|
*/
|
|
21
24
|
outHTML?: string;
|
|
22
25
|
/**
|
|
@@ -25,7 +28,7 @@ export interface CrossDatasetMapOptions {
|
|
|
25
28
|
crossAgencyOnly?: boolean;
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
|
-
* Render the cross-dataset-links GeoJSON to a bucket-colored MapLibre
|
|
31
|
+
* Render the cross-dataset-links GeoJSON to a bucket-colored MapLibre html page.
|
|
29
32
|
*/
|
|
30
33
|
export declare function crossDatasetMap(options?: CrossDatasetMapOptions, report?: (line: string) => void): Promise<{
|
|
31
34
|
outHTML: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-dataset-map.d.ts","sourceRoot":"","sources":["../../../
|
|
1
|
+
{"version":3,"file":"cross-dataset-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/cross-dataset-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CACzB;AAgCD;;GAEG;AACH,wBAAsB,eAAe,CACpC,OAAO,GAAE,sBAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqD3E"}
|
|
@@ -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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AAa,KAAK,kBAAkB;QAC/E,MAAM,EAAE,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,IAAI,GAAG,iBAAiB,CAAC,CAAC,CAAC,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;IACvG,MAAM,EAAE,CAAC,wBAAwB,CAAC,CAAA;IAElC,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,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;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,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,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;CAC1D,CAAA;AAED;;GAEG;AACH,MAAM,eAAe,GAAY;IAChC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE;IACzD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACpD,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE;IACjD,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;CACnC,CAAA;AAED,8EAA8E;AAC9E,MAAM,WAAW,GAAG,CAAC,GAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAA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IAE3D,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BF,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4ED,CAAA;IAEd,MAAM,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACpC,MAAM,EAAE,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;IACjC,MAAM,EAAE,CAAC,KAAK,MAAM,WAAW,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAEvD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,EAAE,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
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../../
|
|
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
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../../
|
|
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,19 +24,23 @@ 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;
|
|
40
44
|
consoleErrors: string[];
|
|
41
45
|
}>;
|
|
42
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -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")]
|
|
@@ -45,4 +46,4 @@ export async function renderPlotlyHTMLToPNG(options, report) {
|
|
|
45
46
|
report?.(`[render] ${options.outPNG}`);
|
|
46
47
|
return { outPNG: options.outPNG, consoleErrors: errors };
|
|
47
48
|
}
|
|
48
|
-
//# sourceMappingURL=
|
|
49
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA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