@mailwoman/corpus 8.6.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/data/PROVENANCE.md +214 -0
- package/data/sub-venue-lexicon.json +18269 -0
- package/out/src/adapters/ban/adapter.d.ts +5 -4
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +62 -69
- package/out/src/adapters/ban/adapter.js.map +1 -1
- package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/ban/street-decompose.js +18 -25
- package/out/src/adapters/ban/street-decompose.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +1 -7
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +4 -26
- package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
- package/out/src/adapters/geonames/adapter.d.ts +1 -1
- package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames/adapter.js +72 -78
- package/out/src/adapters/geonames/adapter.js.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.js +46 -51
- package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
- package/out/src/adapters/gnaf/adapter.js +6 -9
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +7 -12
- package/out/src/adapters/gnaf/assemble.js.map +1 -1
- package/out/src/adapters/index.d.ts +1 -1
- package/out/src/adapters/index.d.ts.map +1 -1
- package/out/src/adapters/index.js +1 -1
- package/out/src/adapters/index.js.map +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/src/adapters/openaddresses/adapter.js +5 -10
- package/out/src/adapters/openaddresses/adapter.js.map +1 -1
- package/out/src/adapters/overture/adapter.d.ts +1 -1
- package/out/src/adapters/overture/adapter.d.ts.map +1 -1
- package/out/src/adapters/overture/adapter.js +5 -9
- package/out/src/adapters/overture/adapter.js.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.js +57 -75
- package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.js +60 -78
- package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.js +69 -87
- package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.js +71 -89
- package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.d.ts +3 -3
- package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.js +10 -18
- package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/src/adapters/tiger/adapter.d.ts +1 -1
- package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
- package/out/src/adapters/tiger/adapter.js +2 -2
- package/out/src/adapters/tiger/adapter.js.map +1 -1
- package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/tiger/street-decompose.js +18 -27
- package/out/src/adapters/tiger/street-decompose.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +4 -4
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +64 -82
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.js +62 -84
- package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.js +59 -66
- package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.js +6 -9
- package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.js +60 -78
- package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +53 -73
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/{adapter.d.ts → adapters/utils/index.d.ts} +43 -2
- package/out/src/adapters/utils/index.d.ts.map +1 -0
- package/out/src/{adapter.js → adapters/utils/index.js} +47 -2
- package/out/src/adapters/utils/index.js.map +1 -0
- package/out/src/adapters/wof-admin-jp/adapter.d.ts +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.js +24 -6
- package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.d.ts +2 -2
- package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.js +2 -2
- package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts +2 -2
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.js +2 -2
- package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
- package/out/src/build.d.ts +3 -4
- package/out/src/build.d.ts.map +1 -1
- package/out/src/build.js +6 -8
- package/out/src/build.js.map +1 -1
- package/out/src/index.d.ts +3 -17
- package/out/src/index.d.ts.map +1 -1
- package/out/src/index.js +3 -17
- package/out/src/index.js.map +1 -1
- package/out/src/name-prone-us-suffixes.d.ts +12 -0
- package/out/src/name-prone-us-suffixes.d.ts.map +1 -0
- package/out/src/name-prone-us-suffixes.js +12 -0
- package/out/src/name-prone-us-suffixes.js.map +1 -0
- package/out/src/parquet-wrapper/reader.d.ts +8 -0
- package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
- package/out/src/parquet-wrapper/reader.js +16 -0
- package/out/src/parquet-wrapper/reader.js.map +1 -1
- package/out/src/parquet-wrapper/schema.d.ts +4 -0
- package/out/src/parquet-wrapper/schema.d.ts.map +1 -1
- package/out/src/parquet-wrapper/schema.js.map +1 -1
- package/out/src/runner.d.ts +2 -2
- package/out/src/runner.d.ts.map +1 -1
- package/out/src/runner.js +1 -1
- package/out/src/runner.js.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.js +5 -4
- package/out/src/shard-recipes/anchor-absorption.js.map +1 -1
- package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -1
- package/out/src/shard-recipes/boundary-stress.js +2 -2
- package/out/src/shard-recipes/boundary-stress.js.map +1 -1
- package/out/src/shard-recipes/country-balanced.d.ts.map +1 -1
- package/out/src/shard-recipes/country-balanced.js +75 -75
- package/out/src/shard-recipes/country-balanced.js.map +1 -1
- package/out/src/shard-recipes/fr-admin-split.js +2 -2
- package/out/src/shard-recipes/fr-admin-split.js.map +1 -1
- package/out/src/shard-recipes/fr-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-fragment.js +8 -5
- package/out/src/shard-recipes/fr-fragment.js.map +1 -1
- package/out/src/shard-recipes/fr-lieudit.js +2 -2
- package/out/src/shard-recipes/fr-lieudit.js.map +1 -1
- package/out/src/shard-recipes/fr-order.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-order.js +18 -72
- package/out/src/shard-recipes/fr-order.js.map +1 -1
- package/out/src/shard-recipes/german.d.ts.map +1 -1
- package/out/src/shard-recipes/german.js +17 -70
- package/out/src/shard-recipes/german.js.map +1 -1
- package/out/src/shard-recipes/house-venue.d.ts.map +1 -1
- package/out/src/shard-recipes/house-venue.js +1 -1
- package/out/src/shard-recipes/house-venue.js.map +1 -1
- package/out/src/shard-recipes/index.d.ts.map +1 -1
- package/out/src/shard-recipes/index.js +4 -1
- package/out/src/shard-recipes/index.js.map +1 -1
- package/out/src/shard-recipes/intersection.d.ts +2 -2
- package/out/src/shard-recipes/intersection.d.ts.map +1 -1
- package/out/src/shard-recipes/intersection.js +28 -72
- package/out/src/shard-recipes/intersection.js.map +1 -1
- package/out/src/shard-recipes/locale.d.ts +5 -5
- package/out/src/shard-recipes/locale.d.ts.map +1 -1
- package/out/src/shard-recipes/locale.js +25 -35
- package/out/src/shard-recipes/locale.js.map +1 -1
- package/out/src/shard-recipes/no-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/no-fragment.js +8 -5
- package/out/src/shard-recipes/no-fragment.js.map +1 -1
- package/out/src/shard-recipes/no-street-led.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street-led.js +8 -5
- package/out/src/shard-recipes/no-street-led.js.map +1 -1
- package/out/src/shard-recipes/no-street.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street.js +1 -1
- package/out/src/shard-recipes/no-street.js.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.d.ts +3 -3
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.js +101 -127
- package/out/src/shard-recipes/po-box-cedex.js.map +1 -1
- package/out/src/shard-recipes/po-box.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box.js +1 -1
- package/out/src/shard-recipes/po-box.js.map +1 -1
- package/out/src/shard-recipes/scaffold.d.ts +58 -9
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
- package/out/src/shard-recipes/scaffold.js +87 -29
- package/out/src/shard-recipes/scaffold.js.map +1 -1
- package/out/src/shard-recipes/street-affix.d.ts +54 -0
- package/out/src/shard-recipes/street-affix.d.ts.map +1 -1
- package/out/src/shard-recipes/street-affix.js +253 -111
- package/out/src/shard-recipes/street-affix.js.map +1 -1
- package/out/src/shard-recipes/street-bare.d.ts.map +1 -1
- package/out/src/shard-recipes/street-bare.js +3 -3
- package/out/src/shard-recipes/street-bare.js.map +1 -1
- package/out/src/shard-recipes/street.d.ts.map +1 -1
- package/out/src/shard-recipes/street.js +2 -2
- package/out/src/shard-recipes/street.js.map +1 -1
- package/out/src/shard-recipes/sub-venue-sources.d.ts +228 -0
- package/out/src/shard-recipes/sub-venue-sources.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue-sources.js +664 -0
- package/out/src/shard-recipes/sub-venue-sources.js.map +1 -0
- package/out/src/shard-recipes/sub-venue.d.ts +269 -0
- package/out/src/shard-recipes/sub-venue.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue.js +709 -0
- package/out/src/shard-recipes/sub-venue.js.map +1 -0
- package/out/src/shard-recipes/unit.d.ts +1 -1
- package/out/src/shard-recipes/unit.d.ts.map +1 -1
- package/out/src/shard-recipes/unit.js +26 -74
- package/out/src/shard-recipes/unit.js.map +1 -1
- package/out/src/{synthesize-anchor-absorption.d.ts → synthesizers/anchor-absorption.d.ts} +1 -1
- package/out/src/synthesizers/anchor-absorption.d.ts.map +1 -0
- package/out/src/{synthesize-anchor-absorption.js → synthesizers/anchor-absorption.js} +1 -1
- package/out/src/synthesizers/anchor-absorption.js.map +1 -0
- package/out/src/{synthesize-boundary-stress.d.ts → synthesizers/boundary-stress.d.ts} +3 -3
- package/out/src/synthesizers/boundary-stress.d.ts.map +1 -0
- package/out/src/{synthesize-boundary-stress.js → synthesizers/boundary-stress.js} +2 -2
- package/out/src/synthesizers/boundary-stress.js.map +1 -0
- package/out/src/{synthesize-german.d.ts → synthesizers/german.d.ts} +2 -2
- package/out/src/synthesizers/german.d.ts.map +1 -0
- package/out/src/{synthesize-german.js → synthesizers/german.js} +2 -2
- package/out/src/synthesizers/german.js.map +1 -0
- package/out/src/{synthesize-house-venue.d.ts → synthesizers/house-venue.d.ts} +4 -4
- package/out/src/synthesizers/house-venue.d.ts.map +1 -0
- package/out/src/{synthesize-house-venue.js → synthesizers/house-venue.js} +4 -4
- package/out/src/synthesizers/house-venue.js.map +1 -0
- package/out/src/{synthesize-intersection.d.ts → synthesizers/intersection.d.ts} +2 -2
- package/out/src/synthesizers/intersection.d.ts.map +1 -0
- package/out/src/{synthesize-intersection.js → synthesizers/intersection.js} +1 -1
- package/out/src/synthesizers/intersection.js.map +1 -0
- package/out/src/{synthesize-no-street.d.ts → synthesizers/no-street.d.ts} +3 -3
- package/out/src/synthesizers/no-street.d.ts.map +1 -0
- package/out/src/{synthesize-no-street.js → synthesizers/no-street.js} +2 -2
- package/out/src/synthesizers/no-street.js.map +1 -0
- package/out/src/{synthesize-po-box.d.ts → synthesizers/po-box.d.ts} +2 -2
- package/out/src/synthesizers/po-box.d.ts.map +1 -0
- package/out/src/{synthesize-po-box.js → synthesizers/po-box.js} +1 -1
- package/out/src/synthesizers/po-box.js.map +1 -0
- package/out/src/{synthesize-street.d.ts → synthesizers/street.d.ts} +2 -2
- package/out/src/synthesizers/street.d.ts.map +1 -0
- package/out/src/{synthesize-street.js → synthesizers/street.js} +2 -2
- package/out/src/synthesizers/street.js.map +1 -0
- package/out/src/{synthesize.d.ts → synthesizers/utils.d.ts} +3 -3
- package/out/src/synthesizers/utils.d.ts.map +1 -0
- package/out/src/{synthesize.js → synthesizers/utils.js} +4 -15
- package/out/src/synthesizers/utils.js.map +1 -0
- package/out/src/tools/align-shard.d.ts.map +1 -1
- package/out/src/tools/align-shard.js +4 -8
- package/out/src/tools/align-shard.js.map +1 -1
- package/out/src/tools/audit.d.ts.map +1 -1
- package/out/src/tools/audit.js +4 -4
- package/out/src/tools/audit.js.map +1 -1
- package/out/src/tools/corpus-stats.d.ts +2 -2
- package/out/src/tools/corpus-stats.d.ts.map +1 -1
- package/out/src/tools/corpus-stats.js +18 -31
- package/out/src/tools/corpus-stats.js.map +1 -1
- package/out/src/tools/fetch/download.d.ts.map +1 -1
- package/out/src/tools/fetch/download.js +5 -6
- package/out/src/tools/fetch/download.js.map +1 -1
- package/out/src/tools/fetch/imls-pls.d.ts.map +1 -1
- package/out/src/tools/fetch/imls-pls.js +3 -15
- package/out/src/tools/fetch/imls-pls.js.map +1 -1
- package/out/src/tools/fetch/index.d.ts +14 -1
- package/out/src/tools/fetch/index.d.ts.map +1 -1
- package/out/src/tools/fetch/index.js +14 -1
- package/out/src/tools/fetch/index.js.map +1 -1
- package/out/src/tools/fetch/nad.d.ts +1 -1
- package/out/src/tools/fetch/nad.js +1 -1
- package/out/src/tools/fetch/nppes.d.ts.map +1 -1
- package/out/src/tools/fetch/nppes.js +8 -14
- package/out/src/tools/fetch/nppes.js.map +1 -1
- package/out/src/tools/fetch/openaddresses.d.ts +1 -1
- package/out/src/tools/fetch/openaddresses.js +1 -1
- package/out/src/tools/fetch/ourairports.d.ts +45 -0
- package/out/src/tools/fetch/ourairports.d.ts.map +1 -0
- package/out/src/tools/fetch/ourairports.js +123 -0
- package/out/src/tools/fetch/ourairports.js.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts +171 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.js +275 -0
- package/out/src/tools/fetch/wikidata-subvenue.js.map +1 -0
- package/out/src/tools/golden-expand.d.ts.map +1 -1
- package/out/src/tools/golden-expand.js +18 -16
- package/out/src/tools/golden-expand.js.map +1 -1
- package/out/src/tools/golden-promote.d.ts.map +1 -1
- package/out/src/tools/golden-promote.js +12 -6
- package/out/src/tools/golden-promote.js.map +1 -1
- package/out/src/tools/golden-relabel-street.d.ts +196 -0
- package/out/src/tools/golden-relabel-street.d.ts.map +1 -0
- package/out/src/tools/golden-relabel-street.js +440 -0
- package/out/src/tools/golden-relabel-street.js.map +1 -0
- package/out/src/tools/index.d.ts +4 -0
- package/out/src/tools/index.d.ts.map +1 -1
- package/out/src/tools/index.js +4 -0
- package/out/src/tools/index.js.map +1 -1
- package/out/src/tools/jsonl-to-parquet.d.ts.map +1 -1
- package/out/src/tools/jsonl-to-parquet.js +3 -2
- package/out/src/tools/jsonl-to-parquet.js.map +1 -1
- package/out/src/tools/lint-shard-vocab.d.ts.map +1 -1
- package/out/src/tools/lint-shard-vocab.js +3 -2
- package/out/src/tools/lint-shard-vocab.js.map +1 -1
- package/out/src/tools/lint-shard.d.ts +3 -3
- package/out/src/tools/lint-shard.d.ts.map +1 -1
- package/out/src/tools/lint-shard.js +23 -32
- package/out/src/tools/lint-shard.js.map +1 -1
- package/out/src/tools/overlay-manifest.d.ts.map +1 -1
- package/out/src/tools/overlay-manifest.js +2 -1
- package/out/src/tools/overlay-manifest.js.map +1 -1
- package/out/src/tools/overture-subvenue.d.ts +112 -0
- package/out/src/tools/overture-subvenue.d.ts.map +1 -0
- package/out/src/tools/overture-subvenue.js +144 -0
- package/out/src/tools/overture-subvenue.js.map +1 -0
- package/out/src/tools/shard-kryptonite.d.ts +1 -1
- package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
- package/out/src/tools/shard-kryptonite.js +6 -6
- package/out/src/tools/shard-kryptonite.js.map +1 -1
- package/out/src/tools/shard-translit.d.ts +6 -3
- package/out/src/tools/shard-translit.d.ts.map +1 -1
- package/out/src/tools/shard-translit.js +9 -8
- package/out/src/tools/shard-translit.js.map +1 -1
- package/out/src/tools/sub-venue-lexicon.d.ts +507 -0
- package/out/src/tools/sub-venue-lexicon.d.ts.map +1 -0
- package/out/src/tools/sub-venue-lexicon.js +817 -0
- package/out/src/tools/sub-venue-lexicon.js.map +1 -0
- package/out/src/tools/sub-venue-promotions.d.ts +94 -0
- package/out/src/tools/sub-venue-promotions.d.ts.map +1 -0
- package/out/src/tools/sub-venue-promotions.js +266 -0
- package/out/src/tools/sub-venue-promotions.js.map +1 -0
- package/out/src/{align.d.ts → utils/align.d.ts} +1 -1
- package/out/src/utils/align.d.ts.map +1 -0
- package/out/src/utils/align.js.map +1 -0
- package/out/src/{golden.d.ts → utils/golden.d.ts} +5 -0
- package/out/src/utils/golden.d.ts.map +1 -0
- package/out/src/{golden.js → utils/golden.js} +24 -10
- package/out/src/utils/golden.js.map +1 -0
- package/out/src/utils/index.d.ts +14 -0
- package/out/src/utils/index.d.ts.map +1 -0
- package/out/src/utils/index.js +14 -0
- package/out/src/utils/index.js.map +1 -0
- package/out/src/utils/license.d.ts.map +1 -0
- package/out/src/utils/license.js.map +1 -0
- package/out/src/{parquet.d.ts → utils/parquet.d.ts} +2 -2
- package/out/src/utils/parquet.d.ts.map +1 -0
- package/out/src/{parquet.js → utils/parquet.js} +3 -15
- package/out/src/utils/parquet.js.map +1 -0
- package/out/src/{split.d.ts → utils/split.d.ts} +8 -1
- package/out/src/utils/split.d.ts.map +1 -0
- package/out/src/{split.js → utils/split.js} +7 -0
- package/out/src/utils/split.js.map +1 -0
- package/out/src/utils/tokenize.d.ts.map +1 -0
- package/out/src/utils/tokenize.js.map +1 -0
- package/out/src/{wof-json.d.ts → utils/wof-json.d.ts} +2 -2
- package/out/src/utils/wof-json.d.ts.map +1 -0
- package/out/src/{wof-json.js → utils/wof-json.js} +5 -8
- package/out/src/utils/wof-json.js.map +1 -0
- package/package.json +66 -20
- package/src/adapters/ban/adapter.ts +58 -68
- package/src/adapters/ban/street-decompose.ts +17 -25
- package/src/adapters/fcc-bdc/adapter.ts +5 -36
- package/src/adapters/geonames/adapter.ts +67 -76
- package/src/adapters/geonames-postal/adapter.ts +45 -54
- package/src/adapters/gnaf/adapter.ts +7 -11
- package/src/adapters/gnaf/assemble.ts +7 -11
- package/src/adapters/index.ts +3 -2
- package/src/adapters/openaddresses/adapter.ts +6 -12
- package/src/adapters/overture/adapter.ts +6 -10
- package/src/adapters/state-hi-schools/adapter.ts +53 -77
- package/src/adapters/state-ia-contractors/adapter.ts +55 -80
- package/src/adapters/state-ny-notaries/adapter.ts +64 -89
- package/src/adapters/state-tx-notaries/adapter.ts +63 -88
- package/src/adapters/synth-po-box/adapter.ts +12 -23
- package/src/adapters/tiger/adapter.ts +4 -3
- package/src/adapters/tiger/street-decompose.ts +21 -31
- package/src/adapters/usgov-hrsa-fqhc/adapter.ts +64 -88
- package/src/adapters/usgov-imls-pls/adapter.ts +57 -86
- package/src/adapters/usgov-irs-bmf/adapter.ts +55 -66
- package/src/adapters/usgov-nad/adapter.ts +7 -11
- package/src/adapters/usgov-nppes/adapter.ts +54 -79
- package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +48 -75
- package/src/{adapter.ts → adapters/utils/index.ts} +59 -3
- package/src/adapters/wof-admin-jp/adapter.ts +35 -9
- package/src/adapters/wof-admin-json/adapter.ts +3 -4
- package/src/adapters/wof-postalcode-json/adapter.ts +3 -4
- package/src/build.ts +12 -11
- package/src/index.ts +3 -17
- package/src/name-prone-us-suffixes.ts +12 -0
- package/src/parquet-wrapper/reader.ts +19 -0
- package/src/parquet-wrapper/schema.ts +4 -0
- package/src/runner.ts +7 -2
- package/src/shard-recipes/anchor-absorption.ts +5 -4
- package/src/shard-recipes/boundary-stress.ts +6 -2
- package/src/shard-recipes/country-balanced.ts +77 -91
- package/src/shard-recipes/fr-admin-split.ts +3 -3
- package/src/shard-recipes/fr-fragment.ts +10 -7
- package/src/shard-recipes/fr-lieudit.ts +3 -3
- package/src/shard-recipes/fr-order.ts +18 -83
- package/src/shard-recipes/german.ts +17 -80
- package/src/shard-recipes/house-venue.ts +2 -1
- package/src/shard-recipes/index.ts +4 -1
- package/src/shard-recipes/intersection.ts +37 -74
- package/src/shard-recipes/locale.ts +31 -39
- package/src/shard-recipes/no-fragment.ts +10 -7
- package/src/shard-recipes/no-street-led.ts +10 -7
- package/src/shard-recipes/no-street.ts +2 -1
- package/src/shard-recipes/po-box-cedex.ts +127 -161
- package/src/shard-recipes/po-box.ts +6 -1
- package/src/shard-recipes/scaffold.ts +125 -27
- package/src/shard-recipes/street-affix.ts +335 -134
- package/src/shard-recipes/street-bare.ts +4 -3
- package/src/shard-recipes/street.ts +3 -2
- package/src/shard-recipes/sub-venue-sources.ts +895 -0
- package/src/shard-recipes/sub-venue.ts +982 -0
- package/src/shard-recipes/unit.ts +27 -85
- package/src/{synthesize-boundary-stress.ts → synthesizers/boundary-stress.ts} +2 -2
- package/src/{synthesize-german.ts → synthesizers/german.ts} +2 -2
- package/src/{synthesize-house-venue.ts → synthesizers/house-venue.ts} +4 -4
- package/src/{synthesize-intersection.ts → synthesizers/intersection.ts} +1 -1
- package/src/{synthesize-no-street.ts → synthesizers/no-street.ts} +2 -2
- package/src/{synthesize-po-box.ts → synthesizers/po-box.ts} +1 -1
- package/src/{synthesize-street.ts → synthesizers/street.ts} +2 -2
- package/src/{synthesize.ts → synthesizers/utils.ts} +4 -18
- package/src/tools/align-shard.ts +4 -7
- package/src/tools/audit.ts +6 -5
- package/src/tools/corpus-stats.ts +25 -33
- package/src/tools/fetch/download.ts +7 -5
- package/src/tools/fetch/imls-pls.ts +4 -18
- package/src/tools/fetch/index.ts +14 -1
- package/src/tools/fetch/nad.ts +1 -1
- package/src/tools/fetch/nppes.ts +9 -16
- package/src/tools/fetch/openaddresses.ts +1 -1
- package/src/tools/fetch/ourairports.ts +166 -0
- package/src/tools/fetch/wikidata-subvenue.ts +386 -0
- package/src/tools/golden-expand.ts +18 -13
- package/src/tools/golden-promote.ts +15 -6
- package/src/tools/golden-relabel-street.ts +685 -0
- package/src/tools/index.ts +4 -0
- package/src/tools/jsonl-to-parquet.ts +3 -2
- package/src/tools/lint-shard-vocab.ts +3 -2
- package/src/tools/lint-shard.ts +33 -36
- package/src/tools/overlay-manifest.ts +2 -1
- package/src/tools/overture-subvenue.ts +215 -0
- package/src/tools/shard-kryptonite.ts +8 -9
- package/src/tools/shard-translit.ts +22 -11
- package/src/tools/sub-venue-lexicon.ts +1250 -0
- package/src/tools/sub-venue-promotions.ts +330 -0
- package/src/{align.ts → utils/align.ts} +1 -1
- package/src/{golden.ts → utils/golden.ts} +25 -11
- package/src/utils/index.ts +14 -0
- package/src/{parquet.ts → utils/parquet.ts} +5 -19
- package/src/{split.ts → utils/split.ts} +8 -2
- package/src/{wof-json.ts → utils/wof-json.ts} +5 -8
- package/out/src/adapter.d.ts.map +0 -1
- package/out/src/adapter.js.map +0 -1
- package/out/src/align.d.ts.map +0 -1
- package/out/src/align.js.map +0 -1
- package/out/src/format.d.ts +0 -14
- package/out/src/format.d.ts.map +0 -1
- package/out/src/format.js +0 -14
- package/out/src/format.js.map +0 -1
- package/out/src/golden.d.ts.map +0 -1
- package/out/src/golden.js.map +0 -1
- package/out/src/license.d.ts.map +0 -1
- package/out/src/license.js.map +0 -1
- package/out/src/parquet.d.ts.map +0 -1
- package/out/src/parquet.js.map +0 -1
- package/out/src/split.d.ts.map +0 -1
- package/out/src/split.js.map +0 -1
- package/out/src/synthesize-anchor-absorption.d.ts.map +0 -1
- package/out/src/synthesize-anchor-absorption.js.map +0 -1
- package/out/src/synthesize-boundary-stress.d.ts.map +0 -1
- package/out/src/synthesize-boundary-stress.js.map +0 -1
- package/out/src/synthesize-german.d.ts.map +0 -1
- package/out/src/synthesize-german.js.map +0 -1
- package/out/src/synthesize-house-venue.d.ts.map +0 -1
- package/out/src/synthesize-house-venue.js.map +0 -1
- package/out/src/synthesize-intersection.d.ts.map +0 -1
- package/out/src/synthesize-intersection.js.map +0 -1
- package/out/src/synthesize-no-street.d.ts.map +0 -1
- package/out/src/synthesize-no-street.js.map +0 -1
- package/out/src/synthesize-po-box.d.ts.map +0 -1
- package/out/src/synthesize-po-box.js.map +0 -1
- package/out/src/synthesize-street.d.ts.map +0 -1
- package/out/src/synthesize-street.js.map +0 -1
- package/out/src/synthesize.d.ts.map +0 -1
- package/out/src/synthesize.js.map +0 -1
- package/out/src/tokenize.d.ts.map +0 -1
- package/out/src/tokenize.js.map +0 -1
- package/out/src/wof-json.d.ts.map +0 -1
- package/out/src/wof-json.js.map +0 -1
- package/src/format.ts +0 -14
- /package/out/src/{align.js → utils/align.js} +0 -0
- /package/out/src/{license.d.ts → utils/license.d.ts} +0 -0
- /package/out/src/{license.js → utils/license.js} +0 -0
- /package/out/src/{tokenize.d.ts → utils/tokenize.d.ts} +0 -0
- /package/out/src/{tokenize.js → utils/tokenize.js} +0 -0
- /package/src/{synthesize-anchor-absorption.ts → synthesizers/anchor-absorption.ts} +0 -0
- /package/src/{license.ts → utils/license.ts} +0 -0
- /package/src/{tokenize.ts → utils/tokenize.ts} +0 -0
|
@@ -18,14 +18,11 @@
|
|
|
18
18
|
* License: stamped `"Public Domain"` per IMLS federal government distribution terms.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
import { lookupStateAbbreviation } from "../../codex/us-fips-state.ts"
|
|
27
|
-
import { reconcileComponents } from "../../format.ts"
|
|
28
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
21
|
+
import { splitStreetLine, stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
22
|
+
import { lookupStateAbbreviation } from "@mailwoman/corpus/codex/us-fips-state"
|
|
23
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
24
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
25
|
+
import { CSVSpliterator } from "spliterator"
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
@@ -38,8 +35,6 @@ export const USGOV_IMLS_PLS_ADAPTER_ID = "usgov-imls-pls"
|
|
|
38
35
|
*/
|
|
39
36
|
export const USGOV_IMLS_PLS_DEFAULT_LICENSE = "Public Domain"
|
|
40
37
|
|
|
41
|
-
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/
|
|
42
|
-
|
|
43
38
|
interface ImlsOutletRow {
|
|
44
39
|
LIBNAME: string
|
|
45
40
|
ADDRESS: string
|
|
@@ -50,17 +45,6 @@ interface ImlsOutletRow {
|
|
|
50
45
|
FSCSKEY: string
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
function splitAddress(address: string): { house_number?: string; street: string } | null {
|
|
54
|
-
const trimmed = address.trim()
|
|
55
|
-
|
|
56
|
-
if (!trimmed) return null
|
|
57
|
-
const m = HOUSE_NUMBER_PREFIX.exec(trimmed)
|
|
58
|
-
|
|
59
|
-
if (m) return { house_number: m[1], street: m[2]!.trim() }
|
|
60
|
-
|
|
61
|
-
return { street: trimmed }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
48
|
export function createUsgovImlsPlsAdapter(): CorpusAdapter {
|
|
65
49
|
return {
|
|
66
50
|
id: USGOV_IMLS_PLS_ADAPTER_ID,
|
|
@@ -72,90 +56,77 @@ export function createUsgovImlsPlsAdapter(): CorpusAdapter {
|
|
|
72
56
|
throw new Error(`usgov-imls-pls adapter: only US supported, got country=${opts.country}`)
|
|
73
57
|
}
|
|
74
58
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
skip_empty_lines: true,
|
|
81
|
-
relax_quotes: true,
|
|
82
|
-
relax_column_count: true,
|
|
83
|
-
})
|
|
84
|
-
)
|
|
59
|
+
const rows = CSVSpliterator.fromAsync(opts.inputPath, {
|
|
60
|
+
mode: "object",
|
|
61
|
+
normalizeKeys: false,
|
|
62
|
+
enableQuoteHandling: true,
|
|
63
|
+
})
|
|
85
64
|
|
|
86
65
|
let emitted = 0
|
|
87
66
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (opts.signal?.aborted) break
|
|
67
|
+
for await (const record of rows as AsyncIterable<ImlsOutletRow>) {
|
|
68
|
+
if (opts.signal?.aborted) break
|
|
91
69
|
|
|
92
|
-
|
|
70
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
93
71
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
72
|
+
const libName = (record.LIBNAME ?? "").trim()
|
|
73
|
+
const address = (record.ADDRESS ?? "").trim()
|
|
74
|
+
const city = (record.CITY ?? "").trim()
|
|
75
|
+
const zip = (record.ZIP ?? "").trim()
|
|
76
|
+
const stateAbbr = (record.STABR ?? "").trim()
|
|
77
|
+
const county = (record.CNTY ?? "").trim()
|
|
100
78
|
|
|
101
|
-
|
|
79
|
+
if (!libName || !city || !zip) continue
|
|
102
80
|
|
|
103
|
-
|
|
81
|
+
const state = lookupStateAbbreviation(stateAbbr)
|
|
104
82
|
|
|
105
|
-
|
|
83
|
+
if (!state) continue
|
|
106
84
|
|
|
107
|
-
|
|
85
|
+
const split = splitStreetLine(address)
|
|
108
86
|
|
|
109
|
-
|
|
87
|
+
if (!split) continue
|
|
110
88
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const streetPart = [split.house_number, split.street].filter(Boolean).join(" ").trim()
|
|
89
|
+
const components: CanonicalRow["components"] = {
|
|
90
|
+
venue: libName,
|
|
91
|
+
...(split.house_number ? { house_number: split.house_number } : {}),
|
|
92
|
+
street: split.street,
|
|
93
|
+
locality: city,
|
|
94
|
+
region: state.abbreviation,
|
|
95
|
+
postcode: zip,
|
|
96
|
+
// #552: no subregion — US postal addresses don't surface the county, so emitting
|
|
97
|
+
// subregion creates a phantom component with no raw-span to align to, quarantining
|
|
98
|
+
// ~21% of rows. The county is still available in the source CSV; it just isn't
|
|
99
|
+
// a postal-surface component here.
|
|
100
|
+
}
|
|
125
101
|
|
|
126
|
-
|
|
127
|
-
libName,
|
|
128
|
-
streetPart,
|
|
129
|
-
[city, [stateAbbr, zip].filter(Boolean).join(" ")].filter(Boolean).join(", "),
|
|
130
|
-
]
|
|
131
|
-
.filter(Boolean)
|
|
132
|
-
.join(", ")
|
|
102
|
+
const streetPart = [split.house_number, split.street].filter(Boolean).join(" ").trim()
|
|
133
103
|
|
|
134
|
-
|
|
104
|
+
const raw = [libName, streetPart, [city, [stateAbbr, zip].filter(Boolean).join(" ")].filter(Boolean).join(", ")]
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join(", ")
|
|
135
107
|
|
|
136
|
-
|
|
108
|
+
const aligned = reconcileComponents(components, raw)
|
|
137
109
|
|
|
138
|
-
|
|
110
|
+
if (Object.keys(aligned).length <= 2) continue
|
|
139
111
|
|
|
140
|
-
|
|
141
|
-
? `${USGOV_IMLS_PLS_ADAPTER_ID}-${fscsKey}`
|
|
142
|
-
: stableSourceID(USGOV_IMLS_PLS_ADAPTER_ID, aligned)
|
|
112
|
+
const fscsKey = (record.FSCSKEY ?? "").trim()
|
|
143
113
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
country: "US",
|
|
148
|
-
locale: "en-US",
|
|
149
|
-
source: USGOV_IMLS_PLS_ADAPTER_ID,
|
|
150
|
-
source_id: sourceID,
|
|
151
|
-
corpus_version: "",
|
|
152
|
-
license: USGOV_IMLS_PLS_DEFAULT_LICENSE,
|
|
153
|
-
}
|
|
114
|
+
const sourceID = fscsKey
|
|
115
|
+
? `${USGOV_IMLS_PLS_ADAPTER_ID}-${fscsKey}`
|
|
116
|
+
: stableSourceID(USGOV_IMLS_PLS_ADAPTER_ID, aligned)
|
|
154
117
|
|
|
155
|
-
|
|
118
|
+
yield {
|
|
119
|
+
raw,
|
|
120
|
+
components: aligned,
|
|
121
|
+
country: "US",
|
|
122
|
+
locale: "en-US",
|
|
123
|
+
source: USGOV_IMLS_PLS_ADAPTER_ID,
|
|
124
|
+
source_id: sourceID,
|
|
125
|
+
corpus_version: "",
|
|
126
|
+
license: USGOV_IMLS_PLS_DEFAULT_LICENSE,
|
|
156
127
|
}
|
|
157
|
-
|
|
158
|
-
|
|
128
|
+
|
|
129
|
+
emitted++
|
|
159
130
|
}
|
|
160
131
|
},
|
|
161
132
|
}
|
|
@@ -19,13 +19,10 @@
|
|
|
19
19
|
* federal).
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
import { stableSourceID } from "../../adapter.ts"
|
|
27
|
-
import { reconcileComponents } from "../../format.ts"
|
|
28
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
22
|
+
import { splitStreetLine, stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
23
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
24
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
25
|
+
import { CSVSpliterator } from "spliterator"
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
@@ -38,7 +35,6 @@ export const USGOV_IRS_BMF_ADAPTER_ID = "usgov-irs-bmf"
|
|
|
38
35
|
*/
|
|
39
36
|
export const USGOV_IRS_BMF_DEFAULT_LICENSE = "Public Domain"
|
|
40
37
|
|
|
41
|
-
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/
|
|
42
38
|
/**
|
|
43
39
|
* PO box in its many written forms: "PO BOX 12", "P.O. BOX 12", "P O BOX 12", "POB 12", "BOX 12".
|
|
44
40
|
*/
|
|
@@ -55,18 +51,17 @@ interface IrsBmfRow {
|
|
|
55
51
|
|
|
56
52
|
/**
|
|
57
53
|
* Classify the street line into a `po_box` or a `{house_number?, street}` split.
|
|
54
|
+
*
|
|
55
|
+
* BMF mixes street addresses and PO boxes in one `STREET` column, so the PO-box shapes have to be claimed BEFORE the
|
|
56
|
+
* shared house-number split runs — otherwise `splitStreetLine` would hand back `"PO Box 1234"` as a plain street, which
|
|
57
|
+
* is correct for every other US adapter and wrong here.
|
|
58
58
|
*/
|
|
59
|
-
function
|
|
59
|
+
function splitStreetLineOrPOBox(street: string): { po_box: string } | { house_number?: string; street: string } | null {
|
|
60
60
|
const trimmed = street.trim()
|
|
61
61
|
|
|
62
|
-
if (!trimmed) return null
|
|
63
|
-
|
|
64
62
|
if (PO_BOX.test(trimmed)) return { po_box: trimmed }
|
|
65
|
-
const m = HOUSE_NUMBER_PREFIX.exec(trimmed)
|
|
66
|
-
|
|
67
|
-
if (m) return { house_number: m[1], street: m[2]!.trim() }
|
|
68
63
|
|
|
69
|
-
return
|
|
64
|
+
return splitStreetLine(trimmed)
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
function composeRaw(
|
|
@@ -93,74 +88,68 @@ export function createUsgovIrsBmfAdapter(): CorpusAdapter {
|
|
|
93
88
|
throw new Error(`usgov-irs-bmf adapter: only US supported, got country=${opts.country}`)
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
91
|
+
const rows = CSVSpliterator.fromAsync(opts.inputPath, {
|
|
92
|
+
mode: "object",
|
|
93
|
+
normalizeKeys: false,
|
|
94
|
+
enableQuoteHandling: true,
|
|
95
|
+
})
|
|
101
96
|
|
|
102
97
|
let emitted = 0
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (opts.signal?.aborted) break
|
|
107
|
-
|
|
108
|
-
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
99
|
+
for await (const record of rows as AsyncIterable<IrsBmfRow>) {
|
|
100
|
+
if (opts.signal?.aborted) break
|
|
109
101
|
|
|
110
|
-
|
|
111
|
-
const venue = (record.NAME ?? "").trim() || undefined
|
|
112
|
-
const street = (record.STREET ?? "").trim()
|
|
113
|
-
const city = (record.CITY ?? "").trim()
|
|
114
|
-
const state = (record.STATE ?? "").trim()
|
|
115
|
-
const zipRaw = (record.ZIP ?? "").trim()
|
|
102
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
116
103
|
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
const ein = (record.EIN ?? "").trim()
|
|
105
|
+
const venue = (record.NAME ?? "").trim() || undefined
|
|
106
|
+
const street = (record.STREET ?? "").trim()
|
|
107
|
+
const city = (record.CITY ?? "").trim()
|
|
108
|
+
const state = (record.STATE ?? "").trim()
|
|
109
|
+
const zipRaw = (record.ZIP ?? "").trim()
|
|
119
110
|
|
|
120
|
-
|
|
111
|
+
if (!city || !zipRaw) continue
|
|
112
|
+
const postcode = zipRaw.split("-")[0]!.trim() // 5-digit; drop the optional +4
|
|
121
113
|
|
|
122
|
-
|
|
114
|
+
const split = splitStreetLineOrPOBox(street)
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
"po_box" in split ? split.po_box : [split.house_number, split.street].filter(Boolean).join(" ")
|
|
116
|
+
if (!split) continue
|
|
126
117
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
...("po_box" in split
|
|
130
|
-
? { po_box: split.po_box }
|
|
131
|
-
: { ...(split.house_number ? { house_number: split.house_number } : {}), street: split.street }),
|
|
132
|
-
locality: city,
|
|
133
|
-
...(state ? { region: state } : {}),
|
|
134
|
-
postcode,
|
|
135
|
-
}
|
|
118
|
+
const streetPart =
|
|
119
|
+
"po_box" in split ? split.po_box : [split.house_number, split.street].filter(Boolean).join(" ")
|
|
136
120
|
|
|
137
|
-
|
|
121
|
+
const components: CanonicalRow["components"] = {
|
|
122
|
+
...(venue ? { venue } : {}),
|
|
123
|
+
...("po_box" in split
|
|
124
|
+
? { po_box: split.po_box }
|
|
125
|
+
: { ...(split.house_number ? { house_number: split.house_number } : {}), street: split.street }),
|
|
126
|
+
locality: city,
|
|
127
|
+
...(state ? { region: state } : {}),
|
|
128
|
+
postcode,
|
|
129
|
+
}
|
|
138
130
|
|
|
139
|
-
|
|
131
|
+
const raw = composeRaw(venue, streetPart, city, state, postcode)
|
|
140
132
|
|
|
141
|
-
|
|
133
|
+
if (!raw) continue
|
|
142
134
|
|
|
143
|
-
|
|
135
|
+
const aligned = reconcileComponents(components, raw)
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
? `${USGOV_IRS_BMF_ADAPTER_ID}-${ein}`
|
|
147
|
-
: stableSourceID(USGOV_IRS_BMF_ADAPTER_ID, aligned)
|
|
137
|
+
if (Object.keys(aligned).length <= 2) continue
|
|
148
138
|
|
|
149
|
-
|
|
150
|
-
raw,
|
|
151
|
-
components: aligned,
|
|
152
|
-
country: "US",
|
|
153
|
-
locale: "en-US",
|
|
154
|
-
source: USGOV_IRS_BMF_ADAPTER_ID,
|
|
155
|
-
source_id: sourceID,
|
|
156
|
-
corpus_version: "",
|
|
157
|
-
license: USGOV_IRS_BMF_DEFAULT_LICENSE,
|
|
158
|
-
}
|
|
139
|
+
const sourceID = ein ? `${USGOV_IRS_BMF_ADAPTER_ID}-${ein}` : stableSourceID(USGOV_IRS_BMF_ADAPTER_ID, aligned)
|
|
159
140
|
|
|
160
|
-
|
|
141
|
+
yield {
|
|
142
|
+
raw,
|
|
143
|
+
components: aligned,
|
|
144
|
+
country: "US",
|
|
145
|
+
locale: "en-US",
|
|
146
|
+
source: USGOV_IRS_BMF_ADAPTER_ID,
|
|
147
|
+
source_id: sourceID,
|
|
148
|
+
corpus_version: "",
|
|
149
|
+
license: USGOV_IRS_BMF_DEFAULT_LICENSE,
|
|
161
150
|
}
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
|
|
152
|
+
emitted++
|
|
164
153
|
}
|
|
165
154
|
},
|
|
166
155
|
}
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
import { readdir } from "node:fs/promises"
|
|
34
34
|
import { join } from "node:path"
|
|
35
35
|
|
|
36
|
+
import { tryParsingJSON } from "@mailwoman/core/objects"
|
|
37
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
38
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
36
39
|
import { TextSpliterator } from "spliterator"
|
|
37
40
|
|
|
38
|
-
import { reconcileComponents } from "../../format.ts"
|
|
39
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
40
|
-
|
|
41
41
|
/**
|
|
42
42
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
43
43
|
* it came from.
|
|
@@ -257,8 +257,8 @@ export function createUsgovNADAdapter(): CorpusAdapter {
|
|
|
257
257
|
let emitted = 0
|
|
258
258
|
outer: for (const shard of shards) {
|
|
259
259
|
if (opts.signal?.aborted) break
|
|
260
|
-
// TextSpliterator streams string lines; the per-line
|
|
261
|
-
// tolerant of malformed rows (skip silently), so TextSpliterator +
|
|
260
|
+
// TextSpliterator streams string lines; the per-line tryParsingJSON below keeps the reader
|
|
261
|
+
// tolerant of malformed rows (skip silently), so TextSpliterator + a non-throwing parse —
|
|
262
262
|
// not JSONSpliterator, which would throw. The path string lets the lib own + dispose each
|
|
263
263
|
// shard's file handle, including on the `break outer` early exit.
|
|
264
264
|
const lines = TextSpliterator.fromAsync(join(opts.inputPath, shard))
|
|
@@ -270,13 +270,9 @@ export function createUsgovNADAdapter(): CorpusAdapter {
|
|
|
270
270
|
|
|
271
271
|
if (!line) continue
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
const record = tryParsingJSON<NADRecord>(line)
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
record = JSON.parse(line) as NADRecord
|
|
277
|
-
} catch {
|
|
278
|
-
continue // malformed line — skip silently
|
|
279
|
-
}
|
|
275
|
+
if (record === null) continue // malformed line — skip silently
|
|
280
276
|
|
|
281
277
|
const state = (record.State ?? "").toString().trim().toUpperCase()
|
|
282
278
|
|
|
@@ -21,14 +21,11 @@
|
|
|
21
21
|
* License: stamped `"Public Domain"` per CMS's federal government distribution terms.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
import { lookupStateAbbreviation } from "../../codex/us-fips-state.ts"
|
|
30
|
-
import { reconcileComponents } from "../../format.ts"
|
|
31
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
24
|
+
import { splitStreetLine, stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
25
|
+
import { lookupStateAbbreviation } from "@mailwoman/corpus/codex/us-fips-state"
|
|
26
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
27
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
28
|
+
import { CSVSpliterator } from "spliterator"
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
@@ -41,8 +38,6 @@ export const USGOV_NPPES_ADAPTER_ID = "usgov-nppes"
|
|
|
41
38
|
*/
|
|
42
39
|
export const USGOV_NPPES_DEFAULT_LICENSE = "Public Domain"
|
|
43
40
|
|
|
44
|
-
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/
|
|
45
|
-
|
|
46
41
|
interface NPPESRow {
|
|
47
42
|
NPI: string
|
|
48
43
|
"Entity Type Code": string
|
|
@@ -56,17 +51,6 @@ interface NPPESRow {
|
|
|
56
51
|
"Provider Business Practice Location Address Postal Code": string
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
function splitAddress(address: string): { house_number?: string; street: string } | null {
|
|
60
|
-
const trimmed = address.trim()
|
|
61
|
-
|
|
62
|
-
if (!trimmed) return null
|
|
63
|
-
const m = HOUSE_NUMBER_PREFIX.exec(trimmed)
|
|
64
|
-
|
|
65
|
-
if (m) return { house_number: m[1], street: m[2]!.trim() }
|
|
66
|
-
|
|
67
|
-
return { street: trimmed }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
54
|
function composeRaw(
|
|
71
55
|
venue: string | undefined,
|
|
72
56
|
house: string | undefined,
|
|
@@ -93,84 +77,75 @@ export function createUsgovNPPESAdapter(): CorpusAdapter {
|
|
|
93
77
|
throw new Error(`usgov-nppes adapter: only US supported, got country=${opts.country}`)
|
|
94
78
|
}
|
|
95
79
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
skip_empty_lines: true,
|
|
102
|
-
relax_quotes: true,
|
|
103
|
-
relax_column_count: true,
|
|
104
|
-
})
|
|
105
|
-
)
|
|
80
|
+
const rows = CSVSpliterator.fromAsync(opts.inputPath, {
|
|
81
|
+
mode: "object",
|
|
82
|
+
normalizeKeys: false,
|
|
83
|
+
enableQuoteHandling: true,
|
|
84
|
+
})
|
|
106
85
|
|
|
107
86
|
let emitted = 0
|
|
108
87
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (opts.signal?.aborted) break
|
|
88
|
+
for await (const record of rows as AsyncIterable<NPPESRow>) {
|
|
89
|
+
if (opts.signal?.aborted) break
|
|
112
90
|
|
|
113
|
-
|
|
91
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
114
92
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
const npi = (record.NPI ?? "").trim()
|
|
94
|
+
const entityType = (record["Entity Type Code"] ?? "").trim()
|
|
95
|
+
const orgName = (record["Provider Organization Name (Legal Business Name)"] ?? "").trim()
|
|
96
|
+
const lastName = (record["Provider Last Name (Legal Name)"] ?? "").trim()
|
|
97
|
+
const firstName = (record["Provider First Name"] ?? "").trim()
|
|
120
98
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
99
|
+
const address1 = (record["Provider First Line Business Practice Location Address"] ?? "").trim()
|
|
100
|
+
const address2 = (record["Provider Second Line Business Practice Location Address"] ?? "").trim()
|
|
101
|
+
const city = (record["Provider Business Practice Location Address City Name"] ?? "").trim()
|
|
102
|
+
const stateRaw = (record["Provider Business Practice Location Address State Name"] ?? "").trim()
|
|
103
|
+
const postcode = (record["Provider Business Practice Location Address Postal Code"] ?? "").trim()
|
|
126
104
|
|
|
127
|
-
|
|
105
|
+
if (!city || !postcode) continue
|
|
128
106
|
|
|
129
|
-
|
|
107
|
+
const state = lookupStateAbbreviation(stateRaw)
|
|
130
108
|
|
|
131
|
-
|
|
109
|
+
if (!state) continue
|
|
132
110
|
|
|
133
|
-
|
|
134
|
-
|
|
111
|
+
const fullStreet = [address1, address2].filter(Boolean).join(" ")
|
|
112
|
+
const split = splitStreetLine(fullStreet)
|
|
135
113
|
|
|
136
|
-
|
|
114
|
+
if (!split) continue
|
|
137
115
|
|
|
138
|
-
|
|
116
|
+
const venue = orgName || [firstName, lastName].filter(Boolean).join(" ") || undefined
|
|
139
117
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const raw = composeRaw(venue, split.house_number, split.street, city, state.abbreviation, postcode)
|
|
118
|
+
const components: CanonicalRow["components"] = {
|
|
119
|
+
...(venue ? { venue } : {}),
|
|
120
|
+
...(split.house_number ? { house_number: split.house_number } : {}),
|
|
121
|
+
street: split.street,
|
|
122
|
+
locality: city,
|
|
123
|
+
region: state.abbreviation,
|
|
124
|
+
postcode,
|
|
125
|
+
}
|
|
150
126
|
|
|
151
|
-
|
|
127
|
+
const raw = composeRaw(venue, split.house_number, split.street, city, state.abbreviation, postcode)
|
|
152
128
|
|
|
153
|
-
|
|
129
|
+
if (!raw) continue
|
|
154
130
|
|
|
155
|
-
|
|
131
|
+
const aligned = reconcileComponents(components, raw)
|
|
156
132
|
|
|
157
|
-
|
|
133
|
+
if (Object.keys(aligned).length <= 2) continue
|
|
158
134
|
|
|
159
|
-
|
|
160
|
-
raw,
|
|
161
|
-
components: aligned,
|
|
162
|
-
country: "US",
|
|
163
|
-
locale: "en-US",
|
|
164
|
-
source: USGOV_NPPES_ADAPTER_ID,
|
|
165
|
-
source_id: sourceID,
|
|
166
|
-
corpus_version: "",
|
|
167
|
-
license: USGOV_NPPES_DEFAULT_LICENSE,
|
|
168
|
-
}
|
|
135
|
+
const sourceID = npi ? `${USGOV_NPPES_ADAPTER_ID}-${npi}` : stableSourceID(USGOV_NPPES_ADAPTER_ID, aligned)
|
|
169
136
|
|
|
170
|
-
|
|
137
|
+
yield {
|
|
138
|
+
raw,
|
|
139
|
+
components: aligned,
|
|
140
|
+
country: "US",
|
|
141
|
+
locale: "en-US",
|
|
142
|
+
source: USGOV_NPPES_ADAPTER_ID,
|
|
143
|
+
source_id: sourceID,
|
|
144
|
+
corpus_version: "",
|
|
145
|
+
license: USGOV_NPPES_DEFAULT_LICENSE,
|
|
171
146
|
}
|
|
172
|
-
|
|
173
|
-
|
|
147
|
+
|
|
148
|
+
emitted++
|
|
174
149
|
}
|
|
175
150
|
},
|
|
176
151
|
}
|