@mailwoman/registry 10.7.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -98
- package/data/manifests/artifacts.json +32 -0
- package/data/manifests/coverage.json +56 -0
- package/data/manifests/sources.lock.json +48 -0
- package/data/normalized/iata-airports.json +126749 -0
- package/data/normalized/iso3166-1.json +2035 -0
- package/definitions/namespaces.json +63 -0
- package/definitions/sections.json +73 -0
- package/docs/data-policy.md +81 -0
- package/docs/performance.md +146 -0
- package/docs/rgy1.md +144 -0
- package/lib/artifacts/country-airport-collision.ts +26 -0
- package/lib/artifacts/iata-airport/membership.ts +26 -0
- package/lib/artifacts/iata-airport/records.ts +26 -0
- package/lib/artifacts/iso3166-1/alpha2-membership.ts +26 -0
- package/lib/artifacts/iso3166-1/alpha3-membership.ts +26 -0
- package/lib/artifacts/iso3166-1/records.ts +26 -0
- package/lib/errors.ts +44 -0
- package/lib/iata/airports/records.ts +174 -0
- package/lib/iata/airports/validate.ts +49 -0
- package/lib/index.ts +25 -15
- package/lib/inspect.ts +56 -0
- package/lib/iso3166/alpha2.ts +48 -0
- package/lib/iso3166/alpha3.ts +51 -0
- package/lib/iso3166/records.ts +149 -0
- package/lib/iso3166/relations.ts +30 -0
- package/lib/key.ts +146 -0
- package/lib/normalize.ts +31 -0
- package/lib/overlap/country-airport.ts +108 -0
- package/lib/rgy1/base64.ts +24 -0
- package/lib/rgy1/reader.ts +316 -0
- package/lib/rgy1/sections.generated.ts +79 -0
- package/lib/rgy1/views.ts +267 -0
- package/lib/types.ts +88 -74
- package/lib/wasm.ts +285 -0
- package/out/artifacts/country-airport-collision.d.ts +15 -0
- package/out/artifacts/country-airport-collision.d.ts.map +1 -0
- package/out/artifacts/country-airport-collision.js +21 -0
- package/out/artifacts/country-airport-collision.js.map +1 -0
- package/out/artifacts/iata-airport/membership.d.ts +15 -0
- package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
- package/out/artifacts/iata-airport/membership.js +21 -0
- package/out/artifacts/iata-airport/membership.js.map +1 -0
- package/out/artifacts/iata-airport/records.d.ts +15 -0
- package/out/artifacts/iata-airport/records.d.ts.map +1 -0
- package/out/artifacts/iata-airport/records.js +21 -0
- package/out/artifacts/iata-airport/records.js.map +1 -0
- package/out/artifacts/iso3166-1/alpha2-membership.d.ts +15 -0
- package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/alpha2-membership.js +21 -0
- package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
- package/out/artifacts/iso3166-1/alpha3-membership.d.ts +15 -0
- package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/alpha3-membership.js +21 -0
- package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
- package/out/artifacts/iso3166-1/records.d.ts +15 -0
- package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/records.js +21 -0
- package/out/artifacts/iso3166-1/records.js.map +1 -0
- package/out/errors.d.ts +38 -0
- package/out/errors.d.ts.map +1 -0
- package/out/errors.js +35 -0
- package/out/errors.js.map +1 -0
- package/out/iata/airports/records.d.ts +44 -0
- package/out/iata/airports/records.d.ts.map +1 -0
- package/out/iata/airports/records.js +137 -0
- package/out/iata/airports/records.js.map +1 -0
- package/out/iata/airports/validate.d.ts +27 -0
- package/out/iata/airports/validate.d.ts.map +1 -0
- package/out/iata/airports/validate.js +42 -0
- package/out/iata/airports/validate.js.map +1 -0
- package/out/index.d.ts +19 -15
- package/out/index.d.ts.map +1 -1
- package/out/index.js +14 -15
- package/out/index.js.map +1 -1
- package/out/inspect.d.ts +38 -0
- package/out/inspect.d.ts.map +1 -0
- package/out/inspect.js +33 -0
- package/out/inspect.js.map +1 -0
- package/out/iso3166/alpha2.d.ts +24 -0
- package/out/iso3166/alpha2.d.ts.map +1 -0
- package/out/iso3166/alpha2.js +41 -0
- package/out/iso3166/alpha2.js.map +1 -0
- package/out/iso3166/alpha3.d.ts +29 -0
- package/out/iso3166/alpha3.d.ts.map +1 -0
- package/out/iso3166/alpha3.js +44 -0
- package/out/iso3166/alpha3.js.map +1 -0
- package/out/iso3166/records.d.ts +38 -0
- package/out/iso3166/records.d.ts.map +1 -0
- package/out/iso3166/records.js +105 -0
- package/out/iso3166/records.js.map +1 -0
- package/out/iso3166/relations.d.ts +20 -0
- package/out/iso3166/relations.d.ts.map +1 -0
- package/out/iso3166/relations.js +27 -0
- package/out/iso3166/relations.js.map +1 -0
- package/out/key.d.ts +68 -0
- package/out/key.d.ts.map +1 -0
- package/out/key.js +122 -0
- package/out/key.js.map +1 -0
- package/out/normalize.d.ts +25 -0
- package/out/normalize.d.ts.map +1 -0
- package/out/normalize.js +21 -0
- package/out/normalize.js.map +1 -0
- package/out/overlap/country-airport.d.ts +57 -0
- package/out/overlap/country-airport.d.ts.map +1 -0
- package/out/overlap/country-airport.js +71 -0
- package/out/overlap/country-airport.js.map +1 -0
- package/out/rgy1/base64.d.ts +15 -0
- package/out/rgy1/base64.d.ts.map +1 -0
- package/out/rgy1/base64.js +22 -0
- package/out/rgy1/base64.js.map +1 -0
- package/out/rgy1/reader.d.ts +103 -0
- package/out/rgy1/reader.d.ts.map +1 -0
- package/out/rgy1/reader.js +230 -0
- package/out/rgy1/reader.js.map +1 -0
- package/out/rgy1/sections.generated.d.ts +54 -0
- package/out/rgy1/sections.generated.d.ts.map +1 -0
- package/out/rgy1/sections.generated.js +69 -0
- package/out/rgy1/sections.generated.js.map +1 -0
- package/out/rgy1/views.d.ts +96 -0
- package/out/rgy1/views.d.ts.map +1 -0
- package/out/rgy1/views.js +218 -0
- package/out/rgy1/views.js.map +1 -0
- package/out/sdk/fetch.d.ts +53 -0
- package/out/sdk/fetch.d.ts.map +1 -0
- package/out/sdk/fetch.js +107 -0
- package/out/sdk/fetch.js.map +1 -0
- package/out/sdk/fetch.run.d.ts +14 -0
- package/out/sdk/fetch.run.d.ts.map +1 -0
- package/out/sdk/fetch.run.js +20 -0
- package/out/sdk/fetch.run.js.map +1 -0
- package/out/sdk/sources.d.ts +111 -0
- package/out/sdk/sources.d.ts.map +1 -0
- package/out/sdk/sources.js +98 -0
- package/out/sdk/sources.js.map +1 -0
- package/out/tools/artifact-path.d.ts +10 -0
- package/out/tools/artifact-path.d.ts.map +1 -0
- package/out/tools/artifact-path.js +12 -0
- package/out/tools/artifact-path.js.map +1 -0
- package/out/tools/bench.run.d.ts +19 -0
- package/out/tools/bench.run.d.ts.map +1 -0
- package/out/tools/bench.run.js +204 -0
- package/out/tools/bench.run.js.map +1 -0
- package/out/tools/build-wasm.run.d.ts +18 -0
- package/out/tools/build-wasm.run.d.ts.map +1 -0
- package/out/tools/build-wasm.run.js +71 -0
- package/out/tools/build-wasm.run.js.map +1 -0
- package/out/tools/generate-sections.run.d.ts +13 -0
- package/out/tools/generate-sections.run.d.ts.map +1 -0
- package/out/tools/generate-sections.run.js +136 -0
- package/out/tools/generate-sections.run.js.map +1 -0
- package/out/tools/generate.run.d.ts +18 -0
- package/out/tools/generate.run.d.ts.map +1 -0
- package/out/tools/generate.run.js +118 -0
- package/out/tools/generate.run.js.map +1 -0
- package/out/tools/normalize.d.ts +155 -0
- package/out/tools/normalize.d.ts.map +1 -0
- package/out/tools/normalize.js +303 -0
- package/out/tools/normalize.js.map +1 -0
- package/out/tools/normalize.run.d.ts +14 -0
- package/out/tools/normalize.run.d.ts.map +1 -0
- package/out/tools/normalize.run.js +29 -0
- package/out/tools/normalize.run.js.map +1 -0
- package/out/types.d.ts +90 -76
- package/out/types.d.ts.map +1 -1
- package/out/types.js +20 -4
- package/out/types.js.map +1 -1
- package/out/wasm.d.ts +98 -0
- package/out/wasm.d.ts.map +1 -0
- package/out/wasm.js +137 -0
- package/out/wasm.js.map +1 -0
- package/package.json +49 -28
- package/sdk/fetch.run.ts +24 -0
- package/sdk/fetch.ts +146 -0
- package/sdk/sources.ts +162 -0
- package/tools/artifact-path.ts +12 -0
- package/tools/bench.run.ts +265 -0
- package/tools/build-wasm.run.ts +82 -0
- package/tools/generate-sections.run.ts +152 -0
- package/tools/generate.run.ts +146 -0
- package/tools/normalize.run.ts +36 -0
- package/tools/normalize.ts +474 -0
- package/wasm/registry-simd.wasm +0 -0
- package/wasm/registry.wasm +0 -0
- package/lib/address-key.ts +0 -46
- package/lib/geocode-handler.ts +0 -37
- package/lib/geojson.ts +0 -73
- package/lib/ingest.ts +0 -349
- package/lib/learned-scorer.ts +0 -134
- package/lib/map-html.ts +0 -287
- package/lib/models/crosssource-gbt-en-us.ts +0 -43
- package/lib/models/dedup-gbt-en-us.ts +0 -47
- package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
- package/lib/reconcile.ts +0 -239
- package/lib/resolve.ts +0 -570
- package/out/address-key.d.ts +0 -34
- package/out/address-key.d.ts.map +0 -1
- package/out/address-key.js +0 -41
- package/out/address-key.js.map +0 -1
- package/out/geocode-handler.d.ts +0 -20
- package/out/geocode-handler.d.ts.map +0 -1
- package/out/geocode-handler.js +0 -29
- package/out/geocode-handler.js.map +0 -1
- package/out/geojson.d.ts +0 -28
- package/out/geojson.d.ts.map +0 -1
- package/out/geojson.js +0 -63
- package/out/geojson.js.map +0 -1
- package/out/ingest.d.ts +0 -173
- package/out/ingest.d.ts.map +0 -1
- package/out/ingest.js +0 -185
- package/out/ingest.js.map +0 -1
- package/out/learned-scorer.d.ts +0 -61
- package/out/learned-scorer.d.ts.map +0 -1
- package/out/learned-scorer.js +0 -91
- package/out/learned-scorer.js.map +0 -1
- package/out/map-html.d.ts +0 -39
- package/out/map-html.d.ts.map +0 -1
- package/out/map-html.js +0 -220
- package/out/map-html.js.map +0 -1
- package/out/models/crosssource-gbt-en-us.d.ts +0 -45
- package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
- package/out/models/crosssource-gbt-en-us.js +0 -40
- package/out/models/crosssource-gbt-en-us.js.map +0 -1
- package/out/models/dedup-gbt-en-us.d.ts +0 -44
- package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
- package/out/models/dedup-gbt-en-us.js +0 -44
- package/out/models/dedup-gbt-en-us.js.map +0 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
- package/out/models/org-crosssource-gbt-en-us.js +0 -40
- package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
- package/out/reconcile.d.ts +0 -96
- package/out/reconcile.d.ts.map +0 -1
- package/out/reconcile.js +0 -127
- package/out/reconcile.js.map +0 -1
- package/out/resolve.d.ts +0 -264
- package/out/resolve.d.ts.map +0 -1
- package/out/resolve.js +0 -282
- package/out/resolve.js.map +0 -1
- package/out/tools/coverage-reconciliation.d.ts +0 -67
- package/out/tools/coverage-reconciliation.d.ts.map +0 -1
- package/out/tools/coverage-reconciliation.js +0 -113
- package/out/tools/coverage-reconciliation.js.map +0 -1
- package/out/tools/cross/dataset-correlation.d.ts +0 -61
- package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
- package/out/tools/cross/dataset-correlation.js +0 -244
- package/out/tools/cross/dataset-correlation.js.map +0 -1
- package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
- package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
- package/out/tools/cross/source-threshold-sweep.js +0 -264
- package/out/tools/cross/source-threshold-sweep.js.map +0 -1
- package/out/tools/dedup-ceiling.d.ts +0 -62
- package/out/tools/dedup-ceiling.d.ts.map +0 -1
- package/out/tools/dedup-ceiling.js +0 -171
- package/out/tools/dedup-ceiling.js.map +0 -1
- package/out/tools/eval-geocoder.d.ts +0 -68
- package/out/tools/eval-geocoder.d.ts.map +0 -1
- package/out/tools/eval-geocoder.js +0 -13
- package/out/tools/eval-geocoder.js.map +0 -1
- package/out/tools/geocoder/namesake-probe.d.ts +0 -33
- package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
- package/out/tools/geocoder/namesake-probe.js +0 -60
- package/out/tools/geocoder/namesake-probe.js.map +0 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
- package/out/tools/geocoder/vs-provided-coords.js +0 -161
- package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
- package/out/tools/gold-set-sample.d.ts +0 -67
- package/out/tools/gold-set-sample.d.ts.map +0 -1
- package/out/tools/gold-set-sample.js +0 -81
- package/out/tools/gold-set-sample.js.map +0 -1
- package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/clustering-eval.js +0 -207
- package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/crossstate-eval.js +0 -168
- package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
- package/out/tools/learned/scorer/eval.d.ts +0 -64
- package/out/tools/learned/scorer/eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/eval.js +0 -275
- package/out/tools/learned/scorer/eval.js.map +0 -1
- package/out/tools/matcher-scale.d.ts +0 -40
- package/out/tools/matcher-scale.d.ts.map +0 -1
- package/out/tools/matcher-scale.js +0 -111
- package/out/tools/matcher-scale.js.map +0 -1
- package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
- package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
- package/out/tools/nppes/dedup-benchmark.js +0 -226
- package/out/tools/nppes/dedup-benchmark.js.map +0 -1
- package/out/tools/nppes/org-name.d.ts +0 -15
- package/out/tools/nppes/org-name.d.ts.map +0 -1
- package/out/tools/nppes/org-name.js +0 -6
- package/out/tools/nppes/org-name.js.map +0 -1
- package/out/tools/nppes/overmerge-packet.d.ts +0 -43
- package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
- package/out/tools/nppes/overmerge-packet.js +0 -54
- package/out/tools/nppes/overmerge-packet.js.map +0 -1
- package/out/tools/nppes/report.d.ts +0 -97
- package/out/tools/nppes/report.d.ts.map +0 -1
- package/out/tools/nppes/report.js +0 -178
- package/out/tools/nppes/report.js.map +0 -1
- package/out/tools/nppes/sample.d.ts +0 -101
- package/out/tools/nppes/sample.d.ts.map +0 -1
- package/out/tools/nppes/sample.js +0 -127
- package/out/tools/nppes/sample.js.map +0 -1
- package/out/tools/nppes/scoring.d.ts +0 -37
- package/out/tools/nppes/scoring.d.ts.map +0 -1
- package/out/tools/nppes/scoring.js +0 -81
- package/out/tools/nppes/scoring.js.map +0 -1
- package/out/tools/nppes/settings.d.ts +0 -41
- package/out/tools/nppes/settings.d.ts.map +0 -1
- package/out/tools/nppes/settings.js +0 -79
- package/out/tools/nppes/settings.js.map +0 -1
- package/out/tools/nppes/truth-grains.d.ts +0 -63
- package/out/tools/nppes/truth-grains.d.ts.map +0 -1
- package/out/tools/nppes/truth-grains.js +0 -139
- package/out/tools/nppes/truth-grains.js.map +0 -1
- package/out/tools/shared.d.ts +0 -325
- package/out/tools/shared.d.ts.map +0 -1
- package/out/tools/shared.js +0 -453
- package/out/tools/shared.js.map +0 -1
- package/out/tools/train/cross-gbt.d.ts +0 -89
- package/out/tools/train/cross-gbt.d.ts.map +0 -1
- package/out/tools/train/cross-gbt.js +0 -132
- package/out/tools/train/cross-gbt.js.map +0 -1
- package/out/tools/train/gbt.d.ts +0 -85
- package/out/tools/train/gbt.d.ts.map +0 -1
- package/out/tools/train/gbt.js +0 -155
- package/out/tools/train/gbt.js.map +0 -1
- package/out/tools/train/org-cross-gbt.d.ts +0 -85
- package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
- package/out/tools/train/org-cross-gbt.js +0 -122
- package/out/tools/train/org-cross-gbt.js.map +0 -1
- package/out/tools/txhhsc-to-oarow.d.ts +0 -42
- package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
- package/out/tools/txhhsc-to-oarow.js +0 -78
- package/out/tools/txhhsc-to-oarow.js.map +0 -1
- package/out/tools/viz/browser.d.ts +0 -31
- package/out/tools/viz/browser.d.ts.map +0 -1
- package/out/tools/viz/browser.js +0 -26
- package/out/tools/viz/browser.js.map +0 -1
- package/out/tools/viz/cross-dataset-map.d.ts +0 -39
- package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
- package/out/tools/viz/cross-dataset-map.js +0 -84
- package/out/tools/viz/cross-dataset-map.js.map +0 -1
- package/out/tools/viz/geocode-first-surface.d.ts +0 -36
- package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
- package/out/tools/viz/geocode-first-surface.js +0 -234
- package/out/tools/viz/geocode-first-surface.js.map +0 -1
- package/out/tools/viz/render/map.d.ts +0 -42
- package/out/tools/viz/render/map.d.ts.map +0 -1
- package/out/tools/viz/render/map.js +0 -40
- package/out/tools/viz/render/map.js.map +0 -1
- package/out/tools/viz/render.d.ts +0 -46
- package/out/tools/viz/render.d.ts.map +0 -1
- package/out/tools/viz/render.js +0 -49
- package/out/tools/viz/render.js.map +0 -1
- package/out/tools/viz/source-provenance-map.d.ts +0 -57
- package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
- package/out/tools/viz/source-provenance-map.js +0 -82
- package/out/tools/viz/source-provenance-map.js.map +0 -1
- package/out/tools/viz/yardstick-figure.d.ts +0 -22
- package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
- package/out/tools/viz/yardstick-figure.js +0 -106
- package/out/tools/viz/yardstick-figure.js.map +0 -1
- package/tools/coverage-reconciliation.ts +0 -192
- package/tools/cross/dataset-correlation.ts +0 -380
- package/tools/cross/source-threshold-sweep.ts +0 -416
- package/tools/dedup-ceiling.ts +0 -225
- package/tools/eval-geocoder.ts +0 -77
- package/tools/geocoder/namesake-probe.ts +0 -91
- package/tools/geocoder/vs-provided-coords.ts +0 -232
- package/tools/gold-set-sample.ts +0 -147
- package/tools/learned/scorer/clustering-eval.ts +0 -349
- package/tools/learned/scorer/crossstate-eval.ts +0 -280
- package/tools/learned/scorer/eval.ts +0 -429
- package/tools/matcher-scale.ts +0 -185
- package/tools/nppes/dedup-benchmark.ts +0 -364
- package/tools/nppes/org-name.ts +0 -15
- package/tools/nppes/overmerge-packet.ts +0 -98
- package/tools/nppes/report.ts +0 -380
- package/tools/nppes/sample.ts +0 -250
- package/tools/nppes/scoring.ts +0 -115
- package/tools/nppes/settings.ts +0 -102
- package/tools/nppes/truth-grains.ts +0 -181
- package/tools/shared.ts +0 -743
- package/tools/train/cross-gbt.ts +0 -214
- package/tools/train/gbt.ts +0 -261
- package/tools/train/org-cross-gbt.ts +0 -189
- package/tools/txhhsc-to-oarow.ts +0 -118
- package/tools/viz/browser.ts +0 -41
- package/tools/viz/cross-dataset-map.ts +0 -133
- package/tools/viz/geocode-first-surface.ts +0 -305
- package/tools/viz/render/map.ts +0 -61
- package/tools/viz/render.ts +0 -103
- package/tools/viz/source-provenance-map.ts +0 -154
- package/tools/viz/yardstick-figure.ts +0 -197
package/out/resolve.js
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The resolve pipeline wires the matching modules over concrete contact and organization records.
|
|
7
|
-
*
|
|
8
|
-
* The upstream pipeline geocodes each `address` and supplies its coordinate and canonical key.
|
|
9
|
-
*/
|
|
10
|
-
import { DEFAULT_DISTANCE_LEVELS, DEFAULT_SPATIAL_LEVELS, agreementPattern, block, buildTermFrequencyTable, cluster, distanceComparison, estimateParameters, exactKey, geoCellKey, representative, scorePair, similarityComparison, spatialComparison, withTermFrequency, } from "@mailwoman/match";
|
|
11
|
-
import { createGBTScorer } from "#learned-scorer";
|
|
12
|
-
import { DEDUP_GBT_META, DEDUP_GBT_MODEL } from "#models/dedup-gbt-en-us";
|
|
13
|
-
/**
|
|
14
|
-
* Cheap, parse-free normalization for the address-frequency key: uppercase,
|
|
15
|
-
* collapse whitespace, drop punctuation.
|
|
16
|
-
*
|
|
17
|
-
* The count covers distinct entities that share an address.
|
|
18
|
-
* It is computable over millions of rows without geocoding.
|
|
19
|
-
*
|
|
20
|
-
* A crowded clinic or billing address is weak identity evidence.
|
|
21
|
-
* A lonely address is strong.
|
|
22
|
-
*/
|
|
23
|
-
export function addressFrequencyKey(raw) {
|
|
24
|
-
return raw
|
|
25
|
-
.toUpperCase()
|
|
26
|
-
.replaceAll(/[^A-Z0-9]+/g, " ")
|
|
27
|
-
.trim()
|
|
28
|
-
.replaceAll(/\s+/g, " ");
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Default tiered levels for a name-like text field.
|
|
32
|
-
*
|
|
33
|
-
* `m`/`u` are EM-estimable seeds.
|
|
34
|
-
*/
|
|
35
|
-
const NAME_LEVELS = [
|
|
36
|
-
{ label: "exact", minSimilarity: 1, m: 0.8, u: 0.01 },
|
|
37
|
-
{ label: "high", minSimilarity: 0.88, m: 0.15, u: 0.03 },
|
|
38
|
-
{ label: "different", minSimilarity: 0, m: 0.05, u: 0.96 },
|
|
39
|
-
];
|
|
40
|
-
/**
|
|
41
|
-
* Exact-vs-different levels for a normalized phone.
|
|
42
|
-
*
|
|
43
|
-
* A shared line is strong, rarely-coincidental evidence.
|
|
44
|
-
*/
|
|
45
|
-
const PHONE_LEVELS = [
|
|
46
|
-
{ label: "exact", minSimilarity: 1, m: 0.6, u: 0.002 },
|
|
47
|
-
{ label: "different", minSimilarity: 0, m: 0.4, u: 0.998 },
|
|
48
|
-
];
|
|
49
|
-
/**
|
|
50
|
-
* Exact-vs-different levels for a closed-vocabulary code set
|
|
51
|
-
* ({@link DefaultModelOptions.exactDiscriminators}), such as NPPES taxonomy codes or license numbers.
|
|
52
|
-
*
|
|
53
|
-
* These are seeds only, since EM refits.
|
|
54
|
-
* `u` starts well above phone's 0.002, because two random providers share a
|
|
55
|
-
* specialty at a far higher rate than a phone line.
|
|
56
|
-
*/
|
|
57
|
-
const CODE_SET_LEVELS = [
|
|
58
|
-
{ label: "exact", minSimilarity: 1, m: 0.75, u: 0.08 },
|
|
59
|
-
{ label: "different", minSimilarity: 0, m: 0.25, u: 0.92 },
|
|
60
|
-
];
|
|
61
|
-
function codeSetOverlap(a, b) {
|
|
62
|
-
const sa = new Set(a
|
|
63
|
-
.toUpperCase()
|
|
64
|
-
.split(/\s+/)
|
|
65
|
-
.filter((value) => value.length));
|
|
66
|
-
for (const t of b.toUpperCase().split(/\s+/))
|
|
67
|
-
if (t && sa.has(t))
|
|
68
|
-
return 1;
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Last-10-digit normalization for phone agreement, dropping country code, punctuation and extensions.
|
|
73
|
-
*
|
|
74
|
-
* A shorter digit string is kept as-is, since partial agreement still contributes
|
|
75
|
-
* weight in the comparison model.
|
|
76
|
-
* `null` means no digits at all.
|
|
77
|
-
*/
|
|
78
|
-
export function normalizePhone(raw) {
|
|
79
|
-
if (!raw)
|
|
80
|
-
return null;
|
|
81
|
-
const digits = raw.replaceAll(/\D+/g, "");
|
|
82
|
-
return digits.length >= 10 ? digits.slice(-10) : digits || null;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* {@link normalizePhone} under the probes' stricter interface, where only a full line counts.
|
|
86
|
-
*
|
|
87
|
-
* Returns the last 10 digits when the input contains at least 10.
|
|
88
|
-
* Returns `""` for shorter input, so callers never receive a partial digit string.
|
|
89
|
-
*
|
|
90
|
-
* Callers guard on truthiness, so `""` reads as no comparable phone rather than a weaker key.
|
|
91
|
-
*/
|
|
92
|
-
export function normalizePhoneStrict(raw) {
|
|
93
|
-
const digits = normalizePhone(raw);
|
|
94
|
-
return digits && digits.length === 10 ? digits : "";
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* The identity-corroborating comparisons: person name, organization and phone.
|
|
98
|
-
*
|
|
99
|
-
* At least one must positively agree before a pair may link, since a shared
|
|
100
|
-
* address provides no identity evidence by itself.
|
|
101
|
-
* Phone is the secondary identifier that rescues a true same-entity link across name drift.
|
|
102
|
-
*/
|
|
103
|
-
const CORROBORATING_FIELDS = new Set(["given", "family", "organization", "phone"]);
|
|
104
|
-
/**
|
|
105
|
-
* The default geocode-first scoring model: name, organization and a spatial signal.
|
|
106
|
-
*
|
|
107
|
-
* The spatial signal is either two comparisons (address-key similarity and great-circle distance)
|
|
108
|
-
* or, with {@link DefaultModelOptions.collapseSpatial}, one collapsed {@link spatialComparison}.
|
|
109
|
-
* `addressFrequency` down-weights agreement on a crowded address either way.
|
|
110
|
-
*/
|
|
111
|
-
export function buildDefaultModel(opts = {}) {
|
|
112
|
-
const identity = [
|
|
113
|
-
similarityComparison({ name: "given", extract: (r) => r.name?.given, levels: NAME_LEVELS }),
|
|
114
|
-
similarityComparison({ name: "family", extract: (r) => r.name?.family, levels: NAME_LEVELS }),
|
|
115
|
-
similarityComparison({
|
|
116
|
-
name: "organization",
|
|
117
|
-
extract: (r) => r.organization?.canonical,
|
|
118
|
-
levels: NAME_LEVELS,
|
|
119
|
-
}),
|
|
120
|
-
];
|
|
121
|
-
if (opts.usePhone) {
|
|
122
|
-
identity.push(similarityComparison({
|
|
123
|
-
name: "phone",
|
|
124
|
-
extract: (r) => normalizePhone(r.phone),
|
|
125
|
-
similarity: (a, b) => (a === b ? 1 : 0),
|
|
126
|
-
levels: PHONE_LEVELS,
|
|
127
|
-
}));
|
|
128
|
-
}
|
|
129
|
-
for (const key of opts.discriminators ?? []) {
|
|
130
|
-
identity.push(similarityComparison({
|
|
131
|
-
name: `attr:${key}`,
|
|
132
|
-
extract: (r) => r.attributes?.[key],
|
|
133
|
-
levels: NAME_LEVELS,
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
for (const key of opts.exactDiscriminators ?? []) {
|
|
137
|
-
identity.push(similarityComparison({
|
|
138
|
-
name: `attr:${key}`,
|
|
139
|
-
extract: (r) => r.attributes?.[key],
|
|
140
|
-
similarity: codeSetOverlap,
|
|
141
|
-
levels: CODE_SET_LEVELS,
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
if (opts.collapseSpatial) {
|
|
145
|
-
let spatial = spatialComparison({
|
|
146
|
-
name: "spatial",
|
|
147
|
-
key: (r) => r.address?.canonicalKey,
|
|
148
|
-
coordinate: (r) => r.address?.geocode?.coordinate,
|
|
149
|
-
levels: DEFAULT_SPATIAL_LEVELS,
|
|
150
|
-
});
|
|
151
|
-
if (opts.addressFrequency) {
|
|
152
|
-
spatial = withTermFrequency(spatial, {
|
|
153
|
-
table: opts.addressFrequency,
|
|
154
|
-
value: (a) => a.address?.raw ?? null,
|
|
155
|
-
levels: [0],
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
return { lambda: 0.0001, comparisons: [...identity, spatial] };
|
|
159
|
-
}
|
|
160
|
-
let address = similarityComparison({
|
|
161
|
-
name: "address",
|
|
162
|
-
extract: (r) => r.address?.canonicalKey,
|
|
163
|
-
levels: NAME_LEVELS,
|
|
164
|
-
});
|
|
165
|
-
if (opts.addressFrequency) {
|
|
166
|
-
address = withTermFrequency(address, { table: opts.addressFrequency, value: (a) => a.address?.raw ?? null });
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
lambda: 0.0001,
|
|
170
|
-
comparisons: [
|
|
171
|
-
...identity,
|
|
172
|
-
address,
|
|
173
|
-
distanceComparison({
|
|
174
|
-
name: "distance",
|
|
175
|
-
extract: (r) => r.address?.geocode?.coordinate,
|
|
176
|
-
levels: DEFAULT_DISTANCE_LEVELS,
|
|
177
|
-
}),
|
|
178
|
-
],
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* The default blocking keys include location and canonical address.
|
|
183
|
-
* They also include phone and email.
|
|
184
|
-
*/
|
|
185
|
-
export function defaultBlockingKeys() {
|
|
186
|
-
return [
|
|
187
|
-
geoCellKey((r) => r.address?.geocode?.coordinate ?? null),
|
|
188
|
-
exactKey((r) => r.address?.canonicalKey ?? null),
|
|
189
|
-
exactKey((r) => r.phone ?? null),
|
|
190
|
-
exactKey((r) => r.email ?? null),
|
|
191
|
-
];
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Resolve source records into canonical entities: block, score, cluster.
|
|
195
|
-
*
|
|
196
|
-
* Every record belongs to exactly one entity.
|
|
197
|
-
* A record without a confident link forms a singleton entity.
|
|
198
|
-
*/
|
|
199
|
-
export function resolveEntities(records, config = {}) {
|
|
200
|
-
const addressFrequency = config.addressFrequency === false
|
|
201
|
-
? undefined
|
|
202
|
-
: (config.addressFrequency ??
|
|
203
|
-
buildTermFrequencyTable(records.map((r) => r.address?.raw), { normalize: addressFrequencyKey }));
|
|
204
|
-
const collapseSpatial = config.collapseSpatial ?? true;
|
|
205
|
-
const model = config.model ??
|
|
206
|
-
buildDefaultModel({
|
|
207
|
-
addressFrequency,
|
|
208
|
-
collapseSpatial,
|
|
209
|
-
usePhone: config.usePhone,
|
|
210
|
-
discriminators: config.discriminators,
|
|
211
|
-
exactDiscriminators: config.exactDiscriminators,
|
|
212
|
-
});
|
|
213
|
-
const blockingKeys = config.blockingKeys ?? defaultBlockingKeys();
|
|
214
|
-
let scorer = config.scorer;
|
|
215
|
-
let usingBundledModel = false;
|
|
216
|
-
if (!scorer && config.learnedScorer !== false) {
|
|
217
|
-
const gbt = config.learnedScorer === undefined || config.learnedScorer === true ? DEDUP_GBT_MODEL : config.learnedScorer;
|
|
218
|
-
usingBundledModel = gbt === DEDUP_GBT_MODEL;
|
|
219
|
-
scorer = createGBTScorer({
|
|
220
|
-
model: gbt,
|
|
221
|
-
comparisons: buildDefaultModel({ collapseSpatial: true, addressFrequency }).comparisons,
|
|
222
|
-
addressFrequency: addressFrequency ?? buildTermFrequencyTable([], { normalize: addressFrequencyKey }),
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
// An explicit threshold wins.
|
|
226
|
-
// Otherwise the bundled model uses its calibrated threshold, because its logit
|
|
227
|
-
// is not in FS-weight units and 0 would over-merge.
|
|
228
|
-
// The FS baseline or a custom model uses 0.
|
|
229
|
-
const threshold = config.threshold ?? (usingBundledModel ? DEDUP_GBT_META.recommendedThreshold : 0);
|
|
230
|
-
const { pairs, droppedBlocks } = block(records, blockingKeys, { maxBlockSize: config.maxBlockSize });
|
|
231
|
-
let scoringModel = model;
|
|
232
|
-
if (config.trainEM && pairs.length) {
|
|
233
|
-
const patterns = pairs.map(([a, b]) => agreementPattern(model.comparisons, a, b));
|
|
234
|
-
scoringModel = estimateParameters(model, patterns).model;
|
|
235
|
-
}
|
|
236
|
-
const links = pairs.map(([a, b]) => {
|
|
237
|
-
const score = scorePair(scoringModel, a, b);
|
|
238
|
-
let weight = scorer ? scorer(a, b) : score.weight;
|
|
239
|
-
// A link requires positive name or organization corroboration, since a shared
|
|
240
|
-
// address provides no identity evidence by itself.
|
|
241
|
-
if (config.requireCorroboration) {
|
|
242
|
-
const corroborated = score.contributions.some((c) => (CORROBORATING_FIELDS.has(c.name) || c.name.startsWith("attr:")) && c.weight > 0);
|
|
243
|
-
if (!corroborated) {
|
|
244
|
-
weight = Number.NEGATIVE_INFINITY;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return { a, b, weight };
|
|
248
|
-
});
|
|
249
|
-
const clusters = cluster(records, links, { threshold, linkage: config.linkage });
|
|
250
|
-
// Cohesion is the weakest within-cluster link weight.
|
|
251
|
-
// Compute it in one pass over links with a record-to-cluster index, because filtering
|
|
252
|
-
// every link for every cluster is O(clusters x links) and dominates the resolve at scale.
|
|
253
|
-
const clusterOf = new Map();
|
|
254
|
-
clusters.forEach((group, i) => {
|
|
255
|
-
for (const record of group) {
|
|
256
|
-
clusterOf.set(record, i);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
const minIntraWeight = new Array(clusters.length).fill(Infinity);
|
|
260
|
-
for (const link of links) {
|
|
261
|
-
if (link.weight < threshold)
|
|
262
|
-
continue;
|
|
263
|
-
const ci = clusterOf.get(link.a);
|
|
264
|
-
if (ci === undefined || ci !== clusterOf.get(link.b))
|
|
265
|
-
continue;
|
|
266
|
-
if (link.weight < minIntraWeight[ci]) {
|
|
267
|
-
minIntraWeight[ci] = link.weight;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const entities = clusters.map((group, i) => {
|
|
271
|
-
const rep = representative(group) ?? group[0];
|
|
272
|
-
return {
|
|
273
|
-
id: `entity-${i}`,
|
|
274
|
-
records: group,
|
|
275
|
-
representative: rep,
|
|
276
|
-
coordinate: rep.address?.geocode?.coordinate ?? null,
|
|
277
|
-
cohesion: group.length > 1 && minIntraWeight[i] !== Infinity ? minIntraWeight[i] : null,
|
|
278
|
-
};
|
|
279
|
-
});
|
|
280
|
-
return { entities, candidatePairs: pairs.length, droppedBlocks };
|
|
281
|
-
}
|
|
282
|
-
//# sourceMappingURL=resolve.js.map
|
package/out/resolve.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../lib/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAON,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,EACL,uBAAuB,EACvB,OAAO,EACP,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGzE;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC9C,OAAO,GAAG;SACR,WAAW,EAAE;SACb,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC;SAC9B,IAAI,EAAE;SACN,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC1B,CA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,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI;SACzF,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,CAAA;AACjE,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Coverage reconciliation, the product output that replaces inspecting the map by eye.
|
|
7
|
-
*
|
|
8
|
-
* Each resolved entity is classified by the kind of source its records come from. An eligibility
|
|
9
|
-
* source holds providers and facilities, such as NPPES org NPIs or TX HHSC nursing facilities. A
|
|
10
|
-
* funding source holds entities enrolled in a funding program, such as FCC Rural Health Care
|
|
11
|
-
* filings.
|
|
12
|
-
*
|
|
13
|
-
* The buckets are enrolled (both an eligibility and a funding record), eligible rather than
|
|
14
|
-
* enrolled (an eligibility record with no funding record resolving to it), and funded rather than
|
|
15
|
-
* in the eligibility set (a funding record with no eligibility record resolving to it).
|
|
16
|
-
*
|
|
17
|
-
* This is strictly a set-membership reconciliation, never an allegation.
|
|
18
|
-
*
|
|
19
|
-
* Run: `mailwoman registry scorer-eval coverage-reconciliation [--cap 2000] [--wof <admin.db>]
|
|
20
|
-
* [--data-root <dir>] [--out-md <md>] [--out-geojson <geojson>]`
|
|
21
|
-
*/
|
|
22
|
-
import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
23
|
-
/**
|
|
24
|
-
* Options for {@linkcode coverageReconciliation}.
|
|
25
|
-
*/
|
|
26
|
-
export interface CoverageReconciliationOptions {
|
|
27
|
-
/**
|
|
28
|
-
* The injected geocoder factory.
|
|
29
|
-
*
|
|
30
|
-
* The command wires `mailwoman/geocode-core`, as `./eval-geocoder.ts` does.
|
|
31
|
-
*/
|
|
32
|
-
createGeocoder: EvalGeocoderFactory;
|
|
33
|
-
/**
|
|
34
|
-
* Record-matcher sources directory.
|
|
35
|
-
*
|
|
36
|
-
* @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
|
|
37
|
-
*/
|
|
38
|
-
sources?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Rows kept per source.
|
|
41
|
-
*
|
|
42
|
-
* @defaultValue `2000`
|
|
43
|
-
*/
|
|
44
|
-
cap?: number;
|
|
45
|
-
/**
|
|
46
|
-
* State filter.
|
|
47
|
-
*
|
|
48
|
-
* @defaultValue TX.
|
|
49
|
-
*/
|
|
50
|
-
state?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Also write the markdown report here.
|
|
53
|
-
*/
|
|
54
|
-
outMd?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Also write the bucket-tagged GeoJSON here.
|
|
57
|
-
*/
|
|
58
|
-
outGeojson?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Reconcile eligibility and funding sources.
|
|
62
|
-
* Emit the markdown report to stdout.
|
|
63
|
-
*/
|
|
64
|
-
export declare function coverageReconciliation(options: CoverageReconciliationOptions, report?: (line: string) => void): Promise<{
|
|
65
|
-
markdown: string;
|
|
66
|
-
}>;
|
|
67
|
-
//# sourceMappingURL=coverage-reconciliation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-reconciliation.d.ts","sourceRoot":"","sources":["../../tools/coverage-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG/D;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;;;OAIG;IACH,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,6BAA6B,EACtC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqG/B"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Coverage reconciliation, the product output that replaces inspecting the map by eye.
|
|
7
|
-
*
|
|
8
|
-
* Each resolved entity is classified by the kind of source its records come from. An eligibility
|
|
9
|
-
* source holds providers and facilities, such as NPPES org NPIs or TX HHSC nursing facilities. A
|
|
10
|
-
* funding source holds entities enrolled in a funding program, such as FCC Rural Health Care
|
|
11
|
-
* filings.
|
|
12
|
-
*
|
|
13
|
-
* The buckets are enrolled (both an eligibility and a funding record), eligible rather than
|
|
14
|
-
* enrolled (an eligibility record with no funding record resolving to it), and funded rather than
|
|
15
|
-
* in the eligibility set (a funding record with no eligibility record resolving to it).
|
|
16
|
-
*
|
|
17
|
-
* This is strictly a set-membership reconciliation, never an allegation.
|
|
18
|
-
*
|
|
19
|
-
* Run: `mailwoman registry scorer-eval coverage-reconciliation [--cap 2000] [--wof <admin.db>]
|
|
20
|
-
* [--data-root <dir>] [--out-md <md>] [--out-geojson <geojson>]`
|
|
21
|
-
*/
|
|
22
|
-
import { dataRootPath } from "@mailwoman/core/data-root";
|
|
23
|
-
import { writeLocalFile, writeLocalJSONFile } from "@mailwoman/core/fs/writers";
|
|
24
|
-
import { ingestRows, reconcileCoverage, reconciliationGeoJSON, reconciliationReport, resolveEntities, streamRows, } from "#index";
|
|
25
|
-
import { buildSpecs, stateOption } from "#tools/shared";
|
|
26
|
-
/**
|
|
27
|
-
* Which kind of source a record's provenance label denotes.
|
|
28
|
-
*/
|
|
29
|
-
const ELIGIBILITY = new Set(["nppes", "txhhsc-nursing"]);
|
|
30
|
-
const FUNDING = new Set(["fcc-rhc"]);
|
|
31
|
-
/**
|
|
32
|
-
* Reconcile eligibility and funding sources.
|
|
33
|
-
* Emit the markdown report to stdout.
|
|
34
|
-
*/
|
|
35
|
-
export async function coverageReconciliation(options, report) {
|
|
36
|
-
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
37
|
-
const CAP = options.cap ?? 2000;
|
|
38
|
-
const STATE = stateOption(options);
|
|
39
|
-
const OUT_MD = options.outMd || "";
|
|
40
|
-
const OUT_GEOJSON = options.outGeojson || "";
|
|
41
|
-
const SPECS = buildSpecs(`${SOURCES}`, STATE);
|
|
42
|
-
const rawBySource = new Map();
|
|
43
|
-
for (const spec of SPECS) {
|
|
44
|
-
report?.(`[A] ${spec.source}: streaming + ${STATE} filter (cap ${CAP})…`);
|
|
45
|
-
const kept = [];
|
|
46
|
-
for await (const row of streamRows(spec.path)) {
|
|
47
|
-
if (!spec.inState(row))
|
|
48
|
-
continue;
|
|
49
|
-
kept.push(row);
|
|
50
|
-
if (kept.length >= CAP)
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
rawBySource.set(spec.source, kept);
|
|
54
|
-
report?.(` ${spec.source}: ${kept.length} rows`);
|
|
55
|
-
}
|
|
56
|
-
report?.("[B] building the geocoder…");
|
|
57
|
-
const geocoder = await options.createGeocoder();
|
|
58
|
-
let geo = 0;
|
|
59
|
-
let total = 0;
|
|
60
|
-
const geocodeForIngest = async (raw) => {
|
|
61
|
-
const g = await geocoder.geocodeAddress(raw);
|
|
62
|
-
total++;
|
|
63
|
-
if (g?.geocode) {
|
|
64
|
-
geo++;
|
|
65
|
-
}
|
|
66
|
-
return g;
|
|
67
|
-
};
|
|
68
|
-
report?.("[C] geocoding + ingesting…");
|
|
69
|
-
const records = [];
|
|
70
|
-
for (const spec of SPECS) {
|
|
71
|
-
const recs = await ingestRows(rawBySource.get(spec.source), spec.mapping, { geocodeAddress: geocodeForIngest });
|
|
72
|
-
for (const r of recs) {
|
|
73
|
-
r.id = `${spec.source}:${r.id}`;
|
|
74
|
-
}
|
|
75
|
-
records.push(...recs);
|
|
76
|
-
}
|
|
77
|
-
geocoder[Symbol.dispose]();
|
|
78
|
-
report?.(` ${records.length} records; geocoded ${geo}/${total} (${((100 * geo) / total).toFixed(1)}%)`);
|
|
79
|
-
report?.("[D] resolving + reconciling…");
|
|
80
|
-
// Use the Fellegi-Sunter baseline for this cross-dataset join.
|
|
81
|
-
// It is recall-oriented because the signal is the same facility under a different operational name.
|
|
82
|
-
// The dedup-calibrated GBT default rejects that pair.
|
|
83
|
-
const { entities } = resolveEntities(records, { trainEM: true, collapseSpatial: true, learnedScorer: false });
|
|
84
|
-
// Reconcile through the shared @mailwoman/registry code path, so the script and the CLI agree.
|
|
85
|
-
const config = { eligibilitySources: [...ELIGIBILITY], fundingSources: [...FUNDING] };
|
|
86
|
-
const result = reconcileCoverage(entities, config);
|
|
87
|
-
const geojson = reconciliationGeoJSON(result);
|
|
88
|
-
const md = reconciliationReport(result, {
|
|
89
|
-
title: "Coverage reconciliation — eligibility ↔ enrollment (#621)",
|
|
90
|
-
scopeNote: `Generated by \`mailwoman registry scorer-eval coverage-reconciliation\`. ${STATE}-scoped, ≤${CAP} rows per ` +
|
|
91
|
-
`source, resolved BLIND across sources. **Eligibility** = NPPES org NPIs + TX HHSC nursing facilities. ` +
|
|
92
|
-
`**Funding/enrollment** = FCC Rural Health Care filings. Each resolved entity is classified by which kinds ` +
|
|
93
|
-
`of source its records span.`,
|
|
94
|
-
scorerNote: `Scored with the Fellegi-Sunter baseline (\`learnedScorer: false\`): this is a cross-dataset eligibility ↔ ` +
|
|
95
|
-
`funding join (recall-oriented), so the dedup-calibrated GBT default (#603) — trained to reject the ` +
|
|
96
|
-
`"same place, different operational name" pattern that IS the cross-source signal — is pinned off. See #655.`,
|
|
97
|
-
sampleNote: `This is a **capped sample** (≤${CAP}/source), so "eligible, not enrolled" includes entities that ARE ` +
|
|
98
|
-
`enrolled in reality but whose funding record fell outside the sample — a **sampling artifact, not a ` +
|
|
99
|
-
`finding**. At full scale the anti-join tightens, but it is STILL only a set of candidates.`,
|
|
100
|
-
spotCheckLimit: 15,
|
|
101
|
-
});
|
|
102
|
-
console.log(md);
|
|
103
|
-
if (OUT_MD) {
|
|
104
|
-
await writeLocalFile(md, OUT_MD);
|
|
105
|
-
report?.(`[written] ${OUT_MD}`);
|
|
106
|
-
}
|
|
107
|
-
if (OUT_GEOJSON) {
|
|
108
|
-
await writeLocalJSONFile(geojson, OUT_GEOJSON);
|
|
109
|
-
report?.(`[written] ${OUT_GEOJSON} (${geojson.features.length} features)`);
|
|
110
|
-
}
|
|
111
|
-
return { markdown: md };
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=coverage-reconciliation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-reconciliation.js","sourceRoot":"","sources":["../../tools/coverage-reconciliation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,UAAU,GAIV,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAwCvD;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;AACxD,MAAM,OAAO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EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import type { EvalGeocoderFactory } from "#tools/eval-geocoder";
|
|
7
|
-
/**
|
|
8
|
-
* Options for {@linkcode crossDatasetCorrelation}.
|
|
9
|
-
*/
|
|
10
|
-
export interface CrossDatasetCorrelationOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Creates the geocoder that resolves the sampled rows.
|
|
13
|
-
*/
|
|
14
|
-
createGeocoder: EvalGeocoderFactory;
|
|
15
|
-
/**
|
|
16
|
-
* The record-matcher sources directory.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue `$MAILWOMAN_DATA_ROOT/record-matcher/sources`
|
|
19
|
-
*/
|
|
20
|
-
sources?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The number of in-state rows sampled per source for geocoding.
|
|
23
|
-
*
|
|
24
|
-
* @defaultValue `300`
|
|
25
|
-
*/
|
|
26
|
-
cap?: number;
|
|
27
|
-
/**
|
|
28
|
-
* The state filter.
|
|
29
|
-
*
|
|
30
|
-
* @defaultValue {@linkcode TX}
|
|
31
|
-
*/
|
|
32
|
-
state?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Whether to scan every in-state row to build a corpus-wide address-frequency table.
|
|
35
|
-
*
|
|
36
|
-
* The scan reads the full source files, including the multi-gigabyte NPPES file.
|
|
37
|
-
* When it is false, `resolveEntities` computes frequencies from the sample only.
|
|
38
|
-
*
|
|
39
|
-
* @defaultValue `true`
|
|
40
|
-
*/
|
|
41
|
-
corpusFrequency?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* An optional path for the Markdown report.
|
|
44
|
-
*/
|
|
45
|
-
outMd?: string;
|
|
46
|
-
/**
|
|
47
|
-
* An optional path for the entity GeoJSON FeatureCollection.
|
|
48
|
-
*/
|
|
49
|
-
outGeojson?: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Geocodes a sample of each source dataset in one state, resolves the records into entities across sources.
|
|
53
|
-
* It returns a Markdown report of the cross-source links.
|
|
54
|
-
*
|
|
55
|
-
* Progress lines go to `report`.
|
|
56
|
-
* The function also writes the report and GeoJSON when `outMd` or `outGeojson` is set.
|
|
57
|
-
*/
|
|
58
|
-
export declare function crossDatasetCorrelation(options: CrossDatasetCorrelationOptions, report?: (line: string) => void): Promise<{
|
|
59
|
-
markdown: string;
|
|
60
|
-
}>;
|
|
61
|
-
//# sourceMappingURL=dataset-correlation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataset-correlation.d.ts","sourceRoot":"","sources":["../../../tools/cross/dataset-correlation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAK/D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,cAAc,EAAE,mBAAmB,CAAA;IAEnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAkDD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,8BAA8B,EACvC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqP/B"}
|