Sha256: 2cb899bd18c908582b76c886c1cd5d2f1f45fdad1fe05990a69436b81e409b99

Contents?: true

Size: 1.35 KB

Versions: 55

Compression:

Stored size: 1.35 KB

Contents

AutomobileMakeFleetYear.class_eval do
  data_miner do
    schema Earth.database_options do
      string   'name'
      string   'make_year_name'
      string   'make_name'
      string   'fleet'
      integer  'year'
      float    'fuel_efficiency'
      string   'fuel_efficiency_units'
      integer  'volume'
    end

    # CAFE data privately emailed to Andy from Terry Anderson at the DOT/NHTSA
    import "annual corporate average fuel economy data for domestic and imported vehicle fleets from the NHTSA",
           :url => 'http://static.brighterplanet.com/science/data/transport/automobiles/make_fleet_years/make_fleet_years.csv',
           :errata => 'http://static.brighterplanet.com/science/data/transport/automobiles/make_fleet_years/errata.csv',
           :select => lambda { |row| row['volume'].to_i > 0 } do
      key   'name', :synthesize => lambda { |row| [ row['manufacturer_name'], row['year_content'], row['fleet'][2,2] ].join ' ' }
      store 'make_year_name', :synthesize => lambda { |row| [ row['manufacturer_name'], row['year_content'] ].join ' ' }
      store 'make_name', :field_name => 'manufacturer_name'
      store 'year', :field_name => 'year_content'
      store 'fleet', :chars => 2..3 # zero-based
      store 'fuel_efficiency', :from_units => :miles_per_gallon, :to_units => :kilometres_per_litre
      store 'volume'
    end
  end
end

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
earth-0.3.9 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.8 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.7 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.6 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.5 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.4 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.3 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.2 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.1 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.3.0 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.14 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.13 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.12 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.11 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.9 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.8 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.7 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.6 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.5 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.2.4 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb