Sha256: 16e40733d14c67513b75a8e5b1c858e6d0cad7bacfe96181ac3417fe1d0547fe

Contents?: true

Size: 1.19 KB

Versions: 42

Compression:

Stored size: 1.19 KB

Contents

ShipmentMode.class_eval do
  data_miner do
    import "a list of shipment modes and their characteristics",
           :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdGR2a2RYcEg2RnRKbkRQcXc0ZkQ5U0E&hl=en&gid=0&output=csv' do
      key   'name'
      store 'route_inefficiency_factor'
      store 'transport_emission_factor', :units_field_name => 'transport_emission_factor_units'
    end
    
    # TODO: derive route inefficiency factor and transport emission factor
    # process "derive route inefficiency factor and transport emission factor from CarrierModes" do
    #   CarrierMode.run_data_miner!
    #   
    #   carrier_modes = CarrierMode.arel_table
    #   modes = ShipmentMode.arel_table
    #   
    #   update_all "route_inefficiency_factor = (#{CarrierMode.weighted_average_relation(:route_inefficiency_factor, :weighted_by => :package_volume).where(modes[:name].eq(carrier_modes[:mode_name])).to_sql})"
    #   update_all "transport_emission_factor = (#{CarrierMode.weighted_average_relation(:transport_emission_factor, :weighted_by => :package_volume).where(modes[:name].eq(carrier_modes[:mode_name])).to_sql})"
    #   what about transport_emission_factor_units?
    # end
    
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.1.2 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.1.1 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.1.0 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.0.3 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.0.2 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.0.1 lib/earth/shipping/shipment_mode/data_miner.rb
earth-1.0.0 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.12.4 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.12.3 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.12.2 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.12.1 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.12.0 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.20 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.19 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.18 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.17 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.16 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.15 lib/earth/shipping/shipment_mode/data_miner.rb
earth-0.11.14 lib/earth/shipping/shipment_mode/data_miner.rb