Sha256: 1c70dd75ceec0e9021e2d5926f1bd84b670020dd81222d312b46118e667ff566

Contents?: true

Size: 924 Bytes

Versions: 8

Compression:

Stored size: 924 Bytes

Contents

AutomobileMakeYearFleet.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_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.11.7 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.6 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.5 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.4 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.3 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.2 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.1 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-0.11.0 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb