@mailwoman/entity-resolution 0.0.0-stage → 10.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.
- package/README.md +114 -2
- package/lib/address-key.ts +46 -0
- package/lib/geocode-handler.ts +37 -0
- package/lib/geojson.ts +72 -0
- package/lib/index.ts +23 -0
- package/lib/ingest.ts +349 -0
- package/lib/learned-scorer.ts +134 -0
- package/lib/map-html.ts +287 -0
- package/lib/models/crosssource-gbt-en-us.ts +43 -0
- package/lib/models/dedup-gbt-en-us.ts +47 -0
- package/lib/models/org-crosssource-gbt-en-us.ts +43 -0
- package/lib/reconcile.ts +239 -0
- package/lib/resolve.ts +569 -0
- package/lib/types.ts +110 -0
- package/out/address-key.d.ts +34 -0
- package/out/address-key.d.ts.map +1 -0
- package/out/address-key.js +41 -0
- package/out/address-key.js.map +1 -0
- package/out/geocode-handler.d.ts +20 -0
- package/out/geocode-handler.d.ts.map +1 -0
- package/out/geocode-handler.js +29 -0
- package/out/geocode-handler.js.map +1 -0
- package/out/geojson.d.ts +28 -0
- package/out/geojson.d.ts.map +1 -0
- package/out/geojson.js +62 -0
- package/out/geojson.js.map +1 -0
- package/out/index.d.ts +23 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +23 -0
- package/out/index.js.map +1 -0
- package/out/ingest.d.ts +173 -0
- package/out/ingest.d.ts.map +1 -0
- package/out/ingest.js +185 -0
- package/out/ingest.js.map +1 -0
- package/out/learned-scorer.d.ts +61 -0
- package/out/learned-scorer.d.ts.map +1 -0
- package/out/learned-scorer.js +91 -0
- package/out/learned-scorer.js.map +1 -0
- package/out/map-html.d.ts +39 -0
- package/out/map-html.d.ts.map +1 -0
- package/out/map-html.js +220 -0
- package/out/map-html.js.map +1 -0
- package/out/models/crosssource-gbt-en-us.d.ts +45 -0
- package/out/models/crosssource-gbt-en-us.d.ts.map +1 -0
- package/out/models/crosssource-gbt-en-us.js +40 -0
- package/out/models/crosssource-gbt-en-us.js.map +1 -0
- package/out/models/dedup-gbt-en-us.d.ts +44 -0
- package/out/models/dedup-gbt-en-us.d.ts.map +1 -0
- package/out/models/dedup-gbt-en-us.js +44 -0
- package/out/models/dedup-gbt-en-us.js.map +1 -0
- package/out/models/org-crosssource-gbt-en-us.d.ts +45 -0
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +1 -0
- package/out/models/org-crosssource-gbt-en-us.js +40 -0
- package/out/models/org-crosssource-gbt-en-us.js.map +1 -0
- package/out/reconcile.d.ts +96 -0
- package/out/reconcile.d.ts.map +1 -0
- package/out/reconcile.js +127 -0
- package/out/reconcile.js.map +1 -0
- package/out/resolve.d.ts +264 -0
- package/out/resolve.d.ts.map +1 -0
- package/out/resolve.js +282 -0
- package/out/resolve.js.map +1 -0
- package/out/tools/coverage-reconciliation.d.ts +67 -0
- package/out/tools/coverage-reconciliation.d.ts.map +1 -0
- package/out/tools/coverage-reconciliation.js +113 -0
- package/out/tools/coverage-reconciliation.js.map +1 -0
- package/out/tools/cross/dataset-correlation.d.ts +61 -0
- package/out/tools/cross/dataset-correlation.d.ts.map +1 -0
- package/out/tools/cross/dataset-correlation.js +244 -0
- package/out/tools/cross/dataset-correlation.js.map +1 -0
- package/out/tools/cross/source-threshold-sweep.d.ts +60 -0
- package/out/tools/cross/source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/cross/source-threshold-sweep.js +264 -0
- package/out/tools/cross/source-threshold-sweep.js.map +1 -0
- package/out/tools/dedup-ceiling.d.ts +62 -0
- package/out/tools/dedup-ceiling.d.ts.map +1 -0
- package/out/tools/dedup-ceiling.js +171 -0
- package/out/tools/dedup-ceiling.js.map +1 -0
- package/out/tools/eval-geocoder.d.ts +68 -0
- package/out/tools/eval-geocoder.d.ts.map +1 -0
- package/out/tools/eval-geocoder.js +13 -0
- package/out/tools/eval-geocoder.js.map +1 -0
- package/out/tools/geocoder/namesake-probe.d.ts +33 -0
- package/out/tools/geocoder/namesake-probe.d.ts.map +1 -0
- package/out/tools/geocoder/namesake-probe.js +60 -0
- package/out/tools/geocoder/namesake-probe.js.map +1 -0
- package/out/tools/geocoder/vs-provided-coords.d.ts +53 -0
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +1 -0
- package/out/tools/geocoder/vs-provided-coords.js +161 -0
- package/out/tools/geocoder/vs-provided-coords.js.map +1 -0
- package/out/tools/gold-set-sample.d.ts +67 -0
- package/out/tools/gold-set-sample.d.ts.map +1 -0
- package/out/tools/gold-set-sample.js +81 -0
- package/out/tools/gold-set-sample.js.map +1 -0
- package/out/tools/learned/scorer/clustering-eval.d.ts +77 -0
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +1 -0
- package/out/tools/learned/scorer/clustering-eval.js +207 -0
- package/out/tools/learned/scorer/clustering-eval.js.map +1 -0
- package/out/tools/learned/scorer/crossstate-eval.d.ts +65 -0
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +1 -0
- package/out/tools/learned/scorer/crossstate-eval.js +168 -0
- package/out/tools/learned/scorer/crossstate-eval.js.map +1 -0
- package/out/tools/learned/scorer/eval.d.ts +64 -0
- package/out/tools/learned/scorer/eval.d.ts.map +1 -0
- package/out/tools/learned/scorer/eval.js +275 -0
- package/out/tools/learned/scorer/eval.js.map +1 -0
- package/out/tools/matcher-scale.d.ts +40 -0
- package/out/tools/matcher-scale.d.ts.map +1 -0
- package/out/tools/matcher-scale.js +111 -0
- package/out/tools/matcher-scale.js.map +1 -0
- package/out/tools/nppes/dedup-benchmark.d.ts +82 -0
- package/out/tools/nppes/dedup-benchmark.d.ts.map +1 -0
- package/out/tools/nppes/dedup-benchmark.js +226 -0
- package/out/tools/nppes/dedup-benchmark.js.map +1 -0
- package/out/tools/nppes/org-name.d.ts +15 -0
- package/out/tools/nppes/org-name.d.ts.map +1 -0
- package/out/tools/nppes/org-name.js +6 -0
- package/out/tools/nppes/org-name.js.map +1 -0
- package/out/tools/nppes/overmerge-packet.d.ts +43 -0
- package/out/tools/nppes/overmerge-packet.d.ts.map +1 -0
- package/out/tools/nppes/overmerge-packet.js +54 -0
- package/out/tools/nppes/overmerge-packet.js.map +1 -0
- package/out/tools/nppes/report.d.ts +97 -0
- package/out/tools/nppes/report.d.ts.map +1 -0
- package/out/tools/nppes/report.js +178 -0
- package/out/tools/nppes/report.js.map +1 -0
- package/out/tools/nppes/sample.d.ts +101 -0
- package/out/tools/nppes/sample.d.ts.map +1 -0
- package/out/tools/nppes/sample.js +127 -0
- package/out/tools/nppes/sample.js.map +1 -0
- package/out/tools/nppes/scoring.d.ts +37 -0
- package/out/tools/nppes/scoring.d.ts.map +1 -0
- package/out/tools/nppes/scoring.js +81 -0
- package/out/tools/nppes/scoring.js.map +1 -0
- package/out/tools/nppes/settings.d.ts +41 -0
- package/out/tools/nppes/settings.d.ts.map +1 -0
- package/out/tools/nppes/settings.js +79 -0
- package/out/tools/nppes/settings.js.map +1 -0
- package/out/tools/nppes/truth-grains.d.ts +63 -0
- package/out/tools/nppes/truth-grains.d.ts.map +1 -0
- package/out/tools/nppes/truth-grains.js +142 -0
- package/out/tools/nppes/truth-grains.js.map +1 -0
- package/out/tools/shared.d.ts +325 -0
- package/out/tools/shared.d.ts.map +1 -0
- package/out/tools/shared.js +453 -0
- package/out/tools/shared.js.map +1 -0
- package/out/tools/train/cross-gbt.d.ts +89 -0
- package/out/tools/train/cross-gbt.d.ts.map +1 -0
- package/out/tools/train/cross-gbt.js +132 -0
- package/out/tools/train/cross-gbt.js.map +1 -0
- package/out/tools/train/gbt.d.ts +85 -0
- package/out/tools/train/gbt.d.ts.map +1 -0
- package/out/tools/train/gbt.js +155 -0
- package/out/tools/train/gbt.js.map +1 -0
- package/out/tools/train/org-cross-gbt.d.ts +85 -0
- package/out/tools/train/org-cross-gbt.d.ts.map +1 -0
- package/out/tools/train/org-cross-gbt.js +122 -0
- package/out/tools/train/org-cross-gbt.js.map +1 -0
- package/out/tools/txhhsc-to-oarow.d.ts +42 -0
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -0
- package/out/tools/txhhsc-to-oarow.js +78 -0
- package/out/tools/txhhsc-to-oarow.js.map +1 -0
- package/out/tools/viz/browser.d.ts +31 -0
- package/out/tools/viz/browser.d.ts.map +1 -0
- package/out/tools/viz/browser.js +26 -0
- package/out/tools/viz/browser.js.map +1 -0
- package/out/tools/viz/cross-dataset-map.d.ts +39 -0
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -0
- package/out/tools/viz/cross-dataset-map.js +84 -0
- package/out/tools/viz/cross-dataset-map.js.map +1 -0
- package/out/tools/viz/geocode-first-surface.d.ts +36 -0
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -0
- package/out/tools/viz/geocode-first-surface.js +234 -0
- package/out/tools/viz/geocode-first-surface.js.map +1 -0
- package/out/tools/viz/render/map.d.ts +42 -0
- package/out/tools/viz/render/map.d.ts.map +1 -0
- package/out/tools/viz/render/map.js +40 -0
- package/out/tools/viz/render/map.js.map +1 -0
- package/out/tools/viz/render.d.ts +46 -0
- package/out/tools/viz/render.d.ts.map +1 -0
- package/out/tools/viz/render.js +49 -0
- package/out/tools/viz/render.js.map +1 -0
- package/out/tools/viz/source-provenance-map.d.ts +57 -0
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -0
- package/out/tools/viz/source-provenance-map.js +82 -0
- package/out/tools/viz/source-provenance-map.js.map +1 -0
- package/out/tools/viz/yardstick-figure.d.ts +22 -0
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -0
- package/out/tools/viz/yardstick-figure.js +106 -0
- package/out/tools/viz/yardstick-figure.js.map +1 -0
- package/out/types.d.ts +108 -0
- package/out/types.d.ts.map +1 -0
- package/out/types.js +11 -0
- package/out/types.js.map +1 -0
- package/package.json +113 -3
- package/tools/coverage-reconciliation.ts +192 -0
- package/tools/cross/dataset-correlation.ts +380 -0
- package/tools/cross/source-threshold-sweep.ts +416 -0
- package/tools/dedup-ceiling.ts +225 -0
- package/tools/eval-geocoder.ts +77 -0
- package/tools/geocoder/namesake-probe.ts +91 -0
- package/tools/geocoder/vs-provided-coords.ts +232 -0
- package/tools/gold-set-sample.ts +147 -0
- package/tools/learned/scorer/clustering-eval.ts +349 -0
- package/tools/learned/scorer/crossstate-eval.ts +280 -0
- package/tools/learned/scorer/eval.ts +429 -0
- package/tools/matcher-scale.ts +185 -0
- package/tools/nppes/dedup-benchmark.ts +364 -0
- package/tools/nppes/org-name.ts +15 -0
- package/tools/nppes/overmerge-packet.ts +98 -0
- package/tools/nppes/report.ts +380 -0
- package/tools/nppes/sample.ts +250 -0
- package/tools/nppes/scoring.ts +115 -0
- package/tools/nppes/settings.ts +102 -0
- package/tools/nppes/truth-grains.ts +185 -0
- package/tools/shared.ts +743 -0
- package/tools/train/cross-gbt.ts +214 -0
- package/tools/train/gbt.ts +261 -0
- package/tools/train/org-cross-gbt.ts +189 -0
- package/tools/txhhsc-to-oarow.ts +118 -0
- package/tools/viz/browser.ts +41 -0
- package/tools/viz/cross-dataset-map.ts +133 -0
- package/tools/viz/geocode-first-surface.ts +305 -0
- package/tools/viz/render/map.ts +61 -0
- package/tools/viz/render.ts +103 -0
- package/tools/viz/source-provenance-map.ts +154 -0
- package/tools/viz/yardstick-figure.ts +197 -0
package/lib/reconcile.ts
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { formatPersonName } from "@mailwoman/record/name"
|
|
2
|
+
import type { GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial"
|
|
3
|
+
|
|
4
|
+
import { toFeature } from "#geojson"
|
|
5
|
+
import type { EntityGeoData, ReconciliationBucket, ResolvedEntity } from "#types"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The source labels that mark eligibility and the labels that mark funding or enrollment.
|
|
9
|
+
*/
|
|
10
|
+
export interface ReconcileConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Source labels that denote membership in the eligibility set.
|
|
13
|
+
*/
|
|
14
|
+
eligibilitySources: readonly string[]
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Source labels that denote enrollment, funding or program participation.
|
|
18
|
+
*/
|
|
19
|
+
fundingSources: readonly string[]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* One entity with its reconciliation bucket.
|
|
24
|
+
*/
|
|
25
|
+
export interface ReconciledEntity {
|
|
26
|
+
entity: ResolvedEntity
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The distinct, sorted source labels across the entity's records.
|
|
30
|
+
*/
|
|
31
|
+
sources: string[]
|
|
32
|
+
bucket: ReconciliationBucket
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The entities that {@link reconcileCoverage} placed in a bucket, with a count per bucket.
|
|
37
|
+
*/
|
|
38
|
+
export interface ReconciliationResult {
|
|
39
|
+
/**
|
|
40
|
+
* The entities that have at least one eligibility or funding source.
|
|
41
|
+
*/
|
|
42
|
+
reconciled: ReconciledEntity[]
|
|
43
|
+
counts: Record<ReconciliationBucket, number>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Places an entity in a reconciliation bucket by whether its source labels include
|
|
48
|
+
* eligibility sources, funding sources, or both.
|
|
49
|
+
*
|
|
50
|
+
* @returns `null` when the entity has neither kind of source.
|
|
51
|
+
*/
|
|
52
|
+
export function bucketOf(sources: Iterable<string>, config: ReconcileConfig): ReconciliationBucket | null {
|
|
53
|
+
const elig = new Set(config.eligibilitySources)
|
|
54
|
+
const fund = new Set(config.fundingSources)
|
|
55
|
+
let hasEligibility = false
|
|
56
|
+
let hasFunding = false
|
|
57
|
+
|
|
58
|
+
for (const s of sources) {
|
|
59
|
+
if (elig.has(s)) {
|
|
60
|
+
hasEligibility = true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (fund.has(s)) {
|
|
64
|
+
hasFunding = true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (hasEligibility && hasFunding) return "enrolled"
|
|
69
|
+
|
|
70
|
+
if (hasEligibility) return "eligible-not-enrolled"
|
|
71
|
+
|
|
72
|
+
if (hasFunding) return "funded-not-eligible"
|
|
73
|
+
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Buckets resolved entities by their sources with {@link bucketOf}.
|
|
79
|
+
*
|
|
80
|
+
* Entities without an eligibility or funding source are dropped.
|
|
81
|
+
*/
|
|
82
|
+
export function reconcileCoverage(entities: readonly ResolvedEntity[], config: ReconcileConfig): ReconciliationResult {
|
|
83
|
+
const reconciled: ReconciledEntity[] = []
|
|
84
|
+
|
|
85
|
+
const counts: Record<ReconciliationBucket, number> = {
|
|
86
|
+
enrolled: 0,
|
|
87
|
+
"eligible-not-enrolled": 0,
|
|
88
|
+
"funded-not-eligible": 0,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for (const entity of entities) {
|
|
92
|
+
const sources = [...new Set(entity.records.map((r) => r.source).filter((s): s is string => !!s))].toSorted()
|
|
93
|
+
const bucket = bucketOf(sources, config)
|
|
94
|
+
|
|
95
|
+
if (!bucket) continue
|
|
96
|
+
|
|
97
|
+
reconciled.push({ entity, sources, bucket })
|
|
98
|
+
|
|
99
|
+
counts[bucket]++
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return { reconciled, counts }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Returns a display name for an entity's representative record.
|
|
107
|
+
*
|
|
108
|
+
* It prefers the organization's canonical name, then the person's name, then the record ID.
|
|
109
|
+
*/
|
|
110
|
+
export function repName(entity: ResolvedEntity): string {
|
|
111
|
+
const rep = entity.representative
|
|
112
|
+
const person = formatPersonName(rep.name ?? null, "short")
|
|
113
|
+
|
|
114
|
+
return rep.organization?.canonical ?? (person || rep.id)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Converts the reconciled entities that have coordinates to point features tagged with their bucket.
|
|
119
|
+
*/
|
|
120
|
+
export function reconciliationGeoJSON(result: ReconciliationResult): GeoFeatureCollection<PointLiteral, EntityGeoData> {
|
|
121
|
+
return {
|
|
122
|
+
type: "FeatureCollection",
|
|
123
|
+
features: result.reconciled
|
|
124
|
+
.filter((c) => c.entity.coordinate)
|
|
125
|
+
.map((c) => toFeature(c.entity, { bucket: c.bucket, name: repName(c.entity) })),
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Options for {@link reconciliationReport}.
|
|
131
|
+
*/
|
|
132
|
+
export interface ReconciliationReportOptions {
|
|
133
|
+
/**
|
|
134
|
+
* The report's level-one heading.
|
|
135
|
+
*
|
|
136
|
+
* @defaultValue `"Coverage reconciliation — eligibility ↔ enrollment"`
|
|
137
|
+
*/
|
|
138
|
+
title?: string
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* An italic paragraph under the title that describes the sources and their scope.
|
|
142
|
+
*/
|
|
143
|
+
scopeNote?: string
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A paragraph that explains the choice of match scorer.
|
|
147
|
+
*/
|
|
148
|
+
scorerNote?: string
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A sentence about sampling or capping that the report places before the closing caveat.
|
|
152
|
+
*/
|
|
153
|
+
sampleNote?: string
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The number of `eligible-not-enrolled` entities that the spot-check lists.
|
|
157
|
+
*
|
|
158
|
+
* @defaultValue `15`
|
|
159
|
+
*/
|
|
160
|
+
spotCheckLimit?: number
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Renders a Markdown reconciliation report with the bucket counts, the enrolled rate,
|
|
165
|
+
* a spot-check of `eligible-not-enrolled` entities and a fixed caveat.
|
|
166
|
+
*
|
|
167
|
+
* The report presents the enrolled rate as a floor because incomplete resolution can only miss links.
|
|
168
|
+
*/
|
|
169
|
+
export function reconciliationReport(result: ReconciliationResult, options: ReconciliationReportOptions = {}): string {
|
|
170
|
+
const { counts, reconciled } = result
|
|
171
|
+
const title = options.title ?? "Coverage reconciliation — eligibility ↔ enrollment"
|
|
172
|
+
const spotCheckLimit = options.spotCheckLimit ?? 15
|
|
173
|
+
const eligibleTotal = counts.enrolled + counts["eligible-not-enrolled"]
|
|
174
|
+
const enrolledRate = eligibleTotal > 0 ? (100 * counts.enrolled) / eligibleTotal : 0
|
|
175
|
+
|
|
176
|
+
const lines: string[] = [`# ${title}`, ""]
|
|
177
|
+
|
|
178
|
+
if (options.scopeNote) {
|
|
179
|
+
lines.push(`_${options.scopeNote}_`)
|
|
180
|
+
lines.push("")
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (options.scorerNote) {
|
|
184
|
+
lines.push(options.scorerNote)
|
|
185
|
+
lines.push("")
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
lines.push(`## The reconciliation`)
|
|
189
|
+
lines.push("")
|
|
190
|
+
lines.push(`| bucket | entities | meaning |`)
|
|
191
|
+
lines.push(`|---|---:|---|`)
|
|
192
|
+
lines.push(`| **enrolled** | ${counts.enrolled} | resolves to an eligibility record AND a funding record |`)
|
|
193
|
+
|
|
194
|
+
lines.push(
|
|
195
|
+
`| **eligible, not enrolled** | ${counts["eligible-not-enrolled"]} | eligibility record without a resolved funding record (the **anti-join**) |`
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
lines.push(
|
|
199
|
+
`| **funded, not in eligibility set** | ${counts["funded-not-eligible"]} | funding record without a resolved eligibility record |`
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
lines.push("")
|
|
203
|
+
|
|
204
|
+
lines.push(
|
|
205
|
+
`Of the ${eligibleTotal} entities with an eligibility record, ${enrolledRate.toFixed(1)}% also resolve to a ` +
|
|
206
|
+
`funding record — a **floor**, not a coverage rate (imperfect resolution + any sampling only ever miss ` +
|
|
207
|
+
`links, never invent them). The deliverable is the anti-join SET, not this percentage.`
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
lines.push("")
|
|
211
|
+
lines.push(`## Anti-join spot-check — first ${spotCheckLimit} "eligible, not enrolled"`)
|
|
212
|
+
lines.push("")
|
|
213
|
+
lines.push(`| entity | sources | name | coordinate |`)
|
|
214
|
+
lines.push(`|---|---|---|---|`)
|
|
215
|
+
|
|
216
|
+
for (const c of reconciled.filter((x) => x.bucket === "eligible-not-enrolled").slice(0, spotCheckLimit)) {
|
|
217
|
+
const coord = c.entity.coordinate
|
|
218
|
+
? `${c.entity.coordinate.latitude.toFixed(4)}, ${c.entity.coordinate.longitude.toFixed(4)}`
|
|
219
|
+
: "—"
|
|
220
|
+
|
|
221
|
+
lines.push(`| ${c.entity.id} | ${c.sources.join(", ")} | ${repName(c.entity)} | ${coord} |`)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
lines.push("")
|
|
225
|
+
lines.push(`## The caveat that matters`)
|
|
226
|
+
lines.push("")
|
|
227
|
+
const sample = options.sampleNote ? `${options.sampleNote} ` : ""
|
|
228
|
+
|
|
229
|
+
lines.push(
|
|
230
|
+
`${sample}This is a **set-membership reconciliation, not a determination**. A missing funding record can mean ` +
|
|
231
|
+
`the entity didn't apply, applied under a name we didn't resolve, is ineligible, or any number of things. We ` +
|
|
232
|
+
`produce the reconciled join and surface the candidate set; **what a gap means, and whether to act on it, is ` +
|
|
233
|
+
`entirely the data consumer's call.** Nothing here is an allegation.`
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
lines.push("")
|
|
237
|
+
|
|
238
|
+
return lines.join("\n")
|
|
239
|
+
}
|