atlas_engine 0.7.0 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +38 -4
- data/app/countries/atlas_engine/gg/address_importer/corrections/open_address/city_corrector.rb +38 -0
- data/app/countries/atlas_engine/gg/country_profile.yml +4 -0
- data/app/countries/atlas_engine/gg/synonyms.yml +3 -0
- data/app/countries/atlas_engine/gg/validation_transcriber/address_parser.rb +15 -1
- data/lib/atlas_engine/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bdadba3857324dae37bf4c22aa4078b4f565876c0f865a4d3b99db69d0eaa41
|
4
|
+
data.tar.gz: 4004ade11bd387145ed6b82cb8b5df9a99989b3d1869cc1d40fd7fb310e3fc7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846730be55864274ddd3d61e90ffd970102ea54d25221e411cee78c91daaa974a1159d0c976cde708ac6ea355815deb9c1d91230ef9c4eb49dcf38fe59e4be27
|
7
|
+
data.tar.gz: 791c4a0050adab0b39092b660c56968d7f6862a1387914f50341f940153963487f9fc8ec8533ee6519fd8569bd69022c8cb7ce181c3017a14313fd32a49879a7
|
data/README.md
CHANGED
@@ -290,12 +290,46 @@ level address validation, your app must have a populated elasticsearch index per
|
|
290
290
|
to query.
|
291
291
|
|
292
292
|
The data we use to power atlas engine validation is free open source data from the [open addresses](https://openaddresses.io/)
|
293
|
-
project.
|
293
|
+
project.
|
294
|
+
|
295
|
+
### Supported countries
|
296
|
+
At the moment, `atlas_engine` supports advanced address validation for the following countries.
|
297
|
+
|
298
|
+
| Country/territory | Two-letter code | Locales | Street | City | Postal Code | Province/State |
|
299
|
+
|-------------------|-----------------|----------|--------|------|-------------|----------------|
|
300
|
+
| Australia | AU | | | x | x | x |
|
301
|
+
| Austria | AT | | | x | x | x |
|
302
|
+
| Belgium | BE | fr,nl,de | | x | x | |
|
303
|
+
| Bermuda | BM | | | x | x | x |
|
304
|
+
| Czechia | CZ | | | x | x | |
|
305
|
+
| Denmark | DK | | | x | x | |
|
306
|
+
| Faroe Islands | FO | | | x | x | |
|
307
|
+
| France | FR | | | x | x | |
|
308
|
+
| Italy | IT | | | | x | |
|
309
|
+
| Liechtenstein | LI | | | x | x | x |
|
310
|
+
| Luxembourg | LU | fr,lb | | x | x | |
|
311
|
+
| Netherlands | NL | nl | | x | x | x |
|
312
|
+
| Poland | PL | | | x | x | x |
|
313
|
+
| Portugal | PT | | | x | x | x |
|
314
|
+
| Slovenia | SI | | | x | x | x |
|
315
|
+
| South Korea | KR | | | x | x | x |
|
316
|
+
| Switzerland | CH | de,fr,it | | x | x | |
|
317
|
+
|
318
|
+
### Downloading and indexing instructions
|
319
|
+
|
320
|
+
|
321
|
+
The following guide demonstrates how to ingest data with the dummy app, but the process is the same with
|
294
322
|
the engine mounted into your own rails app.
|
295
323
|
|
296
324
|
1. Go to the [open addresses](https://openaddresses.io/) download center, create an account, support the project, and
|
297
|
-
download a GeoJSON+LD file for the country or region you wish to validate.
|
298
|
-
|
325
|
+
download a GeoJSON+LD file for the country or region you wish to validate.
|
326
|
+
|
327
|
+
Restrictions on the file:
|
328
|
+
- Must be an `addresses` file, as opposed to a `buildings` or `parcels` file.
|
329
|
+
- Must be gzipped (.gz format)
|
330
|
+
- Datasets listed under the _Individual Sources_ section work fine. Those under _Data Collections_ must first be unzipped. The `addresses` geojson files within may then be gzipped and imported.
|
331
|
+
|
332
|
+
For this example, we will be using the `au/countrywide` --> `addresses - country` data for Australia, in the GeoJSON+LD format.
|
299
333
|
|
300
334
|
2. Once the file is downloaded, start your app with `rails s` and navigate to `http://localhost:3000/maintenance_tasks`
|
301
335
|
(see [the github repo](https://github.com/Shopify/maintenance_tasks) for more information about maintenance_tasks).
|
@@ -309,7 +343,7 @@ records in our mysql database and has the following parameters:
|
|
309
343
|
- **country_code: (required)** The ISO country code of the data we are ingesting.
|
310
344
|
In this example, the country code of Australia is `AU`.
|
311
345
|
|
312
|
-
- **geojson_file_path: (required)** The fully qualified path of the previously downloaded geojson data from
|
346
|
+
- **geojson_file_path: (required)** The fully qualified path of the previously downloaded geojson data from OpenAddresses. A comma-delimited list of fully-qualified paths is also accepted.
|
313
347
|
|
314
348
|
- **locale: (optional)** The language of the data in the open addresses file.
|
315
349
|
|
data/app/countries/atlas_engine/gg/address_importer/corrections/open_address/city_corrector.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module AtlasEngine
|
5
|
+
module Gg
|
6
|
+
module AddressImporter
|
7
|
+
module Corrections
|
8
|
+
module OpenAddress
|
9
|
+
class CityCorrector
|
10
|
+
class << self
|
11
|
+
extend T::Sig
|
12
|
+
|
13
|
+
CITY_ALIASES_MAPPING = {
|
14
|
+
"St. Sampson" => ["Saint Samsaon"],
|
15
|
+
"St. Saviour" => ["Saint-Sauveur", "Saint Sauveux"],
|
16
|
+
"St. Peter Port" => ["Saint-Pierre Port"],
|
17
|
+
"St. Andrew" => ["Saint Andri", "Saint-André-de-la-Pommeraye"],
|
18
|
+
"St. Pierre Du Bois" => ["St. Peter's", "St. Pierre"],
|
19
|
+
"Castel" => ["Lé Casté", "Sainte-Marie-du-Câtel"],
|
20
|
+
"Forest" => ["Le Fôret", "La Fouarêt"],
|
21
|
+
"Torteval" => ["Tortévas"],
|
22
|
+
"Vale" => ["Lé Vale", "Le Valle"],
|
23
|
+
}
|
24
|
+
|
25
|
+
sig { params(address: Hash).void }
|
26
|
+
def apply(address)
|
27
|
+
city = address[:city].first
|
28
|
+
if CITY_ALIASES_MAPPING.include?(city)
|
29
|
+
address[:city] += CITY_ALIASES_MAPPING[city]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -6,6 +6,10 @@ validation:
|
|
6
6
|
address_parser: AtlasEngine::Gg::ValidationTranscriber::AddressParser
|
7
7
|
restrictions:
|
8
8
|
- class: AtlasEngine::Gg::AddressValidation::Validators::FullAddress::Restrictions::UnsupportedCity
|
9
|
+
ingestion:
|
10
|
+
correctors:
|
11
|
+
open_address:
|
12
|
+
- AtlasEngine::Gg::AddressImporter::Corrections::OpenAddress::CityCorrector
|
9
13
|
exclusions:
|
10
14
|
city:
|
11
15
|
- AtlasEngine::Gg::AddressValidation::Validators::FullAddress::Exclusions::City
|
@@ -10,16 +10,30 @@ module AtlasEngine
|
|
10
10
|
CITY = %r{
|
11
11
|
(?<city>
|
12
12
|
st\.?\s?saviour[']?[s]?|
|
13
|
+
saint[-|\s]sauveur|
|
14
|
+
saint\s?sauveux|
|
13
15
|
st\.?\s?sampson[']?[s]?|
|
16
|
+
saint\s?samsaon|
|
14
17
|
st\.?\s?andrew[']?[s]?|
|
18
|
+
saint\s?andri|
|
19
|
+
saint[-|\s]andr[é|e][-|\s]de[-|\s]la[-|\s]pommeraye|
|
15
20
|
st\.?\s?martin[']?[s]?|
|
16
21
|
st\.?\s?peter[']?[s]?\s?port|
|
22
|
+
saint[-|\s]pierre\s?port|
|
17
23
|
st\.?\s?peter[']?[s]?|
|
18
24
|
st\.?\s?pierre\s?du\s?bois|
|
25
|
+
st\.?\s?pierre|
|
19
26
|
vale|
|
27
|
+
l[é|e]\s?vale|
|
28
|
+
le\s?valle|
|
20
29
|
torteval|
|
30
|
+
tort[é|e]vas|
|
21
31
|
castel|
|
22
|
-
|
32
|
+
l[é|e]\s?cast[é|e]|
|
33
|
+
sainte[-|\s]marie[-|\s]du[-|\s]c[â|a]tel|
|
34
|
+
forest|
|
35
|
+
le\s?f[ô|o]ret|
|
36
|
+
la\s?fouar[ê|e]t
|
23
37
|
)
|
24
38
|
}ix
|
25
39
|
|
data/lib/atlas_engine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atlas_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: annex_29
|
@@ -305,9 +305,11 @@ files:
|
|
305
305
|
- app/countries/atlas_engine/gb/country_profile.yml
|
306
306
|
- app/countries/atlas_engine/gb/validation_transcriber/full_address_parser.rb
|
307
307
|
- app/countries/atlas_engine/gb/validation_transcriber/parsed_address.rb
|
308
|
+
- app/countries/atlas_engine/gg/address_importer/corrections/open_address/city_corrector.rb
|
308
309
|
- app/countries/atlas_engine/gg/address_validation/validators/full_address/exclusions/city.rb
|
309
310
|
- app/countries/atlas_engine/gg/address_validation/validators/full_address/restrictions/unsupported_city.rb
|
310
311
|
- app/countries/atlas_engine/gg/country_profile.yml
|
312
|
+
- app/countries/atlas_engine/gg/synonyms.yml
|
311
313
|
- app/countries/atlas_engine/gg/validation_transcriber/address_parser.rb
|
312
314
|
- app/countries/atlas_engine/ie/country_profile.yml
|
313
315
|
- app/countries/atlas_engine/it/address_importer/corrections/open_address/city_corrector.rb
|
@@ -595,7 +597,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
595
597
|
- !ruby/object:Gem::Version
|
596
598
|
version: '0'
|
597
599
|
requirements: []
|
598
|
-
rubygems_version: 3.5.
|
600
|
+
rubygems_version: 3.5.7
|
599
601
|
signing_key:
|
600
602
|
specification_version: 4
|
601
603
|
summary: Address Validation API
|