@mailwoman/registry 9.0.0 → 9.2.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 +1 -1
- package/geojson.ts +3 -2
- package/ingest.ts +2 -1
- package/map-html.ts +4 -4
- package/out/geojson.d.ts.map +1 -1
- package/out/geojson.js +3 -2
- package/out/geojson.js.map +1 -1
- package/out/ingest.d.ts.map +1 -1
- package/out/ingest.js +2 -1
- package/out/ingest.js.map +1 -1
- package/out/map-html.d.ts +2 -2
- package/out/map-html.d.ts.map +1 -1
- package/out/map-html.js.map +1 -1
- package/out/reconcile.d.ts.map +1 -1
- package/out/reconcile.js +2 -1
- package/out/reconcile.js.map +1 -1
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +4 -1
- package/out/resolve.js.map +1 -1
- package/out/tools/coverage-reconciliation.js +2 -2
- 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 +6 -5
- package/out/tools/cross-dataset-correlation.js.map +1 -1
- package/out/tools/cross-source-threshold-sweep.js +2 -2
- 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 -3
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +1 -1
- package/out/tools/eval-geocoder.d.ts.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -1
- package/out/tools/geocoder-vs-provided-coords.js +3 -2
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -1
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +4 -3
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +1 -6
- package/out/tools/index.d.ts.map +1 -1
- package/out/tools/index.js +1 -6
- package/out/tools/index.js.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -1
- package/out/tools/learned-scorer-clustering-eval.js +1 -2
- 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 +1 -1
- 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 +1 -6
- 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 +1 -1
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes/levers.d.ts +38 -0
- package/out/tools/nppes/levers.d.ts.map +1 -0
- package/out/tools/nppes/levers.js +79 -0
- package/out/tools/nppes/levers.js.map +1 -0
- package/out/tools/nppes/org-name.d.ts +24 -0
- package/out/tools/nppes/org-name.d.ts.map +1 -0
- package/out/tools/nppes/org-name.js +42 -0
- package/out/tools/nppes/org-name.js.map +1 -0
- package/out/tools/nppes/overmerge-packet.d.ts +39 -0
- package/out/tools/nppes/overmerge-packet.d.ts.map +1 -0
- package/out/tools/nppes/overmerge-packet.js +55 -0
- package/out/tools/nppes/overmerge-packet.js.map +1 -0
- package/out/tools/nppes/report.d.ts +93 -0
- package/out/tools/nppes/report.d.ts.map +1 -0
- package/out/tools/nppes/report.js +188 -0
- package/out/tools/nppes/report.js.map +1 -0
- package/out/tools/nppes/sample.d.ts +64 -0
- package/out/tools/nppes/sample.d.ts.map +1 -0
- package/out/tools/nppes/sample.js +113 -0
- package/out/tools/nppes/sample.js.map +1 -0
- package/out/tools/nppes/scoring.d.ts +36 -0
- package/out/tools/nppes/scoring.d.ts.map +1 -0
- package/out/tools/nppes/scoring.js +80 -0
- package/out/tools/nppes/scoring.js.map +1 -0
- package/out/tools/nppes/truth-grains.d.ts +50 -0
- package/out/tools/nppes/truth-grains.d.ts.map +1 -0
- package/out/tools/nppes/truth-grains.js +148 -0
- package/out/tools/nppes/truth-grains.js.map +1 -0
- package/out/tools/nppes-dedup-benchmark.d.ts +4 -0
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -1
- package/out/tools/nppes-dedup-benchmark.js +79 -652
- package/out/tools/nppes-dedup-benchmark.js.map +1 -1
- package/out/tools/shared.d.ts.map +1 -1
- package/out/tools/shared.js +5 -4
- package/out/tools/shared.js.map +1 -1
- package/out/tools/train-cross-gbt.d.ts.map +1 -1
- package/out/tools/train-cross-gbt.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/out/tools/train-org-cross-gbt.js.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +2 -2
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +2 -23
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +7 -28
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +2 -32
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +4 -33
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render.js +1 -1
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +2 -22
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +7 -26
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/types.d.ts +11 -1
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/package.json +78 -9
- package/reconcile.ts +2 -1
- package/resolve.ts +6 -1
- package/tools/coverage-reconciliation.ts +3 -3
- package/tools/cross-dataset-correlation.ts +7 -5
- package/tools/cross-source-threshold-sweep.ts +3 -3
- package/tools/dedup-ceiling.ts +3 -3
- package/tools/eval-geocoder.ts +1 -1
- package/tools/geocoder-vs-provided-coords.ts +4 -2
- package/tools/gold-set-sample.ts +5 -3
- package/tools/index.ts +1 -6
- package/tools/learned-scorer-clustering-eval.ts +4 -4
- package/tools/learned-scorer-crossstate-eval.ts +4 -4
- package/tools/learned-scorer-eval.ts +4 -9
- package/tools/matcher-scale.ts +2 -1
- package/tools/nppes/levers.ts +102 -0
- package/tools/nppes/org-name.ts +56 -0
- package/tools/nppes/overmerge-packet.ts +96 -0
- package/tools/nppes/report.ts +376 -0
- package/tools/nppes/sample.ts +197 -0
- package/tools/nppes/scoring.ts +114 -0
- package/tools/nppes/truth-grains.ts +201 -0
- package/tools/nppes-dedup-benchmark.ts +92 -868
- package/tools/shared.ts +6 -4
- package/tools/train-cross-gbt.ts +6 -5
- package/tools/train-gbt.ts +5 -4
- package/tools/train-org-cross-gbt.ts +6 -5
- package/tools/txhhsc-to-oarow.ts +2 -2
- package/tools/viz/cross-dataset-map.ts +12 -34
- package/tools/viz/geocode-first-surface.ts +5 -33
- package/tools/viz/render.ts +1 -1
- package/tools/viz/source-provenance-map.ts +14 -31
- package/types.ts +10 -1
|
@@ -3,38 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* What a reader should walk away with: **geography is the primary key; string similarity only
|
|
9
|
-
* refines within a place.** The figure makes that legible as a _landscape_. Two surfaces of
|
|
10
|
-
* P(match) over the same record-pair space (string similarity × geographic distance), scored by
|
|
11
|
-
* the SAME Fellegi-Sunter machinery, differing only in which evidence each model is allowed to
|
|
12
|
-
* see:
|
|
13
|
-
*
|
|
14
|
-
* - **String-first** sees the name agreement only → its decision boundary is _vertical_: high string
|
|
15
|
-
* similarity ⇒ match, at any distance. It fuses `Springfield General (IL)` with `Springfield
|
|
16
|
-
* General (MA)` (identical name, ~1500 km apart) and still misses `123 Main St` ↔ `123 Main
|
|
17
|
-
* Street Apt 2` when the strings drift.
|
|
18
|
-
* - **Geocode-first** also sees the distance agreement → its boundary _bends with geography_: near
|
|
19
|
-
* the same coordinate a modest name match suffices; far apart, even an exact name is
|
|
20
|
-
* rejected. It gets both traps right.
|
|
21
|
-
*
|
|
22
|
-
* Honesty notes (so the figure can't mislead):
|
|
23
|
-
*
|
|
24
|
-
* - The per-level weights are the REAL Bayes factors from the codebase — `NAME_LEVELS`
|
|
25
|
-
* (`registry/resolve.ts`) and `DEFAULT_DISTANCE_LEVELS` (`match/distance.ts`). Geography
|
|
26
|
-
* simply carries the heaviest evidence: ±9.45 bits at the same-building grain vs ±6.32 for an
|
|
27
|
-
* exact name.
|
|
28
|
-
* - The PRIOR is illustrative (λ shown in the caption), not production's λ=1e-4. Production is even
|
|
29
|
-
* more conservative and leans on additional corroboration (phone, the spatial exact-key) that
|
|
30
|
-
* this two-axis slice deliberately omits — the point here is the _shape of the boundary_, not
|
|
31
|
-
* a reproduction of a production score. The caption says so.
|
|
32
|
-
*
|
|
33
|
-
* Emits a self-contained Plotly HTML (twin 3D landscapes + an annotated 2D contour). Render to PNG
|
|
34
|
-
* with `renderPlotlyHTMLToPNG` (`./render.ts` — Playwright + swiftshader for headless WebGL).
|
|
35
|
-
*
|
|
36
|
-
* Run: `mailwoman registry viz geocode-first-surface [--lambda 0.02]
|
|
37
|
-
* [--out-html /tmp/geocode-first-surface.html]`
|
|
6
|
+
* Plot string-only and string-plus-distance match probabilities using the record matcher's
|
|
7
|
+
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained HTML.
|
|
38
8
|
*/
|
|
39
9
|
/**
|
|
40
10
|
* Options for {@linkcode geocodeFirstSurface}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.d.ts","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAuDD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,GAAE,0BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CA2MrB"}
|
|
@@ -3,40 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* What a reader should walk away with: **geography is the primary key; string similarity only
|
|
9
|
-
* refines within a place.** The figure makes that legible as a _landscape_. Two surfaces of
|
|
10
|
-
* P(match) over the same record-pair space (string similarity × geographic distance), scored by
|
|
11
|
-
* the SAME Fellegi-Sunter machinery, differing only in which evidence each model is allowed to
|
|
12
|
-
* see:
|
|
13
|
-
*
|
|
14
|
-
* - **String-first** sees the name agreement only → its decision boundary is _vertical_: high string
|
|
15
|
-
* similarity ⇒ match, at any distance. It fuses `Springfield General (IL)` with `Springfield
|
|
16
|
-
* General (MA)` (identical name, ~1500 km apart) and still misses `123 Main St` ↔ `123 Main
|
|
17
|
-
* Street Apt 2` when the strings drift.
|
|
18
|
-
* - **Geocode-first** also sees the distance agreement → its boundary _bends with geography_: near
|
|
19
|
-
* the same coordinate a modest name match suffices; far apart, even an exact name is
|
|
20
|
-
* rejected. It gets both traps right.
|
|
21
|
-
*
|
|
22
|
-
* Honesty notes (so the figure can't mislead):
|
|
23
|
-
*
|
|
24
|
-
* - The per-level weights are the REAL Bayes factors from the codebase — `NAME_LEVELS`
|
|
25
|
-
* (`registry/resolve.ts`) and `DEFAULT_DISTANCE_LEVELS` (`match/distance.ts`). Geography
|
|
26
|
-
* simply carries the heaviest evidence: ±9.45 bits at the same-building grain vs ±6.32 for an
|
|
27
|
-
* exact name.
|
|
28
|
-
* - The PRIOR is illustrative (λ shown in the caption), not production's λ=1e-4. Production is even
|
|
29
|
-
* more conservative and leans on additional corroboration (phone, the spatial exact-key) that
|
|
30
|
-
* this two-axis slice deliberately omits — the point here is the _shape of the boundary_, not
|
|
31
|
-
* a reproduction of a production score. The caption says so.
|
|
32
|
-
*
|
|
33
|
-
* Emits a self-contained Plotly HTML (twin 3D landscapes + an annotated 2D contour). Render to PNG
|
|
34
|
-
* with `renderPlotlyHTMLToPNG` (`./render.ts` — Playwright + swiftshader for headless WebGL).
|
|
35
|
-
*
|
|
36
|
-
* Run: `mailwoman registry viz geocode-first-surface [--lambda 0.02]
|
|
37
|
-
* [--out-html /tmp/geocode-first-surface.html]`
|
|
6
|
+
* Plot string-only and string-plus-distance match probabilities using the record matcher's
|
|
7
|
+
* Fellegi-Sunter weights. The supplied prior is illustrative and the output is self-contained HTML.
|
|
38
8
|
*/
|
|
39
9
|
import { writeFileSync } from "node:fs";
|
|
10
|
+
import { tempRootPath } from "@mailwoman/core/utils";
|
|
40
11
|
/**
|
|
41
12
|
* Registry/resolve.ts → NAME_LEVELS.
|
|
42
13
|
*/
|
|
@@ -81,7 +52,7 @@ function distanceWeight(km) {
|
|
|
81
52
|
*/
|
|
82
53
|
export function geocodeFirstSurface(options = {}, report) {
|
|
83
54
|
const LAMBDA = options.lambda ?? 0.02;
|
|
84
|
-
const OUT_HTML = options.outHTML || "
|
|
55
|
+
const OUT_HTML = options.outHTML || tempRootPath("geocode-first-surface.html");
|
|
85
56
|
const PRIOR = priorWeight(LAMBDA);
|
|
86
57
|
/**
|
|
87
58
|
* String-first model: name evidence only — distance is invisible to it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"geocode-first-surface.js","sourceRoot":"","sources":["../../../tools/viz/geocode-first-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AA4BpD;;GAEG;AACH,MAAM,WAAW,GAAY;IAC5B,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACrD,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;IACxD,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;CAC1D,CAAA;AAED;;GAEG;AACH,MAAM,eAAe,GAAY;IAChC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE;IACzD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;IACpD,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE;IACjD,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;CACnC,CAAA;AAED,8EAA8E;AAC9E,MAAM,WAAW,GAAG,CAAC,GAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,I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AI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4ED,CAAA;IAEd,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC7B,MAAM,EAAE,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;IACjC,MAAM,EAAE,CAAC,KAAK,MAAM,WAAW,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAEvD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,EAAE,CACP,KAAK,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CACxJ,CAAA;IACF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC7B,CAAC"}
|
package/out/tools/viz/render.js
CHANGED
|
@@ -38,7 +38,7 @@ export async function renderPlotlyHTMLToPNG(options, report) {
|
|
|
38
38
|
// Resolve once every Plotly graph div has fired plotly_afterplot (3D paints land async, after
|
|
39
39
|
// newPlot's promise resolves), with a per-div fallback so an already-painted div can't hang us.
|
|
40
40
|
await page.evaluate(async () => {
|
|
41
|
-
const doc = globalThis
|
|
41
|
+
const doc = Reflect.get(globalThis, "document");
|
|
42
42
|
const divs = [...doc.querySelectorAll("div")]
|
|
43
43
|
.map((d) => d)
|
|
44
44
|
.filter((d) => d._fullLayout && typeof d.on === "function");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../tools/viz/render.ts"],"names":[],"mappings":"AAAA;;;;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MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACpC,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;QACnB,CAAC;IACF,CAAC;IAED,MAAM,EAAE,CAAC,YAAY,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -3,28 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Every coordinate Mailwoman resolves to comes from an open dataset, and we keep the provenance on
|
|
9
|
-
* the point. This samples the per-state address-point DB (`address_point.source`) and renders it
|
|
10
|
-
* on the house MapLibre + Protomaps stack via {@link toMapHTML}, each dot COLORED BY its upstream
|
|
11
|
-
* open-data source — the National Address Database (a federal release) vs OpenAddresses (county /
|
|
12
|
-
* municipal open-data publishers). New York is the clean example: NAD blankets the state, and New
|
|
13
|
-
* York City arrives separately from NYC Open Data, so the source split is visible as a
|
|
14
|
-
* geography.
|
|
15
|
-
*
|
|
16
|
-
* No competitor in this space will tell you which open dataset a given coordinate came from — for
|
|
17
|
-
* them the assembled pipeline is the moat. Here the provenance is the point of the map.
|
|
18
|
-
*
|
|
19
|
-
* Streets without a rooftop point are covered by TIGER interpolation (`tiger:edges`), a separate
|
|
20
|
-
* layer not plotted here; this map is the rooftop-point sources only.
|
|
21
|
-
*
|
|
22
|
-
* SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
|
|
23
|
-
* domains). e.g. `python3 -m http.server -d <dir>`, or `renderServedMapToPNG` (`./render-map.ts`)
|
|
24
|
-
* against the served URL.
|
|
25
|
-
*
|
|
26
|
-
* Run: `mailwoman registry viz source-provenance-map [--state ny] [--db <address-points-us-XX.db>]
|
|
27
|
-
* [--out-html /tmp/source-provenance.html] [--nad-mod 700] [--oa-mod 120] [--cap 7000]`
|
|
6
|
+
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
+
* The output requires an HTTP origin because the tile server does not serve `file:` origins.
|
|
28
8
|
*/
|
|
29
9
|
/**
|
|
30
10
|
* Options for {@linkcode sourceProvenanceMap}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source-provenance-map.d.ts","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAuBD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,GAAE,0BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiErC"}
|
|
@@ -3,33 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Every coordinate Mailwoman resolves to comes from an open dataset, and we keep the provenance on
|
|
9
|
-
* the point. This samples the per-state address-point DB (`address_point.source`) and renders it
|
|
10
|
-
* on the house MapLibre + Protomaps stack via {@link toMapHTML}, each dot COLORED BY its upstream
|
|
11
|
-
* open-data source — the National Address Database (a federal release) vs OpenAddresses (county /
|
|
12
|
-
* municipal open-data publishers). New York is the clean example: NAD blankets the state, and New
|
|
13
|
-
* York City arrives separately from NYC Open Data, so the source split is visible as a
|
|
14
|
-
* geography.
|
|
15
|
-
*
|
|
16
|
-
* No competitor in this space will tell you which open dataset a given coordinate came from — for
|
|
17
|
-
* them the assembled pipeline is the moat. Here the provenance is the point of the map.
|
|
18
|
-
*
|
|
19
|
-
* Streets without a rooftop point are covered by TIGER interpolation (`tiger:edges`), a separate
|
|
20
|
-
* layer not plotted here; this map is the rooftop-point sources only.
|
|
21
|
-
*
|
|
22
|
-
* SERVE THE OUTPUT OVER LOCALHOST (the house tile server CORS-restricts to localhost + the docs
|
|
23
|
-
* domains). e.g. `python3 -m http.server -d <dir>`, or `renderServedMapToPNG` (`./render-map.ts`)
|
|
24
|
-
* against the served URL.
|
|
25
|
-
*
|
|
26
|
-
* Run: `mailwoman registry viz source-provenance-map [--state ny] [--db <address-points-us-XX.db>]
|
|
27
|
-
* [--out-html /tmp/source-provenance.html] [--nad-mod 700] [--oa-mod 120] [--cap 7000]`
|
|
6
|
+
* Sample `address_point.source` rows from a state database and render them by source in MapLibre.
|
|
7
|
+
* The output requires an HTTP origin because the tile server does not serve `file:` origins.
|
|
28
8
|
*/
|
|
29
9
|
import { writeFileSync } from "node:fs";
|
|
30
10
|
import { DatabaseSync } from "node:sqlite";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
11
|
+
import { isPresent } from "@mailwoman/core/objects";
|
|
12
|
+
import { dataRootPath, tempRootPath } from "@mailwoman/core/utils";
|
|
13
|
+
import { toMapHTML } from "#index";
|
|
33
14
|
// Collapse the raw `source` string into a human, mappable category. The address-point DB stores e.g.
|
|
34
15
|
// "overture:NAD" or "overture:OpenAddresses/NY/NYC Open Data" — the suffix is the real upstream
|
|
35
16
|
// publisher, which is what we want to color by (the "overture:" prefix is just the theme it arrived in).
|
|
@@ -48,7 +29,7 @@ function categorize(source) {
|
|
|
48
29
|
export function sourceProvenanceMap(options = {}, report) {
|
|
49
30
|
const STATE = (options.state || "ny").toLowerCase();
|
|
50
31
|
const DB = options.db || String(dataRootPath("address-points", `address-points-us-${STATE}.db`));
|
|
51
|
-
const OUT = options.outHTML || "
|
|
32
|
+
const OUT = options.outHTML || tempRootPath("source-provenance.html");
|
|
52
33
|
const NAD_MOD = options.nadMod ?? 700; // keep ~1/700 of NAD points
|
|
53
34
|
const OA_MOD = options.oaMod ?? 120; // keep ~1/120 of OpenAddresses points
|
|
54
35
|
const CAP = options.cap ?? 7000; // per-source marker cap
|
|
@@ -69,7 +50,7 @@ export function sourceProvenanceMap(options = {}, report) {
|
|
|
69
50
|
const features = rows.map((r) => {
|
|
70
51
|
const { bucket, publisher } = categorize(r.source);
|
|
71
52
|
counts.set(bucket, (counts.get(bucket) ?? 0) + 1);
|
|
72
|
-
const addr = [r.number, r.street_raw].filter(
|
|
53
|
+
const addr = [r.number, r.street_raw].filter(isPresent).join(" ").trim();
|
|
73
54
|
return {
|
|
74
55
|
type: "Feature",
|
|
75
56
|
geometry: { type: "Point", coordinates: [r.lon, r.lat] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source-provenance-map.js","sourceRoot":"","sources":["../../../tools/viz/source-provenance-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB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vB,OAAO,EAAE,IAAI,IAAI,IAAI;aACrB;SACD,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,GAAuD,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAA;IAE3G,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE;QAC/B,KAAK,EAAE,8BAA8B,KAAK,CAAC,WAAW,EAAE,+CAA+C;QACvG,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,QAAQ;KACjB,CAAC,CAAA;IAEF,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACxB,MAAM,EAAE,CAAC,aAAa,GAAG,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,CAAA;IAEzD,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAA;AACjD,CAAC"}
|
package/out/types.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface ResolvedEntity {
|
|
|
79
79
|
export type ReconciliationBucket = "enrolled" | "eligible-not-enrolled" | "funded-not-eligible";
|
|
80
80
|
export interface EntityGeoData {
|
|
81
81
|
entityID: string;
|
|
82
|
-
|
|
82
|
+
sourceIDs?: string[];
|
|
83
83
|
recordCount?: number;
|
|
84
84
|
cohesion?: number | null;
|
|
85
85
|
sources: string[];
|
|
@@ -89,4 +89,14 @@ export interface EntityGeoData {
|
|
|
89
89
|
geocodeTier?: ResolutionTier | null;
|
|
90
90
|
bucket?: ReconciliationBucket;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Feature properties the map renderer consumes — {@link EntityGeoData} with every field optional, plus an unconstrained
|
|
94
|
+
* `bucket`. The renderer assigns a color per DISTINCT bucket value in first-seen order and builds its legend from that
|
|
95
|
+
* set, so a bucket is any categorical label, not only a {@link ReconciliationBucket}; and a collection assembled from
|
|
96
|
+
* something other than resolved entities (raw address points, links read back from a file) carries no entity id or
|
|
97
|
+
* display name.
|
|
98
|
+
*/
|
|
99
|
+
export type MapFeatureData = Partial<Omit<EntityGeoData, "bucket">> & {
|
|
100
|
+
bucket?: string;
|
|
101
|
+
};
|
|
92
102
|
//# sourceMappingURL=types.d.ts.map
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEpG;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC;;OAE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C5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,WAAW,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACnC,MAAM,CAAC,EAAE,oBAAoB,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/out/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAgGH,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/registry",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.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": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/sister-software/mailwoman.git",
|
|
9
|
-
"directory": "registry"
|
|
9
|
+
"directory": "packages/registry"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"out/**/*.js",
|
|
@@ -20,9 +20,20 @@
|
|
|
20
20
|
"!*.test.ts",
|
|
21
21
|
"!*.test.tsx",
|
|
22
22
|
"!**/*.test.ts",
|
|
23
|
-
"!**/*.test.tsx"
|
|
23
|
+
"!**/*.test.tsx",
|
|
24
|
+
"!test/**"
|
|
24
25
|
],
|
|
25
26
|
"type": "module",
|
|
27
|
+
"imports": {
|
|
28
|
+
"#index": {
|
|
29
|
+
"types": "./out/index.d.ts",
|
|
30
|
+
"default": "./out/index.js"
|
|
31
|
+
},
|
|
32
|
+
"#tools/nppes/*": {
|
|
33
|
+
"types": "./out/tools/nppes/*.d.ts",
|
|
34
|
+
"default": "./out/tools/nppes/*.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
26
37
|
"exports": {
|
|
27
38
|
"./package.json": "./package.json",
|
|
28
39
|
".": {
|
|
@@ -44,6 +55,30 @@
|
|
|
44
55
|
"./tools": {
|
|
45
56
|
"types": "./out/tools/index.d.ts",
|
|
46
57
|
"default": "./out/tools/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./address-key": {
|
|
60
|
+
"types": "./out/address-key.d.ts",
|
|
61
|
+
"default": "./out/address-key.js"
|
|
62
|
+
},
|
|
63
|
+
"./types": {
|
|
64
|
+
"types": "./out/types.d.ts",
|
|
65
|
+
"default": "./out/types.js"
|
|
66
|
+
},
|
|
67
|
+
"./geocode-handler": {
|
|
68
|
+
"types": "./out/geocode-handler.d.ts",
|
|
69
|
+
"default": "./out/geocode-handler.js"
|
|
70
|
+
},
|
|
71
|
+
"./learned-scorer": {
|
|
72
|
+
"types": "./out/learned-scorer.d.ts",
|
|
73
|
+
"default": "./out/learned-scorer.js"
|
|
74
|
+
},
|
|
75
|
+
"./map-html": {
|
|
76
|
+
"types": "./out/map-html.d.ts",
|
|
77
|
+
"default": "./out/map-html.js"
|
|
78
|
+
},
|
|
79
|
+
"./reconcile": {
|
|
80
|
+
"types": "./out/reconcile.d.ts",
|
|
81
|
+
"default": "./out/reconcile.js"
|
|
47
82
|
}
|
|
48
83
|
},
|
|
49
84
|
"publishConfig": {
|
|
@@ -69,18 +104,52 @@
|
|
|
69
104
|
"./tools": {
|
|
70
105
|
"types": "./out/tools/index.d.ts",
|
|
71
106
|
"default": "./out/tools/index.js"
|
|
107
|
+
},
|
|
108
|
+
"./address-key": {
|
|
109
|
+
"types": "./out/address-key.d.ts",
|
|
110
|
+
"default": "./out/address-key.js"
|
|
111
|
+
},
|
|
112
|
+
"./types": {
|
|
113
|
+
"types": "./out/types.d.ts",
|
|
114
|
+
"default": "./out/types.js"
|
|
115
|
+
},
|
|
116
|
+
"./geocode-handler": {
|
|
117
|
+
"types": "./out/geocode-handler.d.ts",
|
|
118
|
+
"default": "./out/geocode-handler.js"
|
|
119
|
+
},
|
|
120
|
+
"./learned-scorer": {
|
|
121
|
+
"types": "./out/learned-scorer.d.ts",
|
|
122
|
+
"default": "./out/learned-scorer.js"
|
|
123
|
+
},
|
|
124
|
+
"./map-html": {
|
|
125
|
+
"types": "./out/map-html.d.ts",
|
|
126
|
+
"default": "./out/map-html.js"
|
|
127
|
+
},
|
|
128
|
+
"./reconcile": {
|
|
129
|
+
"types": "./out/reconcile.d.ts",
|
|
130
|
+
"default": "./out/reconcile.js"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"imports": {
|
|
134
|
+
"#index": {
|
|
135
|
+
"types": "./out/index.d.ts",
|
|
136
|
+
"default": "./out/index.js"
|
|
137
|
+
},
|
|
138
|
+
"#tools/nppes/*": {
|
|
139
|
+
"types": "./out/tools/nppes/*.d.ts",
|
|
140
|
+
"default": "./out/tools/nppes/*.js"
|
|
72
141
|
}
|
|
73
142
|
}
|
|
74
143
|
},
|
|
75
144
|
"dependencies": {
|
|
76
|
-
"@mailwoman/address-id": "9.
|
|
77
|
-
"@mailwoman/core": "9.
|
|
78
|
-
"@mailwoman/match": "9.
|
|
79
|
-
"@mailwoman/record": "9.
|
|
80
|
-
"@mailwoman/spatial": "9.
|
|
145
|
+
"@mailwoman/address-id": "9.2.0",
|
|
146
|
+
"@mailwoman/core": "9.2.0",
|
|
147
|
+
"@mailwoman/match": "9.2.0",
|
|
148
|
+
"@mailwoman/record": "9.2.0",
|
|
149
|
+
"@mailwoman/spatial": "9.2.0",
|
|
81
150
|
"@protomaps/basemaps": "^5.7.2",
|
|
82
151
|
"h3-js": "^4.5.0",
|
|
83
|
-
"spliterator": "^6.0
|
|
152
|
+
"spliterator": "^6.2.0"
|
|
84
153
|
},
|
|
85
154
|
"devDependencies": {
|
|
86
155
|
"@types/node": ">=26.1.2",
|
package/reconcile.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* which the map auto-detects and colors categorically.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
import { isPresent } from "@mailwoman/core/objects"
|
|
30
31
|
import type { GeoFeature, GeoFeatureCollection, PointLiteral } from "@mailwoman/spatial"
|
|
31
32
|
|
|
32
33
|
import type { EntityGeoData, ReconciliationBucket, ResolvedEntity } from "./types.ts"
|
|
@@ -127,7 +128,7 @@ export function reconcileCoverage(entities: readonly ResolvedEntity[], config: R
|
|
|
127
128
|
*/
|
|
128
129
|
function repName(entity: ResolvedEntity): string {
|
|
129
130
|
const rep = entity.representative
|
|
130
|
-
const person = [rep.name?.given, rep.name?.family].filter(
|
|
131
|
+
const person = [rep.name?.given, rep.name?.family].filter(isPresent).join(" ")
|
|
131
132
|
|
|
132
133
|
return rep.organization?.canonical ?? (person || rep.id)
|
|
133
134
|
}
|
package/resolve.ts
CHANGED
|
@@ -91,7 +91,12 @@ const CODE_SET_LEVELS: ComparisonLevel[] = [
|
|
|
91
91
|
* 1 when the whitespace-joined code sets share ANY code, else 0 (order/count-insensitive, case-folded).
|
|
92
92
|
*/
|
|
93
93
|
function codeSetOverlap(a: string, b: string): number {
|
|
94
|
-
const sa = new Set(
|
|
94
|
+
const sa = new Set(
|
|
95
|
+
a
|
|
96
|
+
.toUpperCase()
|
|
97
|
+
.split(/\s+/)
|
|
98
|
+
.filter((value) => value.length > 0)
|
|
99
|
+
)
|
|
95
100
|
|
|
96
101
|
for (const t of b.toUpperCase().split(/\s+/)) if (t && sa.has(t)) return 1
|
|
97
102
|
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
import { writeFileSync } from "node:fs"
|
|
33
33
|
|
|
34
34
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
35
|
+
|
|
35
36
|
import {
|
|
36
37
|
ingestRows,
|
|
37
38
|
reconcileCoverage,
|
|
@@ -39,14 +40,13 @@ import {
|
|
|
39
40
|
reconciliationReport,
|
|
40
41
|
resolveEntities,
|
|
41
42
|
streamRows,
|
|
42
|
-
type ColumnMapping,
|
|
43
43
|
type GeocodeAddress,
|
|
44
44
|
type ReconcileConfig,
|
|
45
45
|
type SourceRecord,
|
|
46
|
-
} from "
|
|
46
|
+
} from "#index"
|
|
47
47
|
|
|
48
48
|
import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
|
|
49
|
-
import { buildSpecs
|
|
49
|
+
import { buildSpecs } from "./shared.ts"
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Options for {@linkcode coverageReconciliation}.
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
import { writeFileSync } from "node:fs"
|
|
23
23
|
|
|
24
|
+
import { isPresent } from "@mailwoman/core/objects"
|
|
24
25
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
26
|
+
|
|
25
27
|
import {
|
|
26
28
|
addressFrequencyKey,
|
|
27
29
|
ingestRows,
|
|
@@ -32,7 +34,7 @@ import {
|
|
|
32
34
|
type GeocodeAddress,
|
|
33
35
|
type ResolvedEntity,
|
|
34
36
|
type SourceRecord,
|
|
35
|
-
} from "
|
|
37
|
+
} from "#index"
|
|
36
38
|
|
|
37
39
|
import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
|
|
38
40
|
import { norm } from "./shared.ts"
|
|
@@ -90,7 +92,7 @@ function composeAddress(row: Record<string, string>, columns: string | string[]
|
|
|
90
92
|
|
|
91
93
|
return list
|
|
92
94
|
.map((c) => norm(row[c]))
|
|
93
|
-
.filter(
|
|
95
|
+
.filter(isPresent)
|
|
94
96
|
.join(" ")
|
|
95
97
|
.trim()
|
|
96
98
|
}
|
|
@@ -152,7 +154,7 @@ const buildSpecs = (S: string, STATE: string): SourceSpec[] => [
|
|
|
152
154
|
"Provider First Line Business Practice Location Address",
|
|
153
155
|
"Provider Business Practice Location Address City Name",
|
|
154
156
|
"Provider Business Practice Location Address State Name",
|
|
155
|
-
"Provider Business Practice Location Address
|
|
157
|
+
"Provider Business Practice Location Address Postcode",
|
|
156
158
|
],
|
|
157
159
|
phone: "Provider Business Practice Location Address Telephone Number",
|
|
158
160
|
source: "nppes",
|
|
@@ -360,7 +362,7 @@ export async function crossDatasetCorrelation(
|
|
|
360
362
|
|
|
361
363
|
const repName = (e: ResolvedEntity) =>
|
|
362
364
|
e.representative.organization?.canonical ??
|
|
363
|
-
[e.representative.name?.given, e.representative.name?.family].filter(
|
|
365
|
+
[e.representative.name?.given, e.representative.name?.family].filter(isPresent).join(" ") ??
|
|
364
366
|
e.representative.id
|
|
365
367
|
|
|
366
368
|
// --- Report. ---
|
|
@@ -481,7 +483,7 @@ export async function crossDatasetCorrelation(
|
|
|
481
483
|
}
|
|
482
484
|
|
|
483
485
|
// --- The reconciliation artifact: a GeoJSON FeatureCollection of every resolved entity. Each feature
|
|
484
|
-
// carries `sources` + `
|
|
486
|
+
// carries `sources` + `sourceIDs` (so an analyst filters the cross-dataset links by `sources` length ≥ 2)
|
|
485
487
|
// and the geocode tier. QGIS-ready; this is the operator-verifiable output of the matcher. ---
|
|
486
488
|
if (OUT_GEOJSON) {
|
|
487
489
|
const fc = toGeoJSON(entities)
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
import { writeFileSync } from "node:fs"
|
|
31
31
|
|
|
32
32
|
import { dataRootPath, formatPercent } from "@mailwoman/core/utils"
|
|
33
|
+
|
|
33
34
|
import {
|
|
34
35
|
addressFrequencyKey,
|
|
35
36
|
buildDefaultModel,
|
|
@@ -39,14 +40,13 @@ import {
|
|
|
39
40
|
ingestRows,
|
|
40
41
|
resolveEntities,
|
|
41
42
|
streamRows,
|
|
42
|
-
type ColumnMapping,
|
|
43
43
|
type GeocodeAddress,
|
|
44
44
|
type ResolvedEntity,
|
|
45
45
|
type SourceRecord,
|
|
46
|
-
} from "
|
|
46
|
+
} from "#index"
|
|
47
47
|
|
|
48
48
|
import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
|
|
49
|
-
import { buildSpecs
|
|
49
|
+
import { buildSpecs } from "./shared.ts"
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Independent sources that must agree before a cluster counts as cross-source corroborated.
|
package/tools/dedup-ceiling.ts
CHANGED
|
@@ -34,7 +34,8 @@ import { writeFileSync } from "node:fs"
|
|
|
34
34
|
|
|
35
35
|
import { dataRootPath, formatPercent } from "@mailwoman/core/utils"
|
|
36
36
|
import { jaccard } from "@mailwoman/match"
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
import { addressFrequencyKey, streamRows } from "#index"
|
|
38
39
|
|
|
39
40
|
import { norm } from "./shared.ts"
|
|
40
41
|
|
|
@@ -152,7 +153,7 @@ export async function dedupCeiling(
|
|
|
152
153
|
if (!org) continue
|
|
153
154
|
const line1 = norm(r["Provider First Line Business Practice Location Address"])
|
|
154
155
|
const city = norm(r["Provider Business Practice Location Address City Name"])
|
|
155
|
-
const zip = norm(r["Provider Business Practice Location Address
|
|
156
|
+
const zip = norm(r["Provider Business Practice Location Address Postcode"])
|
|
156
157
|
|
|
157
158
|
if (!line1) continue
|
|
158
159
|
const addrKey = addressFrequencyKey(`${line1}, ${city}, ${STATE} ${zip}`)
|
|
@@ -259,7 +260,6 @@ export async function dedupCeiling(
|
|
|
259
260
|
// of `mid`). Recall is NOT the binding constraint here (NPPES same-NPI records almost always share
|
|
260
261
|
// either address or org), so the F1 ceiling tracks the precision ceiling. ---
|
|
261
262
|
const pct = formatPercent
|
|
262
|
-
const collisionRate = pairs > 0 ? collide / pairs : 0
|
|
263
263
|
|
|
264
264
|
const lines: string[] = [
|
|
265
265
|
`# #625 — dedup ceiling: the irreducible over-merge of co-located providers`,
|
package/tools/eval-geocoder.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `GeocodeAddress` seam philosophy: ingest never pins the runtime, the caller wires it.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import type { ColumnMapping, GeocodeAddress, SourceRecord } from "
|
|
14
|
+
import type { ColumnMapping, GeocodeAddress, SourceRecord } from "#index"
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The raw single-address geocode surface (the probe tools) — mirrors `mailwoman/geocode-core`'s wire shape.
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
|
|
23
23
|
import { writeFileSync } from "node:fs"
|
|
24
24
|
|
|
25
|
+
import { isPresent } from "@mailwoman/core/objects"
|
|
25
26
|
import { dataRootPath, percentile } from "@mailwoman/core/utils"
|
|
26
27
|
import { haversineKm } from "@mailwoman/match"
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
import { streamRows } from "#index"
|
|
28
30
|
|
|
29
31
|
import type { EvalGeocoderFactory } from "./eval-geocoder.ts"
|
|
30
32
|
import { norm } from "./shared.ts"
|
|
@@ -133,7 +135,7 @@ export async function geocoderVsProvidedCoords(
|
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
scanned++
|
|
136
|
-
const address = [line, city, state, zip].filter(
|
|
138
|
+
const address = [line, city, state, zip].filter(isPresent).join(", ")
|
|
137
139
|
const g = await geocoder.geocode(address)
|
|
138
140
|
|
|
139
141
|
if (g.lat === null || g.lon === null) {
|