@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,249 @@
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
+ import { writeFileSync } from "node:fs";
40
+ import { parseArgs } from "node:util";
41
+ // Loose scan parity with the retired local argv helpers: unknown flags tolerated.
42
+ const { values: rawValues } = parseArgs({
43
+ options: { lambda: { type: "string" }, "out-html": { type: "string" } },
44
+ strict: false,
45
+ allowPositionals: true,
46
+ });
47
+ // Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
48
+ const values = rawValues;
49
+ // Illustrative prior. Production's record matcher uses λ=1e-4 (calibrated for the full multi-field
50
+ // model with phone + spatial exact-key); here we want the boundary visible in a two-axis slice.
51
+ const LAMBDA = Number(values["lambda"] || "0.02");
52
+ const OUT_HTML = values["out-html"] || "/tmp/geocode-first-surface.html";
53
+ // registry/resolve.ts → NAME_LEVELS
54
+ const NAME_LEVELS = [
55
+ { label: "exact", minSimilarity: 1.0, m: 0.8, u: 0.01 },
56
+ { label: "high", minSimilarity: 0.88, m: 0.15, u: 0.03 },
57
+ { label: "different", minSimilarity: 0, m: 0.05, u: 0.96 },
58
+ ];
59
+ // match/distance.ts → DEFAULT_DISTANCE_LEVELS
60
+ const DISTANCE_LEVELS = [
61
+ { label: "same-building", maxKm: 0.05, m: 0.7, u: 0.001 },
62
+ { label: "same-block", maxKm: 0.5, m: 0.2, u: 0.02 },
63
+ { label: "same-area", maxKm: 5, m: 0.08, u: 0.2 },
64
+ { label: "far", m: 0.02, u: 0.779 },
65
+ ];
66
+ // match/fellegi-sunter.ts → levelWeight / priorWeight / probabilityFromWeight
67
+ const levelWeight = (lvl) => (lvl.u <= 0 ? (lvl.m > 0 ? Infinity : 0) : Math.log2(lvl.m / lvl.u));
68
+ const priorWeight = (lambda) => Math.log2(lambda / (1 - lambda));
69
+ const probabilityFromWeight = (w) => 1 / (1 + 2 ** -w);
70
+ /** Assign a name-similarity score to its agreement-level weight (levels ordered high→low sim). */
71
+ function nameWeight(sim) {
72
+ for (const lvl of NAME_LEVELS)
73
+ if (sim >= (lvl.minSimilarity ?? 0))
74
+ return levelWeight(lvl);
75
+ return levelWeight(NAME_LEVELS[NAME_LEVELS.length - 1]);
76
+ }
77
+ /** Assign a distance (km) to its agreement-level weight (levels ordered near→far). */
78
+ function distanceWeight(km) {
79
+ for (const lvl of DISTANCE_LEVELS)
80
+ if (km <= (lvl.maxKm ?? Infinity))
81
+ return levelWeight(lvl);
82
+ return levelWeight(DISTANCE_LEVELS[DISTANCE_LEVELS.length - 1]);
83
+ }
84
+ const PRIOR = priorWeight(LAMBDA);
85
+ /** String-first model: name evidence only — distance is invisible to it. */
86
+ const pStringFirst = (sim, _km) => probabilityFromWeight(PRIOR + nameWeight(sim));
87
+ /** Geocode-first model: name + distance evidence. */
88
+ const pGeocodeFirst = (sim, km) => probabilityFromWeight(PRIOR + nameWeight(sim) + distanceWeight(km));
89
+ // ── Grid. X = string similarity 0→1. Y = geographic distance, sampled denser near 0 (log-ish) so
90
+ // the meaningful same-building / same-block transitions aren't a single pixel. ────────────────
91
+ const NX = 60;
92
+ const NY = 60;
93
+ const KM_MAX = 50; // 0 → 50 km, log-spaced
94
+ const simAxis = Array.from({ length: NX }, (_, i) => i / (NX - 1));
95
+ // log-spaced distance: 0.005 km (5 m) → 50 km, plus a literal 0 at the front
96
+ const kmAxis = Array.from({ length: NY }, (_, j) => {
97
+ const t = j / (NY - 1);
98
+ return 0.005 * Math.pow(KM_MAX / 0.005, t);
99
+ });
100
+ function surface(p) {
101
+ // Plotly z is row-major over y (distance), each row across x (similarity).
102
+ return kmAxis.map((km) => simAxis.map((sim) => p(sim, km)));
103
+ }
104
+ const zString = surface(pStringFirst);
105
+ const zGeo = surface(pGeocodeFirst);
106
+ const TRAPS = [
107
+ {
108
+ label: "Springfield General — IL vs MA",
109
+ detail: "identical name, ~1500 km apart",
110
+ sim: 1.0,
111
+ km: 15, // plotted on the far plateau (real distance ~1500 km; clamped into view)
112
+ },
113
+ {
114
+ // "St" → "Street" canonicalizes to a high (not exact) name agreement; the trailing "Apt 2"
115
+ // keeps it off 1.0. Lands in the 0.88 "high" tier — same place, drifted-but-recognizable string.
116
+ label: "123 Main St vs 123 Main Street Apt 2",
117
+ detail: "same building, drifted string",
118
+ sim: 0.9,
119
+ km: 0.01,
120
+ },
121
+ ];
122
+ // Decision verdicts at each trap (for the annotation text).
123
+ const verdict = (p) => (p >= 0.5 ? "MATCH" : "no");
124
+ const trapRows = TRAPS.map((t) => ({
125
+ ...t,
126
+ stringP: pStringFirst(t.sim, t.km),
127
+ geoP: pGeocodeFirst(t.sim, t.km),
128
+ }));
129
+ // ── HTML. ───────────────────────────────────────────────────────────────────────────────────────
130
+ const data = {
131
+ simAxis,
132
+ kmAxis,
133
+ zString,
134
+ zGeo,
135
+ traps: trapRows,
136
+ lambda: LAMBDA,
137
+ prior: PRIOR,
138
+ };
139
+ const safe = JSON.stringify(data).replace(/<\/script>/gi, "<\\/script>");
140
+ const html = `<!doctype html><html><head><meta charset="utf-8"/>
141
+ <script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>
142
+ <style>
143
+ body{margin:0;font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#111}
144
+ h1{font-size:18px;margin:14px 0 2px 20px}
145
+ h2{font-size:14px;margin:14px 0 0 20px;font-weight:600}
146
+ p.sub{margin:2px 20px 0;color:#555;font-size:12px;max-width:1100px;line-height:1.45}
147
+ #pair{width:1120px;height:440px}
148
+ #contour{width:1120px;height:520px}
149
+ .cap{margin:6px 20px 14px;color:#666;font-size:11px;max-width:1100px;line-height:1.4}
150
+ </style></head><body>
151
+ <h1>Two ways to draw the line — string-first vs geocode-first</h1>
152
+ <p class="sub">P(match) over the same record-pair space: string similarity (x) × geographic distance (y).
153
+ Same Fellegi-Sunter scorer, real per-level Bayes factors; the only difference is which evidence each
154
+ model may see. <b>String-first</b> sees the name only — its boundary is a vertical wall at high
155
+ similarity, blind to where the records are. <b>Geocode-first</b> also sees distance — the wall bends,
156
+ becoming a basin you can only climb out of <i>near a shared place</i>.</p>
157
+ <div id="pair"></div>
158
+ <h2>The decision boundary, read from above</h2>
159
+ <p class="sub">The geocode-first P(match) contour with the string-first boundary (dashed) drawn for
160
+ contrast, and the two traps string matching was built to fall into. Geocode-first puts the far-apart
161
+ namesakes in the reject basin and pulls the same-building pair across the line — string-first inverts
162
+ both.</p>
163
+ <div id="contour"></div>
164
+ <p class="cap" id="cap"></p>
165
+ <script>
166
+ const D = ${safe};
167
+ const COMMON_SCENE = (title) => ({
168
+ xaxis:{title:"string similarity", range:[0,1], backgroundcolor:"#fafafa", gridcolor:"#e5e5e5"},
169
+ yaxis:{title:"distance (km, log)", type:"log", backgroundcolor:"#fafafa", gridcolor:"#e5e5e5"},
170
+ zaxis:{title:"P(match)", range:[0,1], gridcolor:"#e5e5e5"},
171
+ camera:{eye:{x:-1.6,y:-1.5,z:0.9}},
172
+ aspectratio:{x:1,y:1,z:0.6}
173
+ });
174
+ const surfFor = (z, name, colorscale) => ({
175
+ type:"surface", z:z, x:D.simAxis, y:D.kmAxis, name:name,
176
+ colorscale:colorscale, cmin:0, cmax:1, showscale:false,
177
+ contours:{z:{show:true, usecolormap:true, project:{z:true}, start:0, end:1, size:0.1}},
178
+ lighting:{ambient:0.75, diffuse:0.6, roughness:0.9}, opacity:1
179
+ });
180
+ Plotly.newPlot("pair", [
181
+ Object.assign(surfFor(D.zString, "string-first", "YlOrRd"), {scene:"scene"}),
182
+ Object.assign(surfFor(D.zGeo, "geocode-first", "Viridis"), {scene:"scene2"})
183
+ ], {
184
+ margin:{l:0,r:0,t:24,b:0},
185
+ scene:Object.assign(COMMON_SCENE(), {domain:{x:[0,0.48]}}),
186
+ scene2:Object.assign(COMMON_SCENE(), {domain:{x:[0.52,1]}}),
187
+ annotations:[],
188
+ showlegend:false
189
+ }, {displayModeBar:false, responsive:false}).then(()=>{
190
+ // titles over each scene
191
+ Plotly.relayout("pair", {
192
+ "annotations":[
193
+ {text:"<b>STRING-FIRST</b> — name only (vertical wall)", x:0.22, y:1.04, xref:"paper", yref:"paper", showarrow:false, font:{size:13, color:"#b3402a"}},
194
+ {text:"<b>GEOCODE-FIRST</b> — name + distance (basin)", x:0.78, y:1.04, xref:"paper", yref:"paper", showarrow:false, font:{size:13, color:"#2a6b6b"}}
195
+ ]
196
+ });
197
+ });
198
+
199
+ // 2D contour of geocode-first, traps annotated.
200
+ const trapX = D.traps.map(t=>t.sim);
201
+ const trapY = D.traps.map(t=>Math.max(t.km, D.kmAxis[0]));
202
+ Plotly.newPlot("contour", [
203
+ {type:"contour", z:D.zGeo, x:D.simAxis, y:D.kmAxis, colorscale:"Viridis", zmin:0, zmax:1,
204
+ contours:{coloring:"heatmap", showlines:true, start:0, end:1, size:0.1,
205
+ // emphasize the P=0.5 decision isocline
206
+ }, colorbar:{title:"P(match)", thickness:12, len:0.8}},
207
+ // string-first boundary: vertical line where name alone crosses 0.5
208
+ {type:"scatter", mode:"lines", x:[0.985,0.985], y:[D.kmAxis[0], D.kmAxis[D.kmAxis.length-1]],
209
+ line:{color:"#b3402a", width:2, dash:"dash"}, name:"string-first boundary", hoverinfo:"name"},
210
+ {type:"scatter", mode:"markers+text", x:trapX, y:trapY,
211
+ marker:{size:13, color:"#fff", line:{color:"#111", width:2}, symbol:"x-thin", "line.width":3},
212
+ text:D.traps.map((t,i)=> (i===0?"①":"②")), textposition:"middle center",
213
+ textfont:{size:13,color:"#111"}, name:"traps", hoverinfo:"text",
214
+ hovertext:D.traps.map(t=>t.label)}
215
+ ], {
216
+ margin:{l:70,r:20,t:10,b:50},
217
+ yaxis:{title:"geographic distance (km, log)", type:"log", range:[Math.log10(D.kmAxis[0]), Math.log10(D.kmAxis[D.kmAxis.length-1])], autorange:false},
218
+ xaxis:{title:"string similarity", range:[0,1]},
219
+ showlegend:true, legend:{x:0.62, y:0.06, bgcolor:"rgba(255,255,255,0.85)", font:{size:11}},
220
+ shapes:[0.05,0.5,5].map((km)=>({type:"line", xref:"paper", x0:0, x1:1, yref:"y", y0:km, y1:km, line:{color:"rgba(255,255,255,0.45)", width:1, dash:"dot"}})),
221
+ annotations:[
222
+ {x:0.015, y:0.05, text:"same-building", showarrow:false, font:{size:9,color:"#eee"}, xanchor:"left", yanchor:"bottom"},
223
+ {x:0.015, y:0.5, text:"same-block", showarrow:false, font:{size:9,color:"#eee"}, xanchor:"left", yanchor:"bottom"},
224
+ {x:0.015, y:5, text:"same-area", showarrow:false, font:{size:9,color:"#ddd"}, xanchor:"left", yanchor:"bottom"},
225
+ // Paper-anchored callout boxes (stable placement), each tied to its ①/② marker, with a paper→data arrow.
226
+ {xref:"paper", yref:"paper", x:0.30, y:0.86, ax:trapX[0], ay:trapY[0], axref:"x", ayref:"y",
227
+ text:"① "+D.traps[0].label+"<br>"+D.traps[0].detail+"<br><b>string-first: MATCH ✗ · geocode-first: reject ✓</b>",
228
+ showarrow:true, arrowhead:2, arrowcolor:"#b3402a", align:"left", font:{size:10,color:"#111"}, bgcolor:"rgba(255,255,255,0.94)", bordercolor:"#b3402a", borderpad:3},
229
+ {xref:"paper", yref:"paper", x:0.30, y:0.30, ax:trapX[1], ay:trapY[1], axref:"x", ayref:"y",
230
+ text:"② "+D.traps[1].label+"<br>"+D.traps[1].detail+"<br><b>string-first: reject ✗ · geocode-first: MATCH ✓</b>",
231
+ showarrow:true, arrowhead:2, arrowcolor:"#2a6b6b", align:"left", font:{size:10,color:"#111"}, bgcolor:"rgba(255,255,255,0.94)", bordercolor:"#2a6b6b", borderpad:3}
232
+ ]
233
+ }, {displayModeBar:false, responsive:false});
234
+
235
+ const fmt = (p)=> (p*100).toFixed(p>=0.5?0:1)+"%";
236
+ document.getElementByID("cap").innerHTML =
237
+ "Real per-level Bayes factors (NAME_LEVELS, DEFAULT_DISTANCE_LEVELS); illustrative prior λ="+D.lambda+
238
+ " (production λ=1e-4 + phone/spatial-key corroboration, omitted here to isolate the two-axis boundary). "+
239
+ "Trap ① string-first="+fmt(D.traps[0].stringP)+" (MATCH ✗) · geocode-first="+fmt(D.traps[0].geoP)+" (reject ✓). "+
240
+ "Trap ② string-first="+fmt(D.traps[1].stringP)+" (reject ✗) · geocode-first="+fmt(D.traps[1].geoP)+" (MATCH ✓).";
241
+ </script>
242
+ </body></html>`;
243
+ writeFileSync(OUT_HTML, html);
244
+ console.error(`[written] ${OUT_HTML}`);
245
+ console.error(`λ=${LAMBDA} prior=${PRIOR.toFixed(2)} bits`);
246
+ for (const t of trapRows) {
247
+ console.error(` ${t.label}: string-first ${(t.stringP * 100).toFixed(1)}% (${verdict(t.stringP)}) | geocode-first ${(t.geoP * 100).toFixed(1)}% (${verdict(t.geoP)})`);
248
+ }
249
+ //# sourceMappingURL=geocode-first-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,kFAAkF;AAClF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IACvE,MAAM,EAAE,KAAK;IACb,gBAAgB,EAAE,IAAI;CACtB,CAAC,CAAA;AACF,yGAAyG;AACzG,MAAM,MAAM,GAAG,SAAqD,CAAA;AACpE,mGAAmG;AACnG,gGAAgG;AAChG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAA;AACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,iCAAiC,CAAA;AAaxE,oCAAoC;AACpC,MAAM,WAAW,GAAY;IAC5B,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACvD,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,8CAA8C;AA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AAA;AAEH,mGAAmG;AAEnG,MAAM,IAAI,GAAG;IACZ,OAAO;IACP,MAAM;IACN,OAAO;IACP,IAAI;IACJ,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACZ,CAAA;AAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAA;AAExE,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BD,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4ED,CAAA;AAEf,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7B,OAAO,CAAC,KAAK,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;AACtC,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,WAAW,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAE5D,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CACZ,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;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Render a {@link toMapHTML} page (MapLibre GL + Protomaps basemap) to a PNG via headless Chromium.
7
+ *
8
+ * Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
9
+ *
10
+ * - MapLibre needs a real WebGL context → ANGLE's SwiftShader software rasterizer (the same flags the
11
+ * 3D Plotly render uses).
12
+ * - The basemap tiles come from `tiles.sister.software`, which CORS-restricts to localhost + the docs
13
+ * domains — so the page MUST be SERVED OVER LOCALHOST, not opened as a file (a file:// page
14
+ * renders accurate markers on a blank basemap). Serve the output dir first, e.g. `python3 -m
15
+ * http.server 8899 -d <dir>`, then point this at `http://localhost:8899/<page>.html`.
16
+ *
17
+ * The map paints asynchronously after the network settles; we wait for networkidle, then a fixed
18
+ * beat for the basemap tiles + marker layer to finish compositing.
19
+ *
20
+ * Run: node registry/tools/viz/render-map.ts <served-url> <out.png>
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=render-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/render-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Render a {@link toMapHTML} page (MapLibre GL + Protomaps basemap) to a PNG via headless Chromium.
7
+ *
8
+ * Two house-stack constraints make this fiddlier than the Plotly/SVG renderers:
9
+ *
10
+ * - MapLibre needs a real WebGL context → ANGLE's SwiftShader software rasterizer (the same flags the
11
+ * 3D Plotly render uses).
12
+ * - The basemap tiles come from `tiles.sister.software`, which CORS-restricts to localhost + the docs
13
+ * domains — so the page MUST be SERVED OVER LOCALHOST, not opened as a file (a file:// page
14
+ * renders accurate markers on a blank basemap). Serve the output dir first, e.g. `python3 -m
15
+ * http.server 8899 -d <dir>`, then point this at `http://localhost:8899/<page>.html`.
16
+ *
17
+ * The map paints asynchronously after the network settles; we wait for networkidle, then a fixed
18
+ * beat for the basemap tiles + marker layer to finish compositing.
19
+ *
20
+ * Run: node registry/tools/viz/render-map.ts <served-url> <out.png>
21
+ */
22
+ import { parseArgs } from "node:util";
23
+ import { chromium } from "playwright";
24
+ const { positionals } = parseArgs({ allowPositionals: true, strict: false });
25
+ const url = positionals[0];
26
+ const out = positionals[1];
27
+ if (!url || !out) {
28
+ console.error("usage: render-map.ts <served-localhost-url> <out.png>");
29
+ process.exit(1);
30
+ }
31
+ const browser = await chromium.launch({
32
+ args: ["--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--ignore-gpu-blocklist"],
33
+ });
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(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(4_000);
41
+ await page.screenshot({ path: out });
42
+ await browser.close();
43
+ console.error(`[map-render] ${out}; console errors=${errors.length}`);
44
+ for (const e of errors.slice(0, 6)) {
45
+ console.error(" " + e);
46
+ }
47
+ //# sourceMappingURL=render-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-map.js","sourceRoot":"","sources":["../../../tools/viz/render-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AAC5E,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAC1B,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAE1B,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,C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C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACpC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;AACxB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Render a self-contained Plotly HTML to a PNG via headless Chromium.
7
+ *
8
+ * Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context; headless Chromium has none by
9
+ * default, so we force ANGLE's SwiftShader software rasterizer (`--use-gl=angle
10
+ * --use-angle=swiftshader --enable-unsafe-swiftshader`). 2D traces (`contour`/`heatmap`) render
11
+ * on the 2D canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div
12
+ * rather than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
13
+ *
14
+ * Run: node registry/tools/viz/render.ts <in.html> <out.png> [width] [height]
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Render a self-contained Plotly HTML to a PNG via headless Chromium.
7
+ *
8
+ * Plotly 3D (`surface`/`scatter3d`) needs a real WebGL context; headless Chromium has none by
9
+ * default, so we force ANGLE's SwiftShader software rasterizer (`--use-gl=angle
10
+ * --use-angle=swiftshader --enable-unsafe-swiftshader`). 2D traces (`contour`/`heatmap`) render
11
+ * on the 2D canvas regardless. We wait for Plotly's `plotly_afterplot` to fire on every graph div
12
+ * rather than a fixed sleep, so the screenshot can't race the (async) WebGL paint.
13
+ *
14
+ * Run: node registry/tools/viz/render.ts <in.html> <out.png> [width] [height]
15
+ */
16
+ import { resolve } from "node:path";
17
+ import { pathToFileURL } from "node:url";
18
+ import { parseArgs } from "node:util";
19
+ import { chromium } from "playwright";
20
+ const { positionals } = parseArgs({ allowPositionals: true, strict: false });
21
+ const [inHTML, outPNG, w = "1160", h = "1000"] = positionals;
22
+ if (!inHTML || !outPNG) {
23
+ console.error("usage: render.ts <in.html> <out.png> [width] [height]");
24
+ process.exit(1);
25
+ }
26
+ const browser = await chromium.launch({
27
+ args: ["--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--ignore-gpu-blocklist"],
28
+ });
29
+ const page = await browser.newPage({ viewport: { width: Number(w), height: Number(h) }, deviceScaleFactor: 2 });
30
+ const errors = [];
31
+ page.on("console", (m) => m.type() === "error" && errors.push(m.text()));
32
+ page.on("pageerror", (e) => errors.push(String(e)));
33
+ await page.goto(pathToFileURL(resolve(inHTML)).href, { waitUntil: "networkidle" });
34
+ // Resolve once every Plotly graph div has fired plotly_afterplot (3D paints land async, after
35
+ // newPlot's promise resolves), with a per-div fallback so an already-painted div can't hang us.
36
+ await page.evaluate(async () => {
37
+ const doc = globalThis.document;
38
+ const divs = [...doc.querySelectorAll("div")]
39
+ .map((d) => d)
40
+ .filter((d) => d._fullLayout && typeof d.on === "function");
41
+ await Promise.all(divs.map((d) => new Promise((res) => {
42
+ d.on("plotly_afterplot", () => res());
43
+ setTimeout(() => res(), 2000);
44
+ })));
45
+ });
46
+ // Final settle for the software WebGL rasterizer.
47
+ await page.waitForTimeout(800);
48
+ await page.screenshot({ path: resolve(outPNG), fullPage: true });
49
+ await browser.close();
50
+ if (errors.length) {
51
+ console.error(`[render] ${errors.length} console error(s):`);
52
+ for (const e of errors.slice(0, 8)) {
53
+ console.error(" " + e);
54
+ }
55
+ }
56
+ console.error(`[render] ${outPNG}`);
57
+ //# 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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AAE,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,MAAM,oBAAoB,CAAC,CAAA;IAE5D,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;IACxB,CAAC;AACF,CAAC;AACD,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,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 address-point provenance map — the "show your work" proof, on a map.
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 `render-map.mjs` against the served URL.
24
+ *
25
+ * Run: node --experimental-strip-types registry/tools/viz/source-provenance-map.ts\
26
+ * [--state ny] [--db <address-points-us-XX.db>] [--out-html /tmp/source-provenance.html]\
27
+ * [--nad-mod 700] [--oa-mod 120] [--cap 7000]
28
+ */
29
+ export {};
30
+ //# sourceMappingURL=source-provenance-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The address-point provenance map — the "show your work" proof, on a map.
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 `render-map.mjs` against the served URL.
24
+ *
25
+ * Run: node --experimental-strip-types registry/tools/viz/source-provenance-map.ts\
26
+ * [--state ny] [--db <address-points-us-XX.db>] [--out-html /tmp/source-provenance.html]\
27
+ * [--nad-mod 700] [--oa-mod 120] [--cap 7000]
28
+ */
29
+ import { writeFileSync } from "node:fs";
30
+ import { DatabaseSync } from "node:sqlite";
31
+ import { parseArgs } from "node:util";
32
+ import { dataRootPath } from "@mailwoman/core/utils";
33
+ import { toMapHTML } from "@mailwoman/registry";
34
+ // Loose scan parity with the retired local argv helpers: unknown flags tolerated.
35
+ const { values: rawValues } = parseArgs({
36
+ options: {
37
+ cap: { type: "string" },
38
+ db: { type: "string" },
39
+ "nad-mod": { type: "string" },
40
+ "oa-mod": { type: "string" },
41
+ "out-html": { type: "string" },
42
+ state: { type: "string" },
43
+ },
44
+ strict: false,
45
+ allowPositionals: true,
46
+ });
47
+ // Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
48
+ const values = rawValues;
49
+ const STATE = (values["state"] || "ny").toLowerCase();
50
+ const DB = values["db"] || `${dataRootPath("address-points")}/address-points-us-${STATE}.db`;
51
+ const OUT = values["out-html"] || "/tmp/source-provenance.html";
52
+ const NAD_MOD = Number(values["nad-mod"] || "700"); // keep ~1/700 of NAD points
53
+ const OA_MOD = Number(values["oa-mod"] || "120"); // keep ~1/120 of OpenAddresses points
54
+ const CAP = Number(values["cap"] || "7000"); // per-source marker cap
55
+ // Collapse the raw `source` string into a human, mappable category. The address-point DB stores e.g.
56
+ // "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data" — the suffix is the real upstream
57
+ // publisher, which is what we want to color by (the "overture:" prefix is just the theme it arrived in).
58
+ function categorize(source) {
59
+ if (source === "overture:NAD")
60
+ return { bucket: "National Address Database", publisher: "NAD (federal)" };
61
+ if (source.startsWith("overture:OpenAddresses")) {
62
+ const publisher = source.split("/").slice(-1)[0] || "OpenAddresses";
63
+ return { bucket: "OpenAddresses", publisher: `OpenAddresses · ${publisher}` };
64
+ }
65
+ return { bucket: source, publisher: source };
66
+ }
67
+ const db = new DatabaseSync(DB, { readOnly: true });
68
+ // Two stratified samples so the smaller source (OpenAddresses, ~1/6 of NY) stays visible next to NAD.
69
+ // abs(random()) % mod == 0 keeps a spatially-uniform ~1/mod fraction; LIMIT caps the marker count.
70
+ const sample = (where, mod) => db
71
+ .prepare(`SELECT lat, lon, source, number, street_raw FROM address_point
72
+ WHERE ${where} AND lat IS NOT NULL AND lon IS NOT NULL AND abs(random()) % ${mod} = 0
73
+ LIMIT ${CAP}`)
74
+ .all();
75
+ const rows = [...sample("source = 'overture:NAD'", NAD_MOD), ...sample("source LIKE 'overture:OpenAddresses%'", OA_MOD)];
76
+ db.close();
77
+ const counts = new Map();
78
+ const features = rows.map((r) => {
79
+ const { bucket, publisher } = categorize(r.source);
80
+ counts.set(bucket, (counts.get(bucket) ?? 0) + 1);
81
+ const addr = [r.number, r.street_raw].filter(Boolean).join(" ").trim();
82
+ return {
83
+ type: "Feature",
84
+ geometry: { type: "Point", coordinates: [r.lon, r.lat] },
85
+ properties: {
86
+ bucket,
87
+ sources: [bucket],
88
+ recordCount: 1,
89
+ geocodeTier: "address_point",
90
+ organization: publisher,
91
+ address: addr || null,
92
+ },
93
+ };
94
+ });
95
+ const geojson = { type: "FeatureCollection", features };
96
+ const html = toMapHTML(geojson, {
97
+ title: `Address-point provenance — ${STATE.toUpperCase()}, every point colored by its open-data source`,
98
+ flavor: "light",
99
+ colorBy: "bucket",
100
+ });
101
+ writeFileSync(OUT, html);
102
+ console.error(`[written] ${OUT} (${features.length} points)`);
103
+ for (const [bucket, n] of [...counts.entries()].sort((a, b) => b[1] - a[1])) {
104
+ console.error(` ${n.toString().padStart(5)} ${bucket}`);
105
+ }
106
+ //# sourceMappingURL=source-provenance-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,kFAAkF;AAClF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE;QACR,GA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L-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The yardstick figure — "the dedup F1 climbs as the entity-truth gets honest."
7
+ *
8
+ * The #625 finding, made visual: the matcher's MEASURED dedup quality depends almost entirely on
9
+ * which ruler you grade it against, not on the model. NPI-as-truth OVER-SEGMENTS (one org holds
10
+ * many NPIs), so the matcher's correct co-located same-org merges are scored as errors. Grade the
11
+ * IDENTICAL clusters against a gold-set-validated org-name truth and the F1 climbs — the ruler
12
+ * ceasing to charge for correct merges, not the model changing — peaking when the ruler keys on
13
+ * the geocoded BUILDING (the geocode-first coordinate) rather than the address string (+14.5pp
14
+ * NPI → coord).
15
+ *
16
+ * A slope chart over four rulers (NPI → site → org-name → org-name-coord) for the shipped GBT
17
+ * scorer and the FS baseline. Numbers are the committed measurement in
18
+ * `docs/articles/evals/2026-06-16-dedup-dual-level-benchmark.md` (1000 TX NPIs → 2757 records).
19
+ *
20
+ * Emits a self-contained SVG (the docs' committed-chart-asset convention — see
21
+ * `docs/articles/evals/charts/*.svg`), no browser required.
22
+ *
23
+ * Run: node --experimental-strip-types registry/tools/viz/yardstick-figure.ts\
24
+ * [--out-svg docs/articles/evals/charts/dedup-yardstick.svg]
25
+ */
26
+ export {};
27
+ //# sourceMappingURL=yardstick-figure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yardstick-figure.d.ts","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}