earth 0.11.10 → 0.11.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Gemfile +4 -0
  2. data/Guardfile +35 -0
  3. data/README.markdown +94 -20
  4. data/Rakefile +4 -0
  5. data/earth.gemspec +14 -12
  6. data/lib/earth/air/aircraft.rb +2 -2
  7. data/lib/earth/air/aircraft_instance.rb +2 -2
  8. data/lib/earth/air/aircraft_instance_seat_class.rb +2 -2
  9. data/lib/earth/air/airline.rb +2 -2
  10. data/lib/earth/air/airport.rb +2 -2
  11. data/lib/earth/air/bts_aircraft.rb +2 -2
  12. data/lib/earth/air/flight_distance_class.rb +1 -1
  13. data/lib/earth/air/flight_distance_class_seat_class.rb +1 -1
  14. data/lib/earth/air/flight_seat_class.rb +1 -1
  15. data/lib/earth/air/flight_segment.rb +1 -1
  16. data/lib/earth/automobile/automobile_fuel.rb +1 -1
  17. data/lib/earth/automobile/automobile_make.rb +1 -1
  18. data/lib/earth/automobile/automobile_make_model.rb +1 -1
  19. data/lib/earth/automobile/automobile_make_model_year.rb +1 -1
  20. data/lib/earth/automobile/automobile_make_model_year_variant.rb +1 -1
  21. data/lib/earth/automobile/automobile_make_year.rb +1 -1
  22. data/lib/earth/automobile/automobile_make_year_fleet.rb +1 -1
  23. data/lib/earth/automobile/automobile_model.rb +1 -1
  24. data/lib/earth/automobile/automobile_size_class.rb +1 -1
  25. data/lib/earth/automobile/automobile_size_class_year.rb +1 -1
  26. data/lib/earth/automobile/automobile_type_fuel_control.rb +1 -1
  27. data/lib/earth/automobile/automobile_type_fuel_year.rb +1 -1
  28. data/lib/earth/automobile/automobile_type_fuel_year_age.rb +1 -1
  29. data/lib/earth/automobile/automobile_type_fuel_year_control.rb +1 -1
  30. data/lib/earth/automobile/automobile_type_year.rb +2 -2
  31. data/lib/earth/automobile/automobile_year.rb +1 -1
  32. data/lib/earth/bus/bus_class.rb +1 -1
  33. data/lib/earth/bus/bus_fuel.rb +2 -2
  34. data/lib/earth/bus/bus_fuel_control.rb +2 -2
  35. data/lib/earth/bus/bus_fuel_year_control.rb +2 -2
  36. data/lib/earth/computation/computation_carrier.rb +2 -2
  37. data/lib/earth/computation/computation_carrier_instance_class.rb +2 -2
  38. data/lib/earth/computation/computation_carrier_region.rb +2 -2
  39. data/lib/earth/conversions_ext.rb +26 -7
  40. data/lib/earth/diet/diet_class.rb +2 -2
  41. data/lib/earth/diet/food_group.rb +2 -2
  42. data/lib/earth/eia.rb +13 -13
  43. data/lib/earth/fuel/fuel.rb +22 -13
  44. data/lib/earth/fuel/fuel/data_miner.rb +36 -44
  45. data/lib/earth/fuel/fuel_price.rb +1 -1
  46. data/lib/earth/fuel/fuel_type.rb +2 -2
  47. data/lib/earth/fuel/fuel_year.rb +4 -2
  48. data/lib/earth/fuel/greenhouse_gas.rb +2 -2
  49. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response.rb +14 -5
  50. data/lib/earth/hospitality/commercial_building_energy_consumption_survey_response/data_miner.rb +22 -1
  51. data/lib/earth/hospitality/country_lodging_class.rb +3 -3
  52. data/lib/earth/hospitality/country_lodging_class/data_miner.rb +7 -5
  53. data/lib/earth/hospitality/lodging_class.rb +1 -1
  54. data/lib/earth/hospitality/lodging_property.rb +8 -8
  55. data/lib/earth/industry/cbecs_energy_intensity.rb +59 -6
  56. data/lib/earth/industry/cbecs_energy_intensity/data_miner.rb +266 -69
  57. data/lib/earth/industry/industry.rb +1 -1
  58. data/lib/earth/industry/industry_product.rb +2 -2
  59. data/lib/earth/industry/industry_product_line.rb +2 -2
  60. data/lib/earth/industry/industry_sector.rb +2 -2
  61. data/lib/earth/industry/mecs_energy.rb +26 -15
  62. data/lib/earth/industry/mecs_energy/data_miner.rb +39 -23
  63. data/lib/earth/industry/mecs_ratio.rb +13 -10
  64. data/lib/earth/industry/mecs_ratio/data_miner.rb +14 -14
  65. data/lib/earth/industry/merchant.rb +2 -2
  66. data/lib/earth/industry/merchant_category.rb +2 -2
  67. data/lib/earth/industry/merchant_category_industry.rb +2 -2
  68. data/lib/earth/industry/product_line.rb +2 -2
  69. data/lib/earth/industry/product_line_industry_product.rb +2 -2
  70. data/lib/earth/industry/sector.rb +2 -2
  71. data/lib/earth/locality/census_division.rb +2 -2
  72. data/lib/earth/locality/census_division/data_miner.rb +4 -14
  73. data/lib/earth/locality/census_region.rb +2 -2
  74. data/lib/earth/locality/climate_division.rb +1 -17
  75. data/lib/earth/locality/country.rb +14 -28
  76. data/lib/earth/locality/country/data_miner.rb +8 -2
  77. data/lib/earth/locality/egrid_country.rb +1 -1
  78. data/lib/earth/locality/egrid_region.rb +4 -1
  79. data/lib/earth/locality/egrid_region/data_miner.rb +4 -1
  80. data/lib/earth/locality/egrid_subregion.rb +1 -1
  81. data/lib/earth/locality/egrid_subregion/data_miner.rb +1 -0
  82. data/lib/earth/locality/petroleum_administration_for_defense_district.rb +3 -3
  83. data/lib/earth/locality/state.rb +2 -7
  84. data/lib/earth/locality/zip_code.rb +1 -1
  85. data/lib/earth/pet/breed.rb +2 -2
  86. data/lib/earth/pet/breed_gender.rb +2 -2
  87. data/lib/earth/pet/gender.rb +2 -2
  88. data/lib/earth/pet/species.rb +2 -2
  89. data/lib/earth/pet/species/data_miner.rb +0 -9
  90. data/lib/earth/rail/country_rail_class.rb +1 -1
  91. data/lib/earth/rail/country_rail_traction.rb +1 -1
  92. data/lib/earth/rail/country_rail_traction_class.rb +1 -1
  93. data/lib/earth/rail/national_transit_database_company.rb +2 -2
  94. data/lib/earth/rail/national_transit_database_mode.rb +2 -2
  95. data/lib/earth/rail/national_transit_database_record.rb +2 -2
  96. data/lib/earth/rail/national_transit_database_record/data_miner.rb +12 -33
  97. data/lib/earth/rail/rail_class.rb +1 -1
  98. data/lib/earth/rail/rail_company.rb +1 -1
  99. data/lib/earth/rail/rail_company_traction.rb +1 -1
  100. data/lib/earth/rail/rail_company_traction_class.rb +1 -1
  101. data/lib/earth/rail/rail_fuel.rb +1 -1
  102. data/lib/earth/rail/rail_traction.rb +1 -1
  103. data/lib/earth/residence/air_conditioner_use.rb +2 -2
  104. data/lib/earth/residence/clothes_machine_use.rb +2 -2
  105. data/lib/earth/residence/dishwasher_use.rb +2 -2
  106. data/lib/earth/residence/residence_appliance.rb +2 -2
  107. data/lib/earth/residence/residence_class.rb +2 -2
  108. data/lib/earth/residence/residence_fuel_price.rb +2 -2
  109. data/lib/earth/residence/residence_fuel_price/data_miner.rb +0 -5
  110. data/lib/earth/residence/residence_fuel_type.rb +2 -2
  111. data/lib/earth/residence/residential_energy_consumption_survey_response.rb +3 -3
  112. data/lib/earth/residence/residential_energy_consumption_survey_response/data_miner.rb +0 -5
  113. data/lib/earth/residence/urbanity.rb +2 -2
  114. data/lib/earth/shipping/carrier.rb +3 -2
  115. data/lib/earth/shipping/carrier/data_miner.rb +1 -0
  116. data/lib/earth/shipping/carrier_mode.rb +2 -2
  117. data/lib/earth/shipping/shipment_mode.rb +2 -2
  118. data/lib/earth/version.rb +1 -1
  119. data/spec/earth/air/aircraft_spec.rb +421 -0
  120. data/spec/earth/fuel/fuel_spec.rb +35 -0
  121. data/spec/earth/hospitality/lodging_fuel_use_equation_spec.rb +96 -0
  122. data/spec/earth/industry/cbecs_energy_intensity_spec.rb +102 -0
  123. data/spec/earth/industry/mecs_energy_spec.rb +36 -44
  124. data/spec/earth/industry/mecs_ratio_spec.rb +24 -17
  125. data/spec/earth/locality/country_spec.rb +0 -9
  126. data/spec/spec_helper.rb +8 -3
  127. data/spec/support/integration.rb +17 -0
  128. data/vendor/geokit-rails/init.rb +2 -1
  129. data/vendor/geokit-rails/lib/geokit-rails.rb +1 -0
  130. metadata +63 -36
  131. data/lib/earth/hospitality/lodging_fuel_use_equation.rb +0 -26
  132. data/lib/earth/hospitality/lodging_fuel_use_equation/data_miner.rb +0 -20
  133. data/test/test_aircraft_match.rb +0 -732
@@ -1,6 +1,6 @@
1
1
  require 'earth/fuel'
2
2
  class RailFuel < ActiveRecord::Base
3
- set_primary_key :name
3
+ self.primary_key = "name"
4
4
 
5
5
  belongs_to :fuel, :foreign_key => 'fuel_name'
6
6
 
@@ -1,5 +1,5 @@
1
1
  class RailTraction < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  col :name
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class AirConditionerUse < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :residential_energy_consumption_survey_responses
5
5
 
@@ -9,4 +9,4 @@ class AirConditionerUse < ActiveRecord::Base
9
9
  col :name
10
10
  col :fugitive_emission, :type => :float
11
11
  col :fugitive_emission_units
12
- end
12
+ end
@@ -1,9 +1,9 @@
1
1
  class ClothesMachineUse < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :residential_energy_consumption_survey_responses
5
5
 
6
6
  col :name
7
7
  col :annual_energy_from_electricity_for_clothes_driers, :type => :float
8
8
  col :annual_energy_from_electricity_for_clothes_driers_units
9
- end
9
+ end
@@ -1,9 +1,9 @@
1
1
  class DishwasherUse < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :residential_energy_consumption_survey_responses
5
5
 
6
6
  col :name
7
7
  col :annual_energy_from_electricity_for_dishwashers, :type => :float
