@mailwoman/registry 8.6.0 → 9.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.
Files changed (98) hide show
  1. package/README.md +62 -36
  2. package/ingest.ts +7 -2
  3. package/learned-scorer.ts +2 -2
  4. package/models/dedup-gbt-en-us.ts +1 -1
  5. package/out/ingest.d.ts +3 -0
  6. package/out/ingest.d.ts.map +1 -1
  7. package/out/ingest.js +4 -2
  8. package/out/ingest.js.map +1 -1
  9. package/out/learned-scorer.d.ts +2 -2
  10. package/out/learned-scorer.js +2 -2
  11. package/out/models/dedup-gbt-en-us.d.ts +1 -1
  12. package/out/models/dedup-gbt-en-us.js +1 -1
  13. package/out/resolve.js +2 -2
  14. package/out/tools/coverage-reconciliation.d.ts.map +1 -1
  15. package/out/tools/coverage-reconciliation.js +1 -47
  16. package/out/tools/coverage-reconciliation.js.map +1 -1
  17. package/out/tools/cross-dataset-correlation.d.ts.map +1 -1
  18. package/out/tools/cross-dataset-correlation.js +1 -1
  19. package/out/tools/cross-dataset-correlation.js.map +1 -1
  20. package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -1
  21. package/out/tools/cross-source-threshold-sweep.js +4 -50
  22. package/out/tools/cross-source-threshold-sweep.js.map +1 -1
  23. package/out/tools/dedup-ceiling.d.ts.map +1 -1
  24. package/out/tools/dedup-ceiling.js +2 -11
  25. package/out/tools/dedup-ceiling.js.map +1 -1
  26. package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
  27. package/out/tools/geocoder-vs-provided-coords.js +12 -1
  28. package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
  29. package/out/tools/gold-set-sample.d.ts +1 -1
  30. package/out/tools/gold-set-sample.d.ts.map +1 -1
  31. package/out/tools/gold-set-sample.js +3 -12
  32. package/out/tools/gold-set-sample.js.map +1 -1
  33. package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
  34. package/out/tools/learned-scorer-clustering-eval.js +3 -44
  35. package/out/tools/learned-scorer-clustering-eval.js.map +1 -1
  36. package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -1
  37. package/out/tools/learned-scorer-crossstate-eval.js +3 -34
  38. package/out/tools/learned-scorer-crossstate-eval.js.map +1 -1
  39. package/out/tools/learned-scorer-eval.d.ts.map +1 -1
  40. package/out/tools/learned-scorer-eval.js +3 -38
  41. package/out/tools/learned-scorer-eval.js.map +1 -1
  42. package/out/tools/matcher-scale.d.ts.map +1 -1
  43. package/out/tools/matcher-scale.js +2 -11
  44. package/out/tools/matcher-scale.js.map +1 -1
  45. package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
  46. package/out/tools/nppes-dedup-benchmark.js +8 -46
  47. package/out/tools/nppes-dedup-benchmark.js.map +1 -1
  48. package/out/tools/shared.d.ts +92 -0
  49. package/out/tools/shared.d.ts.map +1 -0
  50. package/out/tools/shared.js +139 -0
  51. package/out/tools/shared.js.map +1 -0
  52. package/out/tools/train-cross-gbt.d.ts.map +1 -1
  53. package/out/tools/train-cross-gbt.js +4 -99
  54. package/out/tools/train-cross-gbt.js.map +1 -1
  55. package/out/tools/train-gbt.d.ts.map +1 -1
  56. package/out/tools/train-gbt.js +4 -49
  57. package/out/tools/train-gbt.js.map +1 -1
  58. package/out/tools/train-org-cross-gbt.d.ts.map +1 -1
  59. package/out/tools/train-org-cross-gbt.js +6 -92
  60. package/out/tools/train-org-cross-gbt.js.map +1 -1
  61. package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
  62. package/out/tools/txhhsc-to-oarow.js +20 -11
  63. package/out/tools/txhhsc-to-oarow.js.map +1 -1
  64. package/out/tools/viz/cross-dataset-map.d.ts +2 -2
  65. package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
  66. package/out/tools/viz/cross-dataset-map.js +4 -3
  67. package/out/tools/viz/cross-dataset-map.js.map +1 -1
  68. package/out/tools/viz/geocode-first-surface.d.ts +2 -2
  69. package/out/tools/viz/geocode-first-surface.js +2 -2
  70. package/out/tools/viz/source-provenance-map.d.ts +2 -2
  71. package/out/tools/viz/source-provenance-map.js +3 -3
  72. package/out/tools/viz/source-provenance-map.js.map +1 -1
  73. package/out/tools/viz/yardstick-figure.d.ts +6 -6
  74. package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
  75. package/out/tools/viz/yardstick-figure.js +6 -5
  76. package/out/tools/viz/yardstick-figure.js.map +1 -1
  77. package/package.json +9 -10
  78. package/resolve.ts +2 -2
  79. package/tools/coverage-reconciliation.ts +1 -57
  80. package/tools/cross-dataset-correlation.ts +1 -2
  81. package/tools/cross-source-threshold-sweep.ts +4 -60
  82. package/tools/dedup-ceiling.ts +3 -14
  83. package/tools/geocoder-vs-provided-coords.ts +12 -2
  84. package/tools/gold-set-sample.ts +5 -16
  85. package/tools/learned-scorer-clustering-eval.ts +11 -54
  86. package/tools/learned-scorer-crossstate-eval.ts +11 -41
  87. package/tools/learned-scorer-eval.ts +3 -47
  88. package/tools/matcher-scale.ts +2 -14
  89. package/tools/nppes-dedup-benchmark.ts +8 -53
  90. package/tools/shared.ts +160 -0
  91. package/tools/train-cross-gbt.ts +4 -114
  92. package/tools/train-gbt.ts +4 -59
  93. package/tools/train-org-cross-gbt.ts +6 -105
  94. package/tools/txhhsc-to-oarow.ts +23 -13
  95. package/tools/viz/cross-dataset-map.ts +7 -6
  96. package/tools/viz/geocode-first-surface.ts +4 -4
  97. package/tools/viz/source-provenance-map.ts +5 -5
  98. package/tools/viz/yardstick-figure.ts +9 -8
