@mailwoman/registry 5.6.0 → 5.8.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.
Files changed (65) hide show
  1. package/out/ingest.d.ts +9 -12
  2. package/out/ingest.d.ts.map +1 -1
  3. package/out/ingest.js +36 -52
  4. package/out/ingest.js.map +1 -1
  5. package/out/learned-scorer.d.ts +1 -1
  6. package/out/learned-scorer.d.ts.map +1 -1
  7. package/out/learned-scorer.js +3 -2
  8. package/out/learned-scorer.js.map +1 -1
  9. package/out/map-html.d.ts.map +1 -1
  10. package/out/map-html.js +10 -5
  11. package/out/map-html.js.map +1 -1
  12. package/out/models/crosssource-gbt-en-us.d.ts +1 -1
  13. package/out/models/crosssource-gbt-en-us.js +1 -1
  14. package/out/models/dedup-gbt-en-us.d.ts +1 -1
  15. package/out/models/dedup-gbt-en-us.js +1 -1
  16. package/out/models/org-crosssource-gbt-en-us.d.ts +1 -1
  17. package/out/models/org-crosssource-gbt-en-us.js +1 -1
  18. package/out/reconcile.d.ts +1 -1
  19. package/out/reconcile.d.ts.map +1 -1
  20. package/out/reconcile.js +5 -3
  21. package/out/reconcile.js.map +1 -1
  22. package/out/resolve.d.ts.map +1 -1
  23. package/out/resolve.js +6 -3
  24. package/out/resolve.js.map +1 -1
  25. package/out/tools/dedup-ceiling.d.ts +33 -0
  26. package/out/tools/dedup-ceiling.d.ts.map +1 -0
  27. package/out/tools/dedup-ceiling.js +286 -0
  28. package/out/tools/dedup-ceiling.js.map +1 -0
  29. package/out/tools/gold-set-sample.d.ts +23 -0
  30. package/out/tools/gold-set-sample.d.ts.map +1 -0
  31. package/out/tools/gold-set-sample.js +191 -0
  32. package/out/tools/gold-set-sample.js.map +1 -0
  33. package/out/tools/matcher-scale.d.ts +19 -0
  34. package/out/tools/matcher-scale.d.ts.map +1 -0
  35. package/out/tools/matcher-scale.js +148 -0
  36. package/out/tools/matcher-scale.js.map +1 -0
  37. package/out/tools/txhhsc-to-oarow.d.ts +18 -0
  38. package/out/tools/txhhsc-to-oarow.d.ts.map +1 -0
  39. package/out/tools/txhhsc-to-oarow.js +72 -0
  40. package/out/tools/txhhsc-to-oarow.js.map +1 -0
  41. package/out/tools/viz/cross-dataset-map.d.ts +30 -0
  42. package/out/tools/viz/cross-dataset-map.d.ts.map +1 -0
  43. package/out/tools/viz/cross-dataset-map.js +97 -0
  44. package/out/tools/viz/cross-dataset-map.js.map +1 -0
  45. package/out/tools/viz/geocode-first-surface.d.ts +40 -0
  46. package/out/tools/viz/geocode-first-surface.d.ts.map +1 -0
  47. package/out/tools/viz/geocode-first-surface.js +249 -0
  48. package/out/tools/viz/geocode-first-surface.js.map +1 -0
  49. package/out/tools/viz/render-map.d.ts +23 -0
  50. package/out/tools/viz/render-map.d.ts.map +1 -0
  51. package/out/tools/viz/render-map.js +47 -0
  52. package/out/tools/viz/render-map.js.map +1 -0
  53. package/out/tools/viz/render.d.ts +17 -0
  54. package/out/tools/viz/render.d.ts.map +1 -0
  55. package/out/tools/viz/render.js +57 -0
  56. package/out/tools/viz/render.js.map +1 -0
  57. package/out/tools/viz/source-provenance-map.d.ts +30 -0
  58. package/out/tools/viz/source-provenance-map.d.ts.map +1 -0
  59. package/out/tools/viz/source-provenance-map.js +106 -0
  60. package/out/tools/viz/source-provenance-map.js.map +1 -0
  61. package/out/tools/viz/yardstick-figure.d.ts +27 -0
  62. package/out/tools/viz/yardstick-figure.d.ts.map +1 -0
  63. package/out/tools/viz/yardstick-figure.js +139 -0
  64. package/out/tools/viz/yardstick-figure.js.map +1 -0
  65. package/package.json +9 -7
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Pure-Node matcher scale eval — the number behind "no Elasticsearch, no server."
7
+ *
8
+ * The differentiator vs Pelias/Nominatim + a bolt-on ER stack is that the whole resolve (block →
9
+ * Fellegi-Sunter → cluster) runs in ONE Node process with no external service. This measures how
10
+ * far that goes: synthetic geo-clustered records (so geo-blocking produces realistic candidate
11
+ * pairs, not one giant block or all singletons), resolved at increasing N, timing wall-clock +
12
+ * peak RSS. Geocoding is NOT in scope here (it's the per-record cost measured elsewhere) — this
13
+ * isolates the matcher's block/score/cluster cost as a function of N.
14
+ *
15
+ * Run: node --experimental-strip-types registry/tools/matcher-scale.ts\
16
+ * [--sizes 10000,50000,100000,250000,500000] [--dup 3] [--em] [--out-md <md>]
17
+ */
18
+ import { writeFileSync } from "node:fs";
19
+ import { parseArgs } from "node:util";
20
+ import { resolveEntities } from "@mailwoman/registry";
21
+ // Loose scan parity with the retired local argv helpers: unknown flags tolerated.
22
+ const { values: rawValues } = parseArgs({
23
+ options: {
24
+ dup: { type: "string" },
25
+ em: { type: "boolean" },
26
+ "out-md": { type: "string" },
27
+ sizes: { type: "string" },
28
+ },
29
+ strict: false,
30
+ allowPositionals: true,
31
+ });
32
+ // Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
33
+ const values = rawValues;
34
+ const SIZES = (values["sizes"] || "10000,50000,100000,250000,500000")
35
+ .split(",")
36
+ .map((s) => Number(s.trim()))
37
+ .filter((n) => n > 0);
38
+ const DUP = Number(values["dup"] || "3"); // avg records per distinct place
39
+ const EM = values["em"] ?? false;
40
+ const OUT_MD = values["out-md"] || "";
41
+ /** Deterministic LCG so the eval is reproducible run to run (no Math.random). */
42
+ function lcg(seed) {
43
+ let s = seed >>> 0;
44
+ return () => {
45
+ s = (Math.imul(s, 1664525) + 1013904223) >>> 0;
46
+ return s / 0x100000000;
47
+ };
48
+ }
49
+ /**
50
+ * Generate N synthetic records clustered into ~N/DUP distinct "places". Each place gets a coordinate in the
51
+ * continental-US box, a canonical key, and an org name; its DUP duplicates carry a lightly-varied name and a jittered
52
+ * coordinate, so geo-cell + canonical-key blocking groups them and scoring links them — the realistic shape of a dedup
53
+ * workload.
54
+ */
55
+ function generate(n, seed = 1) {
56
+ const rnd = lcg(seed);
57
+ const places = Math.max(1, Math.round(n / DUP));
58
+ const records = new Array(n);
59
+ for (let i = 0; i < n; i++) {
60
+ const place = i % places;
61
+ const latitude = 25 + rnd() * 24; // ~25–49 N
62
+ const longitude = -124 + rnd() * 57; // ~-124 to -67 W
63
+ const variant = i < places ? "" : rnd() < 0.5 ? " llc" : " inc"; // duplicates drift the name slightly
64
+ records[i] = {
65
+ id: String(i),
66
+ organization: { canonical: `org ${place}${variant}`, raw: `Org ${place}` },
67
+ address: {
68
+ components: {},
69
+ canonicalKey: `key-${place}`,
70
+ raw: `${place} main st`,
71
+ geocode: {
72
+ coordinate: { latitude: latitude + (place % 7) * 1e-4, longitude: longitude + (place % 5) * 1e-4 },
73
+ tier: "address_point",
74
+ uncertaintyMeters: 5,
75
+ },
76
+ },
77
+ };
78
+ }
79
+ return records;
80
+ }
81
+ const mb = (bytes) => `${(bytes / 1024 / 1024).toFixed(0)} MB`;
82
+ const sec = (ms) => `${(ms / 1000).toFixed(2)} s`;
83
+ async function main() {
84
+ const rows = [];
85
+ for (const n of SIZES) {
86
+ const records = generate(n);
87
+ const t0 = performance.now();
88
+ // learnedScorer:false — this measures the FS-baseline pipeline throughput baseline (the learned scorer
89
+ // is now default-on; its per-pair tree eval is a separate cost, not what this scale number tracks).
90
+ const { entities, candidatePairs } = resolveEntities(records, {
91
+ collapseSpatial: true,
92
+ trainEM: EM,
93
+ learnedScorer: false,
94
+ });
95
+ const wallMs = performance.now() - t0;
96
+ const rssBytes = process.memoryUsage().rss;
97
+ rows.push({ n, records: records.length, entities: entities.length, candidatePairs, wallMs, rssBytes });
98
+ console.error(` N=${n}: ${sec(wallMs)}, ${candidatePairs} pairs → ${entities.length} entities, RSS ${mb(rssBytes)}`);
99
+ // Encourage reclamation between sizes (RSS is a shared-process high-water — see the report note).
100
+ if (global.gc) {
101
+ global.gc();
102
+ }
103
+ }
104
+ const lines = [];
105
+ lines.push(`# Matcher scale — pure-Node block → score → cluster (#K)`);
106
+ lines.push("");
107
+ lines.push(`_Generated by \`registry/tools/matcher-scale.ts\`. Synthetic geo-clustered records (~${DUP} per ` +
108
+ `distinct place), resolved with the geo-first baseline (collapsed spatial${EM ? " + EM" : ""}) in ONE Node ` +
109
+ `process — no Elasticsearch, no server. Geocoding is out of scope (measured separately); this isolates the ` +
110
+ `matcher's block/score/cluster cost vs N._`);
111
+ lines.push("");
112
+ lines.push(`| records | candidate pairs | entities | wall-clock | resolve rate | RSS (high-water) |`);
113
+ lines.push(`|---:|---:|---:|---:|---:|---:|`);
114
+ for (const r of rows) {
115
+ const rate = Math.round(r.records / (r.wallMs / 1000));
116
+ lines.push(`| ${r.records.toLocaleString()} | ${r.candidatePairs.toLocaleString()} | ${r.entities.toLocaleString()} | ` +
117
+ `${sec(r.wallMs)} | ${rate.toLocaleString()}/s | ${mb(r.rssBytes)} |`);
118
+ }
119
+ lines.push("");
120
+ lines.push(`## Reading`);
121
+ lines.push("");
122
+ const last = rows[rows.length - 1];
123
+ lines.push(`The matcher resolves **${last.records.toLocaleString()} records in ${sec(last.wallMs)}** in a single Node ` +
124
+ `process — block → Fellegi-Sunter → union-find clustering, no external service. Geo-cell + canonical-key ` +
125
+ `blocking keeps candidate generation near-linear (it never enumerates the O(n²) pair space), so the wall-clock ` +
126
+ `scales with the number of *blocked* pairs, not the square of N. That is the architectural claim made ` +
127
+ `concrete: a calibrated street-level geocoder feeding the blocking lets entity resolution run in-process at ` +
128
+ `hundreds of thousands of records, where a string-similarity matcher would need a search cluster to make the ` +
129
+ `candidate generation tractable.`);
130
+ lines.push("");
131
+ lines.push(`RSS is the shared-process high-water mark across the sweep (each size reuses the heap), so it is an upper ` +
132
+ `bound, not a per-N working set. The largest size that fits is bounded by the record objects + the link array; ` +
133
+ `beyond that, shard by geography (each cell is independent) — the same partition the blocking already implies.`);
134
+ lines.push("");
135
+ lines.push(`One honest caveat on the shape: these are uniform-random US coordinates, so as N rises the geo-cell collision ` +
136
+ `rate climbs and the candidate-pair count grows faster than N (visible in the table). Real address data clusters ` +
137
+ `into a roughly fixed set of places, so its pair/record ratio is flatter — the wall-clock here, which tracks the ` +
138
+ `number of PAIRS, is a conservative upper bound on a realistic workload of the same N.`);
139
+ lines.push("");
140
+ const md = lines.join("\n");
141
+ console.log(md);
142
+ if (OUT_MD) {
143
+ writeFileSync(OUT_MD, md);
144
+ console.error(`[written] ${OUT_MD}`);
145
+ }
146
+ }
147
+ await main();
148
+ //# sourceMappingURL=matcher-scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matcher-scale.js","sourceRoot":"","sources":["../../tools/matcher-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,eAAe,EAAqB,MAAM,qBAAqB,CAAA;AAExE,kFAAkF;AAClF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE;QACR,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACzB;IACD,MAAM,EAAE,KAAK;IACb,gBAAgB,EAAE,IAAI;CACtB,CAAC,CAAA;AACF,yGAAyG;AACzG,MAAM,MAAM,GAAG,SAA8E,CAAA;AAC7F,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,kCAAkC,CAAC;KACnE,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;KAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;A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K,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,IAAI,MAAM,EAAE,CAAC;QACZ,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QACzB,OAAO,CAAC,KAAK,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;IACrC,CAAC;AACF,CAAC;AAED,MAAM,IAAI,EAAE,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * #619: convert the TX HHSC nursing-facilities source (which ships an authoritative `Geo Location`
7
+ * = `lat,lon` per facility) into the OaRow JSONL the resolver eval consumes — so our geocoder can
8
+ * be graded against the provided coordinates on real facility addresses (great-circle delta, tier
9
+ * breakdown via `oa-resolver-eval --address-points`).
10
+ *
11
+ * Neutral scope: this measures GEOCODER ACCURACY on real public addresses; it makes no claim about
12
+ * the facilities themselves.
13
+ *
14
+ * Run: node --experimental-strip-types registry/tools/txhhsc-to-oarow.ts\
15
+ * --src <tsv> --out /tmp/txhhsc-oarow.jsonl
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=txhhsc-to-oarow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txhhsc-to-oarow.d.ts","sourceRoot":"","sources":["../../tools/txhhsc-to-oarow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * #619: convert the TX HHSC nursing-facilities source (which ships an authoritative `Geo Location`
7
+ * = `lat,lon` per facility) into the OaRow JSONL the resolver eval consumes — so our geocoder can
8
+ * be graded against the provided coordinates on real facility addresses (great-circle delta, tier
9
+ * breakdown via `oa-resolver-eval --address-points`).
10
+ *
11
+ * Neutral scope: this measures GEOCODER ACCURACY on real public addresses; it makes no claim about
12
+ * the facilities themselves.
13
+ *
14
+ * Run: node --experimental-strip-types registry/tools/txhhsc-to-oarow.ts\
15
+ * --src <tsv> --out /tmp/txhhsc-oarow.jsonl
16
+ */
17
+ import { readFileSync, writeFileSync } from "node:fs";
18
+ import { parseArgs } from "node:util";
19
+ import { dataRootPath } from "@mailwoman/core/utils";
20
+ const { values } = parseArgs({
21
+ options: {
22
+ src: {
23
+ type: "string",
24
+ default: String(dataRootPath("record-matcher", "sources", "txhhsc_nursing-facilities_20260611.tsv")),
25
+ },
26
+ out: { type: "string", default: "/tmp/txhhsc-oarow.jsonl" },
27
+ },
28
+ });
29
+ const src = values.src;
30
+ const out = values.out;
31
+ const lines = readFileSync(src, "utf8")
32
+ .split("\n")
33
+ .filter((l) => l.trim());
34
+ const header = lines[0].split("\t");
35
+ const col = (name) => header.indexOf(name);
36
+ const cAddr = col("Physical Address");
37
+ const cCity = col("Physical Address CITY");
38
+ const cState = col("Physical Address State");
39
+ const cZip = col("Physical Address Zipcode");
40
+ const cGeo = col("Geo Location");
41
+ const GEO = /^\s*(-?\d+\.\d+)\s*,\s*(-?\d+\.\d+)\s*$/;
42
+ const records = [];
43
+ let skipped = 0;
44
+ for (const line of lines.slice(1)) {
45
+ const f = line.split("\t");
46
+ const addr = (f[cAddr] ?? "").trim();
47
+ const city = (f[cCity] ?? "").trim();
48
+ const zip = (f[cZip] ?? "").trim();
49
+ const m = GEO.exec(f[cGeo] ?? "");
50
+ if (!addr || !city || !m) {
51
+ skipped++;
52
+ continue;
53
+ }
54
+ const lat = Number(m[1]);
55
+ const lon = Number(m[2]);
56
+ // Sanity: TX bounding box (rejects swapped/garbage coords).
57
+ if (lat < 25 || lat > 37 || lon > -93 || lon < -107) {
58
+ skipped++;
59
+ continue;
60
+ }
61
+ records.push(JSON.stringify({
62
+ input: `${addr}, ${city}, TX ${zip}`,
63
+ lat,
64
+ lon,
65
+ expected: { locality: city, region: "TX", postcode: zip },
66
+ state: "TX",
67
+ source: "txhhsc:nursing-facilities",
68
+ }));
69
+ }
70
+ writeFileSync(out, records.join("\n") + "\n");
71
+ console.error(`wrote ${records.length} rows (skipped ${skipped}) → ${out}`);
72
+ //# sourceMappingURL=txhhsc-to-oarow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txhhsc-to-oarow.js","sourceRoot":"","sources":["../../tools/txhhsc-to-oarow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE;QACR,GAAG,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE,SAAS,EAAE,wCAAwC,CAAC,CAAC;SACpG;QACD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,EAAE;KAC3D;CACD,CAAC,CAAA;AACF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAI,CAAA;AACvB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAI,CAAA;AAEvB,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC;KACrC,KAAK,CAAC,IAAI,CAAC;KACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AACzB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AACpC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAClD,MAAM,KAAK,GAAG,GA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AE,IAAI,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QACrD,OAAO,EAAE,CAAA;QACT,SAAQ;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACX,IAAI,CAAC,SAAS,CAAC;QACd,KAAK,EAAE,GAAG,IAAI,KAAK,IAAI,QAAQ,GAAG,EAAE;QACpC,GAAG;QACH,GAAG;QACH,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;QACzD,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,2BAA2B;KACnC,CAAC,CACF,CAAA;AACF,CAAC;AAED,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;AAC7C,OAAO,CAAC,KAAK,CAAC,SAAS,OAAO,CAAC,MAAM,kBAAkB,OAAO,OAAO,GAAG,EAAE,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The cross-dataset linking map — the marquee record-matcher proof, on a map.
7
+ *
8
+ * The matcher resolves entities ACROSS independent sources (NPPES provider registry, FCC RHC
9
+ * funding, TX HHSC facility licensing) with NO shared key — purely on the geocoded location +
10
+ * name agreement. This renders the `cross-dataset-links` GeoJSON (every entity that resolved
11
+ * across ≥2 sources) on the HOUSE map stack via {@link toMapHTML} (MapLibre GL + a Protomaps
12
+ * basemap). Each entity is colored by its SOURCE COMBINATION (a synthesized `bucket`), so the
13
+ * entities spanning all three sources stand out from the two-source links.
14
+ *
15
+ * Neutral entity-resolution view: it shows what resolved to what and how confidently (cohesion
16
+ * sizes the marker). It does NOT interpret coverage/eligibility — that is the consumer's call.
17
+ *
18
+ * SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
19
+ * domains; a file:// page shows accurate markers on a blank basemap). e.g. `python3 -m
20
+ * http.server -d <dir>` then open the page; or use `render-map.mjs` against the served URL.
21
+ *
22
+ * `--cross-agency-only` keeps just the entities whose sources span >1 AGENCY (the two FCC datasets
23
+ * count as one) — the harder cross-agency slice; most raw links are FCC-internal (RHC ↔
24
+ * commitments).
25
+ *
26
+ * Run: node --experimental-strip-types registry/tools/viz/cross-dataset-map.ts\
27
+ * [--in <links.geojson>] [--out-html /tmp/cross-dataset-map.html] [--cross-agency-only]
28
+ */
29
+ export {};
30
+ //# sourceMappingURL=cross-dataset-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-dataset-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/cross-dataset-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The cross-dataset linking map — the marquee record-matcher proof, on a map.
7
+ *
8
+ * The matcher resolves entities ACROSS independent sources (NPPES provider registry, FCC RHC
9
+ * funding, TX HHSC facility licensing) with NO shared key — purely on the geocoded location +
10
+ * name agreement. This renders the `cross-dataset-links` GeoJSON (every entity that resolved
11
+ * across ≥2 sources) on the HOUSE map stack via {@link toMapHTML} (MapLibre GL + a Protomaps
12
+ * basemap). Each entity is colored by its SOURCE COMBINATION (a synthesized `bucket`), so the
13
+ * entities spanning all three sources stand out from the two-source links.
14
+ *
15
+ * Neutral entity-resolution view: it shows what resolved to what and how confidently (cohesion
16
+ * sizes the marker). It does NOT interpret coverage/eligibility — that is the consumer's call.
17
+ *
18
+ * SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
19
+ * domains; a file:// page shows accurate markers on a blank basemap). e.g. `python3 -m
20
+ * http.server -d <dir>` then open the page; or use `render-map.mjs` against the served URL.
21
+ *
22
+ * `--cross-agency-only` keeps just the entities whose sources span >1 AGENCY (the two FCC datasets
23
+ * count as one) — the harder cross-agency slice; most raw links are FCC-internal (RHC ↔
24
+ * commitments).
25
+ *
26
+ * Run: node --experimental-strip-types registry/tools/viz/cross-dataset-map.ts\
27
+ * [--in <links.geojson>] [--out-html /tmp/cross-dataset-map.html] [--cross-agency-only]
28
+ */
29
+ import { readFileSync, writeFileSync } from "node:fs";
30
+ import { parseArgs } from "node:util";
31
+ import { dataRootPath } from "@mailwoman/core/utils";
32
+ import { toMapHTML } from "@mailwoman/registry";
33
+ // Loose scan parity with the retired local argv helpers: unknown flags tolerated.
34
+ const { values: rawValues } = parseArgs({
35
+ options: { "cross-agency-only": { type: "boolean" }, in: { type: "string" }, "out-html": { type: "string" } },
36
+ strict: false,
37
+ allowPositionals: true,
38
+ });
39
+ // Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
40
+ const values = rawValues;
41
+ const IN = values["in"] || dataRootPath("record-matcher", "2026-06-16-cross-dataset-links.geojson");
42
+ const OUT = values["out-html"] || "/tmp/cross-dataset-map.html";
43
+ const SOURCE_LABELS = {
44
+ nppes: "NPPES",
45
+ "fcc-rhc": "FCC RHC",
46
+ "fcc-rhc-commitments": "FCC commitments",
47
+ "txhhsc-nursing": "TX HHSC",
48
+ };
49
+ const label = (s) => SOURCE_LABELS[s] ?? s;
50
+ // Which AGENCY each source belongs to. The two FCC datasets (RHC posted-services + commitments) are
51
+ // ONE agency — so an NPPES↔FCC or FCC↔TX link is cross-AGENCY, but an RHC↔commitments link is not.
52
+ // `--cross-agency-only` keeps just the entities whose sources span >1 agency: the harder, more
53
+ // striking "no shared key ACROSS agencies" slice (most of the raw links are FCC-internal).
54
+ const SOURCE_AGENCY = {
55
+ nppes: "CMS",
56
+ "fcc-rhc": "FCC",
57
+ "fcc-rhc-commitments": "FCC",
58
+ "txhhsc-nursing": "TX HHSC",
59
+ };
60
+ const agencyOf = (s) => SOURCE_AGENCY[s] ?? s;
61
+ const CROSS_AGENCY_ONLY = values["cross-agency-only"] ?? false;
62
+ const sourcesOf = (f) => Array.isArray(f.properties?.["sources"]) ? f.properties["sources"] : [];
63
+ const parsed = JSON.parse(readFileSync(IN, "utf8"));
64
+ const total = parsed.features.length;
65
+ const geojson = CROSS_AGENCY_ONLY
66
+ ? { ...parsed, features: parsed.features.filter((f) => new Set(sourcesOf(f).map(agencyOf)).size > 1) }
67
+ : parsed;
68
+ // Synthesize a `bucket` per entity = its sorted source-combination, so toMapHTML colors by the link
69
+ // TYPE (two-source vs the rarer all-three-source spans) rather than the binary cross/single status.
70
+ let triple = 0;
71
+ const comboCounts = new Map();
72
+ for (const f of geojson.features) {
73
+ const combo = [...new Set(sourcesOf(f))].sort();
74
+ const bucket = combo.map(label).join(" + ") || "unlinked";
75
+ if (f.properties) {
76
+ f.properties["bucket"] = bucket;
77
+ }
78
+ if (new Set(combo.map(agencyOf)).size >= 3) {
79
+ triple++;
80
+ }
81
+ comboCounts.set(bucket, (comboCounts.get(bucket) ?? 0) + 1);
82
+ }
83
+ const kept = geojson.features.length;
84
+ const scope = CROSS_AGENCY_ONLY ? "across agencies" : "across sources";
85
+ const html = toMapHTML(geojson, {
86
+ title: `Cross-dataset entity links — ${kept} resolved ${scope} (no shared key)`,
87
+ flavor: "light",
88
+ colorBy: "bucket",
89
+ });
90
+ writeFileSync(OUT, html);
91
+ console.error(`[written] ${OUT} (${kept}${CROSS_AGENCY_ONLY ? ` of ${total} cross-AGENCY` : ""} entities)`);
92
+ console.error(` source combinations:`);
93
+ for (const [combo, n] of [...comboCounts.entries()].sort((a, b) => b[1] - a[1])) {
94
+ console.error(` ${n.toString().padStart(4)} ${combo}`);
95
+ }
96
+ console.error(` spanning all three agencies: ${triple}`);
97
+ //# sourceMappingURL=cross-dataset-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-dataset-map.js","sourceRoot":"","sources":["../../../tools/viz/cross-dataset-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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AE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAC3D,CAAC;AACD,OAAO,CAAC,KAAK,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAA"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The geocode-first decision surface — the headline concept figure for the record matcher.
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 `registry/tools/viz/render.mjs` (Playwright + swiftshader for headless WebGL).
35
+ *
36
+ * Run: node --experimental-strip-types registry/tools/viz/geocode-first-surface.ts\
37
+ * [--lambda 0.02] [--out-html /tmp/geocode-first-surface.html]
38
+ */
39
+ export {};
40
+ //# sourceMappingURL=geocode-first-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG"}