Sha256: 5af764012c5c19f8ab6afad3c63050129d4a963ecb78871f6e1114c169d96a91

Contents?: true

Size: 1.17 KB

Versions: 29

Compression:

Stored size: 1.17 KB

Contents

DishwasherUse.class_eval do
  data_miner do
    schema do
      string 'name'
      float 'annual_energy_from_electricity_for_dishwashers'
      string 'annual_energy_from_electricity_for_dishwashers_units'
    end
    
    process "derive from ResidentialEnergyConsumptionSurveyResponse" do
      ResidentialEnergyConsumptionSurveyResponse.run_data_miner!
      connection.execute %{
        INSERT IGNORE INTO dishwasher_uses(name)
        SELECT DISTINCT residential_energy_consumption_survey_responses.dishwasher_use_id FROM residential_energy_consumption_survey_responses WHERE LENGTH(residential_energy_consumption_survey_responses.dishwasher_use_id) > 0
      }
    end
    
    # sabshere 5/25/10 weird that this uses cohort
    process "precalculate annual energy" do
      find_in_batches do |batch|
        batch.each do |record|
          record.annual_energy_from_electricity_for_dishwashers = ResidentialEnergyConsumptionSurveyResponse.big_cohort(:dishwasher_use => record).weighted_average :annual_energy_from_electricity_for_dishwashers
          record.annual_energy_from_electricity_for_dishwashers_units = 'joules'
          record.save!
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
earth-0.3.11 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.10 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.9 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.8 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.7 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.6 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.5 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.4 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.3 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.2 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.1 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.3.0 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.14 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.13 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.12 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.11 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.9 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.8 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.7 lib/earth/residence/dishwasher_use/data_miner.rb
earth-0.2.6 lib/earth/residence/dishwasher_use/data_miner.rb