@mailwoman/registry 8.5.0 → 9.0.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 +62 -36
- package/ingest.ts +7 -2
- package/learned-scorer.ts +2 -2
- package/models/dedup-gbt-en-us.ts +1 -1
- package/out/ingest.d.ts +3 -0
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +4 -2
- package/out/ingest.js.map +1 -1
- package/out/learned-scorer.d.ts +2 -2
- package/out/learned-scorer.js +2 -2
- package/out/models/dedup-gbt-en-us.d.ts +1 -1
- package/out/models/dedup-gbt-en-us.js +1 -1
- package/out/resolve.js +2 -2
- package/out/tools/coverage-reconciliation.d.ts.map +1 -1
- package/out/tools/coverage-reconciliation.js +1 -47
- package/out/tools/coverage-reconciliation.js.map +1 -1
- package/out/tools/cross-dataset-correlation.d.ts.map +1 -1
- package/out/tools/cross-dataset-correlation.js +1 -1
- package/out/tools/cross-dataset-correlation.js.map +1 -1
- package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -1
- package/out/tools/cross-source-threshold-sweep.js +4 -50
- package/out/tools/cross-source-threshold-sweep.js.map +1 -1
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +2 -11
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.js +12 -1
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
- package/out/tools/gold-set-sample.d.ts +1 -1
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +3 -12
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.js +3 -44
- package/out/tools/learned-scorer-clustering-eval.js.map +1 -1
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-crossstate-eval.js +3 -34
- package/out/tools/learned-scorer-crossstate-eval.js.map +1 -1
- package/out/tools/learned-scorer-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-eval.js +3 -38
- package/out/tools/learned-scorer-eval.js.map +1 -1
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +2 -11
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes-dedup-benchmark.js +8 -46
- package/out/tools/nppes-dedup-benchmark.js.map +1 -1
- package/out/tools/shared.d.ts +92 -0
- package/out/tools/shared.d.ts.map +1 -0
- package/out/tools/shared.js +139 -0
- package/out/tools/shared.js.map +1 -0
- package/out/tools/train-cross-gbt.d.ts.map +1 -1
- package/out/tools/train-cross-gbt.js +4 -99
- package/out/tools/train-cross-gbt.js.map +1 -1
- package/out/tools/train-gbt.d.ts.map +1 -1
- package/out/tools/train-gbt.js +4 -49
- package/out/tools/train-gbt.js.map +1 -1
- package/out/tools/train-org-cross-gbt.d.ts.map +1 -1
- package/out/tools/train-org-cross-gbt.js +6 -92
- package/out/tools/train-org-cross-gbt.js.map +1 -1
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +20 -11
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +2 -2
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +4 -3
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +2 -2
- package/out/tools/viz/geocode-first-surface.js +2 -2
- package/out/tools/viz/source-provenance-map.d.ts +2 -2
- package/out/tools/viz/source-provenance-map.js +3 -3
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +6 -6
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +6 -5
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/package.json +9 -10
- package/resolve.ts +2 -2
- package/tools/coverage-reconciliation.ts +1 -57
- package/tools/cross-dataset-correlation.ts +1 -2
- package/tools/cross-source-threshold-sweep.ts +4 -60
- package/tools/dedup-ceiling.ts +3 -14
- package/tools/geocoder-vs-provided-coords.ts +12 -2
- package/tools/gold-set-sample.ts +5 -16
- package/tools/learned-scorer-clustering-eval.ts +11 -54
- package/tools/learned-scorer-crossstate-eval.ts +11 -41
- package/tools/learned-scorer-eval.ts +3 -47
- package/tools/matcher-scale.ts +2 -14
- package/tools/nppes-dedup-benchmark.ts +8 -53
- package/tools/shared.ts +160 -0
- package/tools/train-cross-gbt.ts +4 -114
- package/tools/train-gbt.ts +4 -59
- package/tools/train-org-cross-gbt.ts +6 -105
- package/tools/txhhsc-to-oarow.ts +23 -13
- package/tools/viz/cross-dataset-map.ts +7 -6
- package/tools/viz/geocode-first-surface.ts +4 -4
- package/tools/viz/source-provenance-map.ts +5 -5
- package/tools/viz/yardstick-figure.ts +9 -8
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import { mkdirSync, writeFileSync } from "node:fs"
|
|
29
29
|
import { dirname } from "node:path"
|
|
30
30
|
|
|
31
|
-
import { dataRootPath } from "@mailwoman/core/utils"
|
|
31
|
+
import { dataRootPath, makeLcg } from "@mailwoman/core/utils"
|
|
32
32
|
import { block, gbtScore, trainGBT } from "@mailwoman/match"
|
|
33
33
|
import {
|
|
34
34
|
addressFrequencyKey,
|
|
@@ -36,12 +36,13 @@ import {
|
|
|
36
36
|
createMatchFeaturizer,
|
|
37
37
|
defaultBlockingKeys,
|
|
38
38
|
ingestRows,
|
|
39
|
+
streamRows,
|
|
39
40
|
type ColumnMapping,
|
|
40
41
|
type SourceRecord,
|
|
41
42
|
} from "@mailwoman/registry"
|
|
42
|
-
import { TextSpliterator } from "spliterator"
|
|
43
43
|
|
|
44
44
|
import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
|
|
45
|
+
import { addr, norm, uniqueQuantiles } from "./shared.ts"
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Share of entities assigned to fit; the rest are held out.
|
|
@@ -82,11 +83,6 @@ export interface TrainOrgCrossSourceGBTOptions {
|
|
|
82
83
|
date?: string
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
const norm = (s: string | undefined) => (s ?? "").trim()
|
|
86
|
-
|
|
87
|
-
const addr = (line: string, city: string, st: string, zip: string) =>
|
|
88
|
-
[norm(line), norm(city), norm(st), norm(zip)].filter(Boolean).join(", ")
|
|
89
|
-
|
|
90
86
|
interface MessyRow {
|
|
91
87
|
/**
|
|
92
88
|
* The CCN — the cross-system facility key; rides `record.id` as the held-out label.
|
|
@@ -98,101 +94,6 @@ interface MessyRow {
|
|
|
98
94
|
source: string
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
/**
|
|
102
|
-
* Deterministic LCG (no Math.random — reproducible split + commit).
|
|
103
|
-
*/
|
|
104
|
-
function lcg(seed: number): () => number {
|
|
105
|
-
let s = seed >>> 0 || 1
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
s = (Math.imul(s, 1_664_525) + 1_013_904_223) >>> 0
|
|
109
|
-
|
|
110
|
-
return s / 0x1_00_00_00_00
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Up to `n` unique sorted-quantile values from a sorted score array — link-threshold candidates.
|
|
116
|
-
*/
|
|
117
|
-
function uniqueQuantiles(sorted: number[], n: number): number[] {
|
|
118
|
-
if (!sorted.length) return [0]
|
|
119
|
-
const ts = new Set<number>()
|
|
120
|
-
|
|
121
|
-
for (let k = 0; k <= n; k++) {
|
|
122
|
-
ts.add(sorted[Math.floor((k / n) * (sorted.length - 1))]!)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return [...ts]
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Stream a comma CSV with quoted fields (the OP profile format) as header-keyed rows.
|
|
130
|
-
*/
|
|
131
|
-
async function* streamCSV(path: string): AsyncGenerator<Record<string, string>> {
|
|
132
|
-
// spliterator owns the line layer (crlf is load-bearing here: the CMS POS file IS CRLF, and the
|
|
133
|
-
// last column ZIP_CD + the header keys would otherwise carry a stray \r); the manual quote/pending
|
|
134
|
-
// re-join + tokenizer below stays deliberately — spliterator ≥ 3.2.0 CAN do quote handling
|
|
135
|
-
// end-to-end, but this parse feeds model training, so its byte-for-byte behavior is pinned until a
|
|
136
|
-
// re-validation run signs off a swap. Default skipEmpty drops truly-empty lines, so a trailing
|
|
137
|
-
// newline can't inject a spurious empty row.
|
|
138
|
-
let header: string[] | null = null
|
|
139
|
-
let pending = ""
|
|
140
|
-
|
|
141
|
-
for await (const rawLine of TextSpliterator.fromAsync(path, { crlf: true })) {
|
|
142
|
-
// Re-join physical lines until quotes balance (quoted fields may contain newlines).
|
|
143
|
-
pending = pending ? `${pending}\n${rawLine}` : rawLine
|
|
144
|
-
const quotes = (pending.match(/"/g) ?? []).length
|
|
145
|
-
|
|
146
|
-
if (quotes % 2 === 1) continue
|
|
147
|
-
const line = pending
|
|
148
|
-
pending = ""
|
|
149
|
-
const cells: string[] = []
|
|
150
|
-
let cur = ""
|
|
151
|
-
let inQ = false
|
|
152
|
-
|
|
153
|
-
for (let i = 0; i < line.length; i++) {
|
|
154
|
-
const ch = line[i]!
|
|
155
|
-
|
|
156
|
-
if (inQ) {
|
|
157
|
-
if (ch === '"') {
|
|
158
|
-
if (line[i + 1] === '"') {
|
|
159
|
-
cur += '"'
|
|
160
|
-
|
|
161
|
-
i++
|
|
162
|
-
} else {
|
|
163
|
-
inQ = false
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
cur += ch
|
|
167
|
-
}
|
|
168
|
-
} else if (ch === '"') {
|
|
169
|
-
inQ = true
|
|
170
|
-
} else if (ch === ",") {
|
|
171
|
-
cells.push(cur)
|
|
172
|
-
cur = ""
|
|
173
|
-
} else {
|
|
174
|
-
cur += ch
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
cells.push(cur)
|
|
179
|
-
|
|
180
|
-
if (!header) {
|
|
181
|
-
header = cells
|
|
182
|
-
|
|
183
|
-
continue
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const row: Record<string, string> = {}
|
|
187
|
-
|
|
188
|
-
for (let i = 0; i < header.length; i++) {
|
|
189
|
-
row[header[i]!] = cells[i] ?? ""
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
yield row
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
97
|
/**
|
|
197
98
|
* Train + emit the org-level cross-source link GBT — see the module doc.
|
|
198
99
|
*/
|
|
@@ -215,7 +116,7 @@ export async function trainOrgCrossSourceGBT(
|
|
|
215
116
|
report?.("[A] streaming Care Compare…")
|
|
216
117
|
const ccByID = new Map<string, MessyRow>()
|
|
217
118
|
|
|
218
|
-
for await (const r of
|
|
119
|
+
for await (const r of streamRows(CARE_COMPARE)) {
|
|
219
120
|
if (ccByID.size >= CAP) break
|
|
220
121
|
const ccn = norm(r["Facility ID"])
|
|
221
122
|
const name = norm(r["Facility Name"])
|
|
@@ -234,7 +135,7 @@ export async function trainOrgCrossSourceGBT(
|
|
|
234
135
|
const addrCounts = new Map<string, number>()
|
|
235
136
|
let addrTotal = 0
|
|
236
137
|
|
|
237
|
-
for await (const r of
|
|
138
|
+
for await (const r of streamRows(POS)) {
|
|
238
139
|
const address = addr(r["ST_ADR"]!, r["CITY_NAME"]!, r["STATE_CD"]!, r["ZIP_CD"]!)
|
|
239
140
|
|
|
240
141
|
if (address) {
|
|
@@ -314,7 +215,7 @@ export async function trainOrgCrossSourceGBT(
|
|
|
314
215
|
// --- Phase E: held-out-NPI calibration — the #655 threshold rule. ---
|
|
315
216
|
report?.("[E] held-out calibration…")
|
|
316
217
|
const hyperparams = { rounds: 120, depth: 3, lr: 0.3, minLeaf: 20 }
|
|
317
|
-
const rnd =
|
|
218
|
+
const rnd = makeLcg(655)
|
|
318
219
|
const split = new Map<string, "fit" | "holdout">()
|
|
319
220
|
|
|
320
221
|
for (const ccn of joined) {
|
package/tools/txhhsc-to-oarow.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { readFileSync, writeFileSync } from "node:fs"
|
|
18
18
|
|
|
19
19
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
20
|
+
import { TSVSpliterator } from "spliterator"
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Texas bounding box, used to reject rows whose coordinates landed in the wrong state.
|
|
@@ -64,22 +65,31 @@ export function convertTXHHSC(
|
|
|
64
65
|
const src = options.src || String(dataRootPath("record-matcher", "sources", "txhhsc_nursing-facilities_20260611.tsv"))
|
|
65
66
|
const out = options.out || "/tmp/txhhsc-oarow.jsonl"
|
|
66
67
|
|
|
67
|
-
const lines = readFileSync(src, "utf8")
|
|
68
|
-
.split("\n")
|
|
69
|
-
.filter((l) => l.trim())
|
|
70
|
-
|
|
71
|
-
const header = lines[0]!.split("\t")
|
|
72
|
-
const col = (name: string) => header.indexOf(name)
|
|
73
|
-
const cAddr = col("Physical Address")
|
|
74
|
-
const cCity = col("Physical Address CITY")
|
|
75
|
-
const cZip = col("Physical Address Zipcode")
|
|
76
|
-
const cGeo = col("Geo Location")
|
|
77
|
-
|
|
78
68
|
const records: string[] = []
|
|
79
69
|
let skipped = 0
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
// Column indices, captured from the first non-blank row. `header: false` keeps that row in the stream so the
|
|
72
|
+
// blank-row guard below applies to it too.
|
|
73
|
+
let cAddr = -1
|
|
74
|
+
let cCity = -1
|
|
75
|
+
let cZip = -1
|
|
76
|
+
let cGeo = -1
|
|
77
|
+
let sawHeader = false
|
|
78
|
+
|
|
79
|
+
for (const f of TSVSpliterator.from(readFileSync(src, "utf8"), { header: false })) {
|
|
80
|
+
if (f.every((value) => !value.trim())) continue
|
|
81
|
+
|
|
82
|
+
if (!sawHeader) {
|
|
83
|
+
sawHeader = true
|
|
84
|
+
const col = (name: string) => f.indexOf(name)
|
|
85
|
+
cAddr = col("Physical Address")
|
|
86
|
+
cCity = col("Physical Address CITY")
|
|
87
|
+
cZip = col("Physical Address Zipcode")
|
|
88
|
+
cGeo = col("Geo Location")
|
|
89
|
+
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
const addr = (f[cAddr] ?? "").trim()
|
|
84
94
|
const city = (f[cCity] ?? "").trim()
|
|
85
95
|
const zip = (f[cZip] ?? "").trim()
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
import { readFileSync, writeFileSync } from "node:fs"
|
|
32
32
|
|
|
33
|
+
import { parseJSONStrict } from "@mailwoman/core/objects"
|
|
33
34
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
34
35
|
import { toMapHTML } from "@mailwoman/registry"
|
|
35
36
|
|
|
@@ -50,7 +51,7 @@ export interface CrossDatasetMapOptions {
|
|
|
50
51
|
/**
|
|
51
52
|
* Output HTML path. Default `/tmp/cross-dataset-map.html`.
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
+
outHTML?: string
|
|
54
55
|
/**
|
|
55
56
|
* Keep only entities whose sources span >1 agency (the two FCC datasets count as one).
|
|
56
57
|
*/
|
|
@@ -90,15 +91,15 @@ const sourcesOf = (f: { properties: Record<string, unknown> | null }) =>
|
|
|
90
91
|
export function crossDatasetMap(
|
|
91
92
|
options: CrossDatasetMapOptions = {},
|
|
92
93
|
report?: (line: string) => void
|
|
93
|
-
): {
|
|
94
|
+
): { outHTML: string; kept: number; total: number; triple: number } {
|
|
94
95
|
const IN = options.in || dataRootPath("record-matcher", "2026-06-16-cross-dataset-links.geojson")
|
|
95
|
-
const OUT = options.
|
|
96
|
+
const OUT = options.outHTML || "/tmp/cross-dataset-map.html"
|
|
96
97
|
const CROSS_AGENCY_ONLY = options.crossAgencyOnly ?? false
|
|
97
98
|
|
|
98
|
-
const parsed =
|
|
99
|
+
const parsed = parseJSONStrict<{
|
|
99
100
|
type: "FeatureCollection"
|
|
100
101
|
features: Array<{ properties: Record<string, unknown> | null }>
|
|
101
|
-
}
|
|
102
|
+
}>(readFileSync(IN, "utf8"))
|
|
102
103
|
|
|
103
104
|
const total = parsed.features.length
|
|
104
105
|
|
|
@@ -145,5 +146,5 @@ export function crossDatasetMap(
|
|
|
145
146
|
|
|
146
147
|
report?.(` spanning all three agencies: ${triple}`)
|
|
147
148
|
|
|
148
|
-
return {
|
|
149
|
+
return { outHTML: OUT, kept, total, triple }
|
|
149
150
|
}
|
|
@@ -51,7 +51,7 @@ export interface GeocodeFirstSurfaceOptions {
|
|
|
51
51
|
/**
|
|
52
52
|
* Output HTML path. Default `/tmp/geocode-first-surface.html`.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
outHTML?: string
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// ── Real Bayes-factor weights, transcribed from source (values kept in sync by comment, not import,
|
|
@@ -113,9 +113,9 @@ function distanceWeight(km: number): number {
|
|
|
113
113
|
export function geocodeFirstSurface(
|
|
114
114
|
options: GeocodeFirstSurfaceOptions = {},
|
|
115
115
|
report?: (line: string) => void
|
|
116
|
-
): {
|
|
116
|
+
): { outHTML: string } {
|
|
117
117
|
const LAMBDA = options.lambda ?? 0.02
|
|
118
|
-
const OUT_HTML = options.
|
|
118
|
+
const OUT_HTML = options.outHTML || "/tmp/geocode-first-surface.html"
|
|
119
119
|
|
|
120
120
|
const PRIOR = priorWeight(LAMBDA)
|
|
121
121
|
|
|
@@ -315,5 +315,5 @@ document.getElementByID("cap").innerHTML =
|
|
|
315
315
|
)
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
return {
|
|
318
|
+
return { outHTML: OUT_HTML }
|
|
319
319
|
}
|
|
@@ -48,7 +48,7 @@ export interface SourceProvenanceMapOptions {
|
|
|
48
48
|
/**
|
|
49
49
|
* Output HTML path. Default `/tmp/source-provenance.html`.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
outHTML?: string
|
|
52
52
|
/**
|
|
53
53
|
* Keep ~1/N of NAD points. Default 700.
|
|
54
54
|
*/
|
|
@@ -90,10 +90,10 @@ type Row = { lat: number; lon: number; source: string; number: string | null; st
|
|
|
90
90
|
export function sourceProvenanceMap(
|
|
91
91
|
options: SourceProvenanceMapOptions = {},
|
|
92
92
|
report?: (line: string) => void
|
|
93
|
-
): {
|
|
93
|
+
): { outHTML: string; points: number } {
|
|
94
94
|
const STATE = (options.state || "ny").toLowerCase()
|
|
95
|
-
const DB = options.db ||
|
|
96
|
-
const OUT = options.
|
|
95
|
+
const DB = options.db || String(dataRootPath("address-points", `address-points-us-${STATE}.db`))
|
|
96
|
+
const OUT = options.outHTML || "/tmp/source-provenance.html"
|
|
97
97
|
const NAD_MOD = options.nadMod ?? 700 // keep ~1/700 of NAD points
|
|
98
98
|
const OA_MOD = options.oaMod ?? 120 // keep ~1/120 of OpenAddresses points
|
|
99
99
|
const CAP = options.cap ?? 7000 // per-source marker cap
|
|
@@ -154,5 +154,5 @@ export function sourceProvenanceMap(
|
|
|
154
154
|
report?.(` ${n.toString().padStart(5)} ${bucket}`)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
return {
|
|
157
|
+
return { outHTML: OUT, points: features.length }
|
|
158
158
|
}
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
*
|
|
16
16
|
* A slope chart over four rulers (NPI → site → org-name → org-name-coord) for the shipped GBT
|
|
17
17
|
* scorer and the FS baseline. Numbers are the committed measurement in
|
|
18
|
-
* `docs/
|
|
18
|
+
* `docs/records/evals/matcher-dedup/2026-06-16-dedup-dual-level-benchmark.md` (1000 TX NPIs → 2757 records).
|
|
19
19
|
*
|
|
20
20
|
* Emits a self-contained SVG (the docs' committed-chart-asset convention — see
|
|
21
|
-
* `docs/
|
|
21
|
+
* `docs/records/evals/charts/*.svg`), no browser required.
|
|
22
22
|
*
|
|
23
23
|
* Run: `mailwoman registry viz yardstick-figure
|
|
24
|
-
* [--out-svg docs/
|
|
24
|
+
* [--out-svg docs/records/evals/charts/dedup-yardstick.svg]`
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import { writeFileSync } from "node:fs"
|
|
@@ -31,9 +31,9 @@ import { writeFileSync } from "node:fs"
|
|
|
31
31
|
*/
|
|
32
32
|
export interface YardstickFigureOptions {
|
|
33
33
|
/**
|
|
34
|
-
* Output SVG path. Default `docs/
|
|
34
|
+
* Output SVG path. Default `docs/records/evals/charts/dedup-yardstick.svg` (relative to cwd).
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
outSVG?: string
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// ── The committed measurement (2026-06-16-dedup-dual-level-benchmark.md). ────────────────────────
|
|
@@ -101,8 +101,8 @@ const esc = (s: string) => s.replaceAll("&", "&").replaceAll("<", "<").re
|
|
|
101
101
|
export function yardstickFigure(
|
|
102
102
|
options: YardstickFigureOptions = {},
|
|
103
103
|
report?: (line: string) => void
|
|
104
|
-
): {
|
|
105
|
-
const OUT = options.
|
|
104
|
+
): { outSVG: string } {
|
|
105
|
+
const OUT = options.outSVG || "docs/records/evals/charts/dedup-yardstick.svg"
|
|
106
106
|
|
|
107
107
|
const parts: string[] = []
|
|
108
108
|
const push = (s: string) => parts.push(s)
|
|
@@ -151,6 +151,7 @@ export function yardstickFigure(
|
|
|
151
151
|
`<text x="${x.toFixed(1)}" y="${plotB + 36}" text-anchor="middle" font-size="10" fill="#6b7280">${g.classes} classes</text>`
|
|
152
152
|
)
|
|
153
153
|
|
|
154
|
+
// oxlint-disable-next-line mailwoman/prefer-spliterator -- `g.note` is a literal label from the MODELS table, not a file.
|
|
154
155
|
g.note.split("\n").forEach((line, k) => {
|
|
155
156
|
push(
|
|
156
157
|
`<text x="${x.toFixed(1)}" y="${plotB + 50 + k * 12}" text-anchor="middle" font-size="9" fill="#9ca3af">${esc(line)}</text>`
|
|
@@ -228,5 +229,5 @@ export function yardstickFigure(
|
|
|
228
229
|
|
|
229
230
|
report?.(` over-merge: ${OVERMERGE.GBT!.join(" → ")}`)
|
|
230
231
|
|
|
231
|
-
return {
|
|
232
|
+
return { outSVG: OUT }
|
|
232
233
|
}
|