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.0.33 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.32 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.31 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.30 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.29 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.28 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.27 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.26 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.24 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.23 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.22 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.21 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.20 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.19 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb
earth-0.0.18 lib/earth/automobile/automobile_make_fleet_year/data_miner.rb