8
8
  col :annual_energy_from_electricity_for_dishwashers_units
9
- end
9
+ end
@@ -1,5 +1,5 @@
1
1
  class ResidenceAppliance < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  class << self
5
5
  def annual_energy_from_electricity_for(appliance_plural)
@@ -13,4 +13,4 @@ class ResidenceAppliance < ActiveRecord::Base
13
13
  col :name
14
14
  col :annual_energy_from_electricity, :type => :float
15
15
  col :annual_energy_from_electricity_units
16
- end
16
+ end
@@ -1,5 +1,5 @@
1
1
  class ResidenceClass < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :residential_energy_consumption_survey_responses
5
5
 
@@ -10,4 +10,4 @@ class ResidenceClass < ActiveRecord::Base
10
10
  end
11
11
 
12
12
  col :name
13
- end
13
+ end
@@ -1,6 +1,6 @@
1
1
  require 'earth/locality'
2
2
  class ResidenceFuelPrice < ActiveRecord::Base
3
- set_primary_key :row_hash
3
+ self.primary_key = "row_hash"
4
4
 
5
5
  extend CohortScope
6
6
  self.minimum_cohort_size = 5 # ? FIXME
@@ -19,4 +19,4 @@ class ResidenceFuelPrice < ActiveRecord::Base
19
19
  col :locatable_type