@@ -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/articles/evals/matcher-dedup/2026-06-16-dedup-dual-level-benchmark.md` (1000 TX NPIs → 2757 records).
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/articles/evals/charts/*.svg`), no browser required.
21
+ * `docs/records/evals/charts/*.svg`), no browser required.
22
22
  *
23
23
  * Run: `mailwoman registry viz yardstick-figure
24
- * [--out-svg docs/articles/evals/charts/dedup-yardstick.svg]`
24
+ * [--out-svg docs/records/evals/charts/dedup-yardstick.svg]`
25
25
  */
26
26
  import { writeFileSync } from "node:fs";
27
27
  const GRAINS = [
@@ -70,7 +70,7 @@ const esc = (s) => s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll
70
70
  * Emit the dedup-yardstick slope chart as a self-contained SVG — see the module doc.
71
71
  */
72
72
  export function yardstickFigure(options = {}, report) {
73
- const OUT = options.outSvg || "docs/articles/evals/charts/dedup-yardstick.svg";
73
+ const OUT = options.outSVG || "docs/records/evals/charts/dedup-yardstick.svg";
74
74
  const parts = [];
75
75
  const push = (s) => parts.push(s);
76
76
  push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" width="${W}" height="${H}" font-family="ui-sans-serif, system-ui, sans-serif" font-size="11"><rect width="${W}" height="${H}" fill="white"/>`);
