@mailwoman/registry 9.1.0 → 9.3.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 (228) hide show
  1. package/README.md +2 -2
  2. package/{address-key.ts → lib/address-key.ts} +1 -1
  3. package/{geocode-handler.ts → lib/geocode-handler.ts} +7 -7
  4. package/{geojson.ts → lib/geojson.ts} +12 -6
  5. package/{index.ts → lib/index.ts} +10 -10
  6. package/{ingest.ts → lib/ingest.ts} +77 -69
  7. package/{learned-scorer.ts → lib/learned-scorer.ts} +1 -1
  8. package/{map-html.ts → lib/map-html.ts} +10 -16
  9. package/{reconcile.ts → lib/reconcile.ts} +9 -24
  10. package/{resolve.ts → lib/resolve.ts} +31 -13
  11. package/{tools → lib/tools}/coverage-reconciliation.ts +13 -15
  12. package/{tools → lib/tools}/cross-dataset-correlation.ts +64 -139
  13. package/{tools → lib/tools}/cross-source-threshold-sweep.ts +21 -32
  14. package/{tools → lib/tools}/dedup-ceiling.ts +33 -144
  15. package/{tools → lib/tools}/eval-geocoder.ts +10 -11
  16. package/{tools → lib/tools}/geocoder-namesake-probe.ts +5 -12
  17. package/{tools → lib/tools}/geocoder-vs-provided-coords.ts +12 -11
  18. package/lib/tools/gold-set-sample.ts +141 -0
  19. package/lib/tools/index.ts +31 -0
  20. package/{tools → lib/tools}/learned-scorer-clustering-eval.ts +71 -260
  21. package/{tools → lib/tools}/learned-scorer-crossstate-eval.ts +62 -245
  22. package/{tools → lib/tools}/learned-scorer-eval.ts +64 -263
  23. package/{tools → lib/tools}/matcher-scale.ts +5 -5
  24. package/lib/tools/nppes/org-name.ts +23 -0
  25. package/lib/tools/nppes/overmerge-packet.ts +94 -0
  26. package/lib/tools/nppes/report.ts +373 -0
  27. package/lib/tools/nppes/sample.ts +245 -0
  28. package/lib/tools/nppes/scoring.ts +114 -0
  29. package/lib/tools/nppes/settings.ts +102 -0
  30. package/lib/tools/nppes/truth-grains.ts +161 -0
  31. package/lib/tools/nppes-dedup-benchmark.ts +408 -0
  32. package/lib/tools/shared.ts +763 -0
  33. package/lib/tools/train-cross-gbt.ts +209 -0
  34. package/{tools → lib/tools}/train-gbt.ts +38 -156
  35. package/lib/tools/train-org-cross-gbt.ts +179 -0
  36. package/{tools → lib/tools}/txhhsc-to-oarow.ts +10 -28
  37. package/lib/tools/viz/browser.ts +50 -0
  38. package/{tools → lib/tools}/viz/cross-dataset-map.ts +16 -39
  39. package/{tools → lib/tools}/viz/geocode-first-surface.ts +13 -39
  40. package/{tools → lib/tools}/viz/render-map.ts +10 -23
  41. package/lib/tools/viz/render.ts +98 -0
  42. package/{tools → lib/tools}/viz/source-provenance-map.ts +20 -39
  43. package/{tools → lib/tools}/viz/yardstick-figure.ts +6 -5
  44. package/{types.ts → lib/types.ts} +10 -1
  45. package/out/address-key.d.ts +1 -1
  46. package/out/address-key.d.ts.map +1 -1
  47. package/out/address-key.js.map +1 -1
  48. package/out/geocode-handler.d.ts +6 -6
  49. package/out/geocode-handler.d.ts.map +1 -1
  50. package/out/geocode-handler.js +6 -6
  51. package/out/geocode-handler.js.map +1 -1
  52. package/out/geojson.d.ts +7 -2
  53. package/out/geojson.d.ts.map +1 -1
  54. package/out/geojson.js +8 -5
  55. package/out/geojson.js.map +1 -1
  56. package/out/index.d.ts +10 -10
  57. package/out/index.d.ts.map +1 -1
  58. package/out/index.js +10 -10
  59. package/out/index.js.map +1 -1
  60. package/out/ingest.d.ts +64 -46
  61. package/out/ingest.d.ts.map +1 -1
  62. package/out/ingest.js +33 -46
  63. package/out/ingest.js.map +1 -1
  64. package/out/learned-scorer.d.ts +1 -1
  65. package/out/learned-scorer.d.ts.map +1 -1
  66. package/out/learned-scorer.js.map +1 -1
  67. package/out/map-html.d.ts +4 -4
  68. package/out/map-html.d.ts.map +1 -1
  69. package/out/map-html.js +6 -11
  70. package/out/map-html.js.map +1 -1
  71. package/out/models/crosssource-gbt-en-us.d.ts.map +1 -1
  72. package/out/models/crosssource-gbt-en-us.js.map +1 -1
  73. package/out/models/dedup-gbt-en-us.d.ts.map +1 -1
  74. package/out/models/dedup-gbt-en-us.js.map +1 -1
  75. package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -1
  76. package/out/models/org-crosssource-gbt-en-us.js.map +1 -1
  77. package/out/reconcile.d.ts +6 -1
  78. package/out/reconcile.d.ts.map +1 -1
  79. package/out/reconcile.js +7 -21
  80. package/out/reconcile.js.map +1 -1
  81. package/out/resolve.d.ts +19 -7
  82. package/out/resolve.d.ts.map +1 -1
  83. package/out/resolve.js +20 -6
  84. package/out/resolve.js.map +1 -1
  85. package/out/tools/coverage-reconciliation.d.ts +1 -1
  86. package/out/tools/coverage-reconciliation.d.ts.map +1 -1
  87. package/out/tools/coverage-reconciliation.js +12 -12
  88. package/out/tools/coverage-reconciliation.js.map +1 -1
  89. package/out/tools/cross-dataset-correlation.d.ts +4 -4
  90. package/out/tools/cross-dataset-correlation.d.ts.map +1 -1
  91. package/out/tools/cross-dataset-correlation.js +60 -111
  92. package/out/tools/cross-dataset-correlation.js.map +1 -1
  93. package/out/tools/cross-source-threshold-sweep.d.ts +2 -2
  94. package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -1
  95. package/out/tools/cross-source-threshold-sweep.js +19 -27
  96. package/out/tools/cross-source-threshold-sweep.js.map +1 -1
  97. package/out/tools/dedup-ceiling.d.ts.map +1 -1
  98. package/out/tools/dedup-ceiling.js +36 -118
  99. package/out/tools/dedup-ceiling.js.map +1 -1
  100. package/out/tools/eval-geocoder.d.ts +9 -13
  101. package/out/tools/eval-geocoder.d.ts.map +1 -1
  102. package/out/tools/eval-geocoder.js +2 -2
  103. package/out/tools/eval-geocoder.js.map +1 -1
  104. package/out/tools/geocoder-namesake-probe.d.ts +2 -2
  105. package/out/tools/geocoder-namesake-probe.d.ts.map +1 -1
  106. package/out/tools/geocoder-namesake-probe.js +4 -8
  107. package/out/tools/geocoder-namesake-probe.js.map +1 -1
  108. package/out/tools/geocoder-vs-provided-coords.d.ts +1 -1
  109. package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
  110. package/out/tools/geocoder-vs-provided-coords.js +11 -9
  111. package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
  112. package/out/tools/gold-set-sample.d.ts +5 -5
  113. package/out/tools/gold-set-sample.d.ts.map +1 -1
  114. package/out/tools/gold-set-sample.js +37 -121
  115. package/out/tools/gold-set-sample.js.map +1 -1
  116. package/out/tools/index.d.ts +24 -29
  117. package/out/tools/index.d.ts.map +1 -1
  118. package/out/tools/index.js +24 -29
  119. package/out/tools/index.js.map +1 -1
  120. package/out/tools/learned-scorer-clustering-eval.d.ts +1 -1
  121. package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
  122. package/out/tools/learned-scorer-clustering-eval.js +35 -170
  123. package/out/tools/learned-scorer-clustering-eval.js.map +1 -1
  124. package/out/tools/learned-scorer-crossstate-eval.d.ts +5 -5
  125. package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -1
  126. package/out/tools/learned-scorer-crossstate-eval.js +44 -166
  127. package/out/tools/learned-scorer-crossstate-eval.js.map +1 -1
  128. package/out/tools/learned-scorer-eval.d.ts +1 -1
  129. package/out/tools/learned-scorer-eval.d.ts.map +1 -1
  130. package/out/tools/learned-scorer-eval.js +37 -173
  131. package/out/tools/learned-scorer-eval.js.map +1 -1
  132. package/out/tools/matcher-scale.d.ts.map +1 -1
  133. package/out/tools/matcher-scale.js +5 -5
  134. package/out/tools/matcher-scale.js.map +1 -1
  135. package/out/tools/nppes/org-name.d.ts +21 -0
  136. package/out/tools/nppes/org-name.d.ts.map +1 -0
  137. package/out/tools/nppes/org-name.js +13 -0
  138. package/out/tools/nppes/org-name.js.map +1 -0
  139. package/out/tools/nppes/overmerge-packet.d.ts +39 -0
  140. package/out/tools/nppes/overmerge-packet.d.ts.map +1 -0
  141. package/out/tools/nppes/overmerge-packet.js +55 -0
  142. package/out/tools/nppes/overmerge-packet.js.map +1 -0
  143. package/out/tools/nppes/report.d.ts +93 -0
  144. package/out/tools/nppes/report.d.ts.map +1 -0
  145. package/out/tools/nppes/report.js +186 -0
  146. package/out/tools/nppes/report.js.map +1 -0
  147. package/out/tools/nppes/sample.d.ts +90 -0
  148. package/out/tools/nppes/sample.d.ts.map +1 -0
  149. package/out/tools/nppes/sample.js +131 -0
  150. package/out/tools/nppes/sample.js.map +1 -0
  151. package/out/tools/nppes/scoring.d.ts +36 -0
  152. package/out/tools/nppes/scoring.d.ts.map +1 -0
  153. package/out/tools/nppes/scoring.js +80 -0
  154. package/out/tools/nppes/scoring.js.map +1 -0
  155. package/out/tools/nppes/settings.d.ts +38 -0
  156. package/out/tools/nppes/settings.d.ts.map +1 -0
  157. package/out/tools/nppes/settings.js +79 -0
  158. package/out/tools/nppes/settings.js.map +1 -0
  159. package/out/tools/nppes/truth-grains.d.ts +50 -0
  160. package/out/tools/nppes/truth-grains.d.ts.map +1 -0
  161. package/out/tools/nppes/truth-grains.js +123 -0
  162. package/out/tools/nppes/truth-grains.js.map +1 -0
  163. package/out/tools/nppes-dedup-benchmark.d.ts +7 -3
  164. package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
  165. package/out/tools/nppes-dedup-benchmark.js +106 -673
  166. package/out/tools/nppes-dedup-benchmark.js.map +1 -1
  167. package/out/tools/shared.d.ts +244 -7
  168. package/out/tools/shared.d.ts.map +1 -1
  169. package/out/tools/shared.js +353 -21
  170. package/out/tools/shared.js.map +1 -1
  171. package/out/tools/train-cross-gbt.d.ts +7 -7
  172. package/out/tools/train-cross-gbt.d.ts.map +1 -1
  173. package/out/tools/train-cross-gbt.js +47 -145
  174. package/out/tools/train-cross-gbt.js.map +1 -1
  175. package/out/tools/train-gbt.d.ts +7 -7
  176. package/out/tools/train-gbt.d.ts.map +1 -1
  177. package/out/tools/train-gbt.js +31 -111
  178. package/out/tools/train-gbt.js.map +1 -1
  179. package/out/tools/train-org-cross-gbt.d.ts +7 -5
  180. package/out/tools/train-org-cross-gbt.d.ts.map +1 -1
  181. package/out/tools/train-org-cross-gbt.js +45 -141
  182. package/out/tools/train-org-cross-gbt.js.map +1 -1
  183. package/out/tools/txhhsc-to-oarow.d.ts +2 -2
  184. package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
  185. package/out/tools/txhhsc-to-oarow.js +9 -23
  186. package/out/tools/txhhsc-to-oarow.js.map +1 -1
  187. package/out/tools/viz/browser.d.ts +34 -0
  188. package/out/tools/viz/browser.d.ts.map +1 -0
  189. package/out/tools/viz/browser.js +33 -0
  190. package/out/tools/viz/browser.js.map +1 -0
  191. package/out/tools/viz/cross-dataset-map.d.ts +4 -25
  192. package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
  193. package/out/tools/viz/cross-dataset-map.js +12 -33
  194. package/out/tools/viz/cross-dataset-map.js.map +1 -1
  195. package/out/tools/viz/geocode-first-surface.d.ts +6 -35
  196. package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
  197. package/out/tools/viz/geocode-first-surface.js +10 -37
  198. package/out/tools/viz/geocode-first-surface.js.map +1 -1
  199. package/out/tools/viz/render-map.d.ts +3 -6
  200. package/out/tools/viz/render-map.d.ts.map +1 -1
  201. package/out/tools/viz/render-map.js +9 -19
  202. package/out/tools/viz/render-map.js.map +1 -1
  203. package/out/tools/viz/render.d.ts +4 -9
  204. package/out/tools/viz/render.d.ts.map +1 -1
  205. package/out/tools/viz/render.js +24 -39
  206. package/out/tools/viz/render.js.map +1 -1
  207. package/out/tools/viz/source-provenance-map.d.ts +4 -24
  208. package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
  209. package/out/tools/viz/source-provenance-map.js +12 -32
  210. package/out/tools/viz/source-provenance-map.js.map +1 -1
  211. package/out/tools/viz/yardstick-figure.d.ts +2 -2
  212. package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
  213. package/out/tools/viz/yardstick-figure.js +5 -4
  214. package/out/tools/viz/yardstick-figure.js.map +1 -1
  215. package/out/types.d.ts +11 -1
  216. package/out/types.d.ts.map +1 -1
  217. package/out/types.js.map +1 -1
  218. package/package.json +180 -11
  219. package/tools/gold-set-sample.ts +0 -252
  220. package/tools/index.ts +0 -36
  221. package/tools/nppes-dedup-benchmark.ts +0 -1180
  222. package/tools/shared.ts +0 -160
  223. package/tools/train-cross-gbt.ts +0 -358
  224. package/tools/train-org-cross-gbt.ts +0 -329
  225. package/tools/viz/render.ts +0 -113
  226. /package/{models → lib/models}/crosssource-gbt-en-us.ts +0 -0
  227. /package/{models → lib/models}/dedup-gbt-en-us.ts +0 -0
  228. /package/{models → lib/models}/org-crosssource-gbt-en-us.ts +0 -0
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pairwise cluster scoring for the NPPES benchmark — precision/recall/F1 and adjusted Rand of recovered clusters
6
+ * against a truth labelling, plus the over-merge / under-merge shape counts.
7
+ */
8
+ /**
9
+ * Pairs within a group of `n`.
10
+ */
11
+ export const choose2 = (n) => (n * (n - 1)) / 2;
12
+ /**
13
+ * Score recovered clusters against a truth labelling.
14
+ *
15
+ * Pairwise, not set-matching: a true pair is two records carrying the same `labelOf`, a predicted pair is two records
16
+ * in the same entity. `totalRecords` is the labelled population and only feeds the adjusted-Rand expectation, so it
17
+ * must be the whole record set rather than the clustered subset — a smaller value inflates ARI.
18
+ */
19
+ export function scoreEntities(entities, labelOf, totalRecords) {
20
+ const npiTotals = new Map();
21
+ const npiClusters = new Map();
22
+ let sumCK = 0; // Σ C(n_ck, 2)
23
+ let sumCluster = 0; // Σ_c C(|c|, 2)
24
+ let singletons = 0;
25
+ let overMergedClusters = 0;
26
+ let recordsInOverMerged = 0;
27
+ let maxNpisFused = 0;
28
+ entities.forEach((e, ci) => {
29
+ const byNPI = new Map();
30
+ for (const rec of e.records) {
31
+ const lbl = labelOf(rec);
32
+ byNPI.set(lbl, (byNPI.get(lbl) ?? 0) + 1);
33
+ }
34
+ sumCluster += choose2(e.records.length);
35
+ if (e.records.length === 1) {
36
+ singletons++;
37
+ }
38
+ if (byNPI.size > 1) {
39
+ overMergedClusters++;
40
+ recordsInOverMerged += e.records.length;
41
+ maxNpisFused = Math.max(maxNpisFused, byNPI.size);
42
+ }
43
+ for (const [npi, n] of byNPI) {
44
+ sumCK += choose2(n);
45
+ npiTotals.set(npi, (npiTotals.get(npi) ?? 0) + n);
46
+ }
47
+ for (const rec of e.records) {
48
+ const lbl = labelOf(rec);
49
+ const s = npiClusters.get(lbl) ?? new Set();
50
+ s.add(ci);
51
+ npiClusters.set(lbl, s);
52
+ }
53
+ });
54
+ let sumClass = 0;
55
+ // Σ_k C(|k|, 2)
56
+ for (const total of npiTotals.values()) {
57
+ sumClass += choose2(total);
58
+ }
59
+ const tp = sumCK;
60
+ const precision = tp + (sumCluster - tp) > 0 ? tp / sumCluster : 0;
61
+ const recall = sumClass > 0 ? tp / sumClass : 0;
62
+ const f1 = precision + recall > 0 ? (2 * precision * recall) / (precision + recall) : 0;
63
+ const expected = (sumCluster * sumClass) / choose2(totalRecords);
64
+ const maxIndex = (sumCluster + sumClass) / 2;
65
+ const ari = maxIndex - expected !== 0 ? (tp - expected) / (maxIndex - expected) : 1;
66
+ const splitNpis = [...npiClusters.values()].filter((s) => s.size > 1).length;
67
+ return {
68
+ precision,
69
+ recall,
70
+ f1,
71
+ ari,
72
+ clusters: entities.length,
73
+ singletons,
74
+ overMergedClusters,
75
+ recordsInOverMerged,
76
+ maxNpisFused,
77
+ splitNpis,
78
+ };
79
+ }
80
+ //# sourceMappingURL=scoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../../lib/tools/nppes/scoring.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AA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AAC,CAAA;IACvF,MAAM,QAAQ,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IAChE,MAAM,QAAQ,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,QAAQ,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnF,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAA;IAE5E,OAAO;QACN,SAAS;QACT,MAAM;QACN,EAAE;QACF,GAAG;QACH,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,UAAU;QACV,kBAAkB;QAClB,mBAAmB;QACnB,YAAY;QACZ,SAAS;KACT,CAAA;AACF,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The comparison-model setting progression the NPPES benchmark walks — each row turns one setting on so its marginal
6
+ * effect is isolated.
7
+ */
8
+ import type { TermFrequencyTable } from "@mailwoman/match";
9
+ /**
10
+ * The subset of `ResolveConfig` this progression varies.
11
+ */
12
+ export interface SettingConfig {
13
+ addressFrequency?: TermFrequencyTable | false;
14
+ collapseSpatial?: boolean;
15
+ discriminators?: string[];
16
+ requireCorroboration?: boolean;
17
+ usePhone?: boolean;
18
+ linkage?: "single" | "average";
19
+ exactDiscriminators?: string[];
20
+ }
21
+ /**
22
+ * One row of the progression.
23
+ */
24
+ export interface Setting {
25
+ label: string;
26
+ config: SettingConfig;
27
+ }
28
+ /**
29
+ * Build the progression against a corpus-wide address-frequency table.
30
+ *
31
+ * Every row sets BOTH `collapseSpatial` and `addressFrequency` EXPLICITLY, because the proven settings are default-on
32
+ * in `resolveEntities`: leave either implicit and the flipped default silently rides the `+ inverse-address-frequency`
33
+ * row, making the A1 delta read as 0. Every row is fed the corpus-wide table — the realistic deployment, where the CLI
34
+ * builds it from the full source files — so the zero-config default, whose input-scoped table is intentionally sparse
35
+ * on a sub-sample, has to be measured separately.
36
+ */
37
+ export declare function buildSettings(addressFrequency: TermFrequencyTable): Setting[];
38
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/tools/nppes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,gBAAgB,CAAC,EAAE,kBAAkB,GAAG,KAAK,CAAA;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,aAAa,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,kBAAkB,GAAG,OAAO,EAAE,CA6D7E"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The comparison-model setting progression the NPPES benchmark walks — each row turns one setting on so its marginal
6
+ * effect is isolated.
7
+ */
8
+ /**
9
+ * Build the progression against a corpus-wide address-frequency table.
10
+ *
11
+ * Every row sets BOTH `collapseSpatial` and `addressFrequency` EXPLICITLY, because the proven settings are default-on
12
+ * in `resolveEntities`: leave either implicit and the flipped default silently rides the `+ inverse-address-frequency`
13
+ * row, making the A1 delta read as 0. Every row is fed the corpus-wide table — the realistic deployment, where the CLI
14
+ * builds it from the full source files — so the zero-config default, whose input-scoped table is intentionally sparse
15
+ * on a sub-sample, has to be measured separately.
16
+ */
17
+ export function buildSettings(addressFrequency) {
18
+ return [
19
+ {
20
+ label: "baseline (legacy: address-key + distance, settings OFF)",
21
+ config: { collapseSpatial: false, addressFrequency: false },
22
+ },
23
+ { label: "+ inverse-address-frequency (#617, corpus-wide)", config: { collapseSpatial: false, addressFrequency } },
24
+ { label: "+ collapsed spatial signal (A1, #625)", config: { collapseSpatial: true, addressFrequency } },
25
+ {
26
+ label: "+ authorized-official discriminator (#625)",
27
+ config: { collapseSpatial: true, addressFrequency, discriminators: ["authorizedOfficial"] },
28
+ },
29
+ // A2–A4 (#625): the built-but-unmeasured over-merge settings. Each builds on the A1 + discriminator
30
+ // stack so the marginal effect is isolated. A2 (require name/org corroboration) is the direct
31
+ // over-merge precision setting; A3 (phone) is the recall-tail corroborator that should keep A2 from
32
+ // killing name-drift links; A4 (average-linkage) splits a component joined only by a weak bridge.
33
+ {
34
+ label: "+ require name/org corroboration (A2, #625)",
35
+ config: {
36
+ collapseSpatial: true,
37
+ addressFrequency,
38
+ discriminators: ["authorizedOfficial"],
39
+ requireCorroboration: true,
40
+ },
41
+ },
42
+ {
43
+ label: "+ phone comparison (A3, #625)",
44
+ config: {
45
+ collapseSpatial: true,
46
+ addressFrequency,
47
+ discriminators: ["authorizedOfficial"],
48
+ requireCorroboration: true,
49
+ usePhone: true,
50
+ },
51
+ },
52
+ {
53
+ label: "+ average-linkage clustering (A4, #625, full A1–A4 stack)",
54
+ config: {
55
+ collapseSpatial: true,
56
+ addressFrequency,
57
+ discriminators: ["authorizedOfficial"],
58
+ requireCorroboration: true,
59
+ usePhone: true,
60
+ linkage: "average",
61
+ },
62
+ },
63
+ // A5 (#625): the taxonomy code-set discriminator — set-overlap agreement over the NPI's 15 taxonomy
64
+ // slots. The named "still-more-distinctive identifier" from the 2026-06-16 report: co-located
65
+ // DISTINCT providers usually have disjoint sets (the over-merge separator) while an entity's own
66
+ // records always share theirs (never splits). Stacked on the BEST prior classical config (A1 +
67
+ // authorized-official; A3 phone + A4 avg-linkage were measured neutral-to-negative and are left off).
68
+ {
69
+ label: "+ taxonomy code-set discriminator (A5, #625)",
70
+ config: {
71
+ collapseSpatial: true,
72
+ addressFrequency,
73
+ discriminators: ["authorizedOfficial"],
74
+ exactDiscriminators: ["taxonomy"],
75
+ },
76
+ },
77
+ ];
78
+ }
79
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../lib/tools/nppes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,gBAAoC;IACjE,OAAO;QACN;YACC,KAAK,EAAE,yDAAyD;YAChE,MAAM,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE;SAC3D;QACD,EAAE,KAAK,EAAE,iDAAiD,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE;QAClH,EAAE,KAAK,EAAE,uCAAuC,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE;QACvG;YACC,KAAK,EAAE,4CAA4C;YACnD,MAAM,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC,oBAAoB,CAAC,EAAE;SAC3F;QACD,oGAAoG;QACpG,8FAA8F;QAC9F,oGAAoG;QACpG,kGAAkG;QAClG;YACC,KAAK,EAAE,6CAA6C;YACpD,MAAM,EAAE;gBACP,eAAe,EAAE,IAAI;gBACrB,gBAAgB;gBAChB,cAAc,EAAE,CAAC,oBAAoB,CAAC;gBACtC,oBAAoB,EAAE,IAAI;aAC1B;SACD;QACD;YACC,KAAK,EAAE,+BAA+B;YACtC,MAAM,EAAE;gBACP,eAAe,EAAE,IAAI;gBACrB,gBAAgB;gBAChB,cAAc,EAAE,CAAC,oBAAoB,CAAC;gBACtC,oBAAoB,EAAE,IAAI;gBAC1B,QAAQ,EAAE,IAAI;aACd;SACD;QACD;YACC,KAAK,EAAE,2DAA2D;YAClE,MAAM,EAAE;gBACP,eAAe,EAAE,IAAI;gBACrB,gBAAgB;gBAChB,cAAc,EAAE,CAAC,oBAAoB,CAAC;gBACtC,oBAAoB,EAAE,IAAI;gBAC1B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,SAAS;aAClB;SACD;QACD,oGAAoG;QACpG,8FAA8F;QAC9F,iGAAiG;QACjG,+FAA+F;QAC/F,sGAAsG;QACtG;YACC,KAAK,EAAE,8CAA8C;YACrD,MAAM,EAAE;gBACP,eAAe,EAAE,IAAI;gBACrB,gBAAgB;gBAChB,cAAc,EAAE,CAAC,oBAAoB,CAAC;gBACtC,mBAAmB,EAAE,CAAC,UAAU,CAAC;aACjC;SACD;KACD,CAAA;AACF,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The org-name entity-truth grains: union-find labellings that collapse co-located same-org NPIs, keyed three
6
+ * ways — the address string, a haversine co-location radius, and an H3 cell.
7
+ */
8
+ import { type LatLon } from "@mailwoman/match";
9
+ import type { SourceRecord } from "#index";
10
+ import { type NPIPrimary } from "#tools/nppes/org-name";
11
+ /**
12
+ * Same-building distance for the coordinate grain — the `DEFAULT_DISTANCE_LEVELS` grain.
13
+ */
14
+ export declare const COLOCATION_KM = 0.05;
15
+ /**
16
+ * A truth labelling: the entity class a record belongs to.
17
+ */
18
+ export type TruthLabel = (rec: SourceRecord) => string;
19
+ /**
20
+ * An NPI's primary practice coordinate — the FIRST geocoded record it owns, which is its primary row because the sample
21
+ * builder pushes that row before the alternate-name and mailing variants.
22
+ */
23
+ export declare function collectPrimaryCoordinates(records: readonly SourceRecord[]): Map<string, LatLon>;
24
+ /**
25
+ * The string-keyed org-name truth: same NPI ⇒ same entity (so an NPI's records stay together and recall is preserved),
26
+ * PLUS union two NPIs at the same address KEY whose primary org names agree.
27
+ *
28
+ * Blocking on the address string is a conservative LOWER bound — `1504 Taub LOOP` and `1504 Taub LP STE 100` key apart
29
+ * even though they are one building, so a correct merge across them is still charged as an error. The coordinate grain
30
+ * below is the tighter reading. Neither relies on the NPPES subpart flag, which the gold set showed misses 37%.
31
+ */
32
+ export declare function buildOrgNameGrain(npiPrimary: Map<string, NPIPrimary>): TruthLabel;
33
+ /**
34
+ * The coordinate-keyed org-name truth: union same-org NPIs whose primary practice coordinates fall within
35
+ * {@linkcode COLOCATION_KM}. Blocking by the GEOCODED BUILDING catches the same-building pairs the address string keys
36
+ * apart, so this F1 is at or above the string grain's; the Jaccard test still blocks distinct co-located orgs.
37
+ *
38
+ * Brute-force pairwise over the sampled NPIs — trivial at this scale, and unlike a cell key it has no boundary
39
+ * artifact.
40
+ */
41
+ export declare function buildOrgNameCoordGrain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string, LatLon>): TruthLabel;
42
+ /**
43
+ * The H3-cell org-name truth — the same building grain keyed on a cell instead of a radius, so co-location blocking is
44
+ * O(n) rather than O(n²).
45
+ *
46
+ * A robustness check on the coordinate grain, not a replacement: a hard cell boundary can split a same-building pair
47
+ * into adjacent cells, so this slightly UNDER-counts relative to the radius. Coarser resolutions absorb more of that.
48
+ */
49
+ export declare function buildOrgNameH3Grain(npiPrimary: Map<string, NPIPrimary>, npiCoord: Map<string, LatLon>, h3Res: number): TruthLabel;
50
+ //# sourceMappingURL=truth-grains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truth-grains.d.ts","sourceRoot":"","sources":["../../../lib/tools/nppes/truth-grains.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,aAAa,OAAO,CAAA;AAEjC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,CAAA;AAwBtD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAY/F;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,CAoBjF;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,UAAU,CAuBrH;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,KAAK,EAAE,MAAM,GACX,UAAU,CAqBZ"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file The org-name entity-truth grains: union-find labellings that collapse co-located same-org NPIs, keyed three
6
+ * ways — the address string, a haversine co-location radius, and an H3 cell.
7
+ */
8
+ import { createUnionFind } from "@mailwoman/core/utils";
9
+ import { haversineKm, jaccard } from "@mailwoman/match";
10
+ import { latLngToCell } from "h3-js";
11
+ import { ORG_TAU } from "#tools/nppes/org-name";
12
+ /**
13
+ * Same-building distance for the coordinate grain — the `DEFAULT_DISTANCE_LEVELS` grain.
14
+ */
15
+ export const COLOCATION_KM = 0.05;
16
+ /**
17
+ * Union every pair in each block whose org names agree.
18
+ *
19
+ * Quadratic within a block, which is what keeps the test honest: the Jaccard test is per PAIR, so a chain of
20
+ * near-matches cannot transitively fuse two genuinely distinct co-located orgs unless some pair actually agrees.
21
+ */
22
+ function unionAgreeingPairs(blocks, npiPrimary, uf) {
23
+ for (const group of blocks) {
24
+ for (let i = 0; i < group.length; i++) {
25
+ for (let j = i + 1; j < group.length; j++) {
26
+ if (jaccard(npiPrimary.get(group[i]).tokens, npiPrimary.get(group[j]).tokens) >= ORG_TAU) {
27
+ uf.union(group[i], group[j]);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * An NPI's primary practice coordinate — the FIRST geocoded record it owns, which is its primary row because the sample
35
+ * builder pushes that row before the alternate-name and mailing variants.
36
+ */
37
+ export function collectPrimaryCoordinates(records) {
38
+ const npiCoord = new Map();
39
+ for (const rec of records) {
40
+ const c = rec.address?.geocode?.coordinate;
41
+ if (c && !npiCoord.has(rec.id)) {
42
+ npiCoord.set(rec.id, c);
43
+ }
44
+ }
45
+ return npiCoord;
46
+ }
47
+ /**
48
+ * The string-keyed org-name truth: same NPI ⇒ same entity (so an NPI's records stay together and recall is preserved),
49
+ * PLUS union two NPIs at the same address KEY whose primary org names agree.
50
+ *
51
+ * Blocking on the address string is a conservative LOWER bound — `1504 Taub LOOP` and `1504 Taub LP STE 100` key apart
52
+ * even though they are one building, so a correct merge across them is still charged as an error. The coordinate grain
53
+ * below is the tighter reading. Neither relies on the NPPES subpart flag, which the gold set showed misses 37%.
54
+ */
55
+ export function buildOrgNameGrain(npiPrimary) {
56
+ const uf = createUnionFind();
57
+ const byAddr = new Map();
58
+ for (const [npi, info] of npiPrimary) {
59
+ uf.find(npi);
60
+ // seed
61
+ if (!info.addrKey)
62
+ continue;
63
+ if (!byAddr.has(info.addrKey)) {
64
+ byAddr.set(info.addrKey, []);
65
+ }
66
+ byAddr.get(info.addrKey).push(npi);
67
+ }
68
+ unionAgreeingPairs(byAddr.values(), npiPrimary, uf);
69
+ return (rec) => (npiPrimary.has(rec.id) ? uf.find(rec.id) : rec.id);
70
+ }
71
+ /**
72
+ * The coordinate-keyed org-name truth: union same-org NPIs whose primary practice coordinates fall within
73
+ * {@linkcode COLOCATION_KM}. Blocking by the GEOCODED BUILDING catches the same-building pairs the address string keys
74
+ * apart, so this F1 is at or above the string grain's; the Jaccard test still blocks distinct co-located orgs.
75
+ *
76
+ * Brute-force pairwise over the sampled NPIs — trivial at this scale, and unlike a cell key it has no boundary
77
+ * artifact.
78
+ */
79
+ export function buildOrgNameCoordGrain(npiPrimary, npiCoord) {
80
+ const uf = createUnionFind();
81
+ const coLocated = [...npiPrimary.keys()].filter((n) => npiCoord.has(n));
82
+ for (const n of npiPrimary.keys()) {
83
+ uf.find(n);
84
+ }
85
+ // seed every NPI (un-geocoded ones stay singletons)
86
+ for (let i = 0; i < coLocated.length; i++) {
87
+ for (let j = i + 1; j < coLocated.length; j++) {
88
+ const a = coLocated[i];
89
+ const b = coLocated[j];
90
+ if (haversineKm(npiCoord.get(a), npiCoord.get(b)) > COLOCATION_KM)
91
+ continue;
92
+ if (jaccard(npiPrimary.get(a).tokens, npiPrimary.get(b).tokens) >= ORG_TAU) {
93
+ uf.union(a, b);
94
+ }
95
+ }
96
+ }
97
+ return (rec) => (npiPrimary.has(rec.id) ? uf.find(rec.id) : rec.id);
98
+ }
99
+ /**
100
+ * The H3-cell org-name truth — the same building grain keyed on a cell instead of a radius, so co-location blocking is
101
+ * O(n) rather than O(n²).
102
+ *
103
+ * A robustness check on the coordinate grain, not a replacement: a hard cell boundary can split a same-building pair
104
+ * into adjacent cells, so this slightly UNDER-counts relative to the radius. Coarser resolutions absorb more of that.
105
+ */
106
+ export function buildOrgNameH3Grain(npiPrimary, npiCoord, h3Res) {
107
+ const uf = createUnionFind();
108
+ const byCell = new Map();
109
+ for (const n of npiPrimary.keys()) {
110
+ uf.find(n); // seed every NPI (un-geocoded ones stay singletons)
111
+ const c = npiCoord.get(n);
112
+ if (!c)
113
+ continue;
114
+ const cell = latLngToCell(c.latitude, c.longitude, h3Res);
115
+ if (!byCell.has(cell)) {
116
+ byCell.set(cell, []);
117
+ }
118
+ byCell.get(cell).push(n);
119
+ }
120
+ unionAgreeingPairs(byCell.values(), npiPrimary, uf);
121
+ return (rec) => (npiPrimary.has(rec.id) ? uf.find(rec.id) : rec.id);
122
+ }
123
+ //# sourceMappingURL=truth-grains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truth-grains.js","sourceRoot":"","sources":["../../../lib/tools/nppes/truth-grains.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAe,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGpC,OAAO,EAAE,OAAO,EAAmB,MAAM,uBAAuB,CAAA;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAA;AAOjC;;;;;GAKG;AACH,SAAS,kBAAkB,CAC1B,MAAmC,EACnC,UAAmC,EACnC,EAAa;IAEb,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3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QACrB,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;IAEnD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACpE,CAAC"}
@@ -17,15 +17,19 @@
17
17
  * NPI split across two genuinely-distant addresses is geo-first behaving correctly, counted here
18
18
  * as a recall miss. We resolve and report; interpretation is the consumer's.
19
19
  *
20
- * Sample: a tractable, variation-rich cut — providers in one state (default TX) that have ≥1
20
+ * Sample: a tractable, variation-rich slice — providers in one state (default TX) that have ≥1
21
21
  * alternate name, so every entity has ≥2 records and the dedup is non-trivial. Streams the 4.8 GB
22
22
  * registry via `streamRows` (#616), so nothing loads whole.
23
23
  *
24
+ * The stages live in `./nppes/`: the sample, the scorer, the truth grains, the setting progression,
25
+ * the adjudication packet, and the report. This file is the orchestration — read it for the order
26
+ * of operations, the modules for what each stage does.
27
+ *
24
28
  * Run: `mailwoman registry scorer-eval nppes-benchmark [--state TX] [--max-npis 300]
25
29
  * [--wof <admin.db>] [--data-root <dir>] [--no-train-em]
26
30
  * [--out-md docs/articles/evals/matcher-dedup/<date>-nppes-dedup-benchmark.md]`
27
31
  */
28
- import type { EvalGeocodeStream, EvalGeocoderFactory } from "./eval-geocoder.ts";
32
+ import type { EvalGeocodeStream, EvalGeocoderFactory } from "#tools/eval-geocoder";
29
33
  /**
30
34
  * Options for {@linkcode nppesDedupBenchmark}.
31
35
  */
@@ -75,7 +79,7 @@ export interface NPPESDedupBenchmarkOptions {
75
79
  */
76
80
  h3Res?: number;
77
81
  /**
78
- * Geocode the sample across a worker pool ({@linkcode geocodeStream}) instead of the serial in-process seam. Heavy
82
+ * Geocode the sample across a worker pool ({@linkcode geocodeStream}) instead of the serial in-process path. Heavy
79
83
  * per-row work (ONNX parse + WOF SQLite) → threading pays; measured ~1.5× at 2 workers, coordinates identical.
80
84
  */
81
85
  parallelGeocode?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"nppes-dedup-benchmark.d.ts","sourceRoot":"","sources":["../../tools/nppes-dedup-benchmark.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAoBH,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAQhF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AA2DD;;GAEG;AAKH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,0BAA0B,EACnC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KA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