ae_easy-qa 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/ae_easy/qa.rb +2 -0
- data/lib/ae_easy/qa/save_output.rb +1 -0
- data/lib/ae_easy/qa/validate_internal.rb +9 -5
- data/lib/ae_easy/qa/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e5541353f16b04175786b1ceb92a0e767032bbf7
|
4
|
+
data.tar.gz: 54910859a41cbfbe7aed8c21d719b44f48bca999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c6b03b3151a72afd8c7e927c77e91f6ea92e1cc10944be3c5a7de93ec63cd38143d0937e83aeb93ee37e13076026b0b6dfb69f7e69ed78be360f53da9699ff6
|
7
|
+
data.tar.gz: 96bbb90dd55a2ba8ccaaf44c5f68efd0770a34c51184dfff24575c840ba54d047f80990b16dbc827be7f23a788361ba5ea5ee17e4d17c6d7865688d6795c53d7
|
data/lib/ae_easy/qa.rb
CHANGED
@@ -22,10 +22,12 @@ module AeEasy
|
|
22
22
|
@data = data
|
23
23
|
end
|
24
24
|
|
25
|
+
#this method is for validating "internal" scrapers that run on AnswersEngine
|
25
26
|
def validate_internal(vars, outputs)
|
26
27
|
ValidateInternal.new(vars, config, outputs).run
|
27
28
|
end
|
28
29
|
|
30
|
+
#this method is for validating data from "external" sources
|
29
31
|
def validate_external(outputs, collection_name)
|
30
32
|
ValidateExternal.new(data, config, outputs, collection_name, options).run
|
31
33
|
end
|
@@ -28,6 +28,7 @@ module AeEasy
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
#thresholds are a setting where you can ignore errors if they are under a specific error rate
|
31
32
|
def gather_threshold_totals
|
32
33
|
rules.each{|field_to_validate, field_options|
|
33
34
|
field_threshold = return_threshold(field_to_validate, field_options)
|
@@ -1,18 +1,19 @@
|
|
1
1
|
module AeEasy
|
2
2
|
module Qa
|
3
3
|
class ValidateInternal
|
4
|
-
attr_reader :scraper_name, :collections, :rules, :outputs
|
4
|
+
attr_reader :scraper_name, :collections, :rules, :outputs, :data
|
5
5
|
|
6
6
|
def initialize(vars, config, outputs)
|
7
7
|
@scraper_name = vars['scraper_name']
|
8
8
|
@collections = vars['collections']
|
9
9
|
@rules = config['individual_validations']
|
10
10
|
@outputs = outputs
|
11
|
+
@data = vars['data']
|
11
12
|
end
|
12
13
|
|
13
14
|
def run
|
14
15
|
begin
|
15
|
-
ValidateScraper.new(scraper_name, collections, rules, outputs, thresholds).run
|
16
|
+
ValidateScraper.new(scraper_name, collections, rules, outputs, thresholds, data).run
|
16
17
|
rescue StandardError => e
|
17
18
|
puts "An error has occurred: #{e}"
|
18
19
|
return nil
|
@@ -21,6 +22,7 @@ module AeEasy
|
|
21
22
|
|
22
23
|
private
|
23
24
|
|
25
|
+
#thresholds are a setting where you can suppress errors if they are under a specific error rate
|
24
26
|
def thresholds
|
25
27
|
@thresholds ||= begin
|
26
28
|
file_path = File.expand_path('thresholds.yaml', Dir.pwd)
|
@@ -34,14 +36,15 @@ module AeEasy
|
|
34
36
|
end
|
35
37
|
|
36
38
|
class ValidateScraper
|
37
|
-
attr_reader :scraper_name, :collections, :rules, :outputs, :options
|
39
|
+
attr_reader :scraper_name, :collections, :rules, :outputs, :options, :data
|
38
40
|
|
39
|
-
def initialize(scraper_name, collections, rules, outputs, thresholds)
|
41
|
+
def initialize(scraper_name, collections, rules, outputs, thresholds, data)
|
40
42
|
@scraper_name = scraper_name
|
41
43
|
@collections = collections
|
42
44
|
@rules = rules
|
43
45
|
@outputs = outputs
|
44
46
|
@options = {}
|
47
|
+
@data = data
|
45
48
|
options['thresholds'] = thresholds[scraper_name] if thresholds && thresholds[scraper_name]
|
46
49
|
end
|
47
50
|
|
@@ -74,7 +77,7 @@ module AeEasy
|
|
74
77
|
collections.each do |collection_name|
|
75
78
|
collection = collection_counts.find{|collection_hash| collection_hash['collection'] == collection_name }
|
76
79
|
if collection
|
77
|
-
ValidateCollection.new(scraper_name, collection_name, collection['outputs'], rules, outputs, options).run
|
80
|
+
ValidateCollection.new(scraper_name, collection_name, collection['outputs'], rules, outputs, options.merge({'data' => @data})).run
|
78
81
|
else
|
79
82
|
puts "collection #{collection_name} is missing"
|
80
83
|
end
|
@@ -107,6 +110,7 @@ module AeEasy
|
|
107
110
|
@total_records = total_records
|
108
111
|
@rules = rules
|
109
112
|
@outputs = outputs
|
113
|
+
@data = options['data']
|
110
114
|
@options = options
|
111
115
|
@errors = { errored_items: [] }
|
112
116
|
end
|
data/lib/ae_easy/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_easy-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lynam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: answersengine
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.4.5
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: AnswersEngine Easy Quality Assurance gem
|