@@ -90,6 +90,7 @@ export function yardstickFigure(options = {}, report) {
90
90
  push(`<line x1="${x.toFixed(1)}" y1="${plotT}" x2="${x.toFixed(1)}" y2="${plotB}" stroke="#f1f1f1" stroke-width="1"/>`);
91
91
  push(`<text x="${x.toFixed(1)}" y="${plotB + 20}" text-anchor="middle" font-size="12.5" font-weight="600">${esc(g.label)}</text>`);
92
92
  push(`<text x="${x.toFixed(1)}" y="${plotB + 36}" text-anchor="middle" font-size="10" fill="#6b7280">${g.classes} classes</text>`);
93
+ // oxlint-disable-next-line mailwoman/prefer-spliterator -- `g.note` is a literal label from the MODELS table, not a file.
93
94
  g.note.split("\n").forEach((line, k) => {
94
95
  push(`<text x="${x.toFixed(1)}" y="${plotB + 50 + k * 12}" text-anchor="middle" font-size="9" fill="#9ca3af">${esc(line)}</text>`);
95
96
  });
@@ -135,6 +136,6 @@ export function yardstickFigure(options = {}, report) {
135
136
  report?.(`[written] ${OUT}`);
136
137
  report?.(` GBT F1: NPI ${F1.GBT[0]} → site ${F1.GBT[1]} → org-name ${F1.GBT[2]} → coord ${F1.GBT[3]} (+${(F1.GBT[3] - F1.GBT[0]).toFixed(1)}pp)`);
137
138
  report?.(` over-merge: ${OVERMERGE.GBT.join(" → ")}`);
138
- return { outSvg: OUT };
139
+ return { outSVG: OUT };
139
140
  }
140
141
  //# sourceMappingURL=yardstick-figure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yardstick-figure.js","sourceRoot":"","sources":["../../../tools/viz/yardstick-figure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAqBvC,MAAM,MAAM,GAAY;IACvB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,mDAAmD,EAAE;IACtG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,kDAAkD,EAAE;IACvG,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,0CAA0C,EAAE;IACtG;QACC,GAAG,EAAE,gBAAgB;QACrB,KAAK,EAAE,kBAAkB;QACzB,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,oDAAoD;KAC1D;CACD,CAAA;AAED;;GAEG;AACH,MAAM,EAAE,GAAqD;IAC5D,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,kBAAkB;IACjD,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,yBAAyB;CACvD,CAAA;AAED;;GAEG;AACH,MAAM,S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d,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,MAAM,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,CAAA;IAE5B,MAAM,EAAE,CACP,iBAAiB,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC/I,CAAA;IAED,MAAM,EAAE,CAAC,iBAAiB,SAAS,CAAC,GAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAEvD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/registry",
3
- "version": "8.6.0",
3
+ "version": "9.1.0",
4
4
  "description": "The geocode-first record-matching application: resolve messy contact/organization records into canonical, geocoded entities (block → score → cluster) and export them as GeoJSON for spatial analysis. The clinic-funding use case mailwoman was built for.",
5
5
  "license": "AGPL-3.0-only OR LicenseRef-Commercial",
6
6
  "repository": {
@@ -73,18 +73,17 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@mailwoman/address-id": "8.6.0",
77
- "@mailwoman/core": "8.6.0",
78
- "@mailwoman/match": "8.6.0",
79
- "@mailwoman/record": "8.6.0",
80
- "@mailwoman/spatial": "8.6.0",
76
+ "@mailwoman/address-id": "9.1.0",
77
+ "@mailwoman/core": "9.1.0",
78
+ "@mailwoman/match": "9.1.0",
79
+ "@mailwoman/record": "9.1.0",
80
+ "@mailwoman/spatial": "9.1.0",
81
81
  "@protomaps/basemaps": "^5.7.2",
82
- "csv-parse": "^7.0.1",
83
82
  "h3-js": "^4.5.0",
84
- "spliterator": "^4.0.0"
83
+ "spliterator": "^6.1.0"
85
84
  },
86
85
  "devDependencies": {
87
- "@types/node": ">=26.1.1",
88
- "playwright": "^1.62.0"
86
+ "@types/node": ">=26.1.2",
87
+ "playwright": "^1.62.1"
89
88
  }
90
89
  }
package/resolve.ts CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  withTermFrequency,
42
42
  } from "@mailwoman/match"
43
43
 
44
- import { createGbtScorer } from "./learned-scorer.ts"
44
+ import { createGBTScorer } from "./learned-scorer.ts"
45
45
  import { DEDUP_GBT_META, DEDUP_GBT_MODEL } from "./models/dedup-gbt-en-us.ts"
46
46
  import type { ResolvedEntity, SourceRecord } from "./types.ts"
47
47
 
@@ -412,7 +412,7 @@ export function resolveEntities(records: readonly SourceRecord[], config: Resolv
412
412
 
413
413
  usingBundledModel = gbt === DEDUP_GBT_MODEL
414
414
 
415
- scorer = createGbtScorer({
415
+ scorer = createGBTScorer({
416
416
  model: gbt,
417
417
  comparisons: buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons,
418
418
  addressFrequency: addressFrequency ?? buildTermFrequencyTable([], { normalize: addressFrequencyKey }),
@@ -46,6 +46,7 @@ import {
46
46
  } from "@mailwoman/registry"
47
47
 
48
48
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
49
+ import { buildSpecs, norm, type SourceSpec } from "./shared.ts"
49
50
 
50
51
  /**
51
52
  * Options for {@linkcode coverageReconciliation}.
@@ -77,69 +78,12 @@ export interface CoverageReconciliationOptions {
77
78
  outGeojson?: string
78
79
  }
79
80
 
80
- const norm = (s: string | undefined) => (s ?? "").trim()
81
-
82
81
  /**
83
82
  * Which kind of source a record's provenance label denotes.
84
83
  */
85
84
  const ELIGIBILITY = new Set(["nppes", "txhhsc-nursing"])
86
85
  const FUNDING = new Set(["fcc-rhc"])
87
86
 
88
- interface SourceSpec {
89
- source: string
90
- path: string
91
- mapping: ColumnMapping
92
- inState: (row: Record<string, string>) => boolean
93
- }
94
-
95
- const buildSpecs = (S: string, STATE: string): SourceSpec[] => [
96
- {
97
- source: "txhhsc-nursing",
98
- path: `${S}/txhhsc_nursing-facilities_20260611.tsv`,
99
- mapping: {
100
- id: "Facility ID",
101
- organization: "Facility Name",
102
- address: ["Physical Address", "Physical Address CITY", "Physical Address State", "Physical Address Zipcode"],
103
- phone: "Facility Phone Number",
104
- source: "txhhsc-nursing",
105
- },
106
- inState: (r) => norm(r["Physical Address State"]).toUpperCase() === STATE,
107
- },
108
- {
109
- source: "fcc-rhc",
110
- path: `${S}/fcc-rhc_posted-services_form461-465_20260615.tsv`,
111
- mapping: {
112
- id: "HCP Number",
113
- organization: "HCP Name",
114
- address: ["Site Address Line 1", "Site City", "Site State", "Site ZIP Code"],
115
- phone: "Contact Phone",
116
- email: "Contact E-mail",
117
- source: "fcc-rhc",
118
- },
119
- inState: (r) => norm(r["Site State"]).toUpperCase() === STATE,
120
- },
121
- {
122
- source: "nppes",
123
- path: `${S}/nppes_npi-registry_20260607.tsv`,
124
- mapping: {
125
- id: "NPI",
126
- organization: "Provider Organization Name (Legal Business Name)",
127
- address: [
128
- "Provider First Line Business Practice Location Address",
129
- "Provider Business Practice Location Address City Name",
130
- "Provider Business Practice Location Address State Name",
131
- "Provider Business Practice Location Address Postal Code",
132
- ],
133
- phone: "Provider Business Practice Location Address Telephone Number",
134
- source: "nppes",
135
- },
136
- inState: (r) =>
137
- norm(r["Provider Business Practice Location Address State Name"]).toUpperCase() === STATE &&
138
- norm(r["Entity Type Code"]) === "2" &&
139
- !!norm(r["Provider Organization Name (Legal Business Name)"]),
140
- },
141
- ]
142
-
143
87
  /**
144
88
  * Coverage reconciliation (#621) — see the module doc. Emits the markdown report to stdout.
145
89
  */
@@ -35,6 +35,7 @@ import {
35
35
  } from "@mailwoman/registry"
36
36
 
37
37
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
38
+ import { norm } from "./shared.ts"
38
39
 
39
40
  /**
40
41
  * Distinct sources an entity needs to count toward the triple-corroborated tally.
@@ -79,8 +80,6 @@ export interface CrossDatasetCorrelationOptions {
79
80
  outGeojson?: string
80
81
  }
81
82
 
82
- const norm = (s: string | undefined) => (s ?? "").trim()
83
-
84
83
  /**
85
84
  * Compose a row's address the SAME way {@link ingestRows} does (`pick`: join the mapped columns with a space, drop
86
85
  * empties), so a frequency key built here matches the geocoded record's `address.raw`.
@@ -33,7 +33,7 @@ import { dataRootPath, formatPercent } from "@mailwoman/core/utils"
33
33
  import {
34
34
  addressFrequencyKey,
35
35
  buildDefaultModel,
36
- createGbtScorer,
36
+ createGBTScorer,
37
37
  DEDUP_GBT_META,
38
38
  DEDUP_GBT_MODEL,
39
39
  ingestRows,
@@ -46,6 +46,7 @@ import {
46
46
  } from "@mailwoman/registry"
47
47
 
48
48
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
49
+ import { buildSpecs, norm, type SourceSpec } from "./shared.ts"
49
50
 
50
51
  /**
51
52
  * Independent sources that must agree before a cluster counts as cross-source corroborated.
@@ -83,63 +84,6 @@ export interface CrossSourceThresholdSweepOptions {
83
84
  outMd?: string
84
85
  }
85
86
 
86
- const norm = (s: string | undefined) => (s ?? "").trim()
87
-
88
- interface SourceSpec {
89
- source: string
90
- path: string
91
- mapping: ColumnMapping
92
- inState: (row: Record<string, string>) => boolean
93
- }
94
-
95
- const buildSpecs = (S: string, STATE: string): SourceSpec[] => [
96
- {
97
- source: "txhhsc-nursing",
98
- path: `${S}/txhhsc_nursing-facilities_20260611.tsv`,
99
- mapping: {
100
- id: "Facility ID",
101
- organization: "Facility Name",
102
- address: ["Physical Address", "Physical Address CITY", "Physical Address State", "Physical Address Zipcode"],
103
- phone: "Facility Phone Number",
104
- source: "txhhsc-nursing",
105
- },
106
- inState: (r) => norm(r["Physical Address State"]).toUpperCase() === STATE,
107
- },
108
- {
109
- source: "fcc-rhc",
110
- path: `${S}/fcc-rhc_posted-services_form461-465_20260615.tsv`,
111
- mapping: {
112
- id: "HCP Number",
113
- organization: "HCP Name",
114
- address: ["Site Address Line 1", "Site City", "Site State", "Site ZIP Code"],
115
- phone: "Contact Phone",
116
- email: "Contact E-mail",
117
- source: "fcc-rhc",
118
- },
119
- inState: (r) => norm(r["Site State"]).toUpperCase() === STATE,
120
- },
121
- {
122
- source: "nppes",
123
- path: `${S}/nppes_npi-registry_20260607.tsv`,
124
- mapping: {
125
- id: "NPI",
126
- organization: "Provider Organization Name (Legal Business Name)",
127
- address: [
128
- "Provider First Line Business Practice Location Address",
129
- "Provider Business Practice Location Address City Name",
130
- "Provider Business Practice Location Address State Name",
131
- "Provider Business Practice Location Address Postal Code",
132
- ],
133
- phone: "Provider Business Practice Location Address Telephone Number",
134
- source: "nppes",
135
- },
136
- inState: (r) =>
137
- norm(r["Provider Business Practice Location Address State Name"]).toUpperCase() === STATE &&
138
- norm(r["Entity Type Code"]) === "2" &&
139
- !!norm(r["Provider Organization Name (Legal Business Name)"]),
140
- },
141
- ]
142
-
143
87
  /**
144
88
  * Distinct provenance labels an entity's records span.
145
89
  */
@@ -319,7 +263,7 @@ export async function crossSourceThresholdSweep(
319
263
  }
320
264
 
321
265
  const comparisons = buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons
322
- const gbtScorer = createGbtScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency })
266
+ const gbtScorer = createGBTScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency })
323
267
 
324
268
  // --- Arm 1: the FS baseline (the recall-correct baseline cross-source flows currently pin). ---
325
269
  report?.("[D] resolving — FS baseline baseline…")
@@ -373,7 +317,7 @@ export async function crossSourceThresholdSweep(
373
317
  throw new Error(`--candidate module exports neither CROSS_SOURCE_GBT_MODEL nor ORG_CROSS_SOURCE_GBT_MODEL`)
374
318
 
375
319
  const t0 = (mod.CROSS_SOURCE_GBT_META ?? mod.ORG_CROSS_SOURCE_GBT_META)?.recommendedThreshold ?? 0
376
- const candScorer = createGbtScorer({ model: candModel, comparisons, addressFrequency })
320
+ const candScorer = createGBTScorer({ model: candModel, comparisons, addressFrequency })
377
321
  report?.(`[E] resolving — cross-source GBT candidate @ ${t0.toFixed(3)} (±)…`)
378
322
 
379
323
  for (const t of [t0 - 1, t0, t0 + 1]) {
@@ -33,8 +33,11 @@
33
33
  import { writeFileSync } from "node:fs"
34
34
 
35
35
  import { dataRootPath, formatPercent } from "@mailwoman/core/utils"
36
+ import { jaccard } from "@mailwoman/match"
36
37
  import { addressFrequencyKey, streamRows } from "@mailwoman/registry"
37
38
 
39
+ import { norm } from "./shared.ts"
40
+
38
41
  /**
39
42
  * Similarity at or above which a pair is a near-miss worth inspecting rather than plainly unrelated.
40
43
  */
@@ -66,8 +69,6 @@ export interface DedupCeilingOptions {
66
69
  outMd?: string
67
70
  }
68
71
 
69
- const norm = (s: string | undefined) => (s ?? "").trim()
70
-
71
72
  /**
72
73
  * Strip only corporate-form tokens + articles — KEEP domain words (health, medical, center…), which carry the
73
74
  * distinguishing signal between two co-located providers.
@@ -100,18 +101,6 @@ function orgTokens(s: string): Set<string> {
100
101
  )
101
102
  }
102
103
 
103
- function jaccard(a: Set<string>, b: Set<string>): number {
104
- if (!a.size || !b.size) return 0
105
- let inter = 0
106
-
107
- for (const t of a)
108
- if (b.has(t)) {
109
- inter++
110
- }
111
-
112
- return inter / (a.size + b.size - inter)
113
- }
114
-
115
104
  const normPhone = (p?: string): string => {
116
105
  const d = (p ?? "").replaceAll(/\D/g, "")
117
106
 
@@ -27,6 +27,7 @@ import { haversineKm } from "@mailwoman/match"
27
27
  import { streamRows } from "@mailwoman/registry"
28
28
 
29
29
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
30
+ import { norm } from "./shared.ts"
30
31
 
31
32
  /**
32
33
  * Largest absolute latitude in WGS-84 degrees.
@@ -60,10 +61,19 @@ export interface GeocoderVsProvidedCoordsOptions {
60
61
  outMd?: string
61
62
  }
62
63
 
63
- const norm = (s: string | undefined) => (s ?? "").trim()
64
-
65
64
  /**
66
65
  * Parse a `lat,lon` string into a coordinate, or null if malformed / out of range.
66
+ *
67
+ * Deliberately strict, and deliberately not `GeoPoint.from()`. The provided coordinate is this eval's ground truth, so
68
+ * a row we cannot read exactly has to be _dropped_ (counted in `noCoord`) rather than repaired into something plausible
69
+ * — a silently repaired coordinate lands in the delta distribution as geocoder error. Two of the three divergences that
70
+ * originally justified this parser were defects in `GeoPoint` and were fixed on 2026-08-05: it no longer guesses axis
71
+ * order from the magnitudes, and an out-of-range value is now rejected instead of accepted (`200,-97.74` used to become
72
+ * a point). What remains is not a defect and not negotiable. This source writes `latitude,longitude`; `GeoPoint` reads
73
+ * GeoJSON `[longitude, latitude]`, so `31.5,-89.5` is a Mississippi row here and a South-Atlantic point there — and
74
+ * `GeoPoint.from` maps 0,0 to null, which moves Null Island out of the measured outliers and into the skipped bucket.
75
+ * The report below attributes part of its p99/max tail to malformed provided coordinates, so those rows have to stay
76
+ * rejected or measured as-is, never rewritten. Strictness is the measurement, not an unfinished migration.
67
77
  */
68
78
  function parseLatLon(raw: string | undefined): { latitude: number; longitude: number } | null {
69
79
  if (!raw) return null
@@ -23,8 +23,11 @@
23
23
  import { writeFileSync } from "node:fs"
24
24
 
25
25
  import { dataRootPath } from "@mailwoman/core/utils"
26
+ import { jaccard } from "@mailwoman/match"
26
27
  import { addressFrequencyKey, streamRows } from "@mailwoman/registry"
27
28
 
29
+ import { norm } from "./shared.ts"
30
+
28
31
  /**
29
32
  * Options for {@linkcode goldSetSample}.
30
33
  */
@@ -52,11 +55,9 @@ export interface GoldSetSampleOptions {
52
55
  /**
53
56
  * Write the sampled pairs here as JSONL (otherwise the first 10 print to stdout).
54
57
  */
55
- outJsonl?: string
58
+ outJSONL?: string
56
59
  }
57
60
 
58
- const norm = (s: string | undefined) => (s ?? "").trim()
59
-
60
61
  const STOP = new Set([
61
62
  "llc",
62
63
  "inc",
@@ -85,18 +86,6 @@ function orgTokens(s: string): Set<string> {
85
86
  )
86
87
  }
87
88
 
88
- function jaccard(a: Set<string>, b: Set<string>): number {
89
- if (!a.size || !b.size) return 0
90
- let inter = 0
91
-
92
- for (const t of a)
93
- if (b.has(t)) {
94
- inter++
95
- }
96
-
97
- return inter / (a.size + b.size - inter)
98
- }
99
-
100
89
  const C = {
101
90
  npi: "NPI",
102
91
  entityType: "Entity Type Code",
@@ -136,7 +125,7 @@ export async function goldSetSample(
136
125
  const STATE = (options.state || "TX").toUpperCase()
137
126
  const TAU = options.tau ?? 0.7
138
127
  const N = options.n ?? 300
139
- const OUT = options.outJsonl || ""
128
+ const OUT = options.outJSONL || ""
140
129
  const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`
141
130
 
142
131
  report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`)
@@ -30,7 +30,7 @@
30
30
 
31
31
  import { writeFileSync } from "node:fs"
32
32
 
33
- import { dataRootPath } from "@mailwoman/core/utils"
33
+ import { dataRootPath, makeLcg } from "@mailwoman/core/utils"
34
34
  import { block, gbtScore, trainGBT } from "@mailwoman/match"
35
35
  import {
36
36
  addressFrequencyKey,
@@ -46,22 +46,15 @@ import {
46
46
  } from "@mailwoman/registry"
47
47
 
48
48
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
49
-
50
- /**
51
- * Smallest mean F1 gap counted as a real difference between models rather than seed noise. Verdicts inside ±this are
52
- * reported as a tie.
53
- */
54
- const MIN_MEANINGFUL_F1_DELTA = 0.02
55
-
56
- /**
57
- * Groups below this size are too small for a held-out split to mean anything.
58
- */
59
- const MIN_GROUP_SIZE = 5
60
-
61
- /**
62
- * Gradient-boosting rounds. Fixed rather than early-stopped so seeds stay comparable.
63
- */
64
- const TRAINING_EPOCHS = 400
49
+ import {
50
+ addr,
51
+ MIN_GROUP_SIZE,
52
+ MIN_MEANINGFUL_F1_DELTA,
53
+ norm,
54
+ NPPES_COLUMNS as C,
55
+ sigmoid,
56
+ TRAINING_EPOCHS,
57
+ } from "./shared.ts"
65
58
 
66
59
  /**
67
60
  * Highest k swept when scanning cluster counts.
@@ -106,41 +99,6 @@ export interface ScorerClusteringEvalOptions {
106
99
  outMd?: string
107
100
  }
108
101
 
109
- const C = {
110
- npi: "NPI",
111
- entityType: "Entity Type Code",
112
- orgLegal: "Provider Organization Name (Legal Business Name)",
113
- last: "Provider Last Name (Legal Name)",
114
- first: "Provider First Name",
115
- pAddr: "Provider First Line Business Practice Location Address",
116
- pCity: "Provider Business Practice Location Address City Name",
117
- pState: "Provider Business Practice Location Address State Name",
118
- pZip: "Provider Business Practice Location Address Postal Code",
119
- mAddr: "Provider First Line Business Mailing Address",
120
- mCity: "Provider Business Mailing Address City Name",
121
- mState: "Provider Business Mailing Address State Name",
122
- mZip: "Provider Business Mailing Address Postal Code",
123
- otherOrg: "Provider Other Organization Name",
124
- }
125
-
126
- const norm = (s: string | undefined) => (s ?? "").trim()
127
-
128
- const addr = (line: string, city: string, st: string, zip: string) =>
129
- [norm(line), norm(city), norm(st), norm(zip)].filter(Boolean).join(", ")
130
-
131
- /**
132
- * Deterministic LCG (no Math.random — reproducible split).
133
- */
134
- function lcg(seed: number): () => number {
135
- let s = seed >>> 0 || 1
136
-
137
- return () => {
138
- s = (Math.imul(s, 1_664_525) + 1_013_904_223) >>> 0
139
-
140
- return s / 0x1_00_00_00_00
141
- }
142
- }
143
-
144
102
  interface MessyRow {
145
103
  npi: string
146
104
  name: string
@@ -331,7 +289,7 @@ export async function scorerClusteringEval(
331
289
  * with the seed.
332
290
  */
333
291
  function runSeed(seed: number): SeedResult {
334
- const rnd = lcg(seed)
292
+ const rnd = makeLcg(seed || 1)
335
293
  const npiSplit = new Map<string, "train" | "eval">()
336
294
 
337
295
  for (const npi of kept) {
@@ -353,7 +311,6 @@ export async function scorerClusteringEval(
353
311
  // LR (batch GD, class-balanced) — same as the pairwise probe.
354
312
  const w = new Array<number>(dim).fill(0)
355
313
  let bias = 0
356
- const sigmoid = (z: number) => 1 / (1 + Math.exp(-Math.max(-30, Math.min(30, z))))
357
314
 
358
315
  for (let epoch = 0; epoch < TRAINING_EPOCHS; epoch++) {
359
316
  const gw = new Array<number>(dim).fill(0)
@@ -28,7 +28,7 @@ import { block, gbtScore, trainGBT } from "@mailwoman/match"
28
28
  import {
29
29
  addressFrequencyKey,
30
30
  buildDefaultModel,
31
- createGbtScorer,
31
+ createGBTScorer,
32
32
  createMatchFeaturizer,
33
33
  DEDUP_GBT_MODEL,
34
34
  defaultBlockingKeys,
@@ -41,22 +41,15 @@ import {
41
41
  } from "@mailwoman/registry"
42
42
 
43
43
  import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
44
-
45
- /**
46
- * Smallest mean F1 gap counted as a real difference between models rather than seed noise. Verdicts inside ±this are
47
- * reported as a tie.
48
- */
49
- const MIN_MEANINGFUL_F1_DELTA = 0.02
50
-
51
- /**
52
- * Groups below this size are too small for a held-out split to mean anything.
53
- */
54
- const MIN_GROUP_SIZE = 5
55
-
56
- /**
57
- * Gradient-boosting rounds. Fixed rather than early-stopped so seeds stay comparable.
58
- */
59
- const TRAINING_EPOCHS = 400
44
+ import {
45
+ addr,
46
+ MIN_GROUP_SIZE,
47
+ MIN_MEANINGFUL_F1_DELTA,
48
+ norm,
49
+ NPPES_COLUMNS as C,
50
+ sigmoid,
51
+ TRAINING_EPOCHS,
52
+ } from "./shared.ts"
60
53
 
61
54
  /**
62
55
  * Highest k swept when scanning cluster counts.
@@ -93,28 +86,6 @@ export interface ScorerCrossStateEvalOptions {
93
86
  outMd?: string
94
87
  }
95
88
 
96
- const C = {
97
- npi: "NPI",
98
- entityType: "Entity Type Code",
99
- orgLegal: "Provider Organization Name (Legal Business Name)",
100
- last: "Provider Last Name (Legal Name)",
101
- first: "Provider First Name",
102
- pAddr: "Provider First Line Business Practice Location Address",
103
- pCity: "Provider Business Practice Location Address City Name",
104
- pState: "Provider Business Practice Location Address State Name",
105
- pZip: "Provider Business Practice Location Address Postal Code",
106
- mAddr: "Provider First Line Business Mailing Address",
107
- mCity: "Provider Business Mailing Address City Name",
108
- mState: "Provider Business Mailing Address State Name",
109
- mZip: "Provider Business Mailing Address Postal Code",
110
- otherOrg: "Provider Other Organization Name",
111
- }
112
-
113
- const norm = (s: string | undefined) => (s ?? "").trim()
114
-
115
- const addr = (line: string, city: string, st: string, zip: string) =>
116
- [norm(line), norm(city), norm(st), norm(zip)].filter(Boolean).join(", ")
117
-
118
89
  const choose2 = (n: number) => (n * (n - 1)) / 2
119
90
 
120
91
  interface MessyRow {
@@ -293,7 +264,6 @@ export async function scorerCrossStateEval(
293
264
  const gbt = trainGBT(trainX, trainY, trainW, { rounds: 120, depth: 3, lr: 0.3, minLeaf: 20 })
294
265
  const w = new Array<number>(dim).fill(0)
295
266
  let bias = 0
296
- const sigmoid = (z: number) => 1 / (1 + Math.exp(-Math.max(-30, Math.min(30, z))))
297
267
 
298
268
  for (let epoch = 0; epoch < TRAINING_EPOCHS; epoch++) {
299
269
  const gw = new Array<number>(dim).fill(0)
@@ -395,7 +365,7 @@ export async function scorerCrossStateEval(
395
365
  // The SHIPPED model (the default-on candidate): the bundled DEDUP_GBT_MODEL, NOT a fresh per-run TX
396
366
  // fit. This is the arm that justifies flipping `learnedScorer` default-on — the actual artifact every
397
367
  // caller would get, evaluated on a state it never trained on.
398
- const bundledScorer = createGbtScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency })
368
+ const bundledScorer = createGBTScorer({ model: DEDUP_GBT_MODEL, comparisons, addressFrequency })
399
369
 
400
370
  const bundledArm = bestOver(quantileThresholds(evalPairs.map(([a, b]) => bundledScorer(a, b))), (t) => ({
401
371
  addressFrequency,