atlas_engine 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/app/countries/atlas_engine/cz/country_profile.yml +3 -0
- data/app/countries/atlas_engine/es/country_profile.yml +3 -0
- data/app/countries/atlas_engine/es/synonyms.yml +2 -0
- data/app/countries/atlas_engine/es/validation_transcriber/address_parser.rb +28 -0
- data/app/countries/atlas_engine/fo/address_importer/corrections/open_address/city_corrector.rb +27 -0
- data/app/countries/atlas_engine/fo/country_profile.yml +4 -0
- data/app/countries/atlas_engine/fr/country_profile.yml +2 -0
- data/app/countries/atlas_engine/it/address_validation/validators/full_address/exclusions/city.rb +31 -0
- data/app/countries/atlas_engine/it/country_profile.yml +4 -0
- data/app/countries/atlas_engine/kr/address_validation/validators/full_address/exclusions/city.rb +69 -0
- data/app/countries/atlas_engine/kr/country_profile.yml +7 -0
- data/app/countries/atlas_engine/kr/validation_transcriber/address_parser.rb +36 -0
- data/app/countries/atlas_engine/lu/address_importer/corrections/open_address/city_corrector.rb +45 -0
- data/app/countries/atlas_engine/lu/country_profile.yml +4 -1
- data/app/countries/atlas_engine/lu/validation_transcriber/address_parser.rb +23 -0
- data/app/countries/atlas_engine/pl/address_importer/corrections/open_address/city_corrector.rb +25 -0
- data/app/countries/atlas_engine/pl/address_importer/corrections/open_address/empty_street_corrector.rb +32 -0
- data/app/countries/atlas_engine/pl/address_validation/exclusions/placeholder_postal_code.rb +35 -0
- data/app/countries/atlas_engine/pl/address_validation/exclusions/rural_address.rb +42 -0
- data/app/countries/atlas_engine/pl/country_profile.yml +13 -0
- data/app/countries/atlas_engine/pl/synonyms.yml +13 -0
- data/app/countries/atlas_engine/pl/validation_transcriber/address_parser.rb +36 -1
- data/app/countries/atlas_engine/pt/address_validation/validators/full_address/exclusions/zip.rb +38 -0
- data/app/countries/atlas_engine/pt/country_profile.yml +4 -0
- data/app/countries/atlas_engine/pt/synonyms.yml +12 -0
- data/app/countries/atlas_engine/pt/validation_transcriber/address_parser.rb +75 -0
- data/app/countries/atlas_engine/si/address_importer/open_address/corrections/city_district_corrector.rb +25 -0
- data/app/countries/atlas_engine/si/address_importer/open_address/mapper.rb +19 -0
- data/app/countries/atlas_engine/si/address_validation/exclusions/unknown_city.rb +33 -0
- data/app/countries/atlas_engine/si/country_profile.yml +17 -0
- data/app/countries/atlas_engine/si/synonyms.yml +7 -0
- data/app/countries/atlas_engine/si/validation_transcriber/address_parser.rb +52 -0
- data/app/graphql/atlas_engine/schema.graphql +1 -1
- data/app/lib/atlas_engine/validation_transcriber/address_parser_base.rb +1 -1
- data/app/models/atlas_engine/address_validation/concern_record.rb +6 -1
- data/app/models/atlas_engine/address_validation/es/query_builder.rb +6 -1
- data/app/models/atlas_engine/address_validation/statsd_emitter.rb +6 -2
- data/app/models/atlas_engine/address_validation/token/sequence/comparator.rb +38 -4
- data/app/models/atlas_engine/address_validation/token/sequence/comparison.rb +4 -4
- data/app/models/atlas_engine/address_validation/token/sequence/comparison_policy.rb +33 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/address_comparison.rb +41 -15
- data/app/models/atlas_engine/address_validation/validators/full_address/building_comparison.rb +33 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/candidate_result.rb +3 -3
- data/app/models/atlas_engine/address_validation/validators/full_address/city_comparison.rb +25 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/concern_builder.rb +15 -6
- data/app/models/atlas_engine/address_validation/validators/full_address/exclusions/exclusion_base.rb +8 -2
- data/app/models/atlas_engine/address_validation/validators/full_address/field_comparison_base.rb +77 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb +34 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb +34 -12
- data/app/models/atlas_engine/address_validation/validators/full_address/street_comparison.rb +30 -0
- data/app/models/atlas_engine/address_validation/validators/full_address/suggestion_builder.rb +1 -1
- data/app/models/atlas_engine/address_validation/validators/full_address/zip_comparison.rb +37 -0
- data/app/models/atlas_engine/address_validation/validators/predicates/street/building_number_in_address1_or_address2.rb +2 -2
- data/app/models/atlas_engine/country_profile_validation_subset.rb +35 -2
- data/db/data/country_profiles/default.yml +12 -0
- data/lib/atlas_engine/version.rb +1 -1
- data/lib/tasks/atlas_engine/graphql.rake +13 -0
- metadata +35 -6
- data/app/models/atlas_engine/address_validation/validators/full_address/comparison_helper.rb +0 -135
@@ -10,8 +10,6 @@ module AtlasEngine
|
|
10
10
|
|
11
11
|
attr_reader :unmatched_component, :unmatched_field, :matched_components, :address, :suggestion_ids
|
12
12
|
|
13
|
-
UNMATCHED_COMPONENTS_SUGGESTION_THRESHOLD = 2
|
14
|
-
|
15
13
|
class << self
|
16
14
|
extend T::Sig
|
17
15
|
|
@@ -22,16 +20,21 @@ module AtlasEngine
|
|
22
20
|
).returns(T::Boolean)
|
23
21
|
end
|
24
22
|
def should_suggest?(address, unmatched_component_keys)
|
25
|
-
return false if too_many_unmatched_components?(unmatched_component_keys)
|
23
|
+
return false if too_many_unmatched_components?(address, unmatched_component_keys)
|
26
24
|
|
27
25
|
return false if province_and_city_xor_zip?(unmatched_component_keys) && !valid_zip_for_province?(address)
|
28
26
|
|
29
27
|
true
|
30
28
|
end
|
31
29
|
|
32
|
-
sig
|
33
|
-
|
34
|
-
|
30
|
+
sig do
|
31
|
+
params(
|
32
|
+
address: AbstractAddress,
|
33
|
+
unmatched_component_keys: T::Array[Symbol],
|
34
|
+
).returns(T::Boolean)
|
35
|
+
end
|
36
|
+
def too_many_unmatched_components?(address, unmatched_component_keys)
|
37
|
+
unmatched_component_keys.size > unmatched_components_suggestion_threshold(address)
|
35
38
|
end
|
36
39
|
|
37
40
|
sig { params(address: AbstractAddress).returns(T::Boolean) }
|
@@ -62,6 +65,12 @@ module AtlasEngine
|
|
62
65
|
|
63
66
|
province.valid_zip?(address.zip)
|
64
67
|
end
|
68
|
+
|
69
|
+
sig { params(address: AbstractAddress).returns(Integer) }
|
70
|
+
def unmatched_components_suggestion_threshold(address)
|
71
|
+
country_profile = CountryProfile.for(T.must(address.country_code))
|
72
|
+
country_profile.validation.unmatched_components_suggestion_threshold
|
73
|
+
end
|
65
74
|
end
|
66
75
|
|
67
76
|
sig do
|
data/app/models/atlas_engine/address_validation/validators/full_address/exclusions/exclusion_base.rb
CHANGED
@@ -12,8 +12,14 @@ module AtlasEngine
|
|
12
12
|
extend T::Helpers
|
13
13
|
abstract!
|
14
14
|
|
15
|
-
sig
|
16
|
-
|
15
|
+
sig do
|
16
|
+
abstract.params(
|
17
|
+
session: Session,
|
18
|
+
candidate: Candidate,
|
19
|
+
address_comparison: AddressComparison,
|
20
|
+
).returns(T::Boolean)
|
21
|
+
end
|
22
|
+
def apply?(session, candidate, address_comparison); end
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
data/app/models/atlas_engine/address_validation/validators/full_address/field_comparison_base.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module AtlasEngine
|
5
|
+
module AddressValidation
|
6
|
+
module Validators
|
7
|
+
module FullAddress
|
8
|
+
class FieldComparisonBase
|
9
|
+
extend T::Sig
|
10
|
+
extend T::Helpers
|
11
|
+
|
12
|
+
abstract!
|
13
|
+
|
14
|
+
SUPPORTED_FIELDS = Set.new([:street, :city, :zip, :province_code, :building])
|
15
|
+
|
16
|
+
sig { params(address: AbstractAddress, candidate: Candidate, datastore: DatastoreBase).void }
|
17
|
+
def initialize(address:, candidate:, datastore:)
|
18
|
+
@address = address
|
19
|
+
@datastore = datastore
|
20
|
+
@candidate = candidate
|
21
|
+
end
|
22
|
+
|
23
|
+
sig { abstract.returns(T.any(T.nilable(Token::Sequence::Comparison), T.nilable(NumberComparison))) }
|
24
|
+
def sequence_comparison; end
|
25
|
+
|
26
|
+
sig { returns(T::Boolean) }
|
27
|
+
def match?
|
28
|
+
return false if sequence_comparison.nil?
|
29
|
+
|
30
|
+
T.must(sequence_comparison).match?
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
sig { returns(AbstractAddress) }
|
36
|
+
attr_reader :address
|
37
|
+
|
38
|
+
sig { returns(DatastoreBase) }
|
39
|
+
attr_reader :datastore
|
40
|
+
|
41
|
+
sig { returns(Candidate) }
|
42
|
+
attr_reader :candidate
|
43
|
+
|
44
|
+
sig do
|
45
|
+
params(
|
46
|
+
sequence: Token::Sequence,
|
47
|
+
component_sequences: T::Array[Token::Sequence],
|
48
|
+
comparison_policy: Token::Sequence::ComparisonPolicy,
|
49
|
+
).returns(T.nilable(Token::Sequence::Comparison))
|
50
|
+
end
|
51
|
+
def best_comparison(
|
52
|
+
sequence,
|
53
|
+
component_sequences,
|
54
|
+
comparison_policy = Token::Sequence::ComparisonPolicy::DEFAULT_POLICY
|
55
|
+
)
|
56
|
+
component_sequences.map do |component_sequence|
|
57
|
+
Token::Sequence::Comparator.new(
|
58
|
+
left_sequence: sequence,
|
59
|
+
right_sequence: component_sequence,
|
60
|
+
comparison_policy:,
|
61
|
+
).compare
|
62
|
+
end.min_by.with_index do |comparison, index|
|
63
|
+
# ruby's `min` and `sort` methods are not stable
|
64
|
+
# so we need to prefer the leftmost comparison when two comparisons are equivalent
|
65
|
+
[comparison, index]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
sig { params(field: Symbol).returns(Token::Sequence::ComparisonPolicy) }
|
70
|
+
def field_policy(field)
|
71
|
+
datastore.country_profile.validation.comparison_policy(field)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module AtlasEngine
|
5
|
+
module AddressValidation
|
6
|
+
module Validators
|
7
|
+
module FullAddress
|
8
|
+
class ProvinceCodeComparison < FieldComparisonBase
|
9
|
+
extend T::Sig
|
10
|
+
|
11
|
+
sig { override.returns(T.nilable(Token::Sequence::Comparison)) }
|
12
|
+
def sequence_comparison
|
13
|
+
return @province_code_comparison if defined?(@province_code_comparison)
|
14
|
+
|
15
|
+
normalized_session_province_code = ValidationTranscriber::ProvinceCodeNormalizer.normalize(
|
16
|
+
country_code: address.country_code,
|
17
|
+
province_code: address.province_code,
|
18
|
+
)
|
19
|
+
normalized_candidate_province_code = ValidationTranscriber::ProvinceCodeNormalizer.normalize(
|
20
|
+
country_code: T.must(candidate.component(:country_code)).value,
|
21
|
+
province_code: T.must(candidate.component(:province_code)).value,
|
22
|
+
)
|
23
|
+
|
24
|
+
@province_code_comparison = best_comparison(
|
25
|
+
Token::Sequence.from_string(normalized_session_province_code),
|
26
|
+
[Token::Sequence.from_string(normalized_candidate_province_code)],
|
27
|
+
field_policy(:province_code),
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb
CHANGED
@@ -8,7 +8,14 @@ module AtlasEngine
|
|
8
8
|
class RelevantComponents
|
9
9
|
extend T::Sig
|
10
10
|
|
11
|
-
|
11
|
+
sig { returns(Session) }
|
12
|
+
attr_reader :session
|
13
|
+
|
14
|
+
sig { returns(Candidate) }
|
15
|
+
attr_reader :candidate
|
16
|
+
|
17
|
+
sig { returns(AddressComparison) }
|
18
|
+
attr_reader :address_comparison
|
12
19
|
|
13
20
|
ALL_SUPPORTED_COMPONENTS = [
|
14
21
|
:province_code,
|
@@ -21,18 +28,19 @@ module AtlasEngine
|
|
21
28
|
params(
|
22
29
|
session: Session,
|
23
30
|
candidate: Candidate,
|
24
|
-
|
31
|
+
address_comparison: AddressComparison,
|
25
32
|
).void
|
26
33
|
end
|
27
|
-
def initialize(session, candidate,
|
34
|
+
def initialize(session, candidate, address_comparison)
|
28
35
|
@session = session
|
29
36
|
@candidate = candidate
|
30
|
-
@
|
37
|
+
@address_comparison = address_comparison
|
31
38
|
end
|
32
39
|
|
33
40
|
sig { returns(T::Array[Symbol]) }
|
34
41
|
def components_to_validate
|
35
42
|
supported_components = ALL_SUPPORTED_COMPONENTS.dup - unsupported_components_for_country
|
43
|
+
apply_exclusions(supported_components)
|
36
44
|
supported_components.delete(:street) if exclude_street_validation?
|
37
45
|
supported_components
|
38
46
|
end
|
@@ -44,6 +52,18 @@ module AtlasEngine
|
|
44
52
|
|
45
53
|
private
|
46
54
|
|
55
|
+
sig { params(supported_components: T::Array[Symbol]).void }
|
56
|
+
def apply_exclusions(supported_components)
|
57
|
+
supported_components.delete_if do |component|
|
58
|
+
exclusions(component).any? do |exclusion|
|
59
|
+
if exclusion.apply?(session, candidate, address_comparison)
|
60
|
+
emit_excluded_validation(component, "excluded")
|
61
|
+
true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
47
67
|
sig { returns(T::Boolean) }
|
48
68
|
def exclude_street_validation?
|
49
69
|
return @exclude_street_validation if defined?(@exclude_street_validation)
|
@@ -51,23 +71,25 @@ module AtlasEngine
|
|
51
71
|
@exclude_street_validation = if session.matching_strategy !=
|
52
72
|
AddressValidation::MatchingStrategies::EsStreet
|
53
73
|
true
|
54
|
-
elsif street_comparison.blank?
|
55
|
-
emit_excluded_validation(
|
56
|
-
true
|
57
|
-
elsif exclusions("street").any? { |exclusion| exclusion.apply?(session, candidate) }
|
58
|
-
emit_excluded_validation("street", "excluded")
|
74
|
+
elsif address_comparison.street_comparison.sequence_comparison.blank?
|
75
|
+
emit_excluded_validation(:street, "not_found")
|
59
76
|
true
|
60
77
|
else
|
61
78
|
false
|
62
79
|
end
|
63
80
|
end
|
64
81
|
|
65
|
-
sig { params(component:
|
82
|
+
sig { params(component: Symbol).returns(T::Array[T.class_of(Exclusions::ExclusionBase)]) }
|
66
83
|
def exclusions(component)
|
67
|
-
|
84
|
+
country_profile.validation.validation_exclusions(component: component)
|
85
|
+
end
|
86
|
+
|
87
|
+
sig { returns(CountryProfile) }
|
88
|
+
def country_profile
|
89
|
+
@country_profile ||= CountryProfile.for(session.country_code)
|
68
90
|
end
|
69
91
|
|
70
|
-
sig { params(component:
|
92
|
+
sig { params(component: Symbol, reason: String).void }
|
71
93
|
def emit_excluded_validation(component, reason)
|
72
94
|
tags = [
|
73
95
|
"reason:#{reason}",
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module AtlasEngine
|
5
|
+
module AddressValidation
|
6
|
+
module Validators
|
7
|
+
module FullAddress
|
8
|
+
class StreetComparison < FieldComparisonBase
|
9
|
+
extend T::Sig
|
10
|
+
|
11
|
+
sig { override.returns(T.nilable(Token::Sequence::Comparison)) }
|
12
|
+
def sequence_comparison
|
13
|
+
return @street_comparison if defined?(@street_comparison)
|
14
|
+
|
15
|
+
street_sequences = datastore.fetch_street_sequences
|
16
|
+
candidate_sequences = T.must(candidate.component(:street)).sequences
|
17
|
+
|
18
|
+
@street_comparison = street_sequences.map do |street_sequence|
|
19
|
+
best_comparison(
|
20
|
+
street_sequence,
|
21
|
+
candidate_sequences,
|
22
|
+
field_policy(:street),
|
23
|
+
)
|
24
|
+
end.min
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/app/models/atlas_engine/address_validation/validators/full_address/suggestion_builder.rb
CHANGED
@@ -126,7 +126,7 @@ module AtlasEngine
|
|
126
126
|
).returns(String)
|
127
127
|
end
|
128
128
|
def generic_field_suggestion(comparison, candidate, field)
|
129
|
-
if comparison.token_match_count == 0 || comparison.
|
129
|
+
if comparison.token_match_count == 0 || comparison.aggregate_distance > 2
|
130
130
|
candidate.component(field)&.first_value
|
131
131
|
else
|
132
132
|
comparison.right_sequence.raw_value
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module AtlasEngine
|
5
|
+
module AddressValidation
|
6
|
+
module Validators
|
7
|
+
module FullAddress
|
8
|
+
class ZipComparison < FieldComparisonBase
|
9
|
+
extend T::Sig
|
10
|
+
|
11
|
+
sig { override.returns(T.nilable(Token::Sequence::Comparison)) }
|
12
|
+
def sequence_comparison
|
13
|
+
return @zip_comparison if defined?(@zip_comparison)
|
14
|
+
|
15
|
+
candidate.component(:zip)&.value = PostalCodeMatcher.new(
|
16
|
+
T.must(address.country_code),
|
17
|
+
T.must(address.zip),
|
18
|
+
candidate.component(:zip)&.value,
|
19
|
+
).truncate
|
20
|
+
|
21
|
+
normalized_zip = ValidationTranscriber::ZipNormalizer.normalize(
|
22
|
+
country_code: address.country_code, zip: address.zip,
|
23
|
+
)
|
24
|
+
|
25
|
+
zip_sequence = Token::Sequence.from_string(normalized_zip)
|
26
|
+
|
27
|
+
@zip_comparison = best_comparison(
|
28
|
+
zip_sequence,
|
29
|
+
T.must(candidate.component(:zip)).sequences,
|
30
|
+
field_policy(:zip),
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -12,7 +12,7 @@ module AtlasEngine
|
|
12
12
|
return unless @cache.country.country?
|
13
13
|
return unless @cache.country.building_number_required
|
14
14
|
return unless @cache.country.building_number_may_be_in_address2
|
15
|
-
return if contains_number?(T.must(@address.address1)) || contains_number?(
|
15
|
+
return if contains_number?(T.must(@address.address1)) || contains_number?(@address.address2)
|
16
16
|
|
17
17
|
build_concern
|
18
18
|
end
|
@@ -31,7 +31,7 @@ module AtlasEngine
|
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
34
|
-
sig { params(text: String).returns(T::Boolean) }
|
34
|
+
sig { params(text: T.nilable(String)).returns(T::Boolean) }
|
35
35
|
def contains_number?(text)
|
36
36
|
/[0-9\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\uff10-\uff19]/.match?(text)
|
37
37
|
end
|
@@ -24,11 +24,11 @@ module AtlasEngine
|
|
24
24
|
end
|
25
25
|
|
26
26
|
sig do
|
27
|
-
params(component:
|
27
|
+
params(component: Symbol)
|
28
28
|
.returns(T::Array[T.class_of(AddressValidation::Validators::FullAddress::Exclusions::ExclusionBase)])
|
29
29
|
end
|
30
30
|
def validation_exclusions(component:)
|
31
|
-
validation_exclusions = attributes.dig("exclusions", component) || []
|
31
|
+
validation_exclusions = attributes.dig("exclusions", component.to_s) || []
|
32
32
|
validation_exclusions.map(&:constantize)
|
33
33
|
end
|
34
34
|
|
@@ -49,5 +49,38 @@ module AtlasEngine
|
|
49
49
|
def normalized_components
|
50
50
|
attributes.dig("normalized_components") || []
|
51
51
|
end
|
52
|
+
|
53
|
+
sig { params(field: Symbol).returns(AddressValidation::Token::Sequence::ComparisonPolicy) }
|
54
|
+
def comparison_policy(field)
|
55
|
+
field_policy = attributes.dig(
|
56
|
+
"comparison_policies",
|
57
|
+
field.to_s,
|
58
|
+
)&.deep_symbolize_keys&.deep_transform_values!(&:to_sym)
|
59
|
+
|
60
|
+
if field_policy.present?
|
61
|
+
AddressValidation::Token::Sequence::ComparisonPolicy.new(**field_policy)
|
62
|
+
else
|
63
|
+
AddressValidation::Token::Sequence::ComparisonPolicy::DEFAULT_POLICY
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
sig { returns(Integer) }
|
68
|
+
def unmatched_components_suggestion_threshold
|
69
|
+
attributes.dig("unmatched_components_suggestion_threshold") || 2
|
70
|
+
end
|
71
|
+
|
72
|
+
sig { params(field: Symbol).returns(T::Class[AddressValidation::Validators::FullAddress::FieldComparisonBase]) }
|
73
|
+
def address_comparison(field:)
|
74
|
+
unless field.in?(AddressValidation::Validators::FullAddress::FieldComparisonBase::SUPPORTED_FIELDS)
|
75
|
+
raise ArgumentError.new, "Field #{field} is not supported"
|
76
|
+
end
|
77
|
+
|
78
|
+
attributes.dig("address_comparison", field.to_s).constantize
|
79
|
+
end
|
80
|
+
|
81
|
+
sig { returns(Integer) }
|
82
|
+
def zip_prefix_length
|
83
|
+
attributes.dig("zip_prefix_length") || 0
|
84
|
+
end
|
52
85
|
end
|
53
86
|
end
|
@@ -17,5 +17,17 @@ validation:
|
|
17
17
|
query_builder: AtlasEngine::AddressValidation::Es::DefaultQueryBuilder
|
18
18
|
address_parser: AtlasEngine::ValidationTranscriber::AddressParserBase
|
19
19
|
restrictions: []
|
20
|
+
comparison_policies:
|
21
|
+
street: {}
|
22
|
+
city: {}
|
23
|
+
zip: {}
|
24
|
+
province_code: {}
|
25
|
+
unmatched_components_suggestion_threshold: 2
|
26
|
+
address_comparison:
|
27
|
+
street: AtlasEngine::AddressValidation::Validators::FullAddress::StreetComparison
|
28
|
+
city: AtlasEngine::AddressValidation::Validators::FullAddress::CityComparison
|
29
|
+
zip: AtlasEngine::AddressValidation::Validators::FullAddress::ZipComparison
|
30
|
+
province_code: AtlasEngine::AddressValidation::Validators::FullAddress::ProvinceCodeComparison
|
31
|
+
building: AtlasEngine::AddressValidation::Validators::FullAddress::BuildingComparison
|
20
32
|
decompounding_patterns:
|
21
33
|
street: []
|
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.3.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-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: annex_29
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.6.
|
215
|
+
version: 0.6.7
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.6.
|
222
|
+
version: 0.6.7
|
223
223
|
description: The Atlas Engine is a rails engine that provides a GraphQL API for address
|
224
224
|
validation.
|
225
225
|
email: developers@shopify.com
|
@@ -278,6 +278,10 @@ files:
|
|
278
278
|
- app/countries/atlas_engine/dk/country_profile.yml
|
279
279
|
- app/countries/atlas_engine/dk/synonyms.yml
|
280
280
|
- app/countries/atlas_engine/dk/validation_transcriber/address_parser.rb
|
281
|
+
- app/countries/atlas_engine/es/country_profile.yml
|
282
|
+
- app/countries/atlas_engine/es/synonyms.yml
|
283
|
+
- app/countries/atlas_engine/es/validation_transcriber/address_parser.rb
|
284
|
+
- app/countries/atlas_engine/fo/address_importer/corrections/open_address/city_corrector.rb
|
281
285
|
- app/countries/atlas_engine/fo/country_profile.yml
|
282
286
|
- app/countries/atlas_engine/fr/address_importer/corrections/open_address/city_corrector.rb
|
283
287
|
- app/countries/atlas_engine/fr/country_profile.yml
|
@@ -293,11 +297,14 @@ files:
|
|
293
297
|
- app/countries/atlas_engine/it/address_importer/corrections/open_address/city_corrector.rb
|
294
298
|
- app/countries/atlas_engine/it/address_importer/corrections/open_address/province_corrector.rb
|
295
299
|
- app/countries/atlas_engine/it/address_importer/open_address/mapper.rb
|
300
|
+
- app/countries/atlas_engine/it/address_validation/validators/full_address/exclusions/city.rb
|
296
301
|
- app/countries/atlas_engine/it/country_profile.yml
|
297
302
|
- app/countries/atlas_engine/jp/address_validation/es/data_mapper.rb
|
298
303
|
- app/countries/atlas_engine/jp/country_profile.yml
|
299
304
|
- app/countries/atlas_engine/kr/address_importer/open_address/mapper.rb
|
305
|
+
- app/countries/atlas_engine/kr/address_validation/validators/full_address/exclusions/city.rb
|
300
306
|
- app/countries/atlas_engine/kr/country_profile.yml
|
307
|
+
- app/countries/atlas_engine/kr/validation_transcriber/address_parser.rb
|
301
308
|
- app/countries/atlas_engine/li/address_importer/corrections/open_address/city_corrector.rb
|
302
309
|
- app/countries/atlas_engine/li/country_profile.yml
|
303
310
|
- app/countries/atlas_engine/li/index_configuration.yml
|
@@ -305,8 +312,10 @@ files:
|
|
305
312
|
- app/countries/atlas_engine/lt/country_profile.yml
|
306
313
|
- app/countries/atlas_engine/lt/synonyms.yml
|
307
314
|
- app/countries/atlas_engine/lt/validation_transcriber/address_parser.rb
|
315
|
+
- app/countries/atlas_engine/lu/address_importer/corrections/open_address/city_corrector.rb
|
308
316
|
- app/countries/atlas_engine/lu/address_importer/corrections/open_address/locale_corrector.rb
|
309
317
|
- app/countries/atlas_engine/lu/country_profile.yml
|
318
|
+
- app/countries/atlas_engine/lu/validation_transcriber/address_parser.rb
|
310
319
|
- app/countries/atlas_engine/nl/address_importer/corrections/open_address/city_corrector.rb
|
311
320
|
- app/countries/atlas_engine/nl/country_profile.yml
|
312
321
|
- app/countries/atlas_engine/nl/index_configuration.yml
|
@@ -314,14 +323,27 @@ files:
|
|
314
323
|
- app/countries/atlas_engine/nl/validation_transcriber/address_parser.rb
|
315
324
|
- app/countries/atlas_engine/no/country_profile.yml
|
316
325
|
- app/countries/atlas_engine/nz/country_profile.yml
|
326
|
+
- app/countries/atlas_engine/pl/address_importer/corrections/open_address/city_corrector.rb
|
327
|
+
- app/countries/atlas_engine/pl/address_importer/corrections/open_address/empty_street_corrector.rb
|
328
|
+
- app/countries/atlas_engine/pl/address_validation/exclusions/placeholder_postal_code.rb
|
329
|
+
- app/countries/atlas_engine/pl/address_validation/exclusions/rural_address.rb
|
317
330
|
- app/countries/atlas_engine/pl/country_profile.yml
|
331
|
+
- app/countries/atlas_engine/pl/synonyms.yml
|
318
332
|
- app/countries/atlas_engine/pl/validation_transcriber/address_parser.rb
|
319
333
|
- app/countries/atlas_engine/pt/address_importer/corrections/open_address/city_corrector.rb
|
320
334
|
- app/countries/atlas_engine/pt/address_importer/open_address/mapper.rb
|
335
|
+
- app/countries/atlas_engine/pt/address_validation/validators/full_address/exclusions/zip.rb
|
321
336
|
- app/countries/atlas_engine/pt/country_profile.yml
|
322
337
|
- app/countries/atlas_engine/pt/synonyms.yml
|
338
|
+
- app/countries/atlas_engine/pt/validation_transcriber/address_parser.rb
|
323
339
|
- app/countries/atlas_engine/sa/country_profile.yml
|
324
340
|
- app/countries/atlas_engine/se/country_profile.yml
|
341
|
+
- app/countries/atlas_engine/si/address_importer/open_address/corrections/city_district_corrector.rb
|
342
|
+
- app/countries/atlas_engine/si/address_importer/open_address/mapper.rb
|
343
|
+
- app/countries/atlas_engine/si/address_validation/exclusions/unknown_city.rb
|
344
|
+
- app/countries/atlas_engine/si/country_profile.yml
|
345
|
+
- app/countries/atlas_engine/si/synonyms.yml
|
346
|
+
- app/countries/atlas_engine/si/validation_transcriber/address_parser.rb
|
325
347
|
- app/countries/atlas_engine/tt/address_importer/open_address/mapper.rb
|
326
348
|
- app/countries/atlas_engine/tt/country_profile.yml
|
327
349
|
- app/countries/atlas_engine/us/country_profile.yml
|
@@ -437,28 +459,34 @@ files:
|
|
437
459
|
- app/models/atlas_engine/address_validation/token/sequence.rb
|
438
460
|
- app/models/atlas_engine/address_validation/token/sequence/comparator.rb
|
439
461
|
- app/models/atlas_engine/address_validation/token/sequence/comparison.rb
|
462
|
+
- app/models/atlas_engine/address_validation/token/sequence/comparison_policy.rb
|
440
463
|
- app/models/atlas_engine/address_validation/token/synonyms.rb
|
441
464
|
- app/models/atlas_engine/address_validation/validator.rb
|
442
465
|
- app/models/atlas_engine/address_validation/validators/full_address/address_comparison.rb
|
466
|
+
- app/models/atlas_engine/address_validation/validators/full_address/building_comparison.rb
|
443
467
|
- app/models/atlas_engine/address_validation/validators/full_address/candidate_result.rb
|
444
468
|
- app/models/atlas_engine/address_validation/validators/full_address/candidate_result_base.rb
|
445
|
-
- app/models/atlas_engine/address_validation/validators/full_address/
|
469
|
+
- app/models/atlas_engine/address_validation/validators/full_address/city_comparison.rb
|
446
470
|
- app/models/atlas_engine/address_validation/validators/full_address/concern_builder.rb
|
447
471
|
- app/models/atlas_engine/address_validation/validators/full_address/exclusions/exclusion_base.rb
|
472
|
+
- app/models/atlas_engine/address_validation/validators/full_address/field_comparison_base.rb
|
448
473
|
- app/models/atlas_engine/address_validation/validators/full_address/invalid_zip_concern_builder.rb
|
449
474
|
- app/models/atlas_engine/address_validation/validators/full_address/invalid_zip_for_country_concern.rb
|
450
475
|
- app/models/atlas_engine/address_validation/validators/full_address/invalid_zip_for_province_concern.rb
|
451
476
|
- app/models/atlas_engine/address_validation/validators/full_address/no_candidate_result.rb
|
452
477
|
- app/models/atlas_engine/address_validation/validators/full_address/number_comparison.rb
|
453
478
|
- app/models/atlas_engine/address_validation/validators/full_address/postal_code_matcher.rb
|
479
|
+
- app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb
|
454
480
|
- app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb
|
455
481
|
- app/models/atlas_engine/address_validation/validators/full_address/result_updater.rb
|
482
|
+
- app/models/atlas_engine/address_validation/validators/full_address/street_comparison.rb
|
456
483
|
- app/models/atlas_engine/address_validation/validators/full_address/suggestion_builder.rb
|
457
484
|
- app/models/atlas_engine/address_validation/validators/full_address/unknown_address_concern.rb
|
458
485
|
- app/models/atlas_engine/address_validation/validators/full_address/unknown_province_concern.rb
|
459
486
|
- app/models/atlas_engine/address_validation/validators/full_address/unknown_zip_for_address_concern.rb
|
460
487
|
- app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern.rb
|
461
488
|
- app/models/atlas_engine/address_validation/validators/full_address/unsupported_script_result.rb
|
489
|
+
- app/models/atlas_engine/address_validation/validators/full_address/zip_comparison.rb
|
462
490
|
- app/models/atlas_engine/address_validation/validators/predicates/cache.rb
|
463
491
|
- app/models/atlas_engine/address_validation/validators/predicates/city/present.rb
|
464
492
|
- app/models/atlas_engine/address_validation/validators/predicates/country/exists.rb
|
@@ -530,6 +558,7 @@ files:
|
|
530
558
|
- lib/atlas_engine/engine.rb
|
531
559
|
- lib/atlas_engine/version.rb
|
532
560
|
- lib/tasks/atlas_engine/address_importer.rake
|
561
|
+
- lib/tasks/atlas_engine/graphql.rake
|
533
562
|
homepage: https://github.com/Shopify/atlas_engine
|
534
563
|
licenses:
|
535
564
|
- MIT
|
@@ -553,7 +582,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
553
582
|
- !ruby/object:Gem::Version
|
554
583
|
version: '0'
|
555
584
|
requirements: []
|
556
|
-
rubygems_version: 3.5.
|
585
|
+
rubygems_version: 3.5.6
|
557
586
|
signing_key:
|
558
587
|
specification_version: 4
|
559
588
|
summary: Address Validation API
|