20
20
  add_index [:price, :residence_fuel_type_name, :month, :year, :locatable_type, :locatable_id]
21
21
  add_index [:price, :residence_fuel_type_name]
22
- end
22
+ end
@@ -110,11 +110,6 @@ ResidenceFuelPrice.class_eval do
110
110
  # Skipping {"locatable_id"=>"Alabama", "locatable_type"=>"State", "price"=>"2.75", "year"=>1990, "month"=>6, "row_hash"=>"d56480d06e32e7e99ba5f85444fe4827"} because there's no primary key
111
111
 
112
112
  data_miner do
113
- process "Define some unit conversions" do
114
- Conversions.register :dollars, :cents, 100
115
- Conversions.register :cubic_feet, :cubic_metres, 0.0283168466 # TODO conversions gem has 'cubic_metres'
116
- end
117
-
118
113
  # electricity in dollars per kWh
119
114
  import 'residential electricity prices from the EIA',
120
115
  :url => 'http://www.eia.doe.gov/cneaf/electricity/page/sales_revenue.xls',
@@ -1,5 +1,5 @@
1
1
  class ResidenceFuelType < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :prices, :class_name => 'ResidenceFuelPrice', :foreign_key => 'residence_fuel_type_name'
5
5
 
@@ -34,4 +34,4 @@ class ResidenceFuelType < ActiveRecord::Base
34
34
  find_by_name fuel.to_s.humanize.downcase
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -1,7 +1,7 @@
1
1
  require 'earth/locality'
2
2
  class ResidentialEnergyConsumptionSurveyResponse < ActiveRecord::Base
3
- set_primary_key :id
4
- set_table_name :recs_responses
3
+ self.primary_key = "id"
4
+ self.table_name = :recs_responses
5
5
 
6
6
  belongs_to :census_division, :foreign_key => 'census_division_number'
7
7
  belongs_to :census_region, :foreign_key => 'census_region_number'
@@ -122,4 +122,4 @@ class ResidentialEnergyConsumptionSurveyResponse < ActiveRecord::Base
122
122
  col :urbanity_id
123
123
  col :weighting, :type => :float
124
124
  col :window_ac_use
125
- end
125
+ end
@@ -1,11 +1,6 @@
1
1
  require 'earth/locality/data_miner'
2
2
  ResidentialEnergyConsumptionSurveyResponse.class_eval do
3
3
  data_miner do
4
- process "Define some unit conversions" do
5
- Conversions.register :kbtus, :joules, 1_000.0 * 1_055.05585
6
- Conversions.register :square_feet, :square_metres, 0.09290304
7
- end
8
-
9
4
  # conversions are NOT performed here, since we first have to zero out legitimate skips
10
5
  # otherwise you will get values like "999 pounds = 453.138778 kilograms" (where 999 is really a legit skip)
11
6
  import 'the 2005 EIA Residential Energy Consumption Survey microdata',
@@ -1,7 +1,7 @@
1
1
  class Urbanity < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :residential_energy_consumption_survey_responses
5
5
 
6
6
  col :name
7
- end
7
+ end
@@ -1,5 +1,5 @@
1
1
  class Carrier < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :carrier_modes, :foreign_key => 'carrier_name', :primary_key => 'name'
5
5
 
@@ -9,6 +9,7 @@ class Carrier < ActiveRecord::Base
9
9
  :corporate_emission_factor => 0.221
10
10
 
11
11
  col :name
12
+ col :full_name
12
13
  col :package_volume, :type => :float
13
14
  col :route_inefficiency_factor, :type => :float
14
15
  col :transport_emission_factor, :type => :float
@@ -64,4 +65,4 @@ class Carrier < ActiveRecord::Base
64
65
  # end
65
66
  # end
66
67
 
67
- end
68
+ end
@@ -3,6 +3,7 @@ Carrier.class_eval do
3
3
  import "a list of shipping companies and their characteristics",
4
4
  :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdG1ONU1HZDdZTFJNclFYVkRzR0k5Z2c&hl=en&gid=0&output=csv' do
5
5
  key 'name'
6
+ store 'full_name'
6
7
  store 'package_volume'
7
8
  store 'route_inefficiency_factor'
