spout 0.8.0.beta9 → 0.8.0.beta10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/spout/commands/coverage.rb +5 -1
- data/lib/spout/helpers/subject_loader.rb +13 -2
- data/lib/spout/version.rb +1 -1
- data/lib/spout/views/index.html.erb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85db9e44c8437edc8bf46ba106ec1030ce1adf06
|
4
|
+
data.tar.gz: 453e7af390a7cd5ec6fff0a0ca79bd10cb97e93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fb80564f823a0539222ac7080ee782c88dd7859854f2c6f96d0413335a5fe1ffe1cdc04f43491431593728e8928db8a0c9b5b2bce947ef65043576719ec96e
|
7
|
+
data.tar.gz: b657059a6c7536a1e4166782c08100c564a5c79b6cef99afcc4bfe33211222a17ad2ab9ed65ea0fc63c8e9eef85de5a25d77bb7d7f0e4bb2548871824997ff63
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
- `charts`: Array of choices, numeric, or integer variables for charts
|
8
8
|
- The `spout pngs` command now renders the histogram form for each variable
|
9
9
|
- The `spout coverage` command now lists variables that are defined in the data dictionary and that do not exist in any CSV dataset
|
10
|
+
- The `spout coverage` command now lists domains that are defined in the data dictionary and not referenced by any variable
|
10
11
|
- Added `spout outliers` command that returns a list of integer or numeric variables that contain major and minor outliers
|
11
12
|
- Removed the deprecated `spout hybrid` command
|
12
13
|
- **Gem Changes**
|
@@ -9,7 +9,7 @@ module Spout
|
|
9
9
|
def initialize(standard_version)
|
10
10
|
@standard_version = standard_version
|
11
11
|
|
12
|
-
@variable_files =
|
12
|
+
@variable_files = Dir.glob("variables/**/*.json")
|
13
13
|
@valid_ids = []
|
14
14
|
@number_of_rows = nil
|
15
15
|
|
@@ -34,6 +34,10 @@ module Spout
|
|
34
34
|
variable_ids = Dir.glob("variables/**/*.json").collect{ |file| file.gsub(/^(.*)\/|\.json$/, '').downcase }
|
35
35
|
@extra_variable_ids = (variable_ids - @subject_loader.all_methods.keys).sort
|
36
36
|
|
37
|
+
@subject_loader.load_variable_domains!
|
38
|
+
domain_ids = Dir.glob("domains/**/*.json").collect{ |file| file.gsub(/^(.*)\/|\.json$/, '').downcase }
|
39
|
+
@extra_domain_ids = (domain_ids - @subject_loader.all_domains).sort
|
40
|
+
|
37
41
|
@matching_results.sort!{|a,b| [b[2].number_of_errors, a[0].to_s, a[1].to_s] <=> [a[2].number_of_errors, b[0].to_s, b[1].to_s]}
|
38
42
|
|
39
43
|
@coverage_results = []
|
@@ -5,7 +5,7 @@ module Spout
|
|
5
5
|
module Helpers
|
6
6
|
class SubjectLoader
|
7
7
|
attr_accessor :subjects
|
8
|
-
attr_reader :all_methods
|
8
|
+
attr_reader :all_methods, :all_domains
|
9
9
|
|
10
10
|
def initialize(variable_files, valid_ids, standard_version, number_of_rows, visit)
|
11
11
|
@subjects = []
|
@@ -15,6 +15,7 @@ module Spout
|
|
15
15
|
@number_of_rows = number_of_rows
|
16
16
|
@visit = visit
|
17
17
|
@all_methods = {}
|
18
|
+
@all_domains = []
|
18
19
|
end
|
19
20
|
|
20
21
|
def load_subjects_from_csvs!
|
@@ -51,7 +52,6 @@ module Spout
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
# puts "Memory Used: " + (`ps -o rss -p #{$$}`.strip.split.last.to_i / 1024).to_s + " MB" if count % 1000 == 0
|
54
|
-
# break if count >= 1000
|
55
55
|
break if @number_of_rows != nil and count >= @number_of_rows
|
56
56
|
end
|
57
57
|
end
|
@@ -70,6 +70,17 @@ module Spout
|
|
70
70
|
end
|
71
71
|
@subjects
|
72
72
|
end
|
73
|
+
|
74
|
+
def load_variable_domains!
|
75
|
+
@variable_files.each do |variable_file|
|
76
|
+
json = JSON.parse(File.read(variable_file)) rescue json = nil
|
77
|
+
next unless json
|
78
|
+
next unless ["choices"].include?(json["type"])
|
79
|
+
domain = json['domain'].to_s.downcase
|
80
|
+
@all_domains << domain
|
81
|
+
end
|
82
|
+
@all_domains = @all_domains.compact.uniq.sort
|
83
|
+
end
|
73
84
|
end
|
74
85
|
end
|
75
86
|
end
|
data/lib/spout/version.rb
CHANGED
@@ -90,6 +90,15 @@ tfoot td {
|
|
90
90
|
<td></td>
|
91
91
|
</tr>
|
92
92
|
<% end %>
|
93
|
+
<% if @extra_domain_ids.size > 0 %>
|
94
|
+
<tr>
|
95
|
+
<td class="text-muted">Domains Not Referenced by Any Variable</td>
|
96
|
+
<td></td>
|
97
|
+
<td><code class="default"><%= number_with_delimiter( @extra_domain_ids.size ) %></code></td>
|
98
|
+
<td></td>
|
99
|
+
<td></td>
|
100
|
+
</tr>
|
101
|
+
<% end %>
|
93
102
|
<% @coverage_results.each do |csv, total_column_count, mapped_column_count| %>
|
94
103
|
<tr>
|
95
104
|
<td><%= csv %></td>
|
@@ -108,6 +117,29 @@ tfoot td {
|
|
108
117
|
</tbody>
|
109
118
|
</table>
|
110
119
|
|
120
|
+
<% if @extra_domain_ids.size > 0 %>
|
121
|
+
<table class="table">
|
122
|
+
<thead>
|
123
|
+
<tr>
|
124
|
+
<th>Error</th>
|
125
|
+
<th>Domain</th>
|
126
|
+
<th>File</th>
|
127
|
+
<th>Solution</th>
|
128
|
+
</tr>
|
129
|
+
</thead>
|
130
|
+
<tbody>
|
131
|
+
<% @extra_domain_ids.each do |domain_id| %>
|
132
|
+
<tr>
|
133
|
+
<td class="text-muted">Not referenced by any variable</td>
|
134
|
+
<td><%= domain_id %></td>
|
135
|
+
<td><code class="default"><%= domain_id %>.json</code></td>
|
136
|
+
<td class="text-muted">Recommend to remove this domain from data dictionary as no existing variable references the domain.</td>
|
137
|
+
</tr>
|
138
|
+
<% end %>
|
139
|
+
</tbody>
|
140
|
+
</table>
|
141
|
+
<% end %>
|
142
|
+
|
111
143
|
<table class="table table-bordered table-hover">
|
112
144
|
<thead>
|
113
145
|
<tr>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0.
|
4
|
+
version: 0.8.0.beta10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Remo Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|