@mailwoman/corpus 11.1.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -14
- package/data/address-source-register.json +618 -13
- package/data/builds/v0.8.19-overlay/OVERLAY_PLAN.json +4778 -0
- package/data/builds/v0.8.19-rebuild/inputs.json +128 -0
- package/data/builds/v0.8.20-overlay/OVERLAY_PLAN.json +3595 -0
- package/data/builds/v0.8.20-rebuild/inputs.json +131 -0
- package/data/builds/v0.8.21-overlay/OVERLAY_PLAN.json +72 -0
- package/data/corpus-source-inputs.json +104 -2
- package/data/holdout/evaluation-groups.v0.8.18.json +90511 -0
- package/data/holdout/evaluation-groups.v0.8.19.json +100537 -0
- package/data/holdout/evaluation-groups.v0.8.20.json +129215 -0
- package/data/holdout/evaluation-groups.v0.8.21.json +173286 -0
- package/data/holdout/probe-text-collisions.v0.8.20.json +1478 -0
- package/data/license-decisions.json +393 -3
- package/data/licenses/PROVENANCE.md +15 -9
- package/data/licenses/au-acnc-cc-by-3.0-au.md +37 -0
- package/data/licenses/es-sanidad-aviso-legal.md +26 -0
- package/data/licenses/it-miur-iodl-2.0.md +41 -0
- package/data/licenses/nz-charities-cc-by-3.0-nz.md +36 -0
- package/data/region-slot-second-level.json +966 -0
- package/data/source-additions.json +126 -6
- package/data/source-resolutions.json +97 -0
- package/data/training-configs/v8.7.0-base-c6-90k-usgs-structures-s42.yaml +801 -0
- package/data/training-configs/v8.7.0-base-c6-90k-usgs-structures-s43.yaml +726 -0
- package/data/training-configs/v8.8.0-base-c6-90k-v0820-county-s42.yaml +944 -0
- package/data/training-configs/v8.9.0-base-c6-90k-v0821-s42.yaml +848 -0
- package/data/training-manifests/v0.8.19-retention-overlay.json +4553 -0
- package/data/training-manifests/v0.8.20-retention-overlay.json +4579 -0
- package/data/training-manifests/v0.8.21-retention-overlay.effective.json +2521 -0
- package/data/training-manifests/v0.8.21-retention-overlay.json +4579 -0
- package/lib/adapters/cordis/adapter.ts +10 -2
- package/lib/adapters/gleif/adapter.ts +23 -5
- package/lib/adapters/osm/adapter.ts +2 -2
- package/lib/adapters/street/repetition.ts +87 -0
- package/lib/adapters/street/unit.ts +14 -0
- package/lib/adapters/wof/admin/json/adapter.ts +34 -21
- package/lib/adapters/wof/admin/json/dual-role.ts +274 -0
- package/lib/adapters/wof/admin/json/explore.ts +4 -4
- package/lib/adapters/wof/admin/json/region-codes.ts +74 -3
- package/lib/adapters/wof/json-rows.ts +36 -21
- package/lib/adapters/wof/postalcode-json/adapter.ts +10 -28
- package/lib/adapters/wof/sample.ts +15 -3
- package/lib/adapters/wof/stored-records.ts +162 -0
- package/lib/adapters.ts +18 -6
- package/lib/au/adapters/acnc-register/adapter.ts +40 -0
- package/lib/au/evaluation/acnc-register.ts +144 -0
- package/lib/build/align/range.ts +9 -0
- package/lib/build/align/totals.ts +23 -0
- package/lib/build/align.ts +74 -4
- package/lib/build/budget.ts +11 -45
- package/lib/build/checkpoint.ts +11 -0
- package/lib/build/component-check.ts +99 -3
- package/lib/build/manifest.ts +4 -0
- package/lib/build/parallel.ts +8 -34
- package/lib/build/region-names.ts +609 -0
- package/lib/build/source-record.ts +7 -0
- package/lib/build/types.ts +20 -0
- package/lib/build/worker.ts +3 -1
- package/lib/build.ts +3 -6
- package/lib/de/recipes/locale.ts +3 -2
- package/lib/env.ts +0 -6
- package/lib/es/adapters/sanidad-centros-ap/adapter.ts +40 -0
- package/lib/es/evaluation/sanidad-centros-ap.ts +164 -0
- package/lib/evaluation/corpus-adapter.ts +153 -0
- package/lib/evaluation/source.ts +209 -0
- package/lib/evaluation/sources.ts +25 -0
- package/lib/fr/adapters/laposte-poincont/adapter.ts +381 -0
- package/lib/fr/recipes/unit-line-guideline.ts +9 -4
- package/lib/fr/structures/laposte.ts +139 -0
- package/lib/fr/tools/fetch/laposte-poincont.ts +234 -0
- package/lib/it/adapters/miur-scuole/adapter.ts +39 -0
- package/lib/it/evaluation/miur-scuole.ts +125 -0
- package/lib/jp/adapters/wof-admin/adapter.ts +4 -4
- package/lib/nc/adapters/opt-nc/adapter.ts +237 -0
- package/lib/nc/structures/opt-nc.ts +101 -0
- package/lib/nc/tools/fetch/opt-nc.ts +249 -0
- package/lib/nz/adapters/charities-register/adapter.ts +40 -0
- package/lib/nz/evaluation/charities-register.ts +149 -0
- package/lib/recipes/bare/postcode.ts +14 -11
- package/lib/recipes/deepseek/batches.ts +8 -8
- package/lib/recipes/po/box/cedex/recipe.ts +12 -1
- package/lib/recipes/po/box/cedex/us.ts +43 -2
- package/lib/recipes/scaffold.ts +1 -1
- package/lib/recipes/sources.ts +16 -0
- package/lib/recipes.ts +2 -0
- package/lib/registers.ts +28 -2
- package/lib/{post-offices → structures}/source.ts +49 -16
- package/lib/structures/sources.ts +26 -0
- package/lib/synthesizers/house-venue.ts +11 -6
- package/lib/synthesizers/tail.ts +27 -3
- package/lib/tools/audit.ts +1 -1
- package/lib/tools/fetch/storage.ts +18 -4
- package/lib/tools/fetch.ts +10 -2
- package/lib/tools/overlay/kryptonite.ts +6 -2
- package/lib/tools/overlay/split/attribute.ts +14 -2
- package/lib/tools/overlay/split/overlay.ts +36 -7
- package/lib/tools/postcode/triples.ts +3 -3
- package/lib/tools/region-slot-census.run.ts +184 -0
- package/lib/training/config/load.ts +19 -0
- package/lib/training/config/schema.ts +6 -0
- package/lib/tw/registers.ts +15 -4
- package/lib/tw/structures/chunghwa-post.ts +191 -0
- package/lib/tw/tools/fetch/chunghwa-post.ts +174 -0
- package/lib/us/adapters/state/ny-notaries/adapter.ts +7 -2
- package/lib/us/adapters/state/tx-notaries/adapter.ts +126 -21
- package/lib/us/adapters/usgov/nad/adapter.ts +111 -31
- package/lib/us/adapters/usgov/nppes/adapter.ts +8 -11
- package/lib/us/adapters/usgov/{usgs-post-offices → usgs-structures}/adapter.ts +65 -35
- package/lib/us/recipes/county.ts +474 -0
- package/lib/us/street-unit.ts +15 -5
- package/lib/us/structures/usgs/layers.ts +171 -0
- package/lib/us/structures/usgs/national-map.ts +95 -0
- package/lib/us/tools/fetch/usgs/gnis.ts +288 -0
- package/lib/us/tools/fetch/usgs/structures.ts +362 -0
- package/lib/utils/align.ts +2 -2
- package/lib/utils/evaluation-groups.ts +172 -0
- package/lib/utils/split.ts +40 -4
- package/lib/utils/tokenize.ts +7 -7
- package/lib/utils/validation-groups.ts +292 -0
- package/lib/utils/wof-json.ts +96 -134
- package/out/adapters/cordis/adapter.d.ts +3 -1
- package/out/adapters/cordis/adapter.d.ts.map +1 -1
- package/out/adapters/cordis/adapter.js +8 -2
- package/out/adapters/cordis/adapter.js.map +1 -1
- package/out/adapters/gleif/adapter.d.ts.map +1 -1
- package/out/adapters/gleif/adapter.js +19 -5
- package/out/adapters/gleif/adapter.js.map +1 -1
- package/out/adapters/osm/adapter.js +2 -2
- package/out/adapters/osm/adapter.js.map +1 -1
- package/out/adapters/street/repetition.d.ts +19 -0
- package/out/adapters/street/repetition.d.ts.map +1 -0
- package/out/adapters/street/repetition.js +71 -0
- package/out/adapters/street/repetition.js.map +1 -0
- package/out/adapters/street/unit.d.ts +10 -0
- package/out/adapters/street/unit.d.ts.map +1 -1
- package/out/adapters/street/unit.js +6 -0
- package/out/adapters/street/unit.js.map +1 -1
- package/out/adapters/wof/admin/json/adapter.d.ts +8 -0
- package/out/adapters/wof/admin/json/adapter.d.ts.map +1 -1
- package/out/adapters/wof/admin/json/adapter.js +26 -22
- package/out/adapters/wof/admin/json/adapter.js.map +1 -1
- package/out/adapters/wof/admin/json/dual-role.d.ts +83 -0
- package/out/adapters/wof/admin/json/dual-role.d.ts.map +1 -0
- package/out/adapters/wof/admin/json/dual-role.js +183 -0
- package/out/adapters/wof/admin/json/dual-role.js.map +1 -0
- package/out/adapters/wof/admin/json/explore.d.ts.map +1 -1
- package/out/adapters/wof/admin/json/explore.js +4 -4
- package/out/adapters/wof/admin/json/explore.js.map +1 -1
- package/out/adapters/wof/admin/json/region-codes.d.ts +16 -0
- package/out/adapters/wof/admin/json/region-codes.d.ts.map +1 -1
- package/out/adapters/wof/admin/json/region-codes.js +62 -3
- package/out/adapters/wof/admin/json/region-codes.js.map +1 -1
- package/out/adapters/wof/json-rows.d.ts +28 -6
- package/out/adapters/wof/json-rows.d.ts.map +1 -1
- package/out/adapters/wof/json-rows.js +9 -15
- package/out/adapters/wof/json-rows.js.map +1 -1
- package/out/adapters/wof/postalcode-json/adapter.d.ts +1 -1
- package/out/adapters/wof/postalcode-json/adapter.d.ts.map +1 -1
- package/out/adapters/wof/postalcode-json/adapter.js +9 -26
- package/out/adapters/wof/postalcode-json/adapter.js.map +1 -1
- package/out/adapters/wof/sample.d.ts +8 -1
- package/out/adapters/wof/sample.d.ts.map +1 -1
- package/out/adapters/wof/sample.js +12 -4
- package/out/adapters/wof/sample.js.map +1 -1
- package/out/adapters/wof/stored-records.d.ts +62 -0
- package/out/adapters/wof/stored-records.d.ts.map +1 -0
- package/out/adapters/wof/stored-records.js +91 -0
- package/out/adapters/wof/stored-records.js.map +1 -0
- package/out/adapters.d.ts +1 -1
- package/out/adapters.d.ts.map +1 -1
- package/out/adapters.js +15 -3
- package/out/adapters.js.map +1 -1
- package/out/au/adapters/acnc-register/adapter.d.ts +9 -0
- package/out/au/adapters/acnc-register/adapter.d.ts.map +1 -0
- package/out/au/adapters/acnc-register/adapter.js +37 -0
- package/out/au/adapters/acnc-register/adapter.js.map +1 -0
- package/out/au/evaluation/acnc-register.d.ts +56 -0
- package/out/au/evaluation/acnc-register.d.ts.map +1 -0
- package/out/au/evaluation/acnc-register.js +84 -0
- package/out/au/evaluation/acnc-register.js.map +1 -0
- package/out/build/align/range.d.ts.map +1 -1
- package/out/build/align/range.js +9 -0
- package/out/build/align/range.js.map +1 -1
- package/out/build/align/totals.d.ts +5 -0
- package/out/build/align/totals.d.ts.map +1 -1
- package/out/build/align/totals.js +15 -0
- package/out/build/align/totals.js.map +1 -1
- package/out/build/align.d.ts +26 -0
- package/out/build/align.d.ts.map +1 -1
- package/out/build/align.js +35 -2
- package/out/build/align.js.map +1 -1
- package/out/build/budget.d.ts +9 -26
- package/out/build/budget.d.ts.map +1 -1
- package/out/build/budget.js +10 -31
- package/out/build/budget.js.map +1 -1
- package/out/build/checkpoint.d.ts +11 -0
- package/out/build/checkpoint.d.ts.map +1 -1
- package/out/build/checkpoint.js.map +1 -1
- package/out/build/component-check.d.ts +55 -1
- package/out/build/component-check.d.ts.map +1 -1
- package/out/build/component-check.js +65 -3
- package/out/build/component-check.js.map +1 -1
- package/out/build/manifest.d.ts.map +1 -1
- package/out/build/manifest.js +4 -0
- package/out/build/manifest.js.map +1 -1
- package/out/build/parallel.d.ts.map +1 -1
- package/out/build/parallel.js +8 -24
- package/out/build/parallel.js.map +1 -1
- package/out/build/region-names.d.ts +120 -0
- package/out/build/region-names.d.ts.map +1 -0
- package/out/build/region-names.js +430 -0
- package/out/build/region-names.js.map +1 -0
- package/out/build/source-record.d.ts.map +1 -1
- package/out/build/source-record.js +4 -0
- package/out/build/source-record.js.map +1 -1
- package/out/build/types.d.ts +20 -0
- package/out/build/types.d.ts.map +1 -1
- package/out/build/worker.js +3 -1
- package/out/build/worker.js.map +1 -1
- package/out/build.d.ts +0 -1
- package/out/build.d.ts.map +1 -1
- package/out/build.js +3 -5
- package/out/build.js.map +1 -1
- package/out/de/recipes/locale.d.ts.map +1 -1
- package/out/de/recipes/locale.js +3 -2
- package/out/de/recipes/locale.js.map +1 -1
- package/out/env.d.ts +0 -2
- package/out/env.d.ts.map +1 -1
- package/out/env.js +0 -5
- package/out/env.js.map +1 -1
- package/out/es/adapters/sanidad-centros-ap/adapter.d.ts +9 -0
- package/out/es/adapters/sanidad-centros-ap/adapter.d.ts.map +1 -0
- package/out/es/adapters/sanidad-centros-ap/adapter.js +36 -0
- package/out/es/adapters/sanidad-centros-ap/adapter.js.map +1 -0
- package/out/es/evaluation/sanidad-centros-ap.d.ts +34 -0
- package/out/es/evaluation/sanidad-centros-ap.d.ts.map +1 -0
- package/out/es/evaluation/sanidad-centros-ap.js +128 -0
- package/out/es/evaluation/sanidad-centros-ap.js.map +1 -0
- package/out/evaluation/corpus-adapter.d.ts +60 -0
- package/out/evaluation/corpus-adapter.d.ts.map +1 -0
- package/out/evaluation/corpus-adapter.js +100 -0
- package/out/evaluation/corpus-adapter.js.map +1 -0
- package/out/evaluation/source.d.ts +134 -0
- package/out/evaluation/source.d.ts.map +1 -0
- package/out/evaluation/source.js +80 -0
- package/out/evaluation/source.js.map +1 -0
- package/out/evaluation/sources.d.ts +6 -0
- package/out/evaluation/sources.d.ts.map +1 -0
- package/out/evaluation/sources.js +22 -0
- package/out/evaluation/sources.js.map +1 -0
- package/out/fr/adapters/laposte-poincont/adapter.d.ts +110 -0
- package/out/fr/adapters/laposte-poincont/adapter.d.ts.map +1 -0
- package/out/fr/adapters/laposte-poincont/adapter.js +315 -0
- package/out/fr/adapters/laposte-poincont/adapter.js.map +1 -0
- package/out/fr/recipes/unit-line-guideline.d.ts.map +1 -1
- package/out/fr/recipes/unit-line-guideline.js +8 -4
- package/out/fr/recipes/unit-line-guideline.js.map +1 -1
- package/out/fr/structures/laposte.d.ts +27 -0
- package/out/fr/structures/laposte.d.ts.map +1 -0
- package/out/fr/structures/laposte.js +96 -0
- package/out/fr/structures/laposte.js.map +1 -0
- package/out/fr/tools/fetch/laposte-poincont.d.ts +95 -0
- package/out/fr/tools/fetch/laposte-poincont.d.ts.map +1 -0
- package/out/fr/tools/fetch/laposte-poincont.js +135 -0
- package/out/fr/tools/fetch/laposte-poincont.js.map +1 -0
- package/out/it/adapters/miur-scuole/adapter.d.ts +9 -0
- package/out/it/adapters/miur-scuole/adapter.d.ts.map +1 -0
- package/out/it/adapters/miur-scuole/adapter.js +35 -0
- package/out/it/adapters/miur-scuole/adapter.js.map +1 -0
- package/out/it/evaluation/miur-scuole.d.ts +53 -0
- package/out/it/evaluation/miur-scuole.d.ts.map +1 -0
- package/out/it/evaluation/miur-scuole.js +68 -0
- package/out/it/evaluation/miur-scuole.js.map +1 -0
- package/out/jp/adapters/wof-admin/adapter.js +4 -4
- package/out/nc/adapters/opt-nc/adapter.d.ts +84 -0
- package/out/nc/adapters/opt-nc/adapter.d.ts.map +1 -0
- package/out/nc/adapters/opt-nc/adapter.js +173 -0
- package/out/nc/adapters/opt-nc/adapter.js.map +1 -0
- package/out/nc/structures/opt-nc.d.ts +12 -0
- package/out/nc/structures/opt-nc.d.ts.map +1 -0
- package/out/nc/structures/opt-nc.js +64 -0
- package/out/nc/structures/opt-nc.js.map +1 -0
- package/out/nc/tools/fetch/opt-nc.d.ts +81 -0
- package/out/nc/tools/fetch/opt-nc.d.ts.map +1 -0
- package/out/nc/tools/fetch/opt-nc.js +162 -0
- package/out/nc/tools/fetch/opt-nc.js.map +1 -0
- package/out/nz/adapters/charities-register/adapter.d.ts +9 -0
- package/out/nz/adapters/charities-register/adapter.d.ts.map +1 -0
- package/out/nz/adapters/charities-register/adapter.js +36 -0
- package/out/nz/adapters/charities-register/adapter.js.map +1 -0
- package/out/nz/evaluation/charities-register.d.ts +60 -0
- package/out/nz/evaluation/charities-register.d.ts.map +1 -0
- package/out/nz/evaluation/charities-register.js +84 -0
- package/out/nz/evaluation/charities-register.js.map +1 -0
- package/out/recipes/bare/postcode.d.ts +2 -1
- package/out/recipes/bare/postcode.d.ts.map +1 -1
- package/out/recipes/bare/postcode.js +14 -11
- package/out/recipes/bare/postcode.js.map +1 -1
- package/out/recipes/deepseek/batches.d.ts +11 -1
- package/out/recipes/deepseek/batches.d.ts.map +1 -1
- package/out/recipes/deepseek/batches.js +8 -7
- package/out/recipes/deepseek/batches.js.map +1 -1
- package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -1
- package/out/recipes/po/box/cedex/recipe.js +12 -1
- package/out/recipes/po/box/cedex/recipe.js.map +1 -1
- package/out/recipes/po/box/cedex/us.d.ts +12 -0
- package/out/recipes/po/box/cedex/us.d.ts.map +1 -1
- package/out/recipes/po/box/cedex/us.js +36 -2
- package/out/recipes/po/box/cedex/us.js.map +1 -1
- package/out/recipes/scaffold.d.ts +1 -1
- package/out/recipes/sources.d.ts.map +1 -1
- package/out/recipes/sources.js +16 -0
- package/out/recipes/sources.js.map +1 -1
- package/out/recipes.d.ts.map +1 -1
- package/out/recipes.js +2 -0
- package/out/recipes.js.map +1 -1
- package/out/registers.d.ts +28 -2
- package/out/registers.d.ts.map +1 -1
- package/out/registers.js +28 -2
- package/out/registers.js.map +1 -1
- package/out/{post-offices → structures}/source.d.ts +34 -16
- package/out/structures/source.d.ts.map +1 -0
- package/out/structures/source.js +39 -0
- package/out/structures/source.js.map +1 -0
- package/out/structures/sources.d.ts +6 -0
- package/out/structures/sources.d.ts.map +1 -0
- package/out/structures/sources.js +23 -0
- package/out/structures/sources.js.map +1 -0
- package/out/synthesizers/house-venue.d.ts.map +1 -1
- package/out/synthesizers/house-venue.js +2 -1
- package/out/synthesizers/house-venue.js.map +1 -1
- package/out/synthesizers/tail.d.ts +15 -1
- package/out/synthesizers/tail.d.ts.map +1 -1
- package/out/synthesizers/tail.js +8 -3
- package/out/synthesizers/tail.js.map +1 -1
- package/out/tools/audit.js +1 -1
- package/out/tools/audit.js.map +1 -1
- package/out/tools/fetch/storage.d.ts +10 -2
- package/out/tools/fetch/storage.d.ts.map +1 -1
- package/out/tools/fetch/storage.js +18 -4
- package/out/tools/fetch/storage.js.map +1 -1
- package/out/tools/fetch.d.ts +10 -2
- package/out/tools/fetch.d.ts.map +1 -1
- package/out/tools/fetch.js +10 -2
- package/out/tools/fetch.js.map +1 -1
- package/out/tools/overlay/kryptonite.d.ts.map +1 -1
- package/out/tools/overlay/kryptonite.js +5 -2
- package/out/tools/overlay/kryptonite.js.map +1 -1
- package/out/tools/overlay/split/attribute.d.ts +7 -1
- package/out/tools/overlay/split/attribute.d.ts.map +1 -1
- package/out/tools/overlay/split/attribute.js +4 -1
- package/out/tools/overlay/split/attribute.js.map +1 -1
- package/out/tools/overlay/split/overlay.d.ts +10 -0
- package/out/tools/overlay/split/overlay.d.ts.map +1 -1
- package/out/tools/overlay/split/overlay.js +17 -4
- package/out/tools/overlay/split/overlay.js.map +1 -1
- package/out/tools/postcode/triples.js +3 -3
- package/out/tools/postcode/triples.js.map +1 -1
- package/out/tools/region-slot-census.run.d.ts +2 -0
- package/out/tools/region-slot-census.run.d.ts.map +1 -0
- package/out/tools/region-slot-census.run.js +134 -0
- package/out/tools/region-slot-census.run.js.map +1 -0
- package/out/training/config/load.d.ts.map +1 -1
- package/out/training/config/load.js +10 -0
- package/out/training/config/load.js.map +1 -1
- package/out/training/config/schema.d.ts +13 -0
- package/out/training/config/schema.d.ts.map +1 -1
- package/out/training/config/schema.js +6 -0
- package/out/training/config/schema.js.map +1 -1
- package/out/tw/registers.d.ts +9 -0
- package/out/tw/registers.d.ts.map +1 -1
- package/out/tw/registers.js +11 -4
- package/out/tw/registers.js.map +1 -1
- package/out/tw/structures/chunghwa-post.d.ts +39 -0
- package/out/tw/structures/chunghwa-post.d.ts.map +1 -0
- package/out/tw/structures/chunghwa-post.js +150 -0
- package/out/tw/structures/chunghwa-post.js.map +1 -0
- package/out/tw/tools/fetch/chunghwa-post.d.ts +55 -0
- package/out/tw/tools/fetch/chunghwa-post.d.ts.map +1 -0
- package/out/tw/tools/fetch/chunghwa-post.js +110 -0
- package/out/tw/tools/fetch/chunghwa-post.js.map +1 -0
- package/out/us/adapters/state/ny-notaries/adapter.d.ts.map +1 -1
- package/out/us/adapters/state/ny-notaries/adapter.js +7 -2
- package/out/us/adapters/state/ny-notaries/adapter.js.map +1 -1
- package/out/us/adapters/state/tx-notaries/adapter.d.ts +42 -0
- package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -1
- package/out/us/adapters/state/tx-notaries/adapter.js +92 -19
- package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -1
- package/out/us/adapters/usgov/nad/adapter.d.ts +35 -2
- package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
- package/out/us/adapters/usgov/nad/adapter.js +90 -27
- package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
- package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -1
- package/out/us/adapters/usgov/nppes/adapter.js +8 -11
- package/out/us/adapters/usgov/nppes/adapter.js.map +1 -1
- package/out/us/adapters/usgov/usgs-structures/adapter.d.ts +87 -0
- package/out/us/adapters/usgov/usgs-structures/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/{usgs-post-offices → usgs-structures}/adapter.js +36 -27
- package/out/us/adapters/usgov/usgs-structures/adapter.js.map +1 -0
- package/out/us/recipes/county.d.ts +124 -0
- package/out/us/recipes/county.d.ts.map +1 -0
- package/out/us/recipes/county.js +295 -0
- package/out/us/recipes/county.js.map +1 -0
- package/out/us/street-unit.d.ts +10 -3
- package/out/us/street-unit.d.ts.map +1 -1
- package/out/us/street-unit.js +14 -6
- package/out/us/street-unit.js.map +1 -1
- package/out/us/structures/usgs/layers.d.ts +57 -0
- package/out/us/structures/usgs/layers.d.ts.map +1 -0
- package/out/us/structures/usgs/layers.js +121 -0
- package/out/us/structures/usgs/layers.js.map +1 -0
- package/out/us/structures/usgs/national-map.d.ts +14 -0
- package/out/us/structures/usgs/national-map.d.ts.map +1 -0
- package/out/us/{post-offices/usgs-national-map.js → structures/usgs/national-map.js} +16 -14
- package/out/us/structures/usgs/national-map.js.map +1 -0
- package/out/us/tools/fetch/usgs/gnis.d.ts +118 -0
- package/out/us/tools/fetch/usgs/gnis.d.ts.map +1 -0
- package/out/us/tools/fetch/usgs/gnis.js +177 -0
- package/out/us/tools/fetch/usgs/gnis.js.map +1 -0
- package/out/us/tools/fetch/usgs/structures.d.ts +99 -0
- package/out/us/tools/fetch/usgs/structures.d.ts.map +1 -0
- package/out/us/tools/fetch/usgs/structures.js +233 -0
- package/out/us/tools/fetch/usgs/structures.js.map +1 -0
- package/out/utils/align.js.map +1 -1
- package/out/utils/evaluation-groups.d.ts +98 -0
- package/out/utils/evaluation-groups.d.ts.map +1 -0
- package/out/utils/evaluation-groups.js +92 -0
- package/out/utils/evaluation-groups.js.map +1 -0
- package/out/utils/split.d.ts +26 -1
- package/out/utils/split.d.ts.map +1 -1
- package/out/utils/split.js +28 -3
- package/out/utils/split.js.map +1 -1
- package/out/utils/tokenize.d.ts +3 -3
- package/out/utils/tokenize.d.ts.map +1 -1
- package/out/utils/tokenize.js.map +1 -1
- package/out/utils/validation-groups.d.ts +168 -0
- package/out/utils/validation-groups.d.ts.map +1 -0
- package/out/utils/validation-groups.js +135 -0
- package/out/utils/validation-groups.js.map +1 -0
- package/out/utils/wof-json.d.ts +31 -57
- package/out/utils/wof-json.d.ts.map +1 -1
- package/out/utils/wof-json.js +81 -98
- package/out/utils/wof-json.js.map +1 -1
- package/package.json +18 -18
- package/lib/adapters/wof/record-cache.ts +0 -118
- package/lib/build/heap.ts +0 -60
- package/lib/post-offices/sources.ts +0 -18
- package/lib/us/post-offices/usgs-national-map.ts +0 -89
- package/lib/us/tools/fetch/usgs-post-offices.ts +0 -362
- package/out/adapters/wof/record-cache.d.ts +0 -22
- package/out/adapters/wof/record-cache.d.ts.map +0 -1
- package/out/adapters/wof/record-cache.js +0 -89
- package/out/adapters/wof/record-cache.js.map +0 -1
- package/out/build/heap.d.ts +0 -26
- package/out/build/heap.d.ts.map +0 -1
- package/out/build/heap.js +0 -52
- package/out/build/heap.js.map +0 -1
- package/out/post-offices/source.d.ts.map +0 -1
- package/out/post-offices/source.js +0 -21
- package/out/post-offices/source.js.map +0 -1
- package/out/post-offices/sources.d.ts +0 -13
- package/out/post-offices/sources.d.ts.map +0 -1
- package/out/post-offices/sources.js +0 -8
- package/out/post-offices/sources.js.map +0 -1
- package/out/us/adapters/usgov/usgs-post-offices/adapter.d.ts +0 -66
- package/out/us/adapters/usgov/usgs-post-offices/adapter.d.ts.map +0 -1
- package/out/us/adapters/usgov/usgs-post-offices/adapter.js.map +0 -1
- package/out/us/post-offices/usgs-national-map.d.ts +0 -14
- package/out/us/post-offices/usgs-national-map.d.ts.map +0 -1
- package/out/us/post-offices/usgs-national-map.js.map +0 -1
- package/out/us/tools/fetch/usgs-post-offices.d.ts +0 -99
- package/out/us/tools/fetch/usgs-post-offices.d.ts.map +0 -1
- package/out/us/tools/fetch/usgs-post-offices.js +0 -246
- package/out/us/tools/fetch/usgs-post-offices.js.map +0 -1
|
@@ -130,6 +130,13 @@ export async function readReusableSource(
|
|
|
130
130
|
return { record: null, problem: `${path.toString()} was written from another input, code or config` }
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
if (
|
|
134
|
+
!Array.isArray(record.totals.component_findings_by_source) ||
|
|
135
|
+
!Array.isArray(record.totals.unchecked_component_rules)
|
|
136
|
+
) {
|
|
137
|
+
return { record: null, problem: `${path.toString()} records no per-source component counts` }
|
|
138
|
+
}
|
|
139
|
+
|
|
133
140
|
const canonical = await tryStat(record.adapter.jsonl_path)
|
|
134
141
|
|
|
135
142
|
if (canonical?.size !== record.adapter.bytes) {
|
package/lib/build/types.ts
CHANGED
|
@@ -248,6 +248,26 @@ export interface BuildCorpusManifest {
|
|
|
248
248
|
*/
|
|
249
249
|
holdout_check: { checked_at: string; countries: string[]; files_read: number }
|
|
250
250
|
quarantine_count: number
|
|
251
|
+
/**
|
|
252
|
+
* Base rows failing each component rule (`componentFindings`), per `source` then rule.
|
|
253
|
+
*
|
|
254
|
+
* A row failing a rule in {@linkcode enforced_component_rules} was quarantined
|
|
255
|
+
* with reason `component-invalid:<rule>`.
|
|
256
|
+
* A row failing only the other rules was aligned, and is counted so a rule can be
|
|
257
|
+
* read against the rows it would refuse before it is enforced.
|
|
258
|
+
*/
|
|
259
|
+
component_findings_by_source: Record<string, Record<string, number>>
|
|
260
|
+
/**
|
|
261
|
+
* The component rules this build quarantined rows for.
|
|
262
|
+
*/
|
|
263
|
+
enforced_component_rules: string[]
|
|
264
|
+
/**
|
|
265
|
+
* The component rules this build couldn't check, because the data a rule reads wasn't
|
|
266
|
+
* on the host (`region:unknown` reads the WOF admin database).
|
|
267
|
+
*
|
|
268
|
+
* Their counts in {@linkcode component_findings_by_source} are absent rather than zero.
|
|
269
|
+
*/
|
|
270
|
+
unchecked_component_rules: string[]
|
|
251
271
|
total_aligned_rows: number
|
|
252
272
|
/**
|
|
253
273
|
* Resolved license set across all included rows (license string → row count).
|
package/lib/build/worker.ts
CHANGED
|
@@ -359,7 +359,9 @@ if (import.meta.main) {
|
|
|
359
359
|
process.exit(0)
|
|
360
360
|
},
|
|
361
361
|
(error: unknown) => {
|
|
362
|
-
|
|
362
|
+
// Node's inspector prints an Error's stack followed by its whole `cause` chain.
|
|
363
|
+
// A wrapped DuckDB or filesystem failure is only visible in that chain.
|
|
364
|
+
console.error(error)
|
|
363
365
|
|
|
364
366
|
process.exit(1)
|
|
365
367
|
}
|
package/lib/build.ts
CHANGED
|
@@ -40,7 +40,6 @@ import { openSourceRightsAdmission } from "#source-register/corpus-inputs"
|
|
|
40
40
|
import type { LabeledRow } from "#types"
|
|
41
41
|
import { defaultHoldouts, writeSplitManifestsFromLabeledFiles, type SplitName } from "#utils/split"
|
|
42
42
|
|
|
43
|
-
export * from "#build/heap"
|
|
44
43
|
export * from "#build/types"
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -57,14 +56,12 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
57
56
|
throw new Error(`buildCorpus: jobs is ${jobs}; it is a positive integer, 1 for a serial build.`)
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
// The
|
|
61
|
-
// These aborts arrive twelve minutes into the adapter phase.
|
|
59
|
+
// The heap limit is reported so an out-of-memory abort can be read against it.
|
|
62
60
|
const heapLimit = heapLimitBytes()
|
|
63
61
|
const configured = adapters.filter((adapter) => opts.adapterInputs[adapter.id]).map((adapter) => adapter.id)
|
|
64
62
|
|
|
65
|
-
// Refused before any work, since it depends only on the host
|
|
66
|
-
const budget =
|
|
67
|
-
jobs > 1 ? planWorkerBudget({ jobs, adapterIDs: configured, hostMemoryBytes: opts.hostMemoryBytes }) : null
|
|
63
|
+
// Refused before any work, since it depends only on the host.
|
|
64
|
+
const budget = jobs > 1 ? planWorkerBudget({ jobs, hostMemoryBytes: opts.hostMemoryBytes }) : null
|
|
68
65
|
|
|
69
66
|
opts.onProgress?.(
|
|
70
67
|
"adapter-run",
|
package/lib/de/recipes/locale.ts
CHANGED
|
@@ -232,7 +232,7 @@ export const germanRecipe: CorpusRecipe = {
|
|
|
232
232
|
{
|
|
233
233
|
flag: "--admin-db <path>",
|
|
234
234
|
description:
|
|
235
|
-
"WOF admin database for the Ortsteil pool. Default $MAILWOMAN_DATA_ROOT/db/wof/admin-global-priority
|
|
235
|
+
"WOF admin database for the Ortsteil pool. Default $MAILWOMAN_DATA_ROOT/db/wof/admin-global-priority.db",
|
|
236
236
|
},
|
|
237
237
|
],
|
|
238
238
|
async run(opts, write) {
|
|
@@ -252,7 +252,8 @@ export const germanRecipe: CorpusRecipe = {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
|
|
255
|
+
// The pool reads `spr` and `ancestors` only, so the admin database itself serves.
|
|
256
|
+
const adminDB = opts.adminDB ?? wofDatabasePath("admin-global-priority.db")
|
|
256
257
|
const ortsteile = ortsteilFraction > 0 ? await readOrtsteilPool(adminDB) : new Map<string, string[]>()
|
|
257
258
|
|
|
258
259
|
if (ortsteilFraction > 0) {
|
package/lib/env.ts
CHANGED
|
@@ -21,12 +21,6 @@ export const PublicCorpusEnvSchema = z.object({
|
|
|
21
21
|
description:
|
|
22
22
|
"Corpus manifest whose region and locality spans the holdout span check counts; `default` reads the latest base corpus. Unset skips the check.",
|
|
23
23
|
}),
|
|
24
|
-
// The directory the WOF adapters keep parsed records in between builds (`adapters/wof/record-cache.ts`).
|
|
25
|
-
MAILWOMAN_WOF_RECORD_CACHE: z.string().optional().meta({
|
|
26
|
-
title: "WOF record cache",
|
|
27
|
-
description:
|
|
28
|
-
"Directory where the WOF adapters keep the records parsed from the GeoJSON checkouts, keyed by every file's path, size and modification time; a relative path resolves against the data root. Unset parses the GeoJSON on every build.",
|
|
29
|
-
}),
|
|
30
24
|
// The mount the training volume's paths start with.
|
|
31
25
|
// A manifest built on Modal lists its files under it.
|
|
32
26
|
MAILWOMAN_VOLUME_MOUNT: blankAsAbsent(z.string().default("/data")).meta({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `es-sanidad-centros-ap`: the Ministerio de Sanidad's primary-care center catalogue as a corpus source.
|
|
6
|
+
*
|
|
7
|
+
* The adapter reads `SIAP_CENTROS.txt` inside the catalogue zip through
|
|
8
|
+
* {@linkcode readSanidadCentres}, the reader the evaluation source of the same id calls,
|
|
9
|
+
* and renders each center's street, house number, postcode and locality.
|
|
10
|
+
* The center's name is never read into a row.
|
|
11
|
+
* A street line without a house number (`S/N`) yields no row.
|
|
12
|
+
*
|
|
13
|
+
* The ministry's legal notice authorizes `reproducción total o parcial, modificación`
|
|
14
|
+
* for commercial and non-commercial use, on condition of citing the source
|
|
15
|
+
* and the date of its last update (`data/licenses/es-sanidad-aviso-legal.md`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { esSanidadCentrosAPSource, readSanidadCentres } from "#es/evaluation/sanidad-centros-ap"
|
|
19
|
+
import { createEvaluationCorpusAdapter } from "#evaluation/corpus-adapter"
|
|
20
|
+
import { SourceRegister } from "#registers"
|
|
21
|
+
import { AddressRole } from "#types"
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Registry id for this adapter, stamped into every row it emits, and the evaluation source's id.
|
|
25
|
+
*/
|
|
26
|
+
export const ES_SANIDAD_CENTROS_AP_ADAPTER_ID = "es-sanidad-centros-ap"
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The registered `es-sanidad-centros-ap` adapter.
|
|
30
|
+
*/
|
|
31
|
+
export const esSanidadCentrosAPAdapter = createEvaluationCorpusAdapter({
|
|
32
|
+
id: ES_SANIDAD_CENTROS_AP_ADAPTER_ID,
|
|
33
|
+
source: esSanidadCentrosAPSource,
|
|
34
|
+
register: SourceRegister.SanidadCentrosAP,
|
|
35
|
+
locale: "es-ES",
|
|
36
|
+
addressRole: AddressRole.Facility,
|
|
37
|
+
description:
|
|
38
|
+
"Ministerio de Sanidad's primary-care centre catalogue (aviso legal, reuse authorized): each centre's street address, without its name.",
|
|
39
|
+
read: readSanidadCentres,
|
|
40
|
+
})
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `es-sanidad-centros-ap`: the Ministerio de Sanidad's catalogue of the national health
|
|
6
|
+
* system's primary-care centers (`Catálogo de Centros de Atención Primaria del SNS`),
|
|
7
|
+
* read by the evaluation source and by the `es-sanidad-centros-ap` corpus
|
|
8
|
+
* adapter through {@linkcode readSanidadCentres}.
|
|
9
|
+
*
|
|
10
|
+
* The ministry's microdata page (`https://www.sanidad.gob.es/estadisticas/microdatos.do`, type CatCentrosAP)
|
|
11
|
+
* serves the catalogue as one zip of semicolon-separated Windows-1252 text files without a header row.
|
|
12
|
+
* `SIAP_CENTROS.txt` holds one center per line: its id, the health area and basic zone,
|
|
13
|
+
* its type, its name, its code, its street line (`CALLE MAYOR, Nº 42`),
|
|
14
|
+
* its locality, its phone, whether it heads its zone, its municipality code
|
|
15
|
+
* (INE province and municipality plus a check digit), its postcode and its managing body.
|
|
16
|
+
*
|
|
17
|
+
* The locality is the census settlement's name, written with its article
|
|
18
|
+
* after it in brackets (`REBOLLAR (EL)`).
|
|
19
|
+
* The reader moves the article in front (`EL REBOLLAR`), the order an address writes.
|
|
20
|
+
* A street line without a number (`S/N`) yields no record.
|
|
21
|
+
*
|
|
22
|
+
* ## License
|
|
23
|
+
*
|
|
24
|
+
* The ministry's legal notice (`https://www.sanidad.gob.es/avisoLegal/home.htm`)
|
|
25
|
+
* states that the site's information « es susceptible de reutilización; quedando
|
|
26
|
+
* autorizada su reproducción total o parcial, modificación, distribución y comunicación,
|
|
27
|
+
* para usos comerciales y no comerciales », on condition of citing the source
|
|
28
|
+
* and the date of the last update (`data/licenses/es-sanidad-aviso-legal.md`).
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { readZipEntry } from "@mailwoman/core/fs/zip"
|
|
32
|
+
import type { PathBuilder, PathBuilderLike } from "path-ts"
|
|
33
|
+
import { CSVSpliterator } from "spliterator"
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
type EvaluationRecordReading,
|
|
37
|
+
type EvaluationSource,
|
|
38
|
+
evaluationSourceRead,
|
|
39
|
+
evaluationStreetLine,
|
|
40
|
+
fetchEvaluationFile,
|
|
41
|
+
readEvaluationFetch,
|
|
42
|
+
} from "#evaluation/source"
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The catalogue as of 2026, the file the microdata page serves for the year 2025.
|
|
46
|
+
*/
|
|
47
|
+
export const ES_SANIDAD_CENTROS_AP_URL =
|
|
48
|
+
"https://www.sanidad.gob.es/estadEstudios/estadisticas/microdatos/CatCentrosAP/2026_C__Catalogo_de_Centros_AP_txt.zip"
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The zip the fetch writes and the reader opens, under the publisher's own name.
|
|
52
|
+
*/
|
|
53
|
+
export const ES_SANIDAD_CENTROS_AP_FILENAME = "2026_C__Catalogo_de_Centros_AP_txt.zip"
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The zip member that lists the centers.
|
|
57
|
+
* The other members are code tables.
|
|
58
|
+
*/
|
|
59
|
+
export const ES_SANIDAD_CENTROS_MEMBER = "SIAP_CENTROS.txt"
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The columns of `SIAP_CENTROS.txt` the reader takes, by position.
|
|
63
|
+
*/
|
|
64
|
+
const Column = { ID: 0, Street: 6, Locality: 7, Municipality: 10, Postcode: 11 } as const
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A settlement name whose article the census writes after it: `REBOLLAR (EL)`, `PALMAS (LAS)`.
|
|
68
|
+
*/
|
|
69
|
+
const TRAILING_ARTICLE = /^(.+?)\s*\(([^()]+)\)$/u
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The number marker between the street and its number: `CALLE MAYOR, Nº 42`.
|
|
73
|
+
*/
|
|
74
|
+
const NUMBER_MARKER = /,\s*(?:N[º°o]\.?|NUM\.?|NÚM\.?)\s*(?=\d)/iu
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The settlement name in address order.
|
|
78
|
+
*/
|
|
79
|
+
export function spanishSettlementName(name: string): string {
|
|
80
|
+
const match = TRAILING_ARTICLE.exec(name)
|
|
81
|
+
|
|
82
|
+
if (!match) return name
|
|
83
|
+
|
|
84
|
+
const article = match[2]!.trim()
|
|
85
|
+
// An apostrophe article (`L'`) joins its word without a space.
|
|
86
|
+
const joiner = article.endsWith("'") ? "" : " "
|
|
87
|
+
|
|
88
|
+
return `${article}${joiner}${match[1]!.trim()}`
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* One catalogue line as an address record, or the reason it yields none.
|
|
93
|
+
*/
|
|
94
|
+
export function readSanidadCentre(columns: readonly string[]): EvaluationRecordReading {
|
|
95
|
+
const cell = (index: number) => (columns[index] ?? "").replaceAll(/\s+/gu, " ").trim()
|
|
96
|
+
|
|
97
|
+
const id = cell(Column.ID)
|
|
98
|
+
const postcode = cell(Column.Postcode)
|
|
99
|
+
const municipality = cell(Column.Municipality)
|
|
100
|
+
const locality = spanishSettlementName(cell(Column.Locality))
|
|
101
|
+
|
|
102
|
+
if (!id) return { refused: "row:identifier-absent" }
|
|
103
|
+
|
|
104
|
+
if (!/^\d{5}$/u.test(postcode)) return { refused: "row:postcode-absent" }
|
|
105
|
+
|
|
106
|
+
if (!locality) return { refused: "row:locality-absent" }
|
|
107
|
+
|
|
108
|
+
if (!/^\d{5,6}$/u.test(municipality)) return { refused: "row:municipality-absent" }
|
|
109
|
+
|
|
110
|
+
const street = evaluationStreetLine(cell(Column.Street).replace(NUMBER_MARKER, " "), "ES")
|
|
111
|
+
|
|
112
|
+
if ("refused" in street) return street
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
id,
|
|
116
|
+
stratum: `province ${municipality.padStart(6, "0").slice(0, 2)}`,
|
|
117
|
+
components: { street: street.street, house_number: street.house_number, postcode, locality },
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Spain's evaluation source, the primary-care center catalogue.
|
|
123
|
+
*/
|
|
124
|
+
export const esSanidadCentrosAPSource: EvaluationSource = {
|
|
125
|
+
id: "es-sanidad-centros-ap",
|
|
126
|
+
country: "ES",
|
|
127
|
+
publisher: "Ministerio de Sanidad",
|
|
128
|
+
attribution: "Ministerio de Sanidad, Catálogo de Centros de Atención Primaria del SNS (2026)",
|
|
129
|
+
license: "Aviso legal del Ministerio de Sanidad (reutilización autorizada)",
|
|
130
|
+
registerSource: "es-health-1",
|
|
131
|
+
|
|
132
|
+
fetch: (directory, report) =>
|
|
133
|
+
fetchEvaluationFile(directory, ES_SANIDAD_CENTROS_AP_URL, ES_SANIDAD_CENTROS_AP_FILENAME, report),
|
|
134
|
+
|
|
135
|
+
async read(directory: PathBuilder) {
|
|
136
|
+
const fetched = await readEvaluationFetch(directory)
|
|
137
|
+
|
|
138
|
+
return evaluationSourceRead(
|
|
139
|
+
`2026 catalogue (fetched ${fetched.downloaded_at.slice(0, 10)})`,
|
|
140
|
+
readSanidadCentres(directory(ES_SANIDAD_CENTROS_AP_FILENAME))
|
|
141
|
+
)
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Every line of the catalogue zip at `archivePath`, read by {@linkcode readSanidadCentre}.
|
|
147
|
+
*
|
|
148
|
+
* @throws When the zip holds no {@linkcode ES_SANIDAD_CENTROS_MEMBER}.
|
|
149
|
+
*/
|
|
150
|
+
export async function* readSanidadCentres(archivePath: PathBuilderLike): AsyncGenerator<EvaluationRecordReading> {
|
|
151
|
+
const chunks: Uint8Array[] = []
|
|
152
|
+
|
|
153
|
+
for await (const chunk of readZipEntry(archivePath, ES_SANIDAD_CENTROS_MEMBER)) {
|
|
154
|
+
chunks.push(chunk)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!chunks.length) throw new Error(`${archivePath} holds no ${ES_SANIDAD_CENTROS_MEMBER}`)
|
|
158
|
+
|
|
159
|
+
const text = new TextDecoder("windows-1252").decode(Buffer.concat(chunks))
|
|
160
|
+
|
|
161
|
+
for (const columns of CSVSpliterator.from<string[]>(text, { columnDelimiter: ";", header: false })) {
|
|
162
|
+
yield readSanidadCentre(columns)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A corpus adapter over an evaluation source's record reader.
|
|
6
|
+
*
|
|
7
|
+
* The adapter and the evaluation source read the publisher's file through one function,
|
|
8
|
+
* so a fix to the reader reaches both.
|
|
9
|
+
* A record holds only the address components the reader chose, never the publisher's
|
|
10
|
+
* name for the site or the organization, so a row cannot join an address to a
|
|
11
|
+
* person a small charity's name could identify.
|
|
12
|
+
*
|
|
13
|
+
* The row is rendered by the country's codex layout, and its id is content-addressed
|
|
14
|
+
* over the rendered components.
|
|
15
|
+
* Two records at one address are one row, and the second is counted
|
|
16
|
+
* under {@linkcode EvaluationAdapterRefusal.Duplicate}.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { formatAddressRow } from "@mailwoman/codex/address/format"
|
|
20
|
+
import type { PathBuilderLike } from "path-ts"
|
|
21
|
+
|
|
22
|
+
import { UnsupportedCountryError } from "#adapters/errors"
|
|
23
|
+
import { stableSourceID } from "#adapters/source-id"
|
|
24
|
+
import type { EvaluationRecordReading, EvaluationSource } from "#evaluation/source"
|
|
25
|
+
import { type AddressRole, type CanonicalRow, type CorpusAdapter, countDropped, SurfaceOrigin } from "#types"
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Why an address record the reader admitted yielded no corpus row.
|
|
29
|
+
*/
|
|
30
|
+
export const EvaluationAdapterRefusal = {
|
|
31
|
+
/**
|
|
32
|
+
* The country's layout doesn't print every component the record holds.
|
|
33
|
+
*/
|
|
34
|
+
Unrenderable: "row:unrenderable",
|
|
35
|
+
/**
|
|
36
|
+
* Another record already produced this exact row.
|
|
37
|
+
*/
|
|
38
|
+
Duplicate: "row:duplicate",
|
|
39
|
+
} as const
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* What an adapter over an evaluation source's reader declares beyond the source itself.
|
|
43
|
+
*/
|
|
44
|
+
export interface EvaluationCorpusAdapterSpec {
|
|
45
|
+
/**
|
|
46
|
+
* The adapter id, written as a literal `*_ADAPTER_ID` constant in the adapter's module
|
|
47
|
+
* so the `wire-identifiers` check can read it.
|
|
48
|
+
* It must equal the evaluation source's id.
|
|
49
|
+
*/
|
|
50
|
+
id: string
|
|
51
|
+
/**
|
|
52
|
+
* The evaluation source whose id, country and license the adapter stamps on every row.
|
|
53
|
+
*/
|
|
54
|
+
source: Pick<EvaluationSource, "id" | "country" | "license">
|
|
55
|
+
/**
|
|
56
|
+
* The `SourceRegister` value naming the publication.
|
|
57
|
+
*/
|
|
58
|
+
register: string
|
|
59
|
+
/**
|
|
60
|
+
* The adapter stamps this BCP 47 locale on every row.
|
|
61
|
+
*/
|
|
62
|
+
locale: string
|
|
63
|
+
addressRole: AddressRole
|
|
64
|
+
description: string
|
|
65
|
+
/**
|
|
66
|
+
* The record reader the evaluation source also calls, over the adapter's input file.
|
|
67
|
+
*/
|
|
68
|
+
read(path: PathBuilderLike): AsyncIterable<EvaluationRecordReading>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* One reader's verdict as a corpus row, or the reason it yields none.
|
|
73
|
+
*/
|
|
74
|
+
export function evaluationRecordRow(
|
|
75
|
+
spec: Pick<EvaluationCorpusAdapterSpec, "source" | "locale">,
|
|
76
|
+
reading: EvaluationRecordReading
|
|
77
|
+
): { readonly admitted: CanonicalRow } | { readonly refused: string } {
|
|
78
|
+
if ("refused" in reading) return reading
|
|
79
|
+
|
|
80
|
+
const { country } = spec.source
|
|
81
|
+
const rendered = formatAddressRow(reading.components, country, { singleLine: true })
|
|
82
|
+
|
|
83
|
+
if (!rendered || rendered.unplaced.length) return { refused: EvaluationAdapterRefusal.Unrenderable }
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
admitted: {
|
|
87
|
+
raw: rendered.raw,
|
|
88
|
+
components: rendered.components,
|
|
89
|
+
country,
|
|
90
|
+
locale: spec.locale,
|
|
91
|
+
source: spec.source.id,
|
|
92
|
+
source_id: stableSourceID(spec.source.id, rendered.components),
|
|
93
|
+
license: spec.source.license,
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A corpus adapter, under the evaluation source's id, that emits each record its reader admits.
|
|
100
|
+
*
|
|
101
|
+
* @throws When `spec.id` differs from the evaluation source's id.
|
|
102
|
+
*/
|
|
103
|
+
export function createEvaluationCorpusAdapter(spec: EvaluationCorpusAdapterSpec): CorpusAdapter {
|
|
104
|
+
const { id, country, license } = spec.source
|
|
105
|
+
|
|
106
|
+
if (spec.id !== id) {
|
|
107
|
+
throw new Error(`adapter id ${spec.id} differs from its evaluation source's id ${id}`)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
id,
|
|
112
|
+
defaultLicense: license,
|
|
113
|
+
addressRole: spec.addressRole,
|
|
114
|
+
register: spec.register,
|
|
115
|
+
surface: SurfaceOrigin.Rendered,
|
|
116
|
+
description: spec.description,
|
|
117
|
+
|
|
118
|
+
async *rows(opts) {
|
|
119
|
+
if (opts.country && opts.country !== country) {
|
|
120
|
+
throw new UnsupportedCountryError(id, [country], opts.country)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const seen = new Set<string>()
|
|
124
|
+
let emitted = 0
|
|
125
|
+
|
|
126
|
+
for await (const reading of spec.read(opts.inputPath)) {
|
|
127
|
+
if (opts.signal?.aborted) break
|
|
128
|
+
|
|
129
|
+
if (typeof opts.limit === "number" && emitted >= opts.limit) break
|
|
130
|
+
|
|
131
|
+
const row = evaluationRecordRow(spec, reading)
|
|
132
|
+
|
|
133
|
+
if ("refused" in row) {
|
|
134
|
+
countDropped(opts, row.refused)
|
|
135
|
+
|
|
136
|
+
continue
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (seen.has(row.admitted.source_id)) {
|
|
140
|
+
countDropped(opts, EvaluationAdapterRefusal.Duplicate)
|
|
141
|
+
|
|
142
|
+
continue
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
seen.add(row.admitted.source_id)
|
|
146
|
+
|
|
147
|
+
yield row.admitted
|
|
148
|
+
|
|
149
|
+
emitted++
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The contract an evaluation address source satisfies.
|
|
6
|
+
*
|
|
7
|
+
* An evaluation source is a publication whose rows give the release check's comparative objective
|
|
8
|
+
* rows a model didn't train on (`docs/engineering/HOLDOUT_AND_EVALUATION.mdx` section 6.4).
|
|
9
|
+
* A source stays unseen only while its register decision refuses `train`,
|
|
10
|
+
* which keeps it out of every build through `ingestEligibilityProblems`.
|
|
11
|
+
*
|
|
12
|
+
* The four sources `#evaluation/sources` lists now permit `train`, and each feeds a
|
|
13
|
+
* corpus adapter built by `#evaluation/corpus-adapter` over the same record reader,
|
|
14
|
+
* so a fix to the reader reaches both.
|
|
15
|
+
* The fresh set frozen from them on 2026-11-14 is no longer registered by any release
|
|
16
|
+
* specification (`docs/records/evals/2026-11-14-fresh-source-evaluation-set.md`).
|
|
17
|
+
*
|
|
18
|
+
* A source's identity, terms, fetch and reader live under its country's directory
|
|
19
|
+
* (`lib/<cc>/evaluation/`), and `#evaluation/sources` lists every one.
|
|
20
|
+
* The evaluation-set builder in `packages/mailwoman/tools/eval-harness/heldout/fresh/`
|
|
21
|
+
* reads only the fields below and never branches on a country.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { ComponentTag } from "@mailwoman/codex/component"
|
|
25
|
+
import { statPath } from "@mailwoman/core/fs/readers/stat"
|
|
26
|
+
import { makeDirectories } from "@mailwoman/core/fs/writers"
|
|
27
|
+
import { sha256File } from "@mailwoman/core/hash"
|
|
28
|
+
import type { PathBuilder } from "path-ts"
|
|
29
|
+
|
|
30
|
+
import { splitCORDISStreetLine, streetOrderForCountry } from "#adapters/cordis/adapter"
|
|
31
|
+
import { downloadToFile, readManifest, type SourceManifest, writeManifest } from "#tools/fetch/download"
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* One address an evaluation-only source states.
|
|
35
|
+
*/
|
|
36
|
+
export interface EvaluationAddressRecord {
|
|
37
|
+
/**
|
|
38
|
+
* The publisher's own identifier for the record, unique within the source.
|
|
39
|
+
*/
|
|
40
|
+
id: string
|
|
41
|
+
/**
|
|
42
|
+
* The region the record is stratified by: a state, a province, a region,
|
|
43
|
+
* or the publisher's coarsest geographic field.
|
|
44
|
+
*/
|
|
45
|
+
stratum: string
|
|
46
|
+
/**
|
|
47
|
+
* The address as the components the parser labels.
|
|
48
|
+
*/
|
|
49
|
+
components: Partial<Record<ComponentTag, string>>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* One publisher record as an address record, or the reason it yields none.
|
|
54
|
+
*/
|
|
55
|
+
export type EvaluationRecordReading = EvaluationAddressRecord | { readonly refused: string }
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* What one read of a source yielded: its records and why the others yielded none.
|
|
59
|
+
*/
|
|
60
|
+
export interface EvaluationSourceRead {
|
|
61
|
+
/**
|
|
62
|
+
* The publisher's vintage for the read input, or its fetch date where the publisher states none.
|
|
63
|
+
*/
|
|
64
|
+
vintage: string
|
|
65
|
+
records: AsyncIterable<EvaluationAddressRecord>
|
|
66
|
+
/**
|
|
67
|
+
* Refusals counted by reason, filled while `records` is consumed.
|
|
68
|
+
*/
|
|
69
|
+
refused: Record<string, number>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* One country's evaluation-only address publication.
|
|
74
|
+
*/
|
|
75
|
+
export interface EvaluationSource {
|
|
76
|
+
/**
|
|
77
|
+
* The stable source id, stored on every row the source contributes
|
|
78
|
+
* and naming its directory under the sources root.
|
|
79
|
+
*/
|
|
80
|
+
id: string
|
|
81
|
+
/**
|
|
82
|
+
* The ISO 3166-1 alpha-2 code stamped on every row.
|
|
83
|
+
*/
|
|
84
|
+
country: string
|
|
85
|
+
publisher: string
|
|
86
|
+
/**
|
|
87
|
+
* The credit the publisher's grant requires.
|
|
88
|
+
*/
|
|
89
|
+
attribution: string
|
|
90
|
+
/**
|
|
91
|
+
* The grant as the publisher names it, such as `Creative Commons Attribution 3.0 Australia`.
|
|
92
|
+
*/
|
|
93
|
+
license: string
|
|
94
|
+
/**
|
|
95
|
+
* The `sourceID` of the source's row in `data/address-source-register.json`.
|
|
96
|
+
*/
|
|
97
|
+
registerSource: string
|
|
98
|
+
/**
|
|
99
|
+
* Downloads the input `read` takes into `directory` and records the fetch in its `MANIFEST.json`.
|
|
100
|
+
*/
|
|
101
|
+
fetch(directory: PathBuilder, report?: (line: string) => void): Promise<SourceManifest>
|
|
102
|
+
/**
|
|
103
|
+
* Reads the fetched input under `directory`.
|
|
104
|
+
*
|
|
105
|
+
* @throws When the input or the record of its fetch is missing.
|
|
106
|
+
*/
|
|
107
|
+
read(directory: PathBuilder): Promise<EvaluationSourceRead>
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Downloads `url` to `directory/filename` and writes the fetch record beside it.
|
|
112
|
+
*/
|
|
113
|
+
export async function fetchEvaluationFile(
|
|
114
|
+
directory: PathBuilder,
|
|
115
|
+
url: string,
|
|
116
|
+
filename: string,
|
|
117
|
+
report?: (line: string) => void
|
|
118
|
+
): Promise<SourceManifest> {
|
|
119
|
+
await makeDirectories(directory)
|
|
120
|
+
|
|
121
|
+
const dest = directory(filename)
|
|
122
|
+
|
|
123
|
+
report?.(` ${url}`)
|
|
124
|
+
|
|
125
|
+
await downloadToFile({ url, dest, retries: 2 })
|
|
126
|
+
|
|
127
|
+
const manifest: SourceManifest = {
|
|
128
|
+
source_url: url,
|
|
129
|
+
downloaded_at: new Date().toISOString(),
|
|
130
|
+
filename,
|
|
131
|
+
sha256: await sha256File(dest),
|
|
132
|
+
bytes: (await statPath(dest)).size,
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
await writeManifest(directory("MANIFEST.json"), manifest)
|
|
136
|
+
|
|
137
|
+
report?.(` ${manifest.bytes.toLocaleString()} bytes, sha256 ${manifest.sha256}`)
|
|
138
|
+
|
|
139
|
+
return manifest
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The fetch record `fetchEvaluationFile` wrote under `directory`.
|
|
144
|
+
*
|
|
145
|
+
* @throws When the directory holds none.
|
|
146
|
+
*/
|
|
147
|
+
export async function readEvaluationFetch(directory: PathBuilder): Promise<SourceManifest> {
|
|
148
|
+
const manifest = await readManifest<SourceManifest>(directory("MANIFEST.json"))
|
|
149
|
+
|
|
150
|
+
if (!manifest) throw new Error(`${directory("MANIFEST.json")} is missing; fetch the source first`)
|
|
151
|
+
|
|
152
|
+
return manifest
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A source read over `readings`, counting each refusal under `refused` while `records` is consumed.
|
|
157
|
+
*/
|
|
158
|
+
export function evaluationSourceRead(
|
|
159
|
+
vintage: string,
|
|
160
|
+
readings: AsyncIterable<EvaluationRecordReading>
|
|
161
|
+
): EvaluationSourceRead {
|
|
162
|
+
const refused: Record<string, number> = {}
|
|
163
|
+
|
|
164
|
+
async function* records(): AsyncGenerator<EvaluationAddressRecord> {
|
|
165
|
+
for await (const reading of readings) {
|
|
166
|
+
if ("refused" in reading) {
|
|
167
|
+
refused[reading.refused] = (refused[reading.refused] ?? 0) + 1
|
|
168
|
+
|
|
169
|
+
continue
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
yield reading
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return { vintage, records: records(), refused }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Why a street line yields no address.
|
|
181
|
+
*/
|
|
182
|
+
export const EvaluationStreetRefusal = {
|
|
183
|
+
/**
|
|
184
|
+
* The line holds no house number, or one the country's side cannot place.
|
|
185
|
+
*/
|
|
186
|
+
NumberAbsent: "street:number-absent",
|
|
187
|
+
Unread: "street:unread",
|
|
188
|
+
} as const
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A street line split into its street and house number on the side `country`
|
|
192
|
+
* writes the number, or the reason it yields none.
|
|
193
|
+
*
|
|
194
|
+
* A line without a house number is refused, so every row of an evaluation set addresses a premise.
|
|
195
|
+
*/
|
|
196
|
+
export function evaluationStreetLine(
|
|
197
|
+
line: string,
|
|
198
|
+
country: string
|
|
199
|
+
): { street: string; house_number: string } | { refused: string } {
|
|
200
|
+
const split = splitCORDISStreetLine(line, streetOrderForCountry(country))
|
|
201
|
+
|
|
202
|
+
if (!split) return { refused: EvaluationStreetRefusal.Unread }
|
|
203
|
+
|
|
204
|
+
if ("refused" in split) return { refused: `street:${split.refused}` }
|
|
205
|
+
|
|
206
|
+
if (!split.house_number) return { refused: EvaluationStreetRefusal.NumberAbsent }
|
|
207
|
+
|
|
208
|
+
return { street: split.street, house_number: split.house_number }
|
|
209
|
+
}
|