8
9
  store 'transport_emission_factor', :units_field_name => 'transport_emission_factor_units'
@@ -1,5 +1,5 @@
1
1
  class CarrierMode < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  belongs_to :carrier, :foreign_key => 'carrier_name', :primary_key => 'name'
5
5
  belongs_to :mode, :foreign_key => 'mode_name', :primary_key => 'name', :class_name => 'ShipmentMode'
@@ -44,4 +44,4 @@ class CarrierMode < ActiveRecord::Base
44
44
  # end
45
45
  # end
46
46
  # end
47
- end
47
+ end
@@ -1,5 +1,5 @@
1
1
  class ShipmentMode < ActiveRecord::Base
2
- set_primary_key :name
2
+ self.primary_key = "name"
3
3
 
4
4
  has_many :carrier_modes, :foreign_key => 'mode_name', :primary_key => 'name'
5
5
 
@@ -32,4 +32,4 @@ class ShipmentMode < ActiveRecord::Base
32
32
  # end
33
33
  # end
34
34
 
35
- end
35
+ end
data/lib/earth/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Earth
2
- VERSION = "0.11.10"
2
+ VERSION = "0.11.11"
3
3
  end
@@ -11,4 +11,425 @@ describe Aircraft do
11
11
  Aircraft.where(:brighter_planet_aircraft_class_code => nil).should_not be_empty
12
12
  end
13
13
  end
14
+
15
+ # describe 'fuzzy matching' do
16
+ # it 'should match some example aircraft properly' do
17
+ # user_input = "Boeing 727-100RE"
18
+ # assert_equal ["R721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
19
+ #
20
+ # user_input = "Boeing 727 200RE"
21
+ # assert_equal ["R722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
22
+ #
23
+ # user_input = "Boeing 747400 domestic"
24
+ # assert_equal ["B74D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
25
+ #
26
+ # user_input = "Boeing 777-200lr"
27
+ # assert_equal ["B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
28
+ #
29
+ # user_input = "Boeing 707-100"
30
+ # assert_equal ["B701"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
31
+ #
32
+ # user_input = "Boeing 707-200"
33
+ # assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
34
+ #
35
+ # user_input = "Boeing 717-200"
36
+ # assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
37
+ #
38
+ # user_input = "Boeing 717-100"
39
+ # assert_equal ["B712"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
40
+ #
41
+ # user_input = "Boeing 727-100"
42
+ # assert_equal ["B721"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
43
+ #
44
+ # user_input = "Boeing 727-300"
45
+ # assert_equal ["B721", "B722"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
46
+ #
47
+ # user_input = "Boeing 737-900"
48
+ # assert_equal ["B739"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
49
+ #
50
+ # user_input = "Boeing 747-100"
51
+ # assert_equal ["B741"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
52
+ #
53
+ # user_input = "Boeing 747-500"
54
+ # assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code).sort
55
+ #
56
+ # user_input = "Boeing 757-200"
57
+ # assert_equal ["B752"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
58
+ #
59
+ # user_input = "Boeing 757-100"
60
+ # assert_equal ["B752", "B753"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
61
+ #
62
+ # user_input = "Boeing 767-200"
63
+ # assert_equal ["B762"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
64
+ #
65
+ # user_input = "Boeing 767-100"
66
+ # assert_equal ["B762", "B763", "B764"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
67
+ #
68
+ # user_input = "Boeing 777-200"
69
+ # assert_equal ["B772", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
70
+ #
71
+ # user_input = "Boeing 777-100"
72
+ # assert_equal ["B772", "B773", "B77L"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
73
+ #
74
+ # user_input = "Boeing 727 Stage 3"
75
+ # assert_equal ["B72Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
76
+ #
77
+ # user_input = "Boeing 737 Stage 3"
78
+ # assert_equal ["B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
79
+ #
80
+ # user_input = "Boeing 737 Stage 4"
81
+ # assert_equal ["B731", "B732", "B733", "B734", "B735", "B736", "B737", "B738", "B739", "B73Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code).sort
82
+ #
83
+ # user_input = "Boeing 747SP"
84
+ # assert_equal ["B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
85
+ #
86
+ # user_input = "Boeing 747 SR"
87
+ # assert_equal ["B74R"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
88
+ #
89
+ # user_input = "Boeing 747SCA"
90
+ # assert_equal ["BSCA"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
91
+ #
92
+ # user_input = "Boeing 747S"
93
+ # assert_equal ["B741", "B742", "B743", "B744", "B74D", "B74R", "B74S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code).sort
94
+ #
95
+ # user_input = "Boeing 720"
96
+ # assert_equal ["B720"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
97
+ #
98
+ # user_input = "Boeing 707"
99
+ # assert_equal ["B701", "B703"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
100
+ #
101
+ # user_input = "Boeing 787"
102
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
103
+ #
104
+ # user_input = "Airbus A300600"
105
+ # assert_equal ["A306"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
106
+ #
107
+ # user_input = "Airbus A300 100"
108
+ # assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
109
+ #
110
+ # user_input = "Airbus A300-600st"
111
+ # assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
112
+ #
113
+ # user_input = "Airbus Beluga"
114
+ # assert_equal ["A3ST"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
115
+ #
116
+ # user_input = "Airbus A330-200"
117
+ # assert_equal ["A332"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
118
+ #
119
+ # user_input = "Airbus A330-100"
120
+ # assert_equal ["A332", "A333"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
121
+ #
122
+ # user_input = "Airbus A340-200"
123
+ # assert_equal ["A342"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
124
+ #
125
+ # user_input = "Airbus A340-100"
126
+ # assert_equal ["A342", "A343", "A345", "A346"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
127
+ #
128
+ # user_input = "Airbus A380-800"
129
+ # assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
130
+ #
131
+ # user_input = "Airbus A380-100"
132
+ # assert_equal ["A388"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
133
+ #
134
+ # user_input = "Airbus A300C"
135
+ # assert_equal ["A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
136
+ #
137
+ # user_input = "Airbus A300X"
138
+ # assert_equal ["A306", "A30B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
139
+ #
140
+ # user_input = "Airbus A318"
141
+ # assert_equal ["A318"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
142
+ #
143
+ # user_input = "Airbus A311"
144
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
145
+ #
146
+ # user_input = "Airbus A321"
147
+ # assert_equal ["A321"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
148
+ #
149
+ # user_input = "Airbus A322"
150
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
151
+ #
152
+ # user_input = "Airbus A350"
153
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
154
+ #
155
+ # user_input = "Canadair CL601"
156
+ # assert_equal ["CL60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
157
+ #
158
+ # user_input = "Canadair CL215"
159
+ # assert_equal ["CL2P"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
160
+ #
161
+ # user_input = "Canadair CL215 turbine"
162
+ # assert_equal ["CL2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
163
+ #
164
+ # user_input = "Canadair CL44O"
165
+ # assert_equal ["CL4G"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
166
+ #
167
+ # user_input = "Canadair CRJ440"
168
+ # assert_equal ["CRJ2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
169
+ #
170
+ # user_input = "Canadair CRJ111"
171
+ # assert_equal ["CRJ1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
172
+ #
173
+ # user_input = "Embraer ERJ130"
174
+ # assert_equal ["E135"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
175
+ #
176
+ # user_input = "Embraer ERJ145XR"
177
+ # assert_equal ["E45X"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
178
+ #
179
+ # user_input = "Embraer EMB110"
180
+ # assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
181
+ #
182
+ # user_input = "Embraer Bandeirante"
183
+ # assert_equal ["E110"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
184
+ #
185
+ # user_input = "Embraer EMB120"
186
+ # assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
187
+ #
188
+ # user_input = "Embraer Brasilia"
189
+ # assert_equal ["E120"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
190
+ #
191
+ # user_input = "Embraer EMB121"
192
+ # assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
193
+ #
194
+ # user_input = "Embraer Xingu"
195
+ # assert_equal ["E121"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
196
+ #
197
+ # user_input = "Embraer EMB201"
198
+ # assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
199
+ #
200
+ # user_input = "Embraer Ipanema"
201
+ # assert_equal ["IPAN"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
202
+ #
203
+ # user_input = "McDonnell Douglas DC3"
204
+ # assert_equal ["DC3", "DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
205
+ #
206
+ # user_input = "McDonnell Douglas DC3S"
207
+ # assert_equal ["DC3S"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
208
+ #
209
+ # user_input = "McDonnell Douglas DC8-50"
210
+ # assert_equal ["DC85"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
211
+ #
212
+ # user_input = "McDonnell Douglas DC8-40"
213
+ # assert_equal ["DC85", "DC86", "DC87", "DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
214
+ #
215
+ # user_input = "McDonnell Douglas DC8 Stage 3"
216
+ # assert_equal ["DC8Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
217
+ #
218
+ # user_input = "McDonnell Douglas DC9-10"
219
+ # assert_equal ["DC91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
220
+ #
221
+ # user_input = "McDonnell Douglas DC9-60"
222
+ # assert_equal ["DC91", "DC92", "DC93", "DC94", "DC95", "DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
223
+ #
224
+ # user_input = "McDonnell Douglas DC9 Stage 3"
225
+ # assert_equal ["DC9Q"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
226
+ #
227
+ # user_input = "McDonnell Douglas DC10-10"
228
+ # assert_equal ["DC10"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
229
+ #
230
+ # user_input = "McDonnell Douglas DC4"
231
+ # assert_equal ["DC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
232
+ #
233
+ # user_input = "McDonnell Douglas DC5"
234
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
235
+ #
236
+ # user_input = "McDonnell Douglas MD81"
237
+ # assert_equal ["MD81"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
238
+ #
239
+ # user_input = "McDonnell Douglas MD84"
240
+ # assert_equal ["MD81", "MD82", "MD83", "MD87", "MD88"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
241
+ #
242
+ # user_input = "McDonnell Douglas MD11"
243
+ # assert_equal ["MD11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
244
+ #
245
+ # user_input = "McDonnell Douglas MD90"
246
+ # assert_equal ["MD90"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
247
+ #
248
+ # user_input = "McDonnell Douglas C133"
249
+ # assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
250
+ #
251
+ # user_input = "McDonnell Douglas Cargomaster"
252
+ # assert_equal ["C133"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
253
+ #
254
+ # user_input = "de Havilland DHC8-100"
255
+ # assert_equal ["DH8A"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
256
+ #
257
+ # user_input = "de Havilland DHC8-500"
258
+ # assert_equal ["DH8A", "DH8B", "DH8C", "DH8D"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
259
+ #
260
+ # user_input = "de Havilland DHC1"
261
+ # assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
262
+ #
263
+ # user_input = "de Havilland Chipmunk"
264
+ # assert_equal ["DHC1"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
265
+ #
266
+ # user_input = "de Havilland DHC2 mk1"
267
+ # assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
268
+ #
269
+ # user_input = "de Havilland DHC2 mk3"
270
+ # assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
271
+ #
272
+ # user_input = "de Havilland Beaver"
273
+ # assert_equal ["DHC2"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
274
+ #
275
+ # user_input = "de Havilland Turbo Beaver"
276
+ # assert_equal ["DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
277
+ #
278
+ # user_input = "de Havilland DHC2"
279
+ # assert_equal ["DHC2", "DH2T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
280
+ #
281
+ # user_input = "de Havilland DHC3"
282
+ # assert_equal ["DHC3", "DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
283
+ #
284
+ # user_input = "de Havilland Otter"
285
+ # assert_equal ["DHC3"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
286
+ #
287
+ # user_input = "de Havilland Turbo Otter"
288
+ # assert_equal ["DH3T"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
289
+ #
290
+ # user_input = "de Havilland DHC4"
291
+ # assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
292
+ #
293
+ # user_input = "de Havilland Caribou"
294
+ # assert_equal ["DHC4"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
295
+ #
296
+ # user_input = "de Havilland DHC5"
297
+ # assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
298
+ #
299
+ # user_input = "de Havilland Buffalo"
300
+ # assert_equal ["DHC5"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
301
+ #
302
+ # user_input = "de Havilland DHC6"
303
+ # assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
304
+ #
305
+ # user_input = "de Havilland Twin"
306
+ # assert_equal ["DHC6"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
307
+ #
308
+ # user_input = "de Havilland DHC7"
309
+ # assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
310
+ #
311
+ # user_input = "de Havilland Dash 7"
312
+ # assert_equal ["DHC7"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
313
+ #
314
+ # user_input = "aerospatiale atr42"
315
+ # assert_equal ["AT43", "AT44", "AT45"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
316
+ #
317
+ # user_input = "aerospatiale atr72"
318
+ # assert_equal ["AT72"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
319
+ #
320
+ # user_input = "bae bae 146 100"
321
+ # assert_equal ["B461"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
322
+ #
323
+ # user_input = "bae bae146-400"
324
+ # assert_equal ["B461", "B462", "B463"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
325
+ #
326
+ # user_input = "bae jetstream 32"
327
+ # assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
328
+ #
329
+ # user_input = "bae jetstream super 31"
330
+ # assert_equal ["JS32"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
331
+ #
332
+ # user_input = "bae jetstream 31"
333
+ # assert_equal ["JS31"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
334
+ #
335
+ # user_input = "bae jetstream 41"
336
+ # assert_equal ["JS41"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
337
+ #
338
+ # user_input = "bae atp"
339
+ # assert_equal ["atp"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
340
+ #
341
+ # user_input = "bae bac one-eleven"
342
+ # assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
343
+ #
344
+ # user_input = "bae bac111"
345
+ # assert_equal ["BA11"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
346
+ #
347
+ # user_input = "bae bae125-1000"
348
+ # assert_equal ["H25C"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
349
+ #
350
+ # user_input = "bae bae125-70"
351
+ # assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
352
+ #
353
+ # user_input = "bae bae125-75"
354
+ # assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
355
+ #
356
+ # user_input = "bae bae125-80"
357
+ # assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
358
+ #
359
+ # user_input = "bae bae125-85"
360
+ # assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
361
+ #
362
+ # user_input = "bae bae125-90"
363
+ # assert_equal ["H25B"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
364
+ #
365
+ # user_input = "bae bae125-95"
366
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
367
+ #
368
+ # user_input = "bae bae125"
369
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
370
+ #
371
+ # user_input = "fokker 50"
372
+ # assert_equal ["F50"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
373
+ #
374
+ # user_input = "fokker 61"
375
+ # assert_equal ["F60"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
376
+ #
377
+ # user_input = "fokker 72"
378
+ # assert_equal ["F70"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
379
+ #
380
+ # user_input = "fokker 103"
381
+ # assert_equal ["F100"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
382
+ #
383
+ # user_input = "fokker 80"
384
+ # assert_equal [], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
385
+ #
386
+ # user_input = "fokker F27"
387
+ # assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
388
+ #
389
+ # user_input = "fokker Friendship"
390
+ # assert_equal ["F27"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
391
+ #
392
+ # user_input = "fokker F28"
393
+ # assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
394
+ #
395
+ # user_input = "fokker Fellowship"
396
+ # assert_equal ["F28"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
397
+ #
398
+ # user_input = "fokker super"
399
+ # assert_equal ["SUNV"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
400
+ #
401
+ # user_input = "saab 2000"
402
+ # assert_equal ["SB20"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
403
+ #
404
+ # user_input = "saab 340"
405
+ # assert_equal ["SF34"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
406
+ #
407
+ # user_input = "saab 91"
408
+ # assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
409
+ #
410
+ # user_input = "saab safir"
411
+ # assert_equal ["SB91"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
412
+ #
413
+ # user_input = "hawker beechcraft 1900"
414
+ # assert_equal ["B190"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
415
+ #
416
+ # user_input = "cessna 401"
417
+ # assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
418
+ #
419
+ # user_input = "cessna 402"
420
+ # assert_equal ["C402"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
421
+ #
422
+ # user_input = "cessna 208"
423
+ # assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
424
+ #
425
+ # user_input = "cessna caravan"
426
+ # assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
427
+ #
428
+ # user_input = "cessna cargomaster"
429
+ # assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
430
+ #
431
+ # user_input = "cessna grand caravan"
432
+ # assert_equal ["C208"], Aircraft.fuzzy_match.find_all(user_input).map(&:icao_code)
433
+ # end
434
+ # end
14
435
  end