Sha256: 26a15f0a5ca154fbb64e901e020ea5a4593c6ce1f1ee592294ba728eca3f152e

Contents?: true

Size: 968 Bytes

Versions: 9

Compression:

Stored size: 968 Bytes

Contents

require 'cohort_analysis'
DishwasherUse.class_eval do
  data_miner do
    process "Ensure ResidentialEnergyConsumptionSurveyResponse is populated" do
      ResidentialEnergyConsumptionSurveyResponse.run_data_miner!
    end
    
    process "Derive from ResidentialEnergyConsumptionSurveyResponse" do
      ::Earth::Utils.insert_ignore(
        :src => ResidentialEnergyConsumptionSurveyResponse,
        :dest => DishwasherUse,
        :cols => { :dishwasher_use_id => :name }
      )
    end
    
    # sabshere 5/25/10 weird that this uses cohort
    process "precalculate annual energy" do
      safe_find_each do |record|
        record.annual_energy_from_electricity_for_dishwashers = ResidentialEnergyConsumptionSurveyResponse.cohort(:dishwasher_use_id => record.name).weighted_average :annual_energy_from_electricity_for_dishwashers
        record.annual_energy_from_electricity_for_dishwashers_units = 'joules'
        record.save!
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.1.2 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.1.1 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.1.0 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.0.3 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.0.2 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.0.1 lib/earth/residence/dishwasher_use/data_miner.rb
earth-1.0.0 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.12.4 lib/earth/residence/dishwasher_use/data_miner.rb