@mailwoman/resolver-wof-sqlite 10.0.0 → 10.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 +9 -8
- package/lib/address/point/interpolation.ts +45 -39
- package/lib/address/point/schema.ts +17 -40
- package/lib/address/point.ts +316 -0
- package/lib/{address/index.ts → address.ts} +1 -1
- package/lib/ancestry/backfill.ts +20 -86
- package/lib/{ancestry/index.ts → ancestry.ts} +19 -15
- package/lib/build/candidate.ts +122 -174
- package/lib/build/population-corrections.ts +64 -0
- package/lib/build/slim.ts +44 -114
- package/lib/candidate/alias-bags.ts +16 -17
- package/lib/candidate/ancestors/schema.ts +77 -61
- package/lib/candidate/ancestors/sidecar.ts +15 -22
- package/lib/candidate/country-display-names.ts +6 -20
- package/lib/candidate/extract-fold.ts +10 -55
- package/lib/candidate/fts.ts +5 -23
- package/lib/candidate/importance.ts +65 -68
- package/lib/candidate/lookup.ts +124 -415
- package/lib/candidate/name-roles.ts +15 -33
- package/lib/candidate/own-name.ts +35 -32
- package/lib/candidate/place-attrs.ts +20 -13
- package/lib/candidate/schema.ts +29 -65
- package/lib/candidate/scoring.ts +54 -93
- package/lib/capital-schema.ts +21 -17
- package/lib/capitals.ts +29 -27
- package/lib/coincident-roles.ts +85 -55
- package/lib/convention/schema.ts +15 -16
- package/lib/convention.ts +144 -0
- package/lib/coverage-manifest-schema.ts +40 -45
- package/lib/currency-backfill.ts +34 -79
- package/lib/env.ts +1 -1
- package/lib/exact-match.ts +32 -21
- package/lib/extracts.ts +97 -74
- package/lib/fst/autocomplete.ts +54 -37
- package/lib/fst/builder.ts +37 -41
- package/lib/fst/deserialize-web.ts +16 -17
- package/lib/fst/format.ts +41 -23
- package/lib/fst/freshness.ts +43 -120
- package/lib/fst/matcher.ts +7 -5
- package/lib/fst/serialize.ts +54 -74
- package/lib/fst/types.ts +78 -75
- package/lib/{fst/index.ts → fst.ts} +1 -0
- package/lib/fts/query.ts +5 -36
- package/lib/fts.ts +280 -0
- package/lib/geonames/aliases.ts +73 -144
- package/lib/geonames/postal.ts +162 -71
- package/lib/index.ts +9 -8
- package/lib/interpolation.ts +48 -100
- package/lib/lookup.ts +155 -270
- package/lib/name-score.ts +9 -7
- package/lib/nsul/lookup.ts +37 -54
- package/lib/nsul/schema.ts +16 -43
- package/lib/paths.ts +159 -0
- package/lib/place-importance-schema.ts +62 -169
- package/lib/poi/lookup.ts +104 -121
- package/lib/poi/schema.ts +42 -26
- package/lib/polygon-schema.ts +10 -6
- package/lib/postal/city/alias/lookup.ts +22 -40
- package/lib/postal/city/alias/schema.ts +14 -10
- package/lib/postal/city/candidate-schema.ts +26 -20
- package/lib/postcode-point-lookup.ts +8 -27
- package/lib/primary-preference.ts +46 -126
- package/lib/proximity-rerank.ts +44 -33
- package/lib/ranking-weights.ts +105 -78
- package/lib/region-keys.ts +70 -42
- package/lib/reverse.ts +149 -86
- package/lib/schema.ts +73 -50
- package/lib/search-fetch.ts +90 -68
- package/lib/sqlite/convention-source.ts +15 -23
- package/lib/sqlite/utils.ts +19 -22
- package/lib/street/centroid/schema.ts +37 -42
- package/lib/street/{centroid/index.ts → centroid.ts} +16 -25
- package/lib/street/morphology/fst/builder.ts +60 -42
- package/lib/street/morphology/fst/loader.ts +40 -32
- package/lib/street/name-lookup.ts +45 -41
- package/lib/street/normalize.ts +88 -219
- package/lib/street/segment-schema.ts +116 -43
- package/lib/{street/index.ts → street.ts} +1 -1
- package/lib/types.ts +109 -150
- package/lib/unified-schema.ts +29 -29
- package/lib/uprn/existence.ts +30 -19
- package/lib/uprn/lookup.ts +29 -68
- package/lib/uprn/schema.ts +18 -40
- package/lib/weights-overlay-linker.ts +236 -252
- package/out/address/point/interpolation.d.ts +20 -23
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +42 -39
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +12 -35
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point/schema.js +3 -19
- package/out/address/point/schema.js.map +1 -1
- package/out/address/point.d.ts +57 -0
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +206 -0
- package/out/address/point.js.map +1 -0
- package/out/{address/index.js → address.d.ts} +2 -2
- package/out/address.d.ts.map +1 -0
- package/out/{address/index.d.ts → address.js} +2 -2
- package/out/address.js.map +1 -0
- package/out/ancestry/backfill.d.ts +11 -64
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +14 -74
- package/out/ancestry/backfill.js.map +1 -1
- package/out/ancestry.d.ts +49 -0
- package/out/ancestry.d.ts.map +1 -0
- package/out/ancestry.js +59 -0
- package/out/ancestry.js.map +1 -0
- package/out/build/candidate.d.ts +82 -112
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +17 -100
- package/out/build/candidate.js.map +1 -1
- package/out/build/population-corrections.d.ts +52 -0
- package/out/build/population-corrections.d.ts.map +1 -0
- package/out/build/population-corrections.js +40 -0
- package/out/build/population-corrections.js.map +1 -0
- package/out/build/slim.d.ts +8 -44
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +33 -94
- package/out/build/slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +6 -6
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +16 -17
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +73 -57
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/schema.js +56 -48
- package/out/candidate/ancestors/schema.js.map +1 -1
- package/out/candidate/ancestors/sidecar.d.ts +3 -8
- package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.js +15 -22
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +5 -15
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +6 -20
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +7 -15
- package/out/candidate/extract-fold.d.ts.map +1 -1
- package/out/candidate/extract-fold.js +5 -47
- package/out/candidate/extract-fold.js.map +1 -1
- package/out/candidate/fts.d.ts +5 -23
- package/out/candidate/fts.d.ts.map +1 -1
- package/out/candidate/fts.js +5 -23
- package/out/candidate/fts.js.map +1 -1
- package/out/candidate/importance.d.ts +60 -65
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +56 -63
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/lookup.d.ts +18 -55
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +82 -385
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts +9 -21
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +15 -33
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/own-name.d.ts +23 -25
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +35 -32
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +20 -13
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +4 -5
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate/schema.d.ts +27 -62
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +10 -22
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +7 -8
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +52 -89
- package/out/candidate/scoring.js.map +1 -1
- package/out/capital-schema.d.ts +21 -17
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +17 -15
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +27 -25
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +23 -21
- package/out/capitals.js.map +1 -1
- package/out/coincident-roles.d.ts +60 -43
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +72 -50
- package/out/coincident-roles.js.map +1 -1
- package/out/convention/schema.d.ts +14 -14
- package/out/convention/schema.d.ts.map +1 -1
- package/out/convention/schema.js +6 -4
- package/out/convention/schema.js.map +1 -1
- package/out/convention.d.ts +97 -0
- package/out/convention.d.ts.map +1 -0
- package/out/convention.js +81 -0
- package/out/convention.js.map +1 -0
- package/out/coverage-manifest-schema.d.ts +34 -39
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +25 -34
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +16 -38
- package/out/currency-backfill.d.ts.map +1 -1
- package/out/currency-backfill.js +19 -46
- package/out/currency-backfill.js.map +1 -1
- package/out/env.d.ts +1 -1
- package/out/env.js +1 -1
- package/out/exact-match.d.ts +19 -10
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +32 -21
- package/out/exact-match.js.map +1 -1
- package/out/extracts.d.ts +66 -55
- package/out/extracts.d.ts.map +1 -1
- package/out/extracts.js +63 -55
- package/out/extracts.js.map +1 -1
- package/out/fst/autocomplete.d.ts +29 -21
- package/out/fst/autocomplete.d.ts.map +1 -1
- package/out/fst/autocomplete.js +39 -28
- package/out/fst/autocomplete.js.map +1 -1
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +37 -41
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.d.ts +4 -4
- package/out/fst/deserialize-web.d.ts.map +1 -1
- package/out/fst/deserialize-web.js +15 -16
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/format.d.ts +41 -23
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +41 -23
- package/out/fst/format.js.map +1 -1
- package/out/fst/freshness.d.ts +19 -81
- package/out/fst/freshness.d.ts.map +1 -1
- package/out/fst/freshness.js +31 -94
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/matcher.d.ts +5 -4
- package/out/fst/matcher.d.ts.map +1 -1
- package/out/fst/matcher.js +2 -2
- package/out/fst/matcher.js.map +1 -1
- package/out/fst/serialize.d.ts +28 -28
- package/out/fst/serialize.d.ts.map +1 -1
- package/out/fst/serialize.js +53 -71
- package/out/fst/serialize.js.map +1 -1
- package/out/fst/types.d.ts +78 -74
- package/out/fst/types.d.ts.map +1 -1
- package/out/fst/types.js +1 -4
- package/out/fst/types.js.map +1 -1
- package/out/{fst/index.js → fst.d.ts} +2 -1
- package/out/fst.d.ts.map +1 -0
- package/out/{fst/index.d.ts → fst.js} +2 -1
- package/out/fst.js.map +1 -0
- package/out/fts/query.d.ts +2 -27
- package/out/fts/query.d.ts.map +1 -1
- package/out/fts/query.js +5 -36
- package/out/fts/query.js.map +1 -1
- package/out/fts.d.ts +126 -0
- package/out/fts.d.ts.map +1 -0
- package/out/fts.js +188 -0
- package/out/fts.js.map +1 -0
- package/out/geonames/aliases.d.ts +26 -62
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +45 -117
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +84 -44
- package/out/geonames/postal.d.ts.map +1 -1
- package/out/geonames/postal.js +115 -73
- package/out/geonames/postal.js.map +1 -1
- package/out/{geonames/index.js → geonames.d.ts} +1 -1
- package/out/geonames.d.ts.map +1 -0
- package/out/{geonames/index.d.ts → geonames.js} +1 -1
- package/out/geonames.js.map +1 -0
- package/out/index.d.ts +9 -8
- package/out/index.d.ts.map +1 -1
- package/out/index.js +6 -5
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +18 -55
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +27 -69
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +23 -51
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +136 -234
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +2 -2
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +9 -7
- package/out/name-score.js.map +1 -1
- package/out/nsul/lookup.d.ts +33 -34
- package/out/nsul/lookup.d.ts.map +1 -1
- package/out/nsul/lookup.js +26 -40
- package/out/nsul/lookup.js.map +1 -1
- package/out/nsul/schema.d.ts +16 -43
- package/out/nsul/schema.d.ts.map +1 -1
- package/out/nsul/schema.js +9 -35
- package/out/nsul/schema.js.map +1 -1
- package/out/{nsul/index.d.ts → nsul.d.ts} +1 -1
- package/out/nsul.d.ts.map +1 -0
- package/out/{nsul/index.js → nsul.js} +1 -1
- package/out/nsul.js.map +1 -0
- package/out/paths.d.ts +124 -0
- package/out/paths.d.ts.map +1 -0
- package/out/paths.js +104 -0
- package/out/paths.js.map +1 -0
- package/out/place-importance-schema.d.ts +51 -143
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +28 -143
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/lookup.d.ts +40 -47
- package/out/poi/lookup.d.ts.map +1 -1
- package/out/poi/lookup.js +69 -96
- package/out/poi/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +41 -25
- package/out/poi/schema.d.ts.map +1 -1
- package/out/poi/schema.js +25 -17
- package/out/poi/schema.js.map +1 -1
- package/out/{poi/index.js → poi.d.ts} +1 -1
- package/out/poi.d.ts.map +1 -0
- package/out/{poi/index.d.ts → poi.js} +1 -1
- package/out/poi.js.map +1 -0
- package/out/polygon-schema.d.ts +10 -6
- package/out/polygon-schema.d.ts.map +1 -1
- package/out/polygon-schema.js +2 -2
- package/out/polygon-schema.js.map +1 -1
- package/out/postal/city/alias/lookup.d.ts +20 -23
- package/out/postal/city/alias/lookup.d.ts.map +1 -1
- package/out/postal/city/alias/lookup.js +17 -30
- package/out/postal/city/alias/lookup.js.map +1 -1
- package/out/postal/city/alias/schema.d.ts +14 -10
- package/out/postal/city/alias/schema.d.ts.map +1 -1
- package/out/postal/city/alias/schema.js +10 -8
- package/out/postal/city/alias/schema.js.map +1 -1
- package/out/postal/city/candidate-schema.d.ts +25 -19
- package/out/postal/city/candidate-schema.d.ts.map +1 -1
- package/out/postal/city/candidate-schema.js +21 -17
- package/out/postal/city/candidate-schema.js.map +1 -1
- package/out/{postal/index.d.ts → postal.d.ts} +1 -1
- package/out/postal.d.ts.map +1 -0
- package/out/{postal/index.js → postal.js} +1 -1
- package/out/postal.js.map +1 -0
- package/out/postcode-point-lookup.d.ts +6 -24
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +5 -17
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +38 -92
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +15 -99
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +41 -30
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +38 -29
- package/out/proximity-rerank.js.map +1 -1
- package/out/ranking-weights.d.ts +98 -64
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +26 -25
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +50 -31
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +68 -40
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +78 -50
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +98 -61
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +72 -49
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +4 -5
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +16 -12
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +83 -63
- package/out/search-fetch.js.map +1 -1
- package/out/sqlite/convention-source.d.ts +12 -16
- package/out/sqlite/convention-source.d.ts.map +1 -1
- package/out/sqlite/convention-source.js +13 -22
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/sqlite/utils.d.ts +19 -19
- package/out/sqlite/utils.d.ts.map +1 -1
- package/out/sqlite/utils.js +14 -15
- package/out/sqlite/utils.js.map +1 -1
- package/out/street/centroid/schema.d.ts +37 -42
- package/out/street/centroid/schema.d.ts.map +1 -1
- package/out/street/centroid/schema.js +9 -21
- package/out/street/centroid/schema.js.map +1 -1
- package/out/street/centroid.d.ts +30 -0
- package/out/street/centroid.d.ts.map +1 -0
- package/out/street/{centroid/index.js → centroid.js} +13 -24
- package/out/street/centroid.js.map +1 -0
- package/out/street/morphology/fst/builder.d.ts +20 -10
- package/out/street/morphology/fst/builder.d.ts.map +1 -1
- package/out/street/morphology/fst/builder.js +44 -34
- package/out/street/morphology/fst/builder.js.map +1 -1
- package/out/street/morphology/fst/loader.d.ts +33 -26
- package/out/street/morphology/fst/loader.d.ts.map +1 -1
- package/out/street/morphology/fst/loader.js +23 -22
- package/out/street/morphology/fst/loader.js.map +1 -1
- package/out/street/name-lookup.d.ts +24 -18
- package/out/street/name-lookup.d.ts.map +1 -1
- package/out/street/name-lookup.js +34 -35
- package/out/street/name-lookup.js.map +1 -1
- package/out/street/normalize.d.ts +35 -136
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +77 -194
- package/out/street/normalize.js.map +1 -1
- package/out/street/segment-schema.d.ts +79 -39
- package/out/street/segment-schema.d.ts.map +1 -1
- package/out/street/segment-schema.js +71 -21
- package/out/street/segment-schema.js.map +1 -1
- package/out/{street/index.js → street.d.ts} +2 -2
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.d.ts → street.js} +2 -2
- package/out/street.js.map +1 -0
- package/out/types.d.ts +84 -149
- package/out/types.d.ts.map +1 -1
- package/out/types.js +0 -6
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +8 -12
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +29 -29
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +28 -17
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +26 -16
- package/out/uprn/existence.js.map +1 -1
- package/out/uprn/lookup.d.ts +14 -44
- package/out/uprn/lookup.d.ts.map +1 -1
- package/out/uprn/lookup.js +21 -57
- package/out/uprn/lookup.js.map +1 -1
- package/out/uprn/schema.d.ts +18 -40
- package/out/uprn/schema.d.ts.map +1 -1
- package/out/uprn/schema.js +10 -32
- package/out/uprn/schema.js.map +1 -1
- package/out/{uprn/index.d.ts → uprn.d.ts} +1 -1
- package/out/uprn.d.ts.map +1 -0
- package/out/{uprn/index.js → uprn.js} +1 -1
- package/out/uprn.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +138 -144
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +105 -159
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +91 -596
- package/lib/address/point/index.ts +0 -328
- package/lib/convention/index.ts +0 -154
- package/lib/fts/index.ts +0 -361
- package/out/address/index.d.ts.map +0 -1
- package/out/address/index.js.map +0 -1
- package/out/address/point/index.d.ts +0 -53
- package/out/address/point/index.d.ts.map +0 -1
- package/out/address/point/index.js +0 -222
- package/out/address/point/index.js.map +0 -1
- package/out/ancestry/index.d.ts +0 -45
- package/out/ancestry/index.d.ts.map +0 -1
- package/out/ancestry/index.js +0 -55
- package/out/ancestry/index.js.map +0 -1
- package/out/convention/index.d.ts +0 -106
- package/out/convention/index.d.ts.map +0 -1
- package/out/convention/index.js +0 -93
- package/out/convention/index.js.map +0 -1
- package/out/fst/index.d.ts.map +0 -1
- package/out/fst/index.js.map +0 -1
- package/out/fts/index.d.ts +0 -184
- package/out/fts/index.d.ts.map +0 -1
- package/out/fts/index.js +0 -277
- package/out/fts/index.js.map +0 -1
- package/out/geonames/index.d.ts.map +0 -1
- package/out/geonames/index.js.map +0 -1
- package/out/nsul/index.d.ts.map +0 -1
- package/out/nsul/index.js.map +0 -1
- package/out/poi/index.d.ts.map +0 -1
- package/out/poi/index.js.map +0 -1
- package/out/postal/index.d.ts.map +0 -1
- package/out/postal/index.js.map +0 -1
- package/out/street/centroid/index.d.ts +0 -40
- package/out/street/centroid/index.d.ts.map +0 -1
- package/out/street/centroid/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/out/uprn/index.d.ts.map +0 -1
- package/out/uprn/index.js.map +0 -1
- /package/lib/{geonames/index.ts → geonames.ts} +0 -0
- /package/lib/{nsul/index.ts → nsul.ts} +0 -0
- /package/lib/{poi/index.ts → poi.ts} +0 -0
- /package/lib/{postal/index.ts → postal.ts} +0 -0
- /package/lib/{uprn/index.ts → uprn.ts} +0 -0
package/out/uprn/existence.d.ts
CHANGED
|
@@ -3,34 +3,41 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
* @file The consult `./lookup.ts`'s docstring instructs: "callers building negative evidence must consult
|
|
6
|
-
* `readLayerCoverage`, not this reader
|
|
7
|
-
* or
|
|
6
|
+
* `readLayerCoverage`, not this reader by itself." A bare `null` from `nearestUPRN` is two different facts — no uprn here,
|
|
7
|
+
* or an unsurveyed area — and this is the only place that separates them. It answers an {@link Exclusion} or `null`,
|
|
8
8
|
* so a caller cannot read an unsurveyed cell as an empty one by accident.
|
|
9
9
|
*
|
|
10
|
-
* `radiusM` is a
|
|
11
|
-
* this coordinate" and "is this street built at all", and picking one here would bury that choice where
|
|
10
|
+
* `radiusM` is a caller'S parameter with no default. There is no radius that is correct for both "which property is
|
|
11
|
+
* this coordinate" and "is this street built at all", and picking one here would bury that choice where reviewers
|
|
12
12
|
* reviewing an exclusion can see it.
|
|
13
13
|
*/
|
|
14
|
-
import { type
|
|
14
|
+
import { type layerschemahandle } from "@mailwoman/core/layers";
|
|
15
15
|
import { type Exclusion } from "@mailwoman/evidence";
|
|
16
16
|
import type { UPRNLookup } from "#uprn/lookup";
|
|
17
17
|
/**
|
|
18
|
-
* The identity fold, on purpose: this probe keys on a
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The identity fold, on purpose: this probe keys on a coordinate rather than a name,
|
|
19
|
+
* so there is no string folding for the builder and the probe to disagree about.
|
|
20
|
+
*
|
|
21
|
+
* The same identity in both `probeFold` and `layerFold` records that the fold axis
|
|
22
|
+
* is not in play here, rather than silently omitting the check.
|
|
23
|
+
* It is not a stub.
|
|
21
24
|
*/
|
|
22
25
|
export declare const UPRN_EXISTENCE_FOLD: string;
|
|
23
26
|
/**
|
|
24
|
-
* The countries OS Open
|
|
25
|
-
*
|
|
27
|
+
* The countries OS Open uprn covers.
|
|
28
|
+
*
|
|
29
|
+
* Northern Ireland is outside the product, so a `null` there is unknown
|
|
30
|
+
* and must never become evidence of absence.
|
|
31
|
+
* The country check is what keeps it out.
|
|
26
32
|
*/
|
|
27
33
|
export declare const UPRN_COVERED_COUNTRIES: ReadonlySet<string>;
|
|
28
34
|
export interface UPRNAbsenceInput {
|
|
29
35
|
lookup: UPRNLookup;
|
|
30
36
|
/**
|
|
31
|
-
* The same file the lookup reads
|
|
37
|
+
* The same file the lookup reads.
|
|
38
|
+
* The layer interface tables live beside the points.
|
|
32
39
|
*/
|
|
33
|
-
|
|
40
|
+
schemadb: layerschemahandle;
|
|
34
41
|
latitude: number;
|
|
35
42
|
longitude: number;
|
|
36
43
|
radiusM: number;
|
|
@@ -40,14 +47,18 @@ export interface UPRNAbsenceInput {
|
|
|
40
47
|
country?: string;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
|
-
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly
|
|
44
|
-
*
|
|
50
|
+
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly
|
|
51
|
+
* as the builder derives it rather than from the centroid.
|
|
52
|
+
*
|
|
53
|
+
* The centroid lands in a different parent for a fraction of cells.
|
|
45
54
|
*/
|
|
46
55
|
export declare function uprnCoverageCell(latitude: number, longitude: number): number;
|
|
47
56
|
/**
|
|
48
|
-
* An {@link Exclusion} when no
|
|
49
|
-
* (presence is not this probe's business) and on every refusal
|
|
50
|
-
*
|
|
57
|
+
* An {@link Exclusion} when no uprn lies within `radiusM` and the layer's coverage licenses
|
|
58
|
+
* saying so; `null` on a hit (presence is not this probe's business) and on every refusal
|
|
59
|
+
* (unsurveyed cell, `source_present` basis, a country the product does not cover).
|
|
60
|
+
*
|
|
61
|
+
* Never throws on a refusal: the caller falls open to the ranking it already had.
|
|
51
62
|
*/
|
|
52
63
|
export declare function uprnAbsenceAt(input: UPRNAbsenceInput): Promise<Exclusion | null>;
|
|
53
64
|
//# sourceMappingURL=existence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existence.d.ts","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwC,KAAK,
|
|
1
|
+
{"version":3,"file":"existence.d.ts","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwC,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACrG,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,QAAyB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAAmB,CAAA;AAE1E,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,UAAU,CAAA;IAClB;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAqBtF"}
|
package/out/uprn/existence.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
* @file The consult `./lookup.ts`'s docstring instructs: "callers building negative evidence must consult
|
|
6
|
-
* `readLayerCoverage`, not this reader
|
|
7
|
-
* or
|
|
6
|
+
* `readLayerCoverage`, not this reader by itself." A bare `null` from `nearestUPRN` is two different facts — no uprn here,
|
|
7
|
+
* or an unsurveyed area — and this is the only place that separates them. It answers an {@link Exclusion} or `null`,
|
|
8
8
|
* so a caller cannot read an unsurveyed cell as an empty one by accident.
|
|
9
9
|
*
|
|
10
|
-
* `radiusM` is a
|
|
11
|
-
* this coordinate" and "is this street built at all", and picking one here would bury that choice where
|
|
10
|
+
* `radiusM` is a caller'S parameter with no default. There is no radius that is correct for both "which property is
|
|
11
|
+
* this coordinate" and "is this street built at all", and picking one here would bury that choice where reviewers
|
|
12
12
|
* reviewing an exclusion can see it.
|
|
13
13
|
*/
|
|
14
14
|
import { readLayerCoverage, readLayerManifest } from "@mailwoman/core/layers";
|
|
@@ -16,36 +16,46 @@ import { foldIdentity, requireExclusionBasis } from "@mailwoman/evidence";
|
|
|
16
16
|
import { shortCellToParentInt } from "@mailwoman/spatial";
|
|
17
17
|
import { UPRN_COVERAGE_H3_RESOLUTION, UPRN_H3_RESOLUTION, uprnH3Cell } from "#uprn/schema";
|
|
18
18
|
/**
|
|
19
|
-
* The identity fold, on purpose: this probe keys on a
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* The identity fold, on purpose: this probe keys on a coordinate rather than a name,
|
|
20
|
+
* so there is no string folding for the builder and the probe to disagree about.
|
|
21
|
+
*
|
|
22
|
+
* The same identity in both `probeFold` and `layerFold` records that the fold axis
|
|
23
|
+
* is not in play here, rather than silently omitting the check.
|
|
24
|
+
* It is not a stub.
|
|
22
25
|
*/
|
|
23
26
|
export const UPRN_EXISTENCE_FOLD = foldIdentity((s) => s);
|
|
24
27
|
/**
|
|
25
|
-
* The countries OS Open
|
|
26
|
-
*
|
|
28
|
+
* The countries OS Open uprn covers.
|
|
29
|
+
*
|
|
30
|
+
* Northern Ireland is outside the product, so a `null` there is unknown
|
|
31
|
+
* and must never become evidence of absence.
|
|
32
|
+
* The country check is what keeps it out.
|
|
27
33
|
*/
|
|
28
34
|
export const UPRN_COVERED_COUNTRIES = new Set(["GB"]);
|
|
29
35
|
/**
|
|
30
|
-
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly
|
|
31
|
-
*
|
|
36
|
+
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly
|
|
37
|
+
* as the builder derives it rather than from the centroid.
|
|
38
|
+
*
|
|
39
|
+
* The centroid lands in a different parent for a fraction of cells.
|
|
32
40
|
*/
|
|
33
41
|
export function uprnCoverageCell(latitude, longitude) {
|
|
34
42
|
return shortCellToParentInt(uprnH3Cell(latitude, longitude), UPRN_H3_RESOLUTION, UPRN_COVERAGE_H3_RESOLUTION);
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
37
|
-
* An {@link Exclusion} when no
|
|
38
|
-
* (presence is not this probe's business) and on every refusal
|
|
39
|
-
*
|
|
45
|
+
* An {@link Exclusion} when no uprn lies within `radiusM` and the layer's coverage licenses
|
|
46
|
+
* saying so; `null` on a hit (presence is not this probe's business) and on every refusal
|
|
47
|
+
* (unsurveyed cell, `source_present` basis, a country the product does not cover).
|
|
48
|
+
*
|
|
49
|
+
* Never throws on a refusal: the caller falls open to the ranking it already had.
|
|
40
50
|
*/
|
|
41
51
|
export async function uprnAbsenceAt(input) {
|
|
42
52
|
const coverageCell = uprnCoverageCell(input.latitude, input.longitude);
|
|
43
|
-
const coverage = await readLayerCoverage(input.
|
|
53
|
+
const coverage = await readLayerCoverage(input.schemadb, coverageCell);
|
|
44
54
|
if (!coverage)
|
|
45
55
|
return null;
|
|
46
56
|
if (input.lookup.nearestUPRN(input.latitude, input.longitude, input.radiusM))
|
|
47
57
|
return null;
|
|
48
|
-
const manifest = await readLayerManifest(input.
|
|
58
|
+
const manifest = await readLayerManifest(input.schemadb);
|
|
49
59
|
return requireExclusionBasis({
|
|
50
60
|
layer: manifest.name,
|
|
51
61
|
source: manifest.source,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existence.js","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"existence.js","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAA;AACrG,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAkB,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE1F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAkB1E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,SAAiB;IACnE,OAAO,oBAAoB,CAAC,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,kBAAkB,EAAE,2BAA2B,CAAC,CAAA;AAC9G,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAuB;IAC1D,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IACtE,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;IAEtE,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IAEzF,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAExD,OAAO,qBAAqB,CAAC;QAC5B,KAAK,EAAE,QAAQ,CAAC,IAAI;QACpB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,aAAa;QAC/B,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,mBAAmB;QAC9B,SAAS,EAAE,mBAAmB;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,sBAAsB;KACjC,CAAC,CAAA;AACH,CAAC"}
|
package/out/uprn/lookup.d.ts
CHANGED
|
@@ -3,79 +3,49 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - **`coordinateOf(uprn)`**: rowid B-tree hit on the `uprn` integer PK.
|
|
9
|
-
* - **`nearestUPRN(lat, lon, radiusM)`**: bounded nearest-point search over the res-9 `h3_cell`
|
|
10
|
-
* index — ring-by-ring `gridDisk` expansion with chunked `IN` probes and haversine ranking.
|
|
11
|
-
* Rings stop as soon as geometry proves no unprobed cell could beat the best hit — a distance
|
|
12
|
-
* bound, not POILookup's row-count accumulation, so the early exit can never strand a nearer
|
|
13
|
-
* point in an unprobed ring.
|
|
14
|
-
*
|
|
15
|
-
* ## `null` is a claim, scoped by coverage
|
|
16
|
-
*
|
|
17
|
-
* OS designates Open UPRN complete for GB (every UPRN in AddressBase Premium with geometry), and
|
|
18
|
-
* the builder writes `layer_coverage` with basis `designated` for every cell the product touches.
|
|
19
|
-
* So a `null` from either probe inside a covered cell is evidence of absence — "no such published
|
|
20
|
-
* GB UPRN" / "no UPRN within the radius". Outside coverage (Northern Ireland, the Isle of Man, the
|
|
21
|
-
* Channel Islands, open water) it is UNKNOWN, per the meaning-of-zero rule — callers building
|
|
22
|
-
* negative evidence must consult `readLayerCoverage`, not this reader alone.
|
|
23
|
-
*
|
|
24
|
-
* `latLngToCell`/`gridDisk` come from `h3-js`; the 48-bit short-cell packing is
|
|
25
|
-
* `@mailwoman/spatial`'s `shortCellToInt` via `uprnFullCell` — never reimplemented here.
|
|
6
|
+
* Node reader for `uprn.db`, where a `null` is evidence of absence only inside published coverage, so callers building negative evidence must consult `readLayerCoverage`.
|
|
26
7
|
*/
|
|
8
|
+
import { type GeoCoordinate } from "@mailwoman/spatial";
|
|
27
9
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
10
|
+
import type { PathBuilderLike } from "path-ts";
|
|
28
11
|
import type { UPRNDatabase } from "#uprn/schema";
|
|
29
12
|
/**
|
|
30
|
-
* Hard ceiling on `radiusM
|
|
31
|
-
*
|
|
13
|
+
* Hard ceiling on `radiusM` that keeps the probe bounded, since a caller wanting a wider
|
|
14
|
+
* search than "which property is this coordinate" has outgrown this reader.
|
|
32
15
|
*/
|
|
33
16
|
export declare const UPRN_MAX_NEAREST_RADIUS_M = 10000;
|
|
34
|
-
export interface UPRNCoordinate {
|
|
35
|
-
latitude: number;
|
|
36
|
-
longitude: number;
|
|
37
|
-
}
|
|
38
17
|
export interface UPRNNearestHit {
|
|
39
18
|
uprn: number;
|
|
40
19
|
latitude: number;
|
|
41
20
|
longitude: number;
|
|
42
21
|
/**
|
|
43
|
-
* Haversine distance from the query point,
|
|
22
|
+
* Haversine distance from the query point, meters.
|
|
44
23
|
*/
|
|
45
24
|
distanceM: number;
|
|
46
25
|
}
|
|
47
26
|
export interface UPRNLookupOpts {
|
|
48
27
|
/**
|
|
49
|
-
* Path to a `uprn.db` built by `mailwoman`'s gazetteer pipeline
|
|
28
|
+
* Path to a `uprn.db` built by `mailwoman`'s gazetteer pipeline, opened read-only.
|
|
50
29
|
*/
|
|
51
|
-
databasePath?:
|
|
30
|
+
databasePath?: PathBuilderLike;
|
|
52
31
|
/**
|
|
53
|
-
* Pre-opened handle (tests / shared connections)
|
|
32
|
+
* Pre-opened handle (tests / shared connections), mutually exclusive with `databasePath`.
|
|
54
33
|
*/
|
|
55
34
|
database?: DatabaseClient<UPRNDatabase>;
|
|
56
35
|
}
|
|
57
36
|
/**
|
|
58
|
-
* Node reader over `uprn.db
|
|
59
|
-
* precedent as {@link POILookup}.
|
|
37
|
+
* Node reader over `uprn.db`, disposable so callers can take it with `using`.
|
|
60
38
|
*/
|
|
61
39
|
export declare class UPRNLookup implements Disposable {
|
|
62
40
|
#private;
|
|
63
41
|
constructor(opts: UPRNLookupOpts);
|
|
64
42
|
/**
|
|
65
|
-
* The WGS84 point OS publishes for `uprn`, or `null` when the layer holds no such
|
|
66
|
-
* what that `null` claims).
|
|
43
|
+
* The WGS84 point OS publishes for `uprn`, or `null` when the layer holds no such uprn.
|
|
67
44
|
*/
|
|
68
|
-
coordinateOf(uprn: number):
|
|
45
|
+
coordinateOf(uprn: number): GeoCoordinate | null;
|
|
69
46
|
/**
|
|
70
|
-
* The single nearest
|
|
71
|
-
*
|
|
72
|
-
* Bounded two ways: `radiusM` is capped at {@link UPRN_MAX_NEAREST_RADIUS_M}, and rings expand outward only until no
|
|
73
|
-
* unprobed cell could beat the best hit found so far (or the radius, when nothing has been found). The stop rule is
|
|
74
|
-
* geometric — a cell at grid distance `g` holds no point nearer than `g` × spacing floor − cell radius, using the
|
|
75
|
-
* same conservative constants the reach math uses — so unlike POILookup's row-count accumulation there is no
|
|
76
|
-
* early-exit ambiguity: a break can never strand a nearer point in an unprobed ring. This is what keeps a
|
|
77
|
-
* capped-radius call over dense ground at milliseconds instead of a full-disk fetch (measured 6.4 s → 13 ms for a 10
|
|
78
|
-
* km radius over central London, 41.6M-row layer; an empty-sea miss at the cap runs the full expansion, 74 ms).
|
|
47
|
+
* The single nearest uprn within `radiusM` meters of the query point, or `null`
|
|
48
|
+
* when no uprn lies inside the radius.
|
|
79
49
|
*
|
|
80
50
|
* @throws {RangeError} When `radiusM` is not a positive finite number, or exceeds the cap.
|
|
81
51
|
*/
|
package/out/uprn/lookup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAA+B,KAAK,aAAa,EAAe,MAAM,oBAAoB,CAAA;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAchD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAO/C,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CACvC;AAQD;;GAEG;AACH,qBAAa,UAAW,YAAW,UAAU;;IAU5C,YAAY,IAAI,EAAE,cAAc,EAa/B;IAED;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAI/C;IAED;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAmDvF;IAED,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
|
package/out/uprn/lookup.js
CHANGED
|
@@ -3,26 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - **`coordinateOf(uprn)`**: rowid B-tree hit on the `uprn` integer PK.
|
|
9
|
-
* - **`nearestUPRN(lat, lon, radiusM)`**: bounded nearest-point search over the res-9 `h3_cell`
|
|
10
|
-
* index — ring-by-ring `gridDisk` expansion with chunked `IN` probes and haversine ranking.
|
|
11
|
-
* Rings stop as soon as geometry proves no unprobed cell could beat the best hit — a distance
|
|
12
|
-
* bound, not POILookup's row-count accumulation, so the early exit can never strand a nearer
|
|
13
|
-
* point in an unprobed ring.
|
|
14
|
-
*
|
|
15
|
-
* ## `null` is a claim, scoped by coverage
|
|
16
|
-
*
|
|
17
|
-
* OS designates Open UPRN complete for GB (every UPRN in AddressBase Premium with geometry), and
|
|
18
|
-
* the builder writes `layer_coverage` with basis `designated` for every cell the product touches.
|
|
19
|
-
* So a `null` from either probe inside a covered cell is evidence of absence — "no such published
|
|
20
|
-
* GB UPRN" / "no UPRN within the radius". Outside coverage (Northern Ireland, the Isle of Man, the
|
|
21
|
-
* Channel Islands, open water) it is UNKNOWN, per the meaning-of-zero rule — callers building
|
|
22
|
-
* negative evidence must consult `readLayerCoverage`, not this reader alone.
|
|
23
|
-
*
|
|
24
|
-
* `latLngToCell`/`gridDisk` come from `h3-js`; the 48-bit short-cell packing is
|
|
25
|
-
* `@mailwoman/spatial`'s `shortCellToInt` via `uprnFullCell` — never reimplemented here.
|
|
6
|
+
* Node reader for `uprn.db`, where a `null` is evidence of absence only inside published coverage, so callers building negative evidence must consult `readLayerCoverage`.
|
|
26
7
|
*/
|
|
27
8
|
import { allRows } from "@mailwoman/core/utils";
|
|
28
9
|
import { haversineKm, shortCellToInt } from "@mailwoman/spatial";
|
|
@@ -30,21 +11,18 @@ import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
|
30
11
|
import { gridDisk } from "h3-js";
|
|
31
12
|
import { uprnFullCell } from "#uprn/schema";
|
|
32
13
|
/**
|
|
33
|
-
* Conservative
|
|
34
|
-
*
|
|
35
|
-
* distortion shrinks edges by well under the slack this leaves (the true worst is ≈217 m per grid step). Dividing a
|
|
36
|
-
* radius by this over-counts rings and can never miss a cell; multiplying a grid distance by it under-states reach and
|
|
37
|
-
* can never end the ring walk early.
|
|
14
|
+
* Conservative floor, in meters, on the center distance one unit of res-9 grid distance buys,
|
|
15
|
+
* so multiplying a grid distance under-states reach and can never end the ring walk early.
|
|
38
16
|
*/
|
|
39
17
|
const RES9_CENTER_SPACING_FLOOR_M = 150;
|
|
40
18
|
/**
|
|
41
|
-
* Conservative
|
|
42
|
-
*
|
|
19
|
+
* Conservative ceiling, in meters, on a res-9 cell's center-to-vertex distance, so a point
|
|
20
|
+
* within `radiusM` of the query sits in a cell whose center is within `radiusM` plus this.
|
|
43
21
|
*/
|
|
44
22
|
const RES9_CELL_RADIUS_CEILING_M = 300;
|
|
45
23
|
/**
|
|
46
|
-
* Hard ceiling on `radiusM
|
|
47
|
-
*
|
|
24
|
+
* Hard ceiling on `radiusM` that keeps the probe bounded, since a caller wanting a wider
|
|
25
|
+
* search than "which property is this coordinate" has outgrown this reader.
|
|
48
26
|
*/
|
|
49
27
|
export const UPRN_MAX_NEAREST_RADIUS_M = 10_000;
|
|
50
28
|
/**
|
|
@@ -52,50 +30,40 @@ export const UPRN_MAX_NEAREST_RADIUS_M = 10_000;
|
|
|
52
30
|
*/
|
|
53
31
|
const CELL_PROBE_CHUNK = 900;
|
|
54
32
|
/**
|
|
55
|
-
* Node reader over `uprn.db
|
|
56
|
-
* precedent as {@link POILookup}.
|
|
33
|
+
* Node reader over `uprn.db`, disposable so callers can take it with `using`.
|
|
57
34
|
*/
|
|
58
35
|
export class UPRNLookup {
|
|
59
36
|
#db;
|
|
60
37
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
#resources = new DisposableStack();
|
|
65
|
-
/**
|
|
66
|
-
* `uprn` → its point (rowid-alias PK hit).
|
|
38
|
+
* Ownership is membership: a connection handed in by a caller is not in here,
|
|
39
|
+
* so disposal cannot reach it.
|
|
67
40
|
*/
|
|
41
|
+
#resources;
|
|
68
42
|
#coordinateProbe;
|
|
69
43
|
constructor(opts) {
|
|
44
|
+
using resources = new DisposableStack();
|
|
70
45
|
if (opts.database) {
|
|
71
46
|
this.#db = opts.database;
|
|
72
47
|
}
|
|
73
48
|
else if (opts.databasePath) {
|
|
74
|
-
this.#db =
|
|
49
|
+
this.#db = resources.use(new DatabaseClient(opts.databasePath, { readOnly: true }));
|
|
75
50
|
}
|
|
76
51
|
else {
|
|
77
52
|
throw new Error("UPRNLookup needs `databasePath` or `database`");
|
|
78
53
|
}
|
|
79
54
|
this.#coordinateProbe = this.#db.prepare("SELECT lat, lon FROM uprn WHERE uprn = ?");
|
|
55
|
+
this.#resources = resources.move();
|
|
80
56
|
}
|
|
81
57
|
/**
|
|
82
|
-
* The WGS84 point OS publishes for `uprn`, or `null` when the layer holds no such
|
|
83
|
-
* what that `null` claims).
|
|
58
|
+
* The WGS84 point OS publishes for `uprn`, or `null` when the layer holds no such uprn.
|
|
84
59
|
*/
|
|
85
60
|
coordinateOf(uprn) {
|
|
86
61
|
const row = this.#coordinateProbe.get(uprn);
|
|
87
62
|
return row ? { latitude: row.lat, longitude: row.lon } : null;
|
|
88
63
|
}
|
|
89
64
|
/**
|
|
90
|
-
* The single nearest
|
|
91
|
-
*
|
|
92
|
-
* Bounded two ways: `radiusM` is capped at {@link UPRN_MAX_NEAREST_RADIUS_M}, and rings expand outward only until no
|
|
93
|
-
* unprobed cell could beat the best hit found so far (or the radius, when nothing has been found). The stop rule is
|
|
94
|
-
* geometric — a cell at grid distance `g` holds no point nearer than `g` × spacing floor − cell radius, using the
|
|
95
|
-
* same conservative constants the reach math uses — so unlike POILookup's row-count accumulation there is no
|
|
96
|
-
* early-exit ambiguity: a break can never strand a nearer point in an unprobed ring. This is what keeps a
|
|
97
|
-
* capped-radius call over dense ground at milliseconds instead of a full-disk fetch (measured 6.4 s → 13 ms for a 10
|
|
98
|
-
* km radius over central London, 41.6M-row layer; an empty-sea miss at the cap runs the full expansion, 74 ms).
|
|
65
|
+
* The single nearest uprn within `radiusM` meters of the query point, or `null`
|
|
66
|
+
* when no uprn lies inside the radius.
|
|
99
67
|
*
|
|
100
68
|
* @throws {RangeError} When `radiusM` is not a positive finite number, or exceeds the cap.
|
|
101
69
|
*/
|
|
@@ -109,16 +77,13 @@ export class UPRNLookup {
|
|
|
109
77
|
const origin = uprnFullCell(latitude, longitude);
|
|
110
78
|
const seenCells = new Set();
|
|
111
79
|
let best = null;
|
|
112
|
-
//
|
|
113
|
-
// RangeError above caps.
|
|
80
|
+
// The loop terminates because the break bound is at most `radiusM`.
|
|
81
|
+
// The RangeError above caps that value.
|
|
114
82
|
for (let ring = 0;; ring++) {
|
|
115
|
-
//
|
|
116
|
-
// win — the best hit so far, or the radius itself — further rings cannot improve the answer.
|
|
83
|
+
// Once this bound exceeds the best hit so far, or the radius, further rings cannot improve the answer.
|
|
117
84
|
const closestPossibleM = ring * RES9_CENTER_SPACING_FLOOR_M - RES9_CELL_RADIUS_CEILING_M;
|
|
118
85
|
if (closestPossibleM > Math.min(radiusM, best?.distanceM ?? radiusM))
|
|
119
86
|
break;
|
|
120
|
-
// gridDisk(origin, ring) returns the WHOLE disk out to `ring`; diffing against what's already been
|
|
121
|
-
// probed derives just this ring's new cells (the POILookup pattern).
|
|
122
87
|
const diskCells = gridDisk(origin, ring);
|
|
123
88
|
const newCells = [];
|
|
124
89
|
for (const cell of diskCells) {
|
|
@@ -130,11 +95,10 @@ export class UPRNLookup {
|
|
|
130
95
|
for (let i = 0; i < newCells.length; i += CELL_PROBE_CHUNK) {
|
|
131
96
|
const chunk = newCells.slice(i, i + CELL_PROBE_CHUNK);
|
|
132
97
|
const placeholders = chunk.map(() => "?").join(", ");
|
|
133
|
-
// Prepared fresh per chunk arity — a cold, per-call path, same posture as POILookup's batched hydration.
|
|
134
98
|
const rows = allRows(this.#db.prepare(`SELECT uprn, lat, lon FROM uprn WHERE h3_cell IN (${placeholders})`), ...chunk);
|
|
135
99
|
for (const row of rows) {
|
|
136
100
|
const distanceM = haversineKm(latitude, longitude, row.lat, row.lon) * 1000;
|
|
137
|
-
if (distanceM <= radiusM && (best
|
|
101
|
+
if (distanceM <= radiusM && (!best || distanceM < best.distanceM)) {
|
|
138
102
|
best = { uprn: row.uprn, latitude: row.lat, longitude: row.lon, distanceM };
|
|
139
103
|
}
|
|
140
104
|
}
|
package/out/uprn/lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"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"}
|
package/out/uprn/schema.d.ts
CHANGED
|
@@ -3,46 +3,22 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* Number with its WGS84 point, so mailwoman results can carry UPRN as an interoperability key
|
|
8
|
-
* beside our own `@mailwoman/address-id`. One rowid table keyed `uprn INTEGER PRIMARY KEY` (the
|
|
9
|
-
* rowid alias — the optimal shape for an integer-PK point table; `WITHOUT ROWID` buys nothing
|
|
10
|
-
* here), plus a secondary res-9 `h3_cell` index for the bounded nearest-point probe.
|
|
11
|
-
*
|
|
12
|
-
* ## Coordinates are OS's own WGS84 columns
|
|
13
|
-
*
|
|
14
|
-
* The source CSV publishes BOTH coordinate systems per row — OSGB36 eastings/northings AND WGS84
|
|
15
|
-
* `LATITUDE`/`LONGITUDE`. This layer stores OS's own lat/lon verbatim and never reconverts from
|
|
16
|
-
* eastings: `@mailwoman/spatial`'s `osgb36ToWGS84` is a 7-parameter Helmert with a measured p95 of
|
|
17
|
-
* 4.18 m, and re-deriving what the publisher already computed (with OSTN15, exactly) would replace
|
|
18
|
-
* their answer with a strictly worse one.
|
|
19
|
-
*
|
|
20
|
-
* ## Why `h3_cell` exists at all
|
|
21
|
-
*
|
|
22
|
-
* The layer contract requires every domain row to be addressable by at least one spine key —
|
|
23
|
-
* `writeLayerManifest` throws on a manifest that declares none — and UPRN is its own id space, not
|
|
24
|
-
* H3/WOF/address-id/street. The res-9 short cell (`shortCellToInt`, the same packing as poi.db and
|
|
25
|
-
* the OSM situs extracts) is the spine that fits a point table, and its index doubles as the
|
|
26
|
-
* `nearestUPRN` ring probe.
|
|
27
|
-
*
|
|
28
|
-
* The DB also embeds the layer-contract tables from `@mailwoman/core/layers`; the builder
|
|
29
|
-
* (`packages/mailwoman/lib/gazetteer-pipeline/uprn-layer.ts`) writes the manifest and per-res-6-cell
|
|
30
|
-
* coverage.
|
|
6
|
+
* Typed schema for `uprn.db`, storing OS's own WGS84 latitude/longitude verbatim rather than reconverting from the source's eastings.
|
|
31
7
|
*/
|
|
32
|
-
import type {
|
|
8
|
+
import type { layerschemadatabase } from "@mailwoman/core/layers";
|
|
33
9
|
import { type H3Cell } from "@mailwoman/spatial";
|
|
34
10
|
import type { Kysely } from "kysely";
|
|
35
11
|
/**
|
|
36
|
-
* Resolution the `uprn` table's `h3_cell` column is keyed at
|
|
37
|
-
* extracts).
|
|
12
|
+
* Resolution the `uprn` table's `h3_cell` column is keyed at, shared with the other layer spines.
|
|
38
13
|
*/
|
|
39
14
|
export declare const UPRN_H3_RESOLUTION = 9;
|
|
40
15
|
/**
|
|
41
|
-
* Resolution of the layer's `layer_coverage` cells
|
|
16
|
+
* Resolution of the layer's `layer_coverage` cells, coarse per the layer interface
|
|
17
|
+
* and shared with the other spines.
|
|
42
18
|
*/
|
|
43
19
|
export declare const UPRN_COVERAGE_H3_RESOLUTION = 6;
|
|
44
20
|
/**
|
|
45
|
-
* One
|
|
21
|
+
* One uprn point whose `uprn` is a rowid alias, making the primary probe a rowid B-tree hit.
|
|
46
22
|
*/
|
|
47
23
|
export interface UPRNTable {
|
|
48
24
|
/**
|
|
@@ -50,7 +26,7 @@ export interface UPRNTable {
|
|
|
50
26
|
*/
|
|
51
27
|
uprn: number;
|
|
52
28
|
/**
|
|
53
|
-
* WGS84 latitude, as OS published it
|
|
29
|
+
* WGS84 latitude, as OS published it, never reconverted from eastings.
|
|
54
30
|
*/
|
|
55
31
|
lat: number;
|
|
56
32
|
/**
|
|
@@ -58,36 +34,38 @@ export interface UPRNTable {
|
|
|
58
34
|
*/
|
|
59
35
|
lon: number;
|
|
60
36
|
/**
|
|
61
|
-
* 48-bit short H3 cell at {@link UPRN_H3_RESOLUTION}
|
|
62
|
-
* `nearestUPRN` probe index.
|
|
37
|
+
* 48-bit short H3 cell at {@link UPRN_H3_RESOLUTION} — the layer-interface spine key
|
|
38
|
+
* and the `nearestUPRN` probe index.
|
|
63
39
|
*/
|
|
64
40
|
h3_cell: number;
|
|
65
41
|
}
|
|
66
42
|
/**
|
|
67
|
-
* Build-provenance key/value pairs the fixed `layer_manifest` columns have no room for
|
|
68
|
-
*
|
|
43
|
+
* Build-provenance key/value pairs the fixed `layer_manifest` columns have no room for,
|
|
44
|
+
* including the upstream license text verbatim.
|
|
69
45
|
*/
|
|
70
46
|
export interface UPRNMetaTable {
|
|
71
47
|
key: string;
|
|
72
48
|
value: string;
|
|
73
49
|
}
|
|
74
|
-
export interface UPRNDatabase extends
|
|
50
|
+
export interface UPRNDatabase extends layerschemadatabase {
|
|
75
51
|
uprn: UPRNTable;
|
|
76
52
|
uprn_meta: UPRNMetaTable;
|
|
77
53
|
}
|
|
78
54
|
/**
|
|
79
|
-
* The full res-9 cell for a UPRN point
|
|
80
|
-
*
|
|
55
|
+
* The full res-9 cell for a UPRN point.
|
|
56
|
+
*
|
|
57
|
+
* This is the one derivation the builder and its consumers share so their cells cannot disagree.
|
|
81
58
|
*/
|
|
82
59
|
export declare function uprnFullCell(latitude: number, longitude: number): H3Cell;
|
|
83
60
|
/**
|
|
84
|
-
* The `h3_cell` column value for a
|
|
61
|
+
* The `h3_cell` column value for a uprn point, packing {@link uprnFullCell} to
|
|
62
|
+
* the shared 48-bit short-cell integer.
|
|
85
63
|
*/
|
|
86
64
|
export declare function uprnH3Cell(latitude: number, longitude: number): number;
|
|
87
65
|
export declare function createUPRNTable(db: Kysely<UPRNDatabase>): Promise<void>;
|
|
88
66
|
export declare function createUPRNMetaTable(db: Kysely<UPRNDatabase>): Promise<void>;
|
|
89
67
|
/**
|
|
90
|
-
* Secondary index for the `nearestUPRN` ring probe
|
|
68
|
+
* Secondary index for the `nearestUPRN` ring probe, created after the bulk load.
|
|
91
69
|
*/
|
|
92
70
|
export declare function createUPRNIndexes(db: Kysely<UPRNDatabase>): Promise<void>;
|
|
93
71
|
//# sourceMappingURL=schema.d.ts.map
|
package/out/uprn/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../lib/uprn/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../lib/uprn/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACxD,IAAI,EAAE,SAAS,CAAA;IACf,SAAS,EAAE,aAAa,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ7E;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/E"}
|