Sha256: 5ff2f23b31aa43334c3822061565cc6c32e3d1c04f8a3359ac162081a613321e

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

AutomobileMakeFleetYear.class_eval do
  data_miner do
    import "annual corporate average fuel economy data for domestic and imported vehicle fleets from the NHTSA",
           :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdEdXWXB6dkVLWkowLXhYSFVUT01sS2c&hl=en&gid=0&output=csv',
           :errata => { 'url' => '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

8 entries across 8 versions & 1 rubygems

Version Path
earth-0.7.0 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.6 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.5 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.4 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.3 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.2 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.1 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.6.0 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb