Class: ViewModel::SapSchemaNi1800::CommonSchema
- Inherits:
-
DomesticEpcViewModel
- Object
- BaseViewModel
- DomesticEpcViewModel
- ViewModel::SapSchemaNi1800::CommonSchema
- Defined in:
- lib/view_model/sap_schema_ni_1800/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_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_wall_descriptions ⇒ Object
- #all_wall_energy_efficiency_rating ⇒ Object
- #all_wall_env_energy_efficiency_rating ⇒ 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
- #cylinder_insul_thickness ⇒ Object
- #cylinder_insulation_type ⇒ Object
- #cylinder_size ⇒ 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_tariff ⇒ Object
- #environmental_impact_current ⇒ Object
- #environmental_impact_potential ⇒ Object
- #estimated_energy_cost ⇒ Object
- #fixed_lighting_outlets_count ⇒ Object
- #floor_heat_loss ⇒ Object
- #floor_height ⇒ Object
- #floor_level ⇒ Object
- #has_cylinder_thermostat ⇒ 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
- #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_controls ⇒ Object
- #mech_vent_sys_index_number ⇒ Object
- #mechanical_vent_data_source ⇒ Object
- #meter_type ⇒ Object
- #open_fireplaces_count ⇒ 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
- #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
- #tenure ⇒ Object
- #thermal_store ⇒ Object
- #top_storey ⇒ Object
- #total_floor_area ⇒ Object
- #town ⇒ Object
- #transaction_type ⇒ Object
- #type_of_assessment ⇒ Object
- #ventilation_type ⇒ 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, #has_hot_water_cylinder, #improvement_title, #lzc_energy_sources, #main_heating_category, #multi_glazing_type, #property_type, #status, #water_heating_code
Methods inherited from BaseViewModel
Constructor Details
This class inherits a constructor from ViewModel::BaseViewModel
Instance Method Details
#address_id ⇒ Object
65 66 67 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 65 def address_id xpath(%w[UPRN]) end |
#address_line1 ⇒ Object
8 9 10 |
# File 'lib/view_model/sap_schema_ni_1800/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/sap_schema_ni_1800/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/sap_schema_ni_1800/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/sap_schema_ni_1800/common_schema.rb', line 20 def address_line4 xpath(%w[Property Address Address-Line-4]).to_s end |
#all_building_parts ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 222 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), } end end |
#all_floor_descriptions ⇒ Object
430 431 432 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 430 def all_floor_descriptions @xml_doc.search("Property-Summary/Floor/Description").map(&:content) end |
#all_floor_energy_efficiency_rating ⇒ Object
434 435 436 437 438 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 434 def @xml_doc .search("Property-Summary/Floor/Energy-Efficiency-Rating") .map(&:content) end |
#all_floor_env_energy_efficiency_rating ⇒ Object
440 441 442 443 444 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 440 def @xml_doc .search("Property-Summary/Floor/Environmental-Efficiency-Rating") .map(&:content) end |
#all_main_heating_controls_descriptions ⇒ Object
376 377 378 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 376 def all_main_heating_controls_descriptions @xml_doc.search("Main-Heating-Controls/Description").map(&:content) end |
#all_main_heating_controls_energy_efficiency ⇒ Object
446 447 448 449 450 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 446 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
452 453 454 455 456 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 452 def all_main_heating_controls_environmental_efficiency @xml_doc .search("Main-Heating-Controls/Environmental-Efficiency-Rating") .map(&:content) end |
#all_main_heating_descriptions ⇒ Object
368 369 370 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 368 def all_main_heating_descriptions @xml_doc.search("Main-Heating/Description").map(&:content) end |
#all_main_heating_energy_efficiency ⇒ Object
416 417 418 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 416 def all_main_heating_energy_efficiency @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content) end |
#all_main_heating_environmental_efficiency ⇒ Object
424 425 426 427 428 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 424 def all_main_heating_environmental_efficiency @xml_doc .search("Main-Heating/Environmental-Efficiency-Rating") .map(&:content) end |
#all_roof_descriptions ⇒ Object
384 385 386 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 384 def all_roof_descriptions @xml_doc.search("Roof/Description").map(&:content) end |
#all_roof_energy_efficiency_rating ⇒ Object
388 389 390 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 388 def @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content) end |
#all_roof_env_energy_efficiency_rating ⇒ Object
392 393 394 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 392 def @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content) end |
#all_sap_floor_dimensions ⇒ Object
203 204 205 206 207 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 203 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_wall_descriptions ⇒ Object
396 397 398 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 396 def all_wall_descriptions @xml_doc.search("Walls/Description").map(&:content) end |
#all_wall_energy_efficiency_rating ⇒ Object
400 401 402 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 400 def @xml_doc.search("Walls/Energy-Efficiency-Rating").map(&:content) end |
#all_wall_env_energy_efficiency_rating ⇒ Object
404 405 406 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 404 def @xml_doc.search("Walls/Environmental-Efficiency-Rating").map(&:content) end |
#assessment_id ⇒ Object
4 5 6 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 4 def assessment_id xpath(%w[RRN]) end |
#assessor_email ⇒ Object
45 46 47 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 45 def assessor_email xpath(%w[Home-Inspector E-Mail]) end |
#assessor_name ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 36 def assessor_name [ xpath(%w[Home-Inspector Name Prefix]), xpath(%w[Home-Inspector Name First-Name]), xpath(%w[Home-Inspector Name Surname]), xpath(%w[Home-Inspector Name Suffix]), ].reject { |e| e.to_s.empty? }.join(" ") end |
#assessor_telephone ⇒ Object
49 50 51 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 49 def assessor_telephone xpath(%w[Home-Inspector Telephone]) end |
#boiler_flue_type ⇒ Object
268 269 270 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 268 def boiler_flue_type xpath(%w[Boiler-Flue-Type]) end |
#building_part_number ⇒ Object
218 219 220 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 218 def building_part_number xpath(%w[Building-Part-Number]) end |
#built_form ⇒ Object
372 373 374 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 372 def built_form xpath(%w[Built-Form]) end |
#co2_emissions_current_per_floor_area ⇒ Object
292 293 294 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 292 def co2_emissions_current_per_floor_area xpath(%w[CO2-Emissions-Current-Per-Floor-Area]) end |
#country_code ⇒ Object
280 281 282 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 280 def country_code xpath(%w[Country-Code]) end |
#current_carbon_emission ⇒ Object
151 152 153 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 151 def current_carbon_emission xpath(%w[CO2-Emissions-Current]) end |
#current_energy_rating ⇒ Object
159 160 161 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 159 def xpath(%w[Energy-Rating-Current])&.to_i end |
#current_space_heating_demand ⇒ Object
195 196 197 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 195 def current_space_heating_demand xpath(%w[Space-Heating]) or xpath(%w[Space-Heating-Existing-Dwelling]) end |
#current_water_heating_demand ⇒ Object
199 200 201 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 199 def current_water_heating_demand xpath(%w[Water-Heating]) end |
#cylinder_insul_thickness ⇒ Object
476 477 478 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 476 def cylinder_insul_thickness xpath(%w[Hot-Water-Store-Insulation-Thickness]) end |
#cylinder_insulation_type ⇒ Object
480 481 482 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 480 def cylinder_insulation_type xpath(%w[Hot-Water-Store-Insulation-Type]) end |
#cylinder_size ⇒ Object
484 485 486 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 484 def cylinder_size xpath(%w[Hot-Water-Store-Size]) end |
#date_of_assessment ⇒ Object
53 54 55 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 53 def date_of_assessment xpath(%w[Inspection-Date]) end |
#date_of_completion ⇒ Object
61 62 63 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 61 def date_of_completion xpath(%w[Completion-Date]) end |
#date_of_expiry ⇒ Object
69 70 71 72 73 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 69 def date_of_expiry expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10 expires_at.to_s end |
#date_of_registration ⇒ Object
57 58 59 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 57 def date_of_registration xpath(%w[Registration-Date]) end |
#dwelling_type ⇒ Object
177 178 179 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 177 def dwelling_type xpath(%w[Dwelling-Type]) end |
#energy_consumption_potential ⇒ Object
167 168 169 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 167 def energy_consumption_potential xpath(%w[Energy-Consumption-Potential]) end |
#energy_tariff ⇒ Object
408 409 410 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 408 def energy_tariff xpath(%w[Electricity-Tariff]) end |
#environmental_impact_current ⇒ Object
284 285 286 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 284 def environmental_impact_current xpath(%w[Environmental-Impact-Current])&.to_i end |
#environmental_impact_potential ⇒ Object
288 289 290 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 288 def environmental_impact_potential xpath(%w[Environmental-Impact-Potential])&.to_i end |
#estimated_energy_cost ⇒ Object
171 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 171 def estimated_energy_cost; end |
#fixed_lighting_outlets_count ⇒ Object
304 305 306 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 304 def fixed_lighting_outlets_count xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i end |
#floor_heat_loss ⇒ Object
244 245 246 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 244 def floor_heat_loss xpath(%w[Floor-Heat-Loss]) end |
#floor_height ⇒ Object
420 421 422 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 420 def floor_height @xml_doc.search("Storey-Height").map(&:content) end |
#floor_level ⇒ Object
412 413 414 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 412 def floor_level xpath(%w[SAP-Flat-Details Level]) end |
#has_cylinder_thermostat ⇒ Object
488 489 490 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 488 def has_cylinder_thermostat xpath(%w[Has-Cylinder-Thermostat]) end |
#heating_cost_current ⇒ Object
139 140 141 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 139 def heating_cost_current xpath(%w[Heating-Cost-Current]) end |
#heating_cost_potential ⇒ Object
127 128 129 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 127 def heating_cost_potential xpath(%w[Heating-Cost-Potential]) end |
#hot_water_cost_current ⇒ Object
135 136 137 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 135 def hot_water_cost_current xpath(%w[Hot-Water-Cost-Current]) end |
#hot_water_cost_potential ⇒ Object
123 124 125 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 123 def hot_water_cost_potential xpath(%w[Hot-Water-Cost-Potential]) end |
#hot_water_description ⇒ Object
316 317 318 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 316 def hot_water_description xpath(%w[Hot-Water Description]) end |
#hot_water_energy_efficiency_rating ⇒ Object
320 321 322 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 320 def xpath(%w[Hot-Water Energy-Efficiency-Rating]) end |
#hot_water_environmental_efficiency_rating ⇒ Object
324 325 326 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 324 def xpath(%w[Hot-Water Environmental-Efficiency-Rating]) end |
#immersion_heating_type ⇒ Object
252 253 254 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 252 def immersion_heating_type xpath(%w[Immersion-Heating-Type]) end |
#improvements ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 100 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
209 210 211 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 209 def level xpath(%w[Level]) end |
#lighting_cost_current ⇒ Object
143 144 145 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 143 def lighting_cost_current xpath(%w[Lighting-Cost-Current]) end |
#lighting_cost_potential ⇒ Object
131 132 133 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 131 def lighting_cost_potential xpath(%w[Lighting-Cost-Potential]) end |
#lighting_description ⇒ Object
352 353 354 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 352 def lighting_description xpath(%w[Lighting Description]) end |
#lighting_energy_efficiency_rating ⇒ Object
356 357 358 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 356 def xpath(%w[Lighting Energy-Efficiency-Rating]) end |
#lighting_environmental_efficiency_rating ⇒ Object
360 361 362 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 360 def xpath(%w[Lighting Environmental-Efficiency-Rating]) end |
#low_energy_fixed_lighting_outlets_count ⇒ Object
308 309 310 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 308 def low_energy_fixed_lighting_outlets_count xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i end |
#low_energy_lighting ⇒ Object
300 301 302 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 300 def low_energy_lighting xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Percentage]) end |
#main_dwelling_construction_age_band_or_year ⇒ Object
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 458 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
256 257 258 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 256 def main_fuel_type xpath(%w[Main-Fuel-Type]) end |
#main_heating_controls ⇒ Object
296 297 298 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 296 def main_heating_controls xpath(%w[Main-Heating-Controls Description]) end |
#mech_vent_sys_index_number ⇒ Object
492 493 494 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 492 def mech_vent_sys_index_number xpath(%w[Mechanical-Vent-System-Index-Number])&.to_i end |
#mechanical_vent_data_source ⇒ Object
496 497 498 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 496 def mechanical_vent_data_source xpath(%w[Mechanical-Ventilation-Data-Source]) end |
#meter_type ⇒ Object
272 273 274 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 272 def meter_type xpath(%w[Meter-Type]) end |
#open_fireplaces_count ⇒ Object
312 313 314 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 312 def open_fireplaces_count xpath(%w[Open-Fireplaces-Count])&.to_i end |
#postcode ⇒ Object
28 29 30 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 28 def postcode xpath(%w[Property Address Postcode]) end |
#potential_carbon_emission ⇒ Object
147 148 149 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 147 def potential_carbon_emission xpath(%w[CO2-Emissions-Potential]) end |
#potential_energy_rating ⇒ Object
155 156 157 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 155 def xpath(%w[Energy-Rating-Potential])&.to_i end |
#potential_energy_saving ⇒ Object
181 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 181 def potential_energy_saving; end |
#primary_energy_use ⇒ Object
163 164 165 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 163 def primary_energy_use xpath(%w[Energy-Consumption-Current]) end |
#property_age_band ⇒ Object
183 184 185 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 183 def property_age_band xpath(%w[Construction-Year]) end |
#property_summary ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 75 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 |
#related_party_disclosure_number ⇒ Object
96 97 98 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 96 def xpath(%w[Related-Party-Disclosure-Number])&.to_i end |
#related_party_disclosure_text ⇒ Object
92 93 94 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 92 def xpath(%w[Related-Party-Disclosure-Text]) end |
#report_type ⇒ Object
380 381 382 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 380 def report_type xpath(%w[Report-Type]) end |
#sap_main_heating_code ⇒ Object
276 277 278 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 276 def sap_main_heating_code xpath(%w[SAP-Main-Heating-Code]) end |
#scheme_assessor_id ⇒ Object
32 33 34 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 32 def scheme_assessor_id xpath(%w[Certificate-Number]) end |
#secondary_fuel_type ⇒ Object
260 261 262 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 260 def secondary_fuel_type xpath(%w[Secondary-Fuel-Type]) end |
#secondary_heating_description ⇒ Object
340 341 342 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 340 def secondary_heating_description xpath(%w[Secondary-Heating Description]) end |
#secondary_heating_energy_efficiency_rating ⇒ Object
344 345 346 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 344 def xpath(%w[Secondary-Heating Energy-Efficiency-Rating]) end |
#secondary_heating_environmental_efficiency_rating ⇒ Object
348 349 350 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 348 def xpath(%w[Secondary-Heating Environmental-Efficiency-Rating]) end |
#tenure ⇒ Object
187 188 189 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 187 def tenure xpath(%w[Tenure]) end |
#thermal_store ⇒ Object
500 501 502 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 500 def thermal_store xpath(%w[Thermal-Store]) end |
#top_storey ⇒ Object
213 214 215 216 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 213 def top_storey flat_level_code = xpath(%w[Level]) flat_level_code == "3" ? "Y" : "N" end |
#total_floor_area ⇒ Object
173 174 175 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 173 def total_floor_area xpath(%w[Property-Summary Total-Floor-Area]) end |
#town ⇒ Object
24 25 26 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 24 def town xpath(%w[Property Address Post-Town]) end |
#transaction_type ⇒ Object
191 192 193 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 191 def transaction_type xpath(%w[Transaction-Type]) end |
#type_of_assessment ⇒ Object
248 249 250 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 248 def type_of_assessment "SAP" end |
#ventilation_type ⇒ Object
504 505 506 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 504 def ventilation_type xpath(%w[Ventilation-Type]) end |
#water_heating_fuel ⇒ Object
264 265 266 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 264 def water_heating_fuel xpath(%w[Water-Fuel-Type]) end |
#wind_turbine_count ⇒ Object
364 365 366 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 364 def wind_turbine_count xpath(%w[Wind-Turbines-Count])&.to_i end |
#window_description ⇒ Object
328 329 330 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 328 def window_description xpath(%w[Windows Description]) end |
#window_energy_efficiency_rating ⇒ Object
332 333 334 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 332 def xpath(%w[Windows Energy-Efficiency-Rating]) end |
#window_environmental_efficiency_rating ⇒ Object
336 337 338 |
# File 'lib/view_model/sap_schema_ni_1800/common_schema.rb', line 336 def xpath(%w[Windows Environmental-Efficiency-Rating]) end |