atlas_engine 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -7
- data/app/countries/atlas_engine/at/country_profile.yml +1 -1
- data/app/countries/atlas_engine/au/country_profile.yml +1 -1
- data/app/countries/atlas_engine/be/country_profile.yml +2 -2
- data/app/countries/atlas_engine/ch/country_profile.yml +1 -1
- data/app/countries/atlas_engine/fr/country_profile.yml +1 -1
- data/app/countries/atlas_engine/nl/country_profile.yml +1 -1
- data/app/countries/atlas_engine/pl/country_profile.yml +1 -1
- data/app/countries/atlas_engine/us/country_profile.yml +1 -0
- data/app/graphql/atlas_engine/schema.graphql +4 -0
- data/app/graphql/atlas_engine/types/address_validation/address_input.rb +4 -0
- data/app/lib/atlas_engine/validation_transcriber/formatter.rb +10 -1
- data/app/models/atlas_engine/address_number_range.rb +1 -1
- data/app/models/atlas_engine/address_validation/abstract_address.rb +12 -0
- data/app/models/atlas_engine/address_validation/address.rb +8 -0
- data/app/models/atlas_engine/address_validation/concern_record.rb +28 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/suggestion_builder.rb +4 -0
- data/lib/atlas_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde673ac6063402f30381011574f018aee19ac9d6e9b961c04252cf76cfd49e5
|
4
|
+
data.tar.gz: b5c0adce91a39d744004b902e2b3a4a13544a50af756bb1ace003e391b0d3643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfe8b1e2a4ebe506f55b62a541b57ab22c0cca456ed4ef071007d43e106d0ed0b904389fd22a0424661ca76cd2f7bdc4ed5887866663eaee361f9afd5e7d3ac0
|
7
|
+
data.tar.gz: a632f397142d60a6da29ae440ed686ff920cb15e62349c3abb0ef9a3ccaddd975936870d55aee45867851337f10d46982f6740bbcf3379f9d74aeeed15369577
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ Atlas Engine is a rails engine that provides a global end-to-end address validat
|
|
7
7
|
* [Local Development Installation](#local-development-installation)
|
8
8
|
* [Address Data Ingestion](#address-data-ingestion)
|
9
9
|
* [Elasticsearch Matching Strategy](#elasticsearch-matching-strategy)
|
10
|
+
* [Hosted Solution](#hosted-solution)
|
10
11
|
|
11
12
|
## Address Validation API
|
12
13
|
|
@@ -303,23 +304,24 @@ At the moment, `atlas_engine` supports advanced address validation for the follo
|
|
303
304
|
|
304
305
|
| Country/territory | Two-letter code | Locales | Street | City | Postal Code | Province/State |
|
305
306
|
|-------------------|-----------------|----------|--------|------|-------------|----------------|
|
306
|
-
| Australia | AU | |
|
307
|
-
| Austria | AT | |
|
308
|
-
| Belgium | BE | fr,nl,de |
|
307
|
+
| Australia | AU | | x | x | x | x |
|
308
|
+
| Austria | AT | | x | x | x | x |
|
309
|
+
| Belgium | BE | fr,nl,de | x | x | x | |
|
309
310
|
| Bermuda | BM | | | x | x | x |
|
310
311
|
| Czechia | CZ | | | x | x | |
|
311
312
|
| Denmark | DK | | | x | x | |
|
312
313
|
| Faroe Islands | FO | | | x | x | |
|
313
|
-
| France | FR | |
|
314
|
+
| France | FR | | x | x | x | |
|
315
|
+
| Gurnsey | GG | | | x | x | |
|
314
316
|
| Italy | IT | | | | x | |
|
315
317
|
| Liechtenstein | LI | | | x | x | x |
|
316
318
|
| Luxembourg | LU | fr,lb | | x | x | |
|
317
|
-
| Netherlands | NL | nl |
|
318
|
-
| Poland | PL | |
|
319
|
+
| Netherlands | NL | nl | x | x | x | x |
|
320
|
+
| Poland | PL | | x | x | x | x |
|
319
321
|
| Portugal | PT | | | x | x | x |
|
320
322
|
| Slovenia | SI | | | x | x | x |
|
321
323
|
| South Korea | KR | | | x | x | x |
|
322
|
-
| Switzerland | CH | de,fr,it |
|
324
|
+
| Switzerland | CH | de,fr,it | x | x | x | |
|
323
325
|
| United States | US | en | x | x | x | x |
|
324
326
|
|
325
327
|
### Downloading and indexing instructions
|
@@ -653,3 +655,19 @@ will produce the response:
|
|
653
655
|
```
|
654
656
|
|
655
657
|
This response has no concerns or suggestions, and the input address is therefore considered to be valid.
|
658
|
+
|
659
|
+
## Hosted Solution
|
660
|
+
|
661
|
+
If you wish to use the Shopify hosted version of the `atlas_engine` codebase in your applications, you will need to [register for an api key](https://address-validation.shopify.dev/#request-api-key) and agree to our [terms and conditions](https://address-validation.shopify.dev/terms-of-service).
|
662
|
+
|
663
|
+
Once you have successfully redeemed an api key, you will be able to access the `/graphql` endpoint, which can be queried using this example curl request:
|
664
|
+
|
665
|
+
```
|
666
|
+
curl --request POST \
|
667
|
+
--url https://atlas-validation.shopifyapps.com/graphql \
|
668
|
+
--header 'Authorization: Bearer {your-api-key}' \
|
669
|
+
--header 'Content-Type: application/json' \
|
670
|
+
--data '{"query":"query validation { validation(address: { address1: \"233 S Wacker Dr\" address2: \"\" city: \"Chicago\" countryCode: US provinceCode: \"IL\" zip: \"60606\" } locale: \"EN\" ) { validationScope concerns { code fieldNames suggestionIds type typeLevel message } suggestions { id address1 address2 city province provinceCode zip } }}","operationName":"validation"}'
|
671
|
+
```
|
672
|
+
|
673
|
+
Any updates to the `atlas_engine` codebase that are merged into our `main` branch will be deployed to our hosted solution as well.
|
@@ -9,7 +9,7 @@ ingestion:
|
|
9
9
|
data_mapper: AtlasEngine::AddressValidation::Es::DataMappers::DecompoundingDataMapper
|
10
10
|
validation:
|
11
11
|
enabled: true
|
12
|
-
default_matching_strategy:
|
12
|
+
default_matching_strategy: es_street
|
13
13
|
has_provinces: true
|
14
14
|
address_parser: AtlasEngine::At::ValidationTranscriber::AddressParser
|
15
15
|
normalized_components:
|
@@ -8,6 +8,6 @@ ingestion:
|
|
8
8
|
validation:
|
9
9
|
address_parser: AtlasEngine::Au::ValidationTranscriber::AddressParser
|
10
10
|
enabled: true
|
11
|
-
default_matching_strategy:
|
11
|
+
default_matching_strategy: es_street
|
12
12
|
open_address:
|
13
13
|
filter: AtlasEngine::Au::AddressImporter::OpenAddress::Filter
|
@@ -5,9 +5,9 @@ ingestion:
|
|
5
5
|
max_zip_edge_ngram: "4"
|
6
6
|
validation:
|
7
7
|
enabled: true
|
8
|
-
default_matching_strategy:
|
8
|
+
default_matching_strategy: es_street
|
9
9
|
address_parser: AtlasEngine::Be::ValidationTranscriber::AddressParser
|
10
|
-
has_provinces: false
|
10
|
+
has_provinces: false
|
11
11
|
index_locales:
|
12
12
|
- fr
|
13
13
|
- nl
|
@@ -7,7 +7,7 @@ ingestion:
|
|
7
7
|
validation:
|
8
8
|
address_parser: AtlasEngine::Pl::ValidationTranscriber::AddressParser
|
9
9
|
enabled: true
|
10
|
-
default_matching_strategy:
|
10
|
+
default_matching_strategy: es_street
|
11
11
|
exclusions:
|
12
12
|
city:
|
13
13
|
- AtlasEngine::Pl::AddressValidation::Exclusions::RuralAddress
|
@@ -9,6 +9,7 @@ ingestion:
|
|
9
9
|
validation:
|
10
10
|
enabled: true
|
11
11
|
default_matching_strategy: es_street
|
12
|
+
unmatched_components_suggestion_threshold: 1
|
12
13
|
address_parser: AtlasEngine::ValidationTranscriber::AddressParserNorthAmerica
|
13
14
|
open_address:
|
14
15
|
filter: AtlasEngine::Us::AddressImporter::OpenAddress::Filter
|
@@ -12,7 +12,11 @@ module AtlasEngine
|
|
12
12
|
description "Address fields used to fulfill a validation request"
|
13
13
|
|
14
14
|
argument :address1, String, required: false
|
15
|
+
argument :street_name, String, required: false
|
16
|
+
argument :street_number, String, required: false
|
15
17
|
argument :address2, String, required: false
|
18
|
+
argument :line2, String, required: false
|
19
|
+
argument :neighborhood, String, required: false
|
16
20
|
argument :city, String, required: false
|
17
21
|
argument :country_code, ValidationSupportedCountry, required: false
|
18
22
|
argument :province_code, String, required: false
|
@@ -22,7 +22,11 @@ module AtlasEngine
|
|
22
22
|
sig do
|
23
23
|
params(
|
24
24
|
address1: String,
|
25
|
+
street_name: String,
|
26
|
+
street_number: String,
|
25
27
|
address2: String,
|
28
|
+
line2: String,
|
29
|
+
neighborhood: String,
|
26
30
|
city: String,
|
27
31
|
province_code: String,
|
28
32
|
zip: String,
|
@@ -30,10 +34,15 @@ module AtlasEngine
|
|
30
34
|
phone: String,
|
31
35
|
).returns(AddressValidation::Address)
|
32
36
|
end
|
33
|
-
def build_address(address1: "",
|
37
|
+
def build_address(address1: "", street_name: "", street_number: "", address2: "", line2: "", neighborhood: "",
|
38
|
+
city: "", province_code: "", zip: "", country_code: "", phone: "")
|
34
39
|
AddressValidation::Address.new(
|
35
40
|
address1: address1,
|
41
|
+
street_name: street_name,
|
42
|
+
street_number: street_number,
|
36
43
|
address2: address2,
|
44
|
+
line2: line2,
|
45
|
+
neighborhood: neighborhood,
|
37
46
|
city: city,
|
38
47
|
province_code: province_code,
|
39
48
|
zip: zip,
|
@@ -164,7 +164,7 @@ module AtlasEngine
|
|
164
164
|
|
165
165
|
sig { params(value: String).returns(T::Boolean) }
|
166
166
|
def include_fractions?(value)
|
167
|
-
%r{^([0-9]+ )?([0-9]+/[0-9]
|
167
|
+
%r{^([0-9]+ )?([0-9]+/[1-9][0-9]*)?$}.match?(value)
|
168
168
|
end
|
169
169
|
|
170
170
|
sig { params(str: String).returns(String) }
|
@@ -13,9 +13,21 @@ module AtlasEngine
|
|
13
13
|
sig { abstract.returns(ComponentType) }
|
14
14
|
def address1; end
|
15
15
|
|
16
|
+
sig { returns(ComponentType) }
|
17
|
+
def street_name; end
|
18
|
+
|
19
|
+
sig { returns(ComponentType) }
|
20
|
+
def street_number; end
|
21
|
+
|
16
22
|
sig { abstract.returns(ComponentType) }
|
17
23
|
def address2; end
|
18
24
|
|
25
|
+
sig { returns(ComponentType) }
|
26
|
+
def line2; end
|
27
|
+
|
28
|
+
sig { returns(ComponentType) }
|
29
|
+
def neighborhood; end
|
30
|
+
|
19
31
|
sig { abstract.returns(ComponentType) }
|
20
32
|
def city; end
|
21
33
|
|
@@ -13,7 +13,11 @@ module AtlasEngine
|
|
13
13
|
AddressInput = T.type_alias { Types::AddressValidation::AddressInput }
|
14
14
|
|
15
15
|
const :address1, ComponentType
|
16
|
+
const :street_name, ComponentType
|
17
|
+
const :street_number, ComponentType
|
16
18
|
const :address2, ComponentType
|
19
|
+
const :line2, ComponentType
|
20
|
+
const :neighborhood, ComponentType
|
17
21
|
const :city, ComponentType
|
18
22
|
const :province_code, ComponentType
|
19
23
|
const :phone, ComponentType
|
@@ -33,7 +37,11 @@ module AtlasEngine
|
|
33
37
|
def from_address(address:)
|
34
38
|
new(
|
35
39
|
address1: address.address1,
|
40
|
+
street_name: address.street_name,
|
41
|
+
street_number: address.street_number,
|
36
42
|
address2: address.address2,
|
43
|
+
line2: address.line2,
|
44
|
+
neighborhood: address.neighborhood,
|
37
45
|
city: address.city,
|
38
46
|
country_code: address.country_code,
|
39
47
|
province_code: address.province_code,
|
@@ -9,9 +9,21 @@ module AtlasEngine
|
|
9
9
|
sig { returns(String) }
|
10
10
|
attr_reader :address1
|
11
11
|
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_reader :street_name
|
14
|
+
|
15
|
+
sig { returns(String) }
|
16
|
+
attr_reader :street_number
|
17
|
+
|
12
18
|
sig { returns(String) }
|
13
19
|
attr_reader :address2
|
14
20
|
|
21
|
+
sig { returns(String) }
|
22
|
+
attr_reader :line2
|
23
|
+
|
24
|
+
sig { returns(String) }
|
25
|
+
attr_reader :neighborhood
|
26
|
+
|
15
27
|
sig { returns(String) }
|
16
28
|
attr_reader :city
|
17
29
|
|
@@ -73,7 +85,11 @@ module AtlasEngine
|
|
73
85
|
timestamp: Time,
|
74
86
|
origin: String,
|
75
87
|
address1: String,
|
88
|
+
street_name: String,
|
89
|
+
street_number: String,
|
76
90
|
address2: String,
|
91
|
+
line2: String,
|
92
|
+
neighborhood: String,
|
77
93
|
city: String,
|
78
94
|
province_code: String,
|
79
95
|
country_code: String,
|
@@ -87,7 +103,11 @@ module AtlasEngine
|
|
87
103
|
timestamp: Time.zone.now,
|
88
104
|
origin: "",
|
89
105
|
address1: "",
|
106
|
+
street_name: "",
|
107
|
+
street_number: "",
|
90
108
|
address2: "",
|
109
|
+
line2: "",
|
110
|
+
neighborhood: "",
|
91
111
|
city: "",
|
92
112
|
province_code: "",
|
93
113
|
country_code: "",
|
@@ -100,7 +120,11 @@ module AtlasEngine
|
|
100
120
|
@timestamp = timestamp
|
101
121
|
@origin = origin
|
102
122
|
@address1 = address1
|
123
|
+
@street_name = street_name
|
124
|
+
@street_number = street_number
|
103
125
|
@address2 = address2
|
126
|
+
@line2 = line2
|
127
|
+
@neighborhood = neighborhood
|
104
128
|
@city = city
|
105
129
|
@province_code = province_code
|
106
130
|
@country_code = country_code
|
@@ -114,7 +138,11 @@ module AtlasEngine
|
|
114
138
|
def address_attributes
|
115
139
|
{
|
116
140
|
address1: address1,
|
141
|
+
street_name: street_name,
|
142
|
+
street_number: street_number,
|
117
143
|
address2: address2,
|
144
|
+
line2: line2,
|
145
|
+
neighborhood: neighborhood,
|
118
146
|
city: city,
|
119
147
|
province_code: province_code,
|
120
148
|
zip: zip,
|
data/app/models/atlas_engine/address_validation/validators/full_address/suggestion_builder.rb
CHANGED
@@ -12,7 +12,11 @@ module AtlasEngine
|
|
12
12
|
params(
|
13
13
|
address: {
|
14
14
|
address1: T.nilable(String),
|
15
|
+
street_name: T.nilable(String),
|
16
|
+
street_number: T.nilable(String),
|
15
17
|
address2: T.nilable(String),
|
18
|
+
line2: T.nilable(String),
|
19
|
+
neighborhood: T.nilable(String),
|
16
20
|
city: T.nilable(String),
|
17
21
|
province_code: T.nilable(String),
|
18
22
|
country_code: T.nilable(String),
|
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: 1.
|
4
|
+
version: 1.1.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-05-
|
11
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: annex_29
|