earth 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/earth/automobile/automobile_make_model/data_miner.rb +4 -3
- data/lib/earth/automobile/automobile_make_model_year/data_miner.rb +5 -4
- data/lib/earth/automobile/automobile_make_model_year_variant/data_miner.rb +2 -2
- data/lib/earth/locality/petroleum_administration_for_defense_district.rb +1 -1
- metadata +15 -25
@@ -17,7 +17,7 @@ AutomobileMakeModel.class_eval do
|
|
17
17
|
AutomobileMakeModelYearVariant.run_data_miner!
|
18
18
|
connection.execute %{
|
19
19
|
INSERT IGNORE INTO automobile_make_models(name, make_name)
|
20
|
-
SELECT automobile_make_model_year_variants.
|
20
|
+
SELECT automobile_make_model_year_variants.make_model_name, automobile_make_model_year_variants.make_name FROM automobile_make_model_year_variants WHERE LENGTH(automobile_make_model_year_variants.make_model_name) > 0 AND LENGTH(automobile_make_model_year_variants.make_name) > 0
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
@@ -26,9 +26,10 @@ AutomobileMakeModel.class_eval do
|
|
26
26
|
AutomobileMakeModelYearVariant.run_data_miner!
|
27
27
|
automobile_make_models = AutomobileMakeModel.arel_table
|
28
28
|
automobile_make_model_year_variants = AutomobileMakeModelYearVariant.arel_table
|
29
|
-
conditional_relation = automobile_make_models[:name].eq(automobile_make_model_year_variants[:
|
29
|
+
conditional_relation = automobile_make_models[:name].eq(automobile_make_model_year_variants[:make_model_name])
|
30
30
|
%w{ city highway }.each do |i|
|
31
|
-
|
31
|
+
# sabshere 12/6/10 careful, don't use AutomobileMakeModelYearVariant.where here or you will be forced into projecting *
|
32
|
+
relation = automobile_make_model_year_variants.where(conditional_relation).where("`automobile_make_model_year_variants`.`fuel_efficiency_#{i}` IS NOT NULL").project("AVG(`automobile_make_model_year_variants`.`fuel_efficiency_#{i}`)")
|
32
33
|
update_all "fuel_efficiency_#{i} = (#{relation.to_sql})"
|
33
34
|
update_all "fuel_efficiency_#{i}_units = 'kilometres_per_litre'"
|
34
35
|
end
|
@@ -21,8 +21,8 @@ AutomobileMakeModelYear.class_eval do
|
|
21
21
|
process "Derive model year names from automobile make model year variants" do
|
22
22
|
AutomobileMakeModelYearVariant.run_data_miner!
|
23
23
|
connection.execute %{
|
24
|
-
INSERT IGNORE INTO automobile_make_model_years(name, make_name,
|
25
|
-
SELECT automobile_make_model_year_variants.
|
24
|
+
INSERT IGNORE INTO automobile_make_model_years(name, make_name, make_model_name, year, make_year_name)
|
25
|
+
SELECT automobile_make_model_year_variants.make_model_year_name, automobile_make_model_year_variants.make_name, automobile_make_model_year_variants.make_model_name, automobile_make_model_year_variants.year, automobile_make_model_year_variants.make_year_name FROM automobile_make_model_year_variants WHERE LENGTH(automobile_make_model_year_variants.make_name) > 0 AND LENGTH(automobile_make_model_year_variants.make_model_name) > 0
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
@@ -34,9 +34,10 @@ AutomobileMakeModelYear.class_eval do
|
|
34
34
|
AutomobileMakeModelYearVariant.run_data_miner!
|
35
35
|
automobile_make_model_years = AutomobileMakeModelYear.arel_table
|
36
36
|
automobile_make_model_year_variants = AutomobileMakeModelYearVariant.arel_table
|
37
|
-
conditional_relation = automobile_make_model_years[:name].eq(automobile_make_model_year_variants[:
|
37
|
+
conditional_relation = automobile_make_model_years[:name].eq(automobile_make_model_year_variants[:make_model_year_name])
|
38
38
|
%w{ city highway }.each do |i|
|
39
|
-
|
39
|
+
# sabshere 12/6/10 careful, don't use AutomobileMakeModelYearVariant.where here or you will be forced into projecting *
|
40
|
+
relation = automobile_make_model_year_variants.where(conditional_relation).where("`automobile_make_model_year_variants`.`fuel_efficiency_#{i}` IS NOT NULL").project("AVG(`automobile_make_model_year_variants`.`fuel_efficiency_#{i}`)")
|
40
41
|
update_all "fuel_efficiency_#{i} = (#{relation.to_sql})"
|
41
42
|
update_all "fuel_efficiency_#{i}_units = 'kilometres_per_litre'"
|
42
43
|
end
|
@@ -440,9 +440,9 @@ AutomobileMakeModelYearVariant.class_eval do
|
|
440
440
|
# end
|
441
441
|
|
442
442
|
process "Derive model and model year names" do
|
443
|
-
update_all "
|
443
|
+
update_all "make_model_name = CONCAT(make_name, ' ', name)"
|
444
444
|
update_all "make_year_name = CONCAT(make_name, ' ', year)"
|
445
|
-
update_all "
|
445
|
+
update_all "make_model_year_name = CONCAT(make_name, ' ', name, ' ', year)"
|
446
446
|
end
|
447
447
|
|
448
448
|
process "Calculate adjusted fuel efficiency using the latest EPA equations" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: earth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Seamus Abshere
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-12-06 00:00:00 -06:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -26,15 +26,12 @@ dependencies:
|
|
26
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|
28
28
|
requirements:
|
29
|
-
- -
|
29
|
+
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
hash:
|
31
|
+
hash: 5
|
32
32
|
segments:
|
33
33
|
- 3
|
34
|
-
|
35
|
-
- 0
|
36
|
-
- beta4
|
37
|
-
version: 3.0.0.beta4
|
34
|
+
version: "3"
|
38
35
|
type: :runtime
|
39
36
|
version_requirements: *id001
|
40
37
|
- !ruby/object:Gem::Dependency
|
@@ -155,16 +152,12 @@ dependencies:
|
|
155
152
|
requirement: &id009 !ruby/object:Gem::Requirement
|
156
153
|
none: false
|
157
154
|
requirements:
|
158
|
-
- -
|
155
|
+
- - ~>
|
159
156
|
- !ruby/object:Gem::Version
|
160
|
-
hash:
|
157
|
+
hash: 7
|
161
158
|
segments:
|
162
159
|
- 2
|
163
|
-
|
164
|
-
- 0
|
165
|
-
- beta
|
166
|
-
- 17
|
167
|
-
version: 2.0.0.beta.17
|
160
|
+
version: "2"
|
168
161
|
type: :development
|
169
162
|
version_requirements: *id009
|
170
163
|
- !ruby/object:Gem::Dependency
|
@@ -187,14 +180,13 @@ dependencies:
|
|
187
180
|
requirement: &id011 !ruby/object:Gem::Requirement
|
188
181
|
none: false
|
189
182
|
requirements:
|
190
|
-
- -
|
183
|
+
- - ~>
|
191
184
|
- !ruby/object:Gem::Version
|
192
|
-
hash:
|
185
|
+
hash: 5
|
193
186
|
segments:
|
194
187
|
- 1
|
195
188
|
- 5
|
196
|
-
|
197
|
-
version: 1.5.0
|
189
|
+
version: "1.5"
|
198
190
|
type: :development
|
199
191
|
version_requirements: *id011
|
200
192
|
- !ruby/object:Gem::Dependency
|
@@ -233,12 +225,10 @@ dependencies:
|
|
233
225
|
requirements:
|
234
226
|
- - ">="
|
235
227
|
- !ruby/object:Gem::Version
|
236
|
-
hash:
|
228
|
+
hash: 3
|
237
229
|
segments:
|
238
|
-
- 1
|
239
|
-
- 3
|
240
230
|
- 0
|
241
|
-
version:
|
231
|
+
version: "0"
|
242
232
|
type: :development
|
243
233
|
version_requirements: *id014
|
244
234
|
description: An earth-simulation environment with ActiveRecord models and data
|