Class: ViewModel::RdSapSchema200::CommonSchema
- Inherits:
-
DomesticEpcViewModel
- Object
- BaseViewModel
- DomesticEpcViewModel
- ViewModel::RdSapSchema200::CommonSchema
- Defined in:
- lib/view_model/rd_sap_schema_200/common_schema.rb
Instance Method Summary collapse
- #address_id ⇒ Object
- #address_line1 ⇒ Object
- #address_line2 ⇒ Object
- #address_line3 ⇒ Object
- #address_line4 ⇒ Object
- #all_building_parts ⇒ Object
- #all_floor_descriptions ⇒ Object
- #all_floor_energy_efficiency_rating ⇒ Object
- #all_floor_env_energy_efficiency_rating ⇒ Object
- #all_hot_water_descriptions ⇒ Object
- #all_lighting_descriptions ⇒ Object
- #all_main_heating_controls_descriptions ⇒ Object
- #all_main_heating_controls_energy_efficiency ⇒ Object
- #all_main_heating_controls_environmental_efficiency ⇒ Object
- #all_main_heating_descriptions ⇒ Object
- #all_main_heating_energy_efficiency ⇒ Object
- #all_main_heating_environmental_efficiency ⇒ Object
- #all_roof_descriptions ⇒ Object
- #all_roof_energy_efficiency_rating ⇒ Object
- #all_roof_env_energy_efficiency_rating ⇒ Object
- #all_sap_floor_dimensions ⇒ Object
- #all_secondary_heating_descriptions ⇒ Object
- #all_wall_descriptions ⇒ Object
- #all_wall_energy_efficiency_rating ⇒ Object
- #all_wall_env_energy_efficiency_rating ⇒ Object
- #all_window_descriptions ⇒ Object
- #assessment_id ⇒ Object
- #assessor_email ⇒ Object
- #assessor_name ⇒ Object
- #assessor_telephone ⇒ Object
- #boiler_flue_type ⇒ Object
- #building_part_number ⇒ Object
- #built_form ⇒ Object
- #co2_emissions_current_per_floor_area ⇒ Object
- #country_code ⇒ Object
- #current_carbon_emission ⇒ Object
- #current_energy_rating ⇒ Object
- #current_space_heating_demand ⇒ Object
- #current_water_heating_demand ⇒ Object
- #date_of_assessment ⇒ Object
- #date_of_completion ⇒ Object
- #date_of_expiry ⇒ Object
- #date_of_registration ⇒ Object
- #dwelling_type ⇒ Object
- #energy_consumption_potential ⇒ Object
- #energy_rating_current ⇒ Object
- #energy_rating_potential ⇒ Object
- #environmental_impact_current ⇒ Object
- #environmental_impact_potential ⇒ Object
- #estimated_energy_cost ⇒ Object
- #extensions_count ⇒ Object
- #fixed_lighting_outlets_count ⇒ Object
- #floor_heat_loss ⇒ Object
- #floor_height ⇒ Object
- #floor_level ⇒ Object
- #glazed_area ⇒ Object
- #habitable_room_count ⇒ Object
- #heat_loss_corridor ⇒ Object
- #heated_room_count ⇒ Object
- #heating_cost_current ⇒ Object
- #heating_cost_potential ⇒ Object
- #hot_water_cost_current ⇒ Object
- #hot_water_cost_potential ⇒ Object
- #hot_water_description ⇒ Object
- #hot_water_energy_efficiency_rating ⇒ Object
- #hot_water_environmental_efficiency_rating ⇒ Object
- #immersion_heating_type ⇒ Object
- #impact_of_cavity_insulation ⇒ Object
- #impact_of_loft_insulation ⇒ Object
- #impact_of_solid_wall_insulation ⇒ Object
- #improvements ⇒ Object
- #level ⇒ Object
- #lighting_cost_current ⇒ Object
- #lighting_cost_potential ⇒ Object
- #lighting_description ⇒ Object
- #lighting_energy_efficiency_rating ⇒ Object
- #lighting_environmental_efficiency_rating ⇒ Object
- #low_energy_fixed_lighting_outlets_count ⇒ Object
- #low_energy_lighting ⇒ Object
- #main_dwelling_construction_age_band_or_year ⇒ Object
- #main_fuel_type ⇒ Object
- #main_heating_category ⇒ Object
- #main_heating_controls ⇒ Object
- #mains_gas ⇒ Object
- #mechanical_ventilation ⇒ Object
- #meter_type ⇒ Object
- #multiple_glazed_proportion ⇒ Object
- #open_fireplaces_count ⇒ Object
- #photovoltaic_roof_area_percent ⇒ Object
- #postcode ⇒ Object
- #potential_carbon_emission ⇒ Object
- #potential_energy_rating ⇒ Object
- #potential_energy_saving ⇒ Object
- #primary_energy_use ⇒ Object
- #property_age_band ⇒ Object
- #property_summary ⇒ Object
- #recommendations_for_report ⇒ Object
- #related_party_disclosure_number ⇒ Object
- #related_party_disclosure_text ⇒ Object
- #report_type ⇒ Object
- #sap_main_heating_code ⇒ Object
- #scheme_assessor_id ⇒ Object
- #secondary_fuel_type ⇒ Object
- #secondary_heating_description ⇒ Object
- #secondary_heating_energy_efficiency_rating ⇒ Object
- #secondary_heating_environmental_efficiency_rating ⇒ Object
- #solar_water_heating_flag ⇒ Object
- #storey_count ⇒ Object
- #tenure ⇒ Object
- #top_storey ⇒ Object
- #total_floor_area ⇒ Object
- #town ⇒ Object
- #transaction_type ⇒ Object
- #unheated_corridor_length ⇒ Object
- #water_heating_code ⇒ Object
- #water_heating_fuel ⇒ Object
- #wind_turbine_count ⇒ Object
- #window_description ⇒ Object
- #window_energy_efficiency_rating ⇒ Object
- #window_environmental_efficiency_rating ⇒ Object
Methods inherited from DomesticEpcViewModel
#addendum, #improvement_title, #lzc_energy_sources, #multi_glazing_type, #property_type, #status
Methods inherited from BaseViewModel
Constructor Details
This class inherits a constructor from ViewModel::BaseViewModel
Instance Method Details
#address_id ⇒ Object
60 61 62 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 60 def address_id xpath(%w[UPRN]) end |
#address_line1 ⇒ Object
8 9 10 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 8 def address_line1 xpath(%w[Property Address Address-Line-1]) end |
#address_line2 ⇒ Object
12 13 14 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 12 def address_line2 xpath(%w[Property Address Address-Line-2]).to_s end |
#address_line3 ⇒ Object
16 17 18 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 16 def address_line3 xpath(%w[Property Address Address-Line-3]).to_s end |
#address_line4 ⇒ Object
20 21 22 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 20 def address_line4 xpath(%w[Property Address Address-Line-4]).to_s end |
#all_building_parts ⇒ Object
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 322 def all_building_parts @xml_doc .search("SAP-Building-Parts/SAP-Building-Part") .map do |part| { roof_insulation_thickness: if part.xpath("Roof-Insulation-Thickness").empty? nil else part.xpath("Roof-Insulation-Thickness").text end, rafter_insulation_thickness: xpath(%w[Rafter-Insulation-Thickness], part), flat_roof_insulation_thickness: xpath(%w[Flat-Roof-Insulation-Thickness], part), sloping_ceiling_insulation_thickness: xpath(%w[Sloping-Ceiling-Insulation-Thickness], part), roof_u_value: xpath(%w[Roof-U-Value], part), roof_room_connected: xpath(%w[Roof-Room-Connected], part), } end end |
#all_floor_descriptions ⇒ Object
533 534 535 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 533 def all_floor_descriptions @xml_doc.search("Property-Summary/Floor/Description").map(&:content) end |
#all_floor_energy_efficiency_rating ⇒ Object
537 538 539 540 541 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 537 def @xml_doc .search("Property-Summary/Floor/Energy-Efficiency-Rating") .map(&:content) end |
#all_floor_env_energy_efficiency_rating ⇒ Object
543 544 545 546 547 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 543 def @xml_doc .search("Property-Summary/Floor/Environmental-Efficiency-Rating") .map(&:content) end |
#all_hot_water_descriptions ⇒ Object
288 289 290 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 288 def all_hot_water_descriptions @xml_doc.search("Hot-Water/Description").map(&:content) end |
#all_lighting_descriptions ⇒ Object
292 293 294 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 292 def all_lighting_descriptions @xml_doc.search("Lighting/Description").map(&:content) end |
#all_main_heating_controls_descriptions ⇒ Object
274 275 276 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 274 def all_main_heating_controls_descriptions @xml_doc.search("Main-Heating-Controls/Description").map(&:content) end |
#all_main_heating_controls_energy_efficiency ⇒ Object
549 550 551 552 553 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 549 def all_main_heating_controls_energy_efficiency @xml_doc .search("Main-Heating-Controls/Energy-Efficiency-Rating") .map(&:content) end |
#all_main_heating_controls_environmental_efficiency ⇒ Object
555 556 557 558 559 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 555 def all_main_heating_controls_environmental_efficiency @xml_doc .search("Main-Heating-Controls/Environmental-Efficiency-Rating") .map(&:content) end |
#all_main_heating_descriptions ⇒ Object
270 271 272 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 270 def all_main_heating_descriptions @xml_doc.search("Main-Heating/Description").map(&:content) end |
#all_main_heating_energy_efficiency ⇒ Object
278 279 280 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 278 def all_main_heating_energy_efficiency @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content) end |
#all_main_heating_environmental_efficiency ⇒ Object
282 283 284 285 286 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 282 def all_main_heating_environmental_efficiency @xml_doc .search("Main-Heating/Environmental-Efficiency-Rating") .map(&:content) end |
#all_roof_descriptions ⇒ Object
254 255 256 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 254 def all_roof_descriptions @xml_doc.search("Roof/Description").map(&:content) end |
#all_roof_energy_efficiency_rating ⇒ Object
258 259 260 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 258 def @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content) end |
#all_roof_env_energy_efficiency_rating ⇒ Object
262 263 264 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 262 def @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content) end |
#all_sap_floor_dimensions ⇒ Object
300 301 302 303 304 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 300 def all_sap_floor_dimensions @xml_doc.search("SAP-Floor-Dimension").select(&:element?).map { |node| { total_floor_area: xpath(%w[Total-Floor-Area], node).to_f } }.compact end |
#all_secondary_heating_descriptions ⇒ Object
296 297 298 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 296 def all_secondary_heating_descriptions @xml_doc.search("Secondary-Heating/Description").map(&:content) end |
#all_wall_descriptions ⇒ Object
505 506 507 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 505 def all_wall_descriptions @xml_doc.search("Wall/Description").map(&:content) end |
#all_wall_energy_efficiency_rating ⇒ Object
509 510 511 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 509 def @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content) end |
#all_wall_env_energy_efficiency_rating ⇒ Object
513 514 515 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 513 def @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content) end |
#all_window_descriptions ⇒ Object
266 267 268 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 266 def all_window_descriptions @xml_doc.search("Window/Description").map(&:content) end |
#assessment_id ⇒ Object
4 5 6 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 4 def assessment_id xpath(%w[RRN]) end |
#assessor_email ⇒ Object
40 41 42 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 40 def assessor_email xpath(%w[Energy-Assessor E-Mail]) end |
#assessor_name ⇒ Object
36 37 38 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 36 def assessor_name xpath(%w[Energy-Assessor Name]) end |
#assessor_telephone ⇒ Object
44 45 46 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 44 def assessor_telephone xpath(%w[Energy-Assessor Telephone]) end |
#boiler_flue_type ⇒ Object
373 374 375 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 373 def boiler_flue_type xpath(%w[Boiler-Flue-Type]) end |
#building_part_number ⇒ Object
318 319 320 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 318 def building_part_number xpath(%w[Building-Part-Number]) end |
#built_form ⇒ Object
493 494 495 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 493 def built_form xpath(%w[Built-Form]) end |
#co2_emissions_current_per_floor_area ⇒ Object
389 390 391 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 389 def co2_emissions_current_per_floor_area xpath(%w[CO2-Emissions-Current-Per-Floor-Area]) end |
#country_code ⇒ Object
385 386 387 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 385 def country_code xpath(%w[Country-Code]) end |
#current_carbon_emission ⇒ Object
162 163 164 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 162 def current_carbon_emission xpath(%w[CO2-Emissions-Current]) end |
#current_energy_rating ⇒ Object
170 171 172 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 170 def xpath(%w[Energy-Rating-Current]).to_i end |
#current_space_heating_demand ⇒ Object
200 201 202 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 200 def current_space_heating_demand xpath(%w[Space-Heating-Existing-Dwelling]) end |
#current_water_heating_demand ⇒ Object
204 205 206 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 204 def current_water_heating_demand xpath(%w[Water-Heating]) end |
#date_of_assessment ⇒ Object
48 49 50 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 48 def date_of_assessment xpath(%w[Inspection-Date]) end |
#date_of_completion ⇒ Object
56 57 58 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 56 def date_of_completion xpath(%w[Completion-Date]) end |
#date_of_expiry ⇒ Object
64 65 66 67 68 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 64 def date_of_expiry expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10 expires_at.to_s end |
#date_of_registration ⇒ Object
52 53 54 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 52 def date_of_registration xpath(%w[Registration-Date]) end |
#dwelling_type ⇒ Object
182 183 184 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 182 def dwelling_type xpath(%w[Dwelling-Type]) end |
#energy_consumption_potential ⇒ Object
250 251 252 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 250 def energy_consumption_potential xpath(%w[Energy-Consumption-Potential]) end |
#energy_rating_current ⇒ Object
230 231 232 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 230 def xpath(%w[Energy-Rating-Current]) end |
#energy_rating_potential ⇒ Object
234 235 236 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 234 def xpath(%w[Energy-Rating-Potential]) end |
#environmental_impact_current ⇒ Object
238 239 240 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 238 def environmental_impact_current xpath(%w[Environmental-Impact-Current]) end |
#environmental_impact_potential ⇒ Object
242 243 244 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 242 def environmental_impact_potential xpath(%w[Environmental-Impact-Potential]) end |
#estimated_energy_cost ⇒ Object
174 175 176 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 174 def estimated_energy_cost xpath(%w[Estimated-Energy-Cost]) end |
#extensions_count ⇒ Object
497 498 499 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 497 def extensions_count xpath(%w[Extensions-Count]) end |
#fixed_lighting_outlets_count ⇒ Object
417 418 419 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 417 def fixed_lighting_outlets_count xpath(%w[Fixed-Lighting-Outlets-Count]) end |
#floor_heat_loss ⇒ Object
345 346 347 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 345 def floor_heat_loss xpath(%w[Floor-Heat-Loss]) end |
#floor_height ⇒ Object
529 530 531 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 529 def floor_height @xml_doc.search("Room-Height").map(&:content) end |
#floor_level ⇒ Object
517 518 519 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 517 def floor_level xpath(%w[Flat-Location]) end |
#glazed_area ⇒ Object
405 406 407 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 405 def glazed_area xpath(%w[Glazed-Area]) end |
#habitable_room_count ⇒ Object
226 227 228 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 226 def habitable_room_count xpath(%w[Habitable-Room-Count]) end |
#heat_loss_corridor ⇒ Object
445 446 447 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 445 def heat_loss_corridor xpath(%w[Heat-Loss-Corridor]) end |
#heated_room_count ⇒ Object
409 410 411 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 409 def heated_room_count xpath(%w[Heated-Room-Count]) end |
#heating_cost_current ⇒ Object
150 151 152 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 150 def heating_cost_current xpath(%w[Heating-Cost-Current]) end |
#heating_cost_potential ⇒ Object
138 139 140 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 138 def heating_cost_potential xpath(%w[Heating-Cost-Potential]) end |
#hot_water_cost_current ⇒ Object
146 147 148 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 146 def hot_water_cost_current xpath(%w[Hot-Water-Cost-Current]) end |
#hot_water_cost_potential ⇒ Object
134 135 136 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 134 def hot_water_cost_potential xpath(%w[Hot-Water-Cost-Potential]) end |
#hot_water_description ⇒ Object
429 430 431 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 429 def hot_water_description xpath(%w[Hot-Water Description]) end |
#hot_water_energy_efficiency_rating ⇒ Object
433 434 435 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 433 def xpath(%w[Hot-Water Energy-Efficiency-Rating]) end |
#hot_water_environmental_efficiency_rating ⇒ Object
437 438 439 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 437 def xpath(%w[Hot-Water Environmental-Efficiency-Rating]) end |
#immersion_heating_type ⇒ Object
353 354 355 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 353 def immersion_heating_type xpath(%w[Immersion-Heating-Type]) end |
#impact_of_cavity_insulation ⇒ Object
208 209 210 211 212 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 208 def impact_of_cavity_insulation if xpath(%w[Impact-Of-Cavity-Insulation]) xpath(%w[Impact-Of-Cavity-Insulation]).to_i end end |
#impact_of_loft_insulation ⇒ Object
214 215 216 217 218 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 214 def impact_of_loft_insulation if xpath(%w[Impact-Of-Loft-Insulation]) xpath(%w[Impact-Of-Loft-Insulation]).to_i end end |
#impact_of_solid_wall_insulation ⇒ Object
220 221 222 223 224 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 220 def impact_of_solid_wall_insulation if xpath(%w[Impact-Of-Solid-Wall-Insulation]) xpath(%w[Impact-Of-Solid-Wall-Insulation]).to_i end end |
#improvements ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 96 def improvements @xml_doc .search("Suggested-Improvements Improvement") .map do |node| { energy_performance_rating_improvement: xpath(%w[Energy-Performance-Rating], node).to_i, environmental_impact_rating_improvement: xpath(%w[Environmental-Impact-Rating], node).to_i, green_deal_category_code: xpath(%w[Green-Deal-Category], node), improvement_category: xpath(%w[Improvement-Category], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_title: improvement_title(node), improvement_type: xpath(%w[Improvement-Type], node), indicative_cost: xpath(%w[Indicative-Cost], node), sequence: xpath(%w[Sequence], node).to_i, typical_saving: xpath(%w[Typical-Saving], node), } end end |
#level ⇒ Object
306 307 308 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 306 def level xpath(%w[Level]) end |
#lighting_cost_current ⇒ Object
154 155 156 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 154 def lighting_cost_current xpath(%w[Lighting-Cost-Current]) end |
#lighting_cost_potential ⇒ Object
142 143 144 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 142 def lighting_cost_potential xpath(%w[Lighting-Cost-Potential]) end |
#lighting_description ⇒ Object
477 478 479 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 477 def lighting_description xpath(%w[Lighting Description]) end |
#lighting_energy_efficiency_rating ⇒ Object
481 482 483 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 481 def xpath(%w[Lighting Energy-Efficiency-Rating]) end |
#lighting_environmental_efficiency_rating ⇒ Object
485 486 487 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 485 def xpath(%w[Lighting Environmental-Efficiency-Rating]) end |
#low_energy_fixed_lighting_outlets_count ⇒ Object
421 422 423 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 421 def low_energy_fixed_lighting_outlets_count xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count]) end |
#low_energy_lighting ⇒ Object
413 414 415 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 413 def low_energy_lighting xpath(%w[Low-Energy-Lighting]) end |
#main_dwelling_construction_age_band_or_year ⇒ Object
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 561 def main_dwelling_construction_age_band_or_year sap_building_parts = @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part") sap_building_parts.each do |sap_building_part| building_part_number = sap_building_part.at("Building-Part-Number") # Identifies the Main Dwelling if building_part_number&.content == "1" return( sap_building_part.at_xpath( "Construction-Age-Band | Construction-Year", )&.content ) end end nil end |
#main_fuel_type ⇒ Object
361 362 363 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 361 def main_fuel_type xpath(%w[Main-Fuel-Type]) end |
#main_heating_category ⇒ Object
357 358 359 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 357 def main_heating_category xpath(%w[Main-Heating-Category]) end |
#main_heating_controls ⇒ Object
397 398 399 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 397 def main_heating_controls xpath(%w[Main-Heating-Controls Description]) end |
#mains_gas ⇒ Object
393 394 395 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 393 def mains_gas xpath(%w[Mains-Gas]) end |
#mechanical_ventilation ⇒ Object
525 526 527 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 525 def mechanical_ventilation xpath(%w[Mechanical-Ventilation]) end |
#meter_type ⇒ Object
377 378 379 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 377 def meter_type xpath(%w[Meter-Type]) end |
#multiple_glazed_proportion ⇒ Object
401 402 403 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 401 def multiple_glazed_proportion xpath(%w[Multiple-Glazed-Proportion]) end |
#open_fireplaces_count ⇒ Object
425 426 427 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 425 def open_fireplaces_count xpath(%w[Open-Fireplaces-Count]) end |
#photovoltaic_roof_area_percent ⇒ Object
489 490 491 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 489 def photovoltaic_roof_area_percent xpath(%w[Photovoltaic-Supply Percent-Roof-Area]) end |
#postcode ⇒ Object
28 29 30 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 28 def postcode xpath(%w[Property Address Postcode]) end |
#potential_carbon_emission ⇒ Object
158 159 160 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 158 def potential_carbon_emission xpath(%w[CO2-Emissions-Potential]) end |
#potential_energy_rating ⇒ Object
166 167 168 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 166 def xpath(%w[Energy-Rating-Potential]).to_i end |
#potential_energy_saving ⇒ Object
186 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 186 def potential_energy_saving; end |
#primary_energy_use ⇒ Object
246 247 248 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 246 def primary_energy_use xpath(%w[Energy-Consumption-Current]) end |
#property_age_band ⇒ Object
188 189 190 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 188 def property_age_band xpath(%w[Construction-Age-Band]) end |
#property_summary ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 70 def property_summary @xml_doc.search("Energy-Assessment Property-Summary").children.select( &:element? ).map { |node| next if xpath(%w[Energy-Efficiency-Rating], node).nil? { energy_efficiency_rating: xpath(%w[Energy-Efficiency-Rating], node).to_i, environmental_efficiency_rating: xpath(%w[Environmental-Efficiency-Rating], node).to_i, name: node.name.underscore, description: xpath(%w[Description], node), } }.compact end |
#recommendations_for_report ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 119 def recommendations_for_report @xml_doc .search("Suggested-Improvements Improvement") .map do |node| { sequence: xpath(%w[Sequence], node).to_i, improvement_summary: xpath(%w[Improvement-Summary], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), indicative_cost: xpath(%w[Indicative-Cost], node), } end end |
#related_party_disclosure_number ⇒ Object
91 92 93 94 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 91 def disclosure_number = xpath(%w[Related-Party-Disclosure-Number]) disclosure_number.nil? ? nil : disclosure_number.to_i end |
#related_party_disclosure_text ⇒ Object
87 88 89 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 87 def xpath(%w[Related-Party-Disclosure-Text]) end |
#report_type ⇒ Object
501 502 503 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 501 def report_type xpath(%w[Report-Type]) end |
#sap_main_heating_code ⇒ Object
381 382 383 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 381 def sap_main_heating_code xpath(%w[SAP-Main-Heating-Code]) end |
#scheme_assessor_id ⇒ Object
32 33 34 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 32 def scheme_assessor_id xpath(%w[Certificate-Number]) end |
#secondary_fuel_type ⇒ Object
365 366 367 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 365 def secondary_fuel_type xpath(%w[Secondary-Fuel-Type]) end |
#secondary_heating_description ⇒ Object
465 466 467 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 465 def secondary_heating_description xpath(%w[Secondary-Heating Description]) end |
#secondary_heating_energy_efficiency_rating ⇒ Object
469 470 471 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 469 def xpath(%w[Secondary-Heating Energy-Efficiency-Rating]) end |
#secondary_heating_environmental_efficiency_rating ⇒ Object
473 474 475 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 473 def xpath(%w[Secondary-Heating Environmental-Efficiency-Rating]) end |
#solar_water_heating_flag ⇒ Object
521 522 523 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 521 def solar_water_heating_flag xpath(%w[Solar-Water-Heating]) end |
#storey_count ⇒ Object
314 315 316 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 314 def storey_count xpath(%w[Storey-Count]) end |
#tenure ⇒ Object
192 193 194 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 192 def tenure xpath(%w[Tenure]) end |
#top_storey ⇒ Object
310 311 312 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 310 def top_storey xpath(%w[Top-Storey]) end |
#total_floor_area ⇒ Object
178 179 180 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 178 def total_floor_area xpath(%w[Property-Summary Total-Floor-Area]) end |
#town ⇒ Object
24 25 26 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 24 def town xpath(%w[Property Address Post-Town]) end |
#transaction_type ⇒ Object
196 197 198 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 196 def transaction_type xpath(%w[Transaction-Type]) end |
#unheated_corridor_length ⇒ Object
449 450 451 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 449 def unheated_corridor_length xpath(%w[Unheated-Corridor-Length]) end |
#water_heating_code ⇒ Object
349 350 351 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 349 def water_heating_code xpath(%w[Water-Heating-Code]) end |
#water_heating_fuel ⇒ Object
369 370 371 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 369 def water_heating_fuel xpath(%w[Water-Heating-Fuel]) end |
#wind_turbine_count ⇒ Object
441 442 443 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 441 def wind_turbine_count xpath(%w[Wind-Turbines-Count]) end |
#window_description ⇒ Object
453 454 455 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 453 def window_description xpath(%w[Window Description]) end |
#window_energy_efficiency_rating ⇒ Object
457 458 459 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 457 def xpath(%w[Window Energy-Efficiency-Rating]) end |
#window_environmental_efficiency_rating ⇒ Object
461 462 463 |
# File 'lib/view_model/rd_sap_schema_200/common_schema.rb', line 461 def xpath(%w[Window Environmental-Efficiency-Rating]) end |