earth 0.11.10 → 0.11.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/Guardfile +35 -0
- data/README.markdown +94 -20
- data/Rakefile +4 -0
- data/earth.gemspec +14 -12
- data/lib/earth/air/aircraft.rb +2 -2
- data/lib/earth/air/aircraft_instance.rb +2 -2
- data/lib/earth/air/aircraft_instance_seat_class.rb +2 -2
- data/lib/earth/air/airline.rb +2 -2
- data/lib/earth/air/airport.rb +2 -2
- data/lib/earth/air/bts_aircraft.rb +2 -2
- data/lib/earth/air/flight_distance_class.rb +1 -1
- data/lib/earth/air/flight_distance_class_seat_class.rb +1 -1
- data/lib/earth/air/flight_seat_class.rb +1 -1
- data/lib/earth/air/flight_segment.rb +1 -1
- data/lib/earth/automobile/automobile_fuel.rb +1 -1
- data/lib/earth/automobile/automobile_make.rb +1 -1
- data/lib/earth/automobile/automobile_make_model.rb +1 -1
- data/lib/earth/automobile/automobile_make_model_year.rb +1 -1
- data/lib/earth/automobile/automobile_make_model_year_variant.rb +1 -1
- data/lib/earth/automobile/automobile_make_year.rb +1 -1
- data/lib/earth/automobile/automobile_make_year_fleet.rb +1 -1
- data/lib/earth/automobile/automobile_model.rb +1 -1
- data/lib/earth/automobile/automobile_size_class.rb +1 -1
- data/lib/earth/automobile/automobile_size_class_year.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_control.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_year_age.rb +1 -1
- data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -1
- data/lib/earth/automobile/automobile_type_year.rb +2 -2
- data/lib/earth/automobile/automobile_year.rb +1 -1
- data/lib/earth/bus/bus_class.rb +1 -1
- data/lib/earth/bus/bus_fuel.rb +2 -2
- data/lib/earth/bus/bus_fuel_control.rb +2 -2
- data/lib/earth/bus/bus_fuel_year_control.rb +2 -2
- data/lib/earth/computation/computation_carrier.rb +2 -2
- data/lib/earth/computation/computation_carrier_instance_class.rb +2 -2
- data/lib/earth/computation/computation_carrier_region.rb +2 -2
- data/lib/earth/conversions_ext.rb +26 -7
- data/lib/earth/diet/diet_class.rb +2 -2
- data/lib/earth/diet/food_group.rb +2 -2
- data/lib/earth/eia.rb +13 -13
- data/lib/earth/fuel/fuel.rb +22 -13
- data/lib/earth/fuel/fuel/data_miner.rb +36 -44
- data/lib/earth/fuel/fuel_price.rb +1 -1
- data/lib/earth/fuel/fuel_type.rb +2 -2
- data/lib/earth/fuel/fuel_year.rb +4 -2
- data/lib/earth/fuel/greenhouse_gas.rb +2 -2
- data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response.rb +14 -5
- data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response/data_miner.rb +22 -1
- data/lib/earth/hospitality/country_lodging_class.rb +3 -3
- data/lib/earth/hospitality/country_lodging_class/data_miner.rb +7 -5
- data/lib/earth/hospitality/lodging_class.rb +1 -1
- data/lib/earth/hospitality/lodging_property.rb +8 -8
- data/lib/earth/industry/cbecs_energy_intensity.rb +59 -6
- data/lib/earth/industry/cbecs_energy_intensity/data_miner.rb +266 -69
- data/lib/earth/industry/industry.rb +1 -1
- data/lib/earth/industry/industry_product.rb +2 -2
- data/lib/earth/industry/industry_product_line.rb +2 -2
- data/lib/earth/industry/industry_sector.rb +2 -2
- data/lib/earth/industry/mecs_energy.rb +26 -15
- data/lib/earth/industry/mecs_energy/data_miner.rb +39 -23
- data/lib/earth/industry/mecs_ratio.rb +13 -10
- data/lib/earth/industry/mecs_ratio/data_miner.rb +14 -14
- data/lib/earth/industry/merchant.rb +2 -2
- data/lib/earth/industry/merchant_category.rb +2 -2
- data/lib/earth/industry/merchant_category_industry.rb +2 -2
- data/lib/earth/industry/product_line.rb +2 -2
- data/lib/earth/industry/product_line_industry_product.rb +2 -2
- data/lib/earth/industry/sector.rb +2 -2
- data/lib/earth/locality/census_division.rb +2 -2
- data/lib/earth/locality/census_division/data_miner.rb +4 -14
- data/lib/earth/locality/census_region.rb +2 -2
- data/lib/earth/locality/climate_division.rb +1 -17
- data/lib/earth/locality/country.rb +14 -28
- data/lib/earth/locality/country/data_miner.rb +8 -2
- data/lib/earth/locality/egrid_country.rb +1 -1
- data/lib/earth/locality/egrid_region.rb +4 -1
- data/lib/earth/locality/egrid_region/data_miner.rb +4 -1
- data/lib/earth/locality/egrid_subregion.rb +1 -1
- data/lib/earth/locality/egrid_subregion/data_miner.rb +1 -0
- data/lib/earth/locality/petroleum_administration_for_defense_district.rb +3 -3
- data/lib/earth/locality/state.rb +2 -7
- data/lib/earth/locality/zip_code.rb +1 -1
- data/lib/earth/pet/breed.rb +2 -2
- data/lib/earth/pet/breed_gender.rb +2 -2
- data/lib/earth/pet/gender.rb +2 -2
- data/lib/earth/pet/species.rb +2 -2
- data/lib/earth/pet/species/data_miner.rb +0 -9
- data/lib/earth/rail/country_rail_class.rb +1 -1
- data/lib/earth/rail/country_rail_traction.rb +1 -1
- data/lib/earth/rail/country_rail_traction_class.rb +1 -1
- data/lib/earth/rail/national_transit_database_company.rb +2 -2
- data/lib/earth/rail/national_transit_database_mode.rb +2 -2
- data/lib/earth/rail/national_transit_database_record.rb +2 -2
- data/lib/earth/rail/national_transit_database_record/data_miner.rb +12 -33
- data/lib/earth/rail/rail_class.rb +1 -1
- data/lib/earth/rail/rail_company.rb +1 -1
- data/lib/earth/rail/rail_company_traction.rb +1 -1
- data/lib/earth/rail/rail_company_traction_class.rb +1 -1
- data/lib/earth/rail/rail_fuel.rb +1 -1
- data/lib/earth/rail/rail_traction.rb +1 -1
- data/lib/earth/residence/air_conditioner_use.rb +2 -2
- data/lib/earth/residence/clothes_machine_use.rb +2 -2
- data/lib/earth/residence/dishwasher_use.rb +2 -2
- data/lib/earth/residence/residence_appliance.rb +2 -2
- data/lib/earth/residence/residence_class.rb +2 -2
- data/lib/earth/residence/residence_fuel_price.rb +2 -2
- data/lib/earth/residence/residence_fuel_price/data_miner.rb +0 -5
- data/lib/earth/residence/residence_fuel_type.rb +2 -2
- data/lib/earth/residence/residential_energy_consumption_survey_response.rb +3 -3
- data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +0 -5
- data/lib/earth/residence/urbanity.rb +2 -2
- data/lib/earth/shipping/carrier.rb +3 -2
- data/lib/earth/shipping/carrier/data_miner.rb +1 -0
- data/lib/earth/shipping/carrier_mode.rb +2 -2
- data/lib/earth/shipping/shipment_mode.rb +2 -2
- data/lib/earth/version.rb +1 -1
- data/spec/earth/air/aircraft_spec.rb +421 -0
- data/spec/earth/fuel/fuel_spec.rb +35 -0
- data/spec/earth/hospitality/lodging_fuel_use_equation_spec.rb +96 -0
- data/spec/earth/industry/cbecs_energy_intensity_spec.rb +102 -0
- data/spec/earth/industry/mecs_energy_spec.rb +36 -44
- data/spec/earth/industry/mecs_ratio_spec.rb +24 -17
- data/spec/earth/locality/country_spec.rb +0 -9
- data/spec/spec_helper.rb +8 -3
- data/spec/support/integration.rb +17 -0
- data/vendor/geokit-rails/init.rb +2 -1
- data/vendor/geokit-rails/lib/geokit-rails.rb +1 -0
- metadata +63 -36
- data/lib/earth/hospitality/lodging_fuel_use_equation.rb +0 -26
- data/lib/earth/hospitality/lodging_fuel_use_equation/data_miner.rb +0 -20
- data/test/test_aircraft_match.rb +0 -732
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^spec/.+_spec\.rb$})
|
11
|
+
watch(%r{^app/models/(.+)\.rb$}) { |m| "spec/models/#{m[1]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers(.+)\.rb$}) { |m| "spec/controllers/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
15
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
16
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
17
|
+
watch('spec/spec_helper.rb') { "spec" }
|
18
|
+
watch('config/routes.rb') { "spec/routing" }
|
19
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
20
|
+
# Capybara request specs
|
21
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
guard 'bundler' do
|
26
|
+
watch('Gemfile')
|
27
|
+
# Uncomment next line if Gemfile contain `gemspec' command
|
28
|
+
# watch(/^.+\.gemspec/)
|
29
|
+
end
|
30
|
+
|
31
|
+
guard 'cucumber' do
|
32
|
+
watch(%r{^features/.+\.feature$})
|
33
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
34
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
35
|
+
end
|
data/README.markdown
CHANGED
@@ -2,47 +2,121 @@
|
|
2
2
|
|
3
3
|
Earth is a collection of data models that represent various things found here on Earth, such as pet breeds, kinds of rail travel, zip codes, and Petroleum Administration for Defense Districts.
|
4
4
|
|
5
|
-
The data that these models represent can be pulled from
|
5
|
+
The data that these models represent can be pulled from preconfigured authoritative sources.
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
``` ruby
|
10
|
+
require 'earth'
|
11
|
+
Earth.init :automobile, :locality
|
12
|
+
ft = AutomobileFuel.first
|
13
|
+
# ...
|
14
|
+
```
|
13
15
|
|
14
16
|
`Earth.init` loads desired "data domains" as well as any supporting classes and plugins that each data model needs. A "data domain" is a grouping of related data models. For instance, all automobile-related data is in the `:automobile` domain.
|
15
17
|
|
18
|
+
### Domains
|
19
|
+
|
20
|
+
<table>
|
21
|
+
<thead>
|
22
|
+
<tr>
|
23
|
+
<th>Domain</th>
|
24
|
+
<th>Models</th>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
27
|
+
<tbody>
|
28
|
+
<tr>
|
29
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/air"><code>:air</code></a></td>
|
30
|
+
<td>Aircraft, Airline, Airport ...</td>
|
31
|
+
</tr>
|
32
|
+
<tr>
|
33
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/automobile"><code>:automobile</code></a></td>
|
34
|
+
<td>AutomobileFuel, AutomobileMake, AutomobileModel ...</td>
|
35
|
+
</tr>
|
36
|
+
<tr>
|
37
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/bus"><code>:bus</code></a></td>
|
38
|
+
<td>BusClass, BusFuel ...</td>
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/computation"><code>:computation</code></a></td>
|
42
|
+
<td>ComputationCarrier, ComputationCarrierInstanceClass ...</td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/diet"><code>:diet</code></a></td>
|
46
|
+
<td>DietClass, FoodGroup ...</td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/fuel"><code>:fuel</code></a></td>
|
50
|
+
<td>Fuel, FuelPrice, GreenhouseGas ...</td>
|
51
|
+
</tr>
|
52
|
+
<tr>
|
53
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/hospitality"><code>:hospitality</code></a></td>
|
54
|
+
<td>LodgingClass, CommercialBuildingEnergyConsumptionSurveyResponse ...</td>
|
55
|
+
</tr>
|
56
|
+
<tr>
|
57
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/industry"><code>:industry</code></a></td>
|
58
|
+
<td>Industry, CbecsEnergyIntensity ...</td>
|
59
|
+
</tr>
|
60
|
+
<tr>
|
61
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/locality"><code>:locality</code></a></td>
|
62
|
+
<td>CensusDivision, Country, ZipCode ...</td>
|
63
|
+
</tr>
|
64
|
+
<tr>
|
65
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/pet"><code>:pet</code></a></td>
|
66
|
+
<td>Breed, Gender, Species ...</td>
|
67
|
+
</tr>
|
68
|
+
<tr>
|
69
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/rail"><code>:rail</code></a></td>
|
70
|
+
<td>RailClass, RailFuel, RailCompany ...</td>
|
71
|
+
</tr>
|
72
|
+
<tr>
|
73
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/residence"><code>:residence</code></a></td>
|
74
|
+
<td>Urbanity, ResidenceClass, AirConditionerUse</td>
|
75
|
+
</tr>
|
76
|
+
<tr>
|
77
|
+
<td><a href="https://github.com/brighterplanet/earth/tree/master/lib/earth/shipping"><code>:shipping</code></a></td>
|
78
|
+
<td>Carrier, ShipmentMode ...</td>
|
79
|
+
</tr>
|
80
|
+
</tbody>
|
81
|
+
</table>
|
82
|
+
|
83
|
+
|
16
84
|
### Data storage
|
17
85
|
|
18
86
|
You can store Earth data in any relational database. On your very first run, you will need to create the tables for data each model. This is done using minirecord with the `apply_schemas` option:
|
19
87
|
|
20
|
-
|
21
|
-
|
88
|
+
``` ruby
|
89
|
+
require 'activerecord'
|
90
|
+
ActiveRecord::Base.establish_connection :adapter => ... # Not needed if using Rails
|
22
91
|
|
23
|
-
|
24
|
-
|
92
|
+
require 'earth'
|
93
|
+
Earth.init :all, :apply_schemas => true
|
94
|
+
```
|
25
95
|
|
26
96
|
### Pulling data from data.brighterplanet.com
|
27
97
|
|
28
|
-
By default, Earth will pull data from data.brighterplanet.com. Simply call
|
98
|
+
By default, Earth will pull data from [data.brighterplanet.com](http://data.brighterplanet.com), which continuously (and transparently) refreshes its data from authoritative sources. Simply call `#run_data_miner!` on whichever data model class you need. If there are any Earth classes that the chosen class depends on, they will be downloaded as well automatically:
|
29
99
|
|
30
|
-
|
31
|
-
|
32
|
-
|
100
|
+
``` ruby
|
101
|
+
require 'earth'
|
102
|
+
Earth.init :locality
|
103
|
+
ZipCode.run_data_miner!
|
104
|
+
```
|
33
105
|
|
34
106
|
### Pulling data from the original sources
|
35
107
|
|
36
|
-
If you'd like to pull data directly from
|
108
|
+
If you'd like to bypass the [data.brighterplanet.com](http://data.brighterplanet.com) proxy and pull data directly from authoritative sources (*e.g.,* automobile data from EPA), simply require the `data\_miner` file for the desired domain:
|
37
109
|
|
38
|
-
|
39
|
-
|
110
|
+
``` ruby
|
111
|
+
require 'earth'
|
112
|
+
Earth.init :automobile
|
40
113
|
|
41
|
-
|
42
|
-
|
114
|
+
require 'earth/automobile/data_miner'
|
115
|
+
AutomobileMake.run_data_miner!
|
116
|
+
```
|
43
117
|
|
44
118
|
## Collaboration cycle
|
45
|
-
Brighter Planet vigorously encourages collaborative improvement
|
119
|
+
Brighter Planet vigorously encourages collaborative improvement.
|
46
120
|
|
47
121
|
### You
|
48
122
|
1. Fork the earth repository on GitHub.
|
@@ -57,4 +131,4 @@ Brighter Planet vigorously encourages collaborative improvement of its emitter l
|
|
57
131
|
1. Ensure tests pass.
|
58
132
|
1. Review changes for scientific accuracy.
|
59
133
|
1. Merge changes to master repository and publish.
|
60
|
-
1. Direct production environment to use new
|
134
|
+
1. Direct production environment to use new library version.
|
data/Rakefile
CHANGED
@@ -6,6 +6,10 @@ require 'bueller'
|
|
6
6
|
Bueller::Tasks.new
|
7
7
|
|
8
8
|
task :console do
|
9
|
+
require 'earth'
|
10
|
+
logger = Logger.new('log/test.log')
|
11
|
+
DataMiner.logger = ActiveRecord::Base.logger = logger
|
12
|
+
ActiveRecord::Base.establish_connection :adapter => 'postgresql', :database => 'test_earth'
|
9
13
|
Earth.init :all
|
10
14
|
|
11
15
|
require 'irb'
|
data/earth.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "earth/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "earth"
|
7
7
|
s.version = Earth::VERSION
|
8
|
-
s.date = "2012-
|
8
|
+
s.date = "2012-02-15"
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.authors = ["Seamus Abshere", "Derek Kastner", "Andy Rossmeissl"]
|
11
11
|
s.email = %q{andy@rossmeissl.net}
|
@@ -27,26 +27,28 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.require_paths = ["lib"]
|
28
28
|
s.rubygems_version = %q{1.3.7}
|
29
29
|
|
30
|
-
s.add_runtime_dependency '
|
31
|
-
s.add_runtime_dependency '
|
30
|
+
s.add_runtime_dependency 'activerecord'
|
31
|
+
s.add_runtime_dependency 'activesupport'
|
32
32
|
s.add_runtime_dependency 'cohort_scope'
|
33
|
-
s.add_runtime_dependency '
|
34
|
-
s.add_runtime_dependency '
|
33
|
+
s.add_runtime_dependency 'conversions'
|
34
|
+
s.add_runtime_dependency 'data_miner', '>=1.3'
|
35
35
|
s.add_runtime_dependency 'falls_back_on'
|
36
36
|
s.add_runtime_dependency 'fixed_width-multibyte'
|
37
|
-
s.add_runtime_dependency 'geokit'
|
38
37
|
s.add_runtime_dependency 'fuzzy_match', '>=1.1.0'
|
39
|
-
s.add_runtime_dependency '
|
38
|
+
s.add_runtime_dependency 'geokit'
|
40
39
|
s.add_runtime_dependency 'mini_record-compat' # need https://github.com/DAddYE/mini_record/pull/7
|
41
|
-
s.add_runtime_dependency '
|
42
|
-
s.add_runtime_dependency '
|
43
|
-
s.
|
40
|
+
s.add_runtime_dependency 'remote_table', '>=1.3.0'
|
41
|
+
s.add_runtime_dependency 'table_warnings', '>=0.0.6'
|
42
|
+
s.add_runtime_dependency 'to_regexp'
|
43
|
+
s.add_runtime_dependency 'weighted_average', '>=1.0.2'
|
44
44
|
s.add_development_dependency 'bueller'
|
45
|
+
s.add_development_dependency 'bundler'
|
46
|
+
s.add_development_dependency 'charisma'
|
45
47
|
s.add_development_dependency 'cucumber'
|
48
|
+
s.add_development_dependency 'mysql' # for bin/earth_tester.rb
|
49
|
+
s.add_development_dependency 'pg'
|
46
50
|
s.add_development_dependency 'rake'
|
47
51
|
s.add_development_dependency 'rdoc'
|
48
52
|
s.add_development_dependency 'rspec'
|
49
53
|
s.add_development_dependency 'sqlite3-ruby'
|
50
|
-
s.add_development_dependency 'mysql' # for bin/earth_tester.rb
|
51
|
-
s.add_development_dependency 'pg'
|
52
54
|
end
|
data/lib/earth/air/aircraft.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Aircraft < ActiveRecord::Base
|
2
|
-
|
2
|
+
self.primary_key = "icao_code"
|
3
3
|
|
4
4
|
# Fuzzy association with FlightSegment
|
5
5
|
cache_fuzzy_match_with :flight_segments, :primary_key => :description, :foreign_key => :aircraft_description
|
@@ -141,4 +141,4 @@ class Aircraft < ActiveRecord::Base
|
|
141
141
|
col :b, :type => :float
|
142
142
|
col :b_units
|
143
143
|
col :fuel_use_specificity
|
144
|
-
end
|
144
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class AircraftInstance < ActiveRecord::Base
|
2
|
-
|
2
|
+
self.primary_key = "id"
|
3
3
|
|
4
4
|
col :id
|
5
5
|
col :registration
|
@@ -8,4 +8,4 @@ class AircraftInstance < ActiveRecord::Base
|
|
8
8
|
col :airline_name
|
9
9
|
add_index :registration
|
10
10
|
add_index :serial_number
|
11
|
-
end
|
11
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class AircraftInstanceSeatClass < ActiveRecord::Base
|
2
|
-
|
2
|
+
self.primary_key = "row_hash"
|
3
3
|
|
4
4
|
col :row_hash
|
5
5
|
col :seat_class_name
|
@@ -10,4 +10,4 @@ class AircraftInstanceSeatClass < ActiveRecord::Base
|
|
10
10
|
col :seat_width, :type => :float
|
11
11
|
col :seat_width_units
|
12
12
|
add_index :aircraft_instance_id
|
13
|
-
end
|
13
|
+
end
|
data/lib/earth/air/airline.rb
CHANGED
data/lib/earth/air/airport.rb
CHANGED
@@ -2,7 +2,7 @@ require ::File.join(Earth.vendor_dir, 'geokit-rails', 'lib', 'geokit-rails')
|
|
2
2
|
require 'earth/locality'
|
3
3
|
|
4
4
|
class Airport < ActiveRecord::Base
|
5
|
-
|
5
|
+
self.primary_key = "iata_code"
|
6
6
|
|
7
7
|
belongs_to :country, :foreign_key => 'country_iso_3166_code', :primary_key => 'iso_3166_code'
|
8
8
|
|
@@ -17,4 +17,4 @@ class Airport < ActiveRecord::Base
|
|
17
17
|
col :country_iso_3166_code
|
18
18
|
col :latitude, :type => :float
|
19
19
|
col :longitude, :type => :float
|
20
|
-
end
|
20
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'earth/fuel'
|
2
2
|
|
3
3
|
class AutomobileFuel < ActiveRecord::Base
|
4
|
-
|
4
|
+
self.primary_key = "name"
|
5
5
|
|
6
6
|
has_many :type_fuel_year_ages, :class_name => 'AutomobileTypeFuelYearAge', :foreign_key => 'fuel_common_name', :primary_key => 'distance_key'
|
7
7
|
has_many :type_fuel_years, :class_name => 'AutomobileTypeFuelYear', :foreign_key => 'fuel_common_name', :primary_key => 'ef_key'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'earth/fuel'
|
2
2
|
class AutomobileMakeModelYear < ActiveRecord::Base
|
3
|
-
|
3
|
+
self.primary_key = "name"
|
4
4
|
|
5
5
|
# Need this so Automobile and AutomobileTrip can do characteristics[:make_model_year].automobile_fuel
|
6
6
|
belongs_to :automobile_fuel, :foreign_key => 'fuel_code', :primary_key => 'code'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'earth/fuel'
|
2
2
|
class AutomobileMakeModelYearVariant < ActiveRecord::Base
|
3
|
-
|
3
|
+
self.primary_key = "row_hash"
|
4
4
|
|
5
5
|
# It looks like synthesizing a unique name would require including pretty much every column from the FEGs
|
6
6
|
# (e.g. creeper gear, automatic vs automatic with lockup, feedback fuel system, etc.)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'earth/fuel'
|
2
2
|
class AutomobileSizeClass < ActiveRecord::Base
|
3
|
-
|
3
|
+
self.primary_key = "name"
|
4
4
|
|
5
5
|
# FIXME TODO clean up size class in MakeModelYearVariant, derive size class for MakeModelYear, and calculate this from MakeModelYear
|
6
6
|
falls_back_on :hybrid_fuel_efficiency_city_multiplier => 1.651, # https://brighterplanet.sifterapp.com/issue/667
|