Sha256: e053264678cbdc4c2049f752fe4ef382aaba7900f2b2b61a02e477172a9c2214

Contents?: true

Size: 720 Bytes

Versions: 37

Compression:

Stored size: 720 Bytes

Contents

ResidenceAppliance.class_eval do
  data_miner do
    process "Ensure ResidentialEnergyConsumptionSurveyResponse is populated" do
      ResidentialEnergyConsumptionSurveyResponse.run_data_miner!
    end
    
    process "Derive from ResidentialEnergyConsumptionSurveyResponse" do
      ResidentialEnergyConsumptionSurveyResponse.column_names.grep(/_count$/).each do |column_name|
        appliance_name = column_name.sub '_count', ''
        appliance = find_or_create_by_name appliance_name
        appliance.annual_energy_from_electricity = ResidentialEnergyConsumptionSurveyResponse.weighted_average "annual_energy_from_electricity_for_#{appliance_name.pluralize}"
        appliance.save!
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.12.3 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.12.2 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.12.1 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.12.0 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.20 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.19 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.18 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.17 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.16 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.15 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.14 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.13 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.12 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.11 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.10 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.9 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.8 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.7 lib/earth/residence/residence_appliance/data_miner.rb
earth-0.11.6 lib/earth/residence/residence_appliance/data_miner.rb