Class: ViewModel::RdSapSchemaS140::CommonSchema

Inherits:
DomesticEpcViewModel show all
Defined in:
lib/view_model/rd_sap_schema_s_140/common_schema.rb

Instance Method Summary collapse

Methods inherited from DomesticEpcViewModel

#assessor_contact_address, #company_name, #has_hot_water_cylinder, #improvement_title, #main_heating_category, #multi_glazing_type, #property_type, #status, #water_heating_code

Instance Method Details

#addendum ⇒ Object



535
536
537
538
539
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 535

def addendum
  return nil if xpath(%w[Addendum]).nil?

  fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
end

#address_id ⇒ Object



60
61
62
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 60

def address_id
  "LPRN-#{xpath(%w[UPRN])}"
end

#address_line1 ⇒ Object



8
9
10
# File 'lib/view_model/rd_sap_schema_s_140/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_s_140/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_s_140/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_s_140/common_schema.rb', line 20

def address_line4
  xpath(%w[Property Address Address-Line-4]).to_s
end

#all_floor_descriptions ⇒ Object



460
461
462
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 460

def all_floor_descriptions
  @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
end

#all_floor_energy_efficiency_rating ⇒ Object



464
465
466
467
468
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 464

def all_floor_energy_efficiency_rating
  @xml_doc
    .search("Property-Summary/Floor/Energy-Efficiency-Rating")
    .map(&:content)
end

#all_floor_env_energy_efficiency_rating ⇒ Object



470
471
472
473
474
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 470

def all_floor_env_energy_efficiency_rating
  @xml_doc
    .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
    .map(&:content)
end

#all_hot_water_descriptions ⇒ Object



272
273
274
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 272

def all_hot_water_descriptions
  @xml_doc.search("Hot-Water/Description").map(&:content)
end

#all_lighting_descriptions ⇒ Object



276
277
278
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 276

def all_lighting_descriptions
  @xml_doc.search("Lighting/Description").map(&:content)
end

#all_main_heating_controls_descriptions ⇒ Object



258
259
260
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 258

def all_main_heating_controls_descriptions
  @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
end

#all_main_heating_controls_energy_efficiency ⇒ Object



476
477
478
479
480
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 476

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



482
483
484
485
486
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 482

def all_main_heating_controls_environmental_efficiency
  @xml_doc
    .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
    .map(&:content)
end

#all_main_heating_descriptions ⇒ Object



254
255
256
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 254

def all_main_heating_descriptions
  @xml_doc.search("Main-Heating/Description").map(&:content)
end

#all_main_heating_energy_efficiency ⇒ Object



262
263
264
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 262

def all_main_heating_energy_efficiency
  @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
end

#all_main_heating_environmental_efficiency ⇒ Object



266
267
268
269
270
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 266

def all_main_heating_environmental_efficiency
  @xml_doc
    .search("Main-Heating/Environmental-Efficiency-Rating")
    .map(&:content)
end

#all_roof_descriptions ⇒ Object



238
239
240
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 238

def all_roof_descriptions
  @xml_doc.search("Roof/Description").map(&:content)
end

#all_roof_energy_efficiency_rating ⇒ Object



242
243
244
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 242

def all_roof_energy_efficiency_rating
  @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
end

#all_roof_env_energy_efficiency_rating ⇒ Object



246
247
248
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 246

def all_roof_env_energy_efficiency_rating
  @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
end

#all_secondary_heating_descriptions ⇒ Object



280
281
282
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 280

def all_secondary_heating_descriptions
  @xml_doc.search("Secondary-Heating/Description").map(&:content)
end

#all_wall_descriptions ⇒ Object



428
429
430
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 428

def all_wall_descriptions
  @xml_doc.search("Wall/Description").map(&:content)
end

#all_wall_energy_efficiency_rating ⇒ Object



432
433
434
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 432

def all_wall_energy_efficiency_rating
  @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
end

#all_wall_env_energy_efficiency_rating ⇒ Object



436
437
438
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 436

def all_wall_env_energy_efficiency_rating
  @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
end

#all_window_descriptions ⇒ Object



250
251
252
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 250

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_s_140/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_s_140/common_schema.rb', line 40

def assessor_email
  xpath(%w[Home-Inspector E-Mail])
end

#assessor_name ⇒ Object



36
37
38
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 36

def assessor_name
  "#{xpath(%w[Home-Inspector Name First-Name])} #{xpath(%w[Home-Inspector Name Surname])}"
end

#assessor_telephone ⇒ Object



44
45
46
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 44

def assessor_telephone
  xpath(%w[Home-Inspector Telephone])
end

#built_form ⇒ Object



416
417
418
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 416

def built_form
  xpath(%w[Built-Form])
end

#co2_emissions_current_per_floor_area ⇒ Object



300
301
302
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 300

def co2_emissions_current_per_floor_area
  xpath(%w[CO2-Emissions-Current-Per-Floor-Area])&.to_f
end

#country_code ⇒ Object



284
285
286
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 284

def country_code
  xpath(%w[Country-Code])
end

#current_carbon_emission ⇒ Object



158
159
160
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 158

def current_carbon_emission
  xpath(%w[CO2-Emissions-Current])
end

#current_energy_rating ⇒ Object



166
167
168
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 166

def current_energy_rating
  xpath(%w[Energy-Rating-Current])&.to_i
end

#current_space_heating_demand ⇒ Object



190
191
192
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 190

def current_space_heating_demand
  nil
end

#current_water_heating_demand ⇒ Object



194
195
196
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 194

def current_water_heating_demand
  nil
end

#cylinder_insul_thickness ⇒ Object



506
507
508
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 506

def cylinder_insul_thickness
  xpath(%w[Cylinder-Insulation-Thickness])
end

#cylinder_insulation_type ⇒ Object



510
511
512
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 510

def cylinder_insulation_type
  xpath(%w[Cylinder-Insulation-Type])
end

#cylinder_size ⇒ Object



514
515
516
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 514

def cylinder_size
  xpath(%w[Cylinder-Size])
end

#date_of_assessment ⇒ Object



48
49
50
# File 'lib/view_model/rd_sap_schema_s_140/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_s_140/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_s_140/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_s_140/common_schema.rb', line 52

def date_of_registration
  xpath(%w[Registration-Date])
end

#dwelling_type ⇒ Object



174
175
176
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 174

def dwelling_type
  xpath(%w[Dwelling-Type])
end

#electricity_smart_meter_present ⇒ Object



545
546
547
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 545

def electricity_smart_meter_present
  nil
end

#energy_consumption_potential ⇒ Object



234
235
236
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 234

def energy_consumption_potential
  xpath(%w[Energy-Consumption-Potential])&.to_f
end

#energy_rating_current ⇒ Object



214
215
216
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 214

def energy_rating_current
  xpath(%w[Energy-Rating-Current])&.to_i
end

#energy_rating_potential ⇒ Object



218
219
220
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 218

def energy_rating_potential
  xpath(%w[Energy-Rating-Potential])&.to_i
end

#environmental_impact_current ⇒ Object



222
223
224
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 222

def environmental_impact_current
  xpath(%w[Environmental-Impact-Current])&.to_i
end

#environmental_impact_potential ⇒ Object



226
227
228
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 226

def environmental_impact_potential
  xpath(%w[Environmental-Impact-Potential])&.to_i
end

#extensions_count ⇒ Object



420
421
422
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 420

def extensions_count
  xpath(%w[Extensions-Count])&.to_i
end

#fixed_lighting_outlets_count ⇒ Object



340
341
342
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 340

def fixed_lighting_outlets_count
  xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i
end

#floor_height ⇒ Object



456
457
458
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 456

def floor_height
  @xml_doc.search("Room-Height").map(&:content)
end

#floor_level ⇒ Object



444
445
446
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 444

def floor_level
  xpath(%w[Flat-Location])
end

#gas_smart_meter_present ⇒ Object



541
542
543
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 541

def gas_smart_meter_present
  nil
end

#glazed_area ⇒ Object



328
329
330
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 328

def glazed_area
  xpath(%w[Glazed-Area])
end

#habitable_room_count ⇒ Object



210
211
212
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 210

def habitable_room_count
  xpath(%w[Habitable-Room-Count])&.to_i
end

#has_cylinder_thermostat ⇒ Object



518
519
520
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 518

def has_cylinder_thermostat
  xpath(%w[Cylinder-Thermostat])
end

#heat_loss_corridor ⇒ Object



368
369
370
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 368

def heat_loss_corridor
  xpath(%w[Heat-Loss-Corridor])
end

#heated_room_count ⇒ Object



332
333
334
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 332

def heated_room_count
  xpath(%w[Heated-Room-Count])&.to_i
end

#heating_cost_current ⇒ Object



146
147
148
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 146

def heating_cost_current
  xpath(%w[Heating-Cost-Current])
end

#heating_cost_potential ⇒ Object



134
135
136
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 134

def heating_cost_potential
  xpath(%w[Heating-Cost-Potential])
end

#hot_water_cost_current ⇒ Object



142
143
144
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 142

def hot_water_cost_current
  xpath(%w[Hot-Water-Cost-Current])
end

#hot_water_cost_potential ⇒ Object



130
131
132
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 130

def hot_water_cost_potential
  xpath(%w[Hot-Water-Cost-Potential])
end

#hot_water_description ⇒ Object



352
353
354
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 352

def hot_water_description
  xpath(%w[Hot-Water Description])
end

#hot_water_energy_efficiency_rating ⇒ Object



356
357
358
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 356

def hot_water_energy_efficiency_rating
  xpath(%w[Hot-Water Energy-Efficiency-Rating])
end

#hot_water_environmental_efficiency_rating ⇒ Object



360
361
362
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 360

def hot_water_environmental_efficiency_rating
  xpath(%w[Hot-Water Environmental-Efficiency-Rating])
end

#impact_of_cavity_insulation ⇒ Object



198
199
200
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 198

def impact_of_cavity_insulation
  nil
end

#impact_of_loft_insulation ⇒ Object



202
203
204
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 202

def impact_of_loft_insulation
  nil
end

#impact_of_solid_wall_insulation ⇒ Object



206
207
208
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 206

def impact_of_solid_wall_insulation
  nil
end

#improvements ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/view_model/rd_sap_schema_s_140/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: nil,
        improvement_category: xpath(%w[Improvement-Category], node),
        improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
        improvement_description: nil,
        improvement_title: "",
        improvement_type: xpath(%w[Improvement-Type], node),
        indicative_cost: nil,
        sequence: xpath(%w[Sequence], node).to_i,
        typical_saving: xpath(%w[Typical-Saving], node),
      }
    end
end

#level ⇒ Object



308
309
310
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 308

def level
  xpath(%w[Level])
end

#lighting_cost_current ⇒ Object



150
151
152
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 150

def lighting_cost_current
  xpath(%w[Lighting-Cost-Current])
end

#lighting_cost_potential ⇒ Object



138
139
140
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 138

def lighting_cost_potential
  xpath(%w[Lighting-Cost-Potential])
end

#lighting_description ⇒ Object



400
401
402
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 400

def lighting_description
  xpath(%w[Lighting Description])
end

#lighting_energy_efficiency_rating ⇒ Object



404
405
406
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 404

def lighting_energy_efficiency_rating
  xpath(%w[Lighting Energy-Efficiency-Rating])
end

#lighting_environmental_efficiency_rating ⇒ Object



408
409
410
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 408

def lighting_environmental_efficiency_rating
  xpath(%w[Lighting Environmental-Efficiency-Rating])
end

#low_energy_fixed_lighting_outlets_count ⇒ Object



344
345
346
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 344

def low_energy_fixed_lighting_outlets_count
  xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i
end

#low_energy_lighting ⇒ Object



336
337
338
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 336

def low_energy_lighting
  xpath(%w[Low-Energy-Lighting])
end

#lzc_energy_sources ⇒ Object



526
527
528
529
530
531
532
533
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 526

def lzc_energy_sources
  return nil if xpath(%w[LZC-Energy-Sources]).nil?

  @xml_doc
    .search("LZC-Energy-Sources/LZC-Energy-Source")
    .select(&:element?)
    .map { |n| n.text.to_i }
end

#main_dwelling_construction_age_band_or_year ⇒ Object



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 488

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



288
289
290
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 288

def main_fuel_type
  xpath(%w[Main-Fuel-Type])
end

#main_heating_controls ⇒ Object



320
321
322
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 320

def main_heating_controls
  xpath(%w[Main-Heating-Controls Description])
end

#mains_gas ⇒ Object



304
305
306
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 304

def mains_gas
  xpath(%w[Mains-Gas])
end

#mechanical_ventilation ⇒ Object



452
453
454
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 452

def mechanical_ventilation
  xpath(%w[Mechanical-Ventilation])
end

#meter_type ⇒ Object



440
441
442
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 440

def meter_type
  xpath(%w[Meter-Type])
end

#multiple_glazed_proportion ⇒ Object



324
325
326
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 324

def multiple_glazed_proportion
  xpath(%w[Multiple-Glazed-Proportion])
end

#open_fireplaces_count ⇒ Object



348
349
350
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 348

def open_fireplaces_count
  xpath(%w[Open-Fireplaces-Count])&.to_i
end

#party_wall_construction ⇒ Object



522
523
524
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 522

def party_wall_construction
  xpath(%w[SAP-Building-Part Party-Wall-Construction])
end

#photovoltaic_roof_area_percent ⇒ Object



412
413
414
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 412

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_s_140/common_schema.rb', line 28

def postcode
  xpath(%w[Property Address Postcode])
end

#potential_carbon_emission ⇒ Object



154
155
156
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 154

def potential_carbon_emission
  xpath(%w[CO2-Emissions-Potential])
end

#potential_energy_rating ⇒ Object



162
163
164
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 162

def potential_energy_rating
  xpath(%w[Energy-Rating-Potential])&.to_i
end

#primary_energy_use ⇒ Object



230
231
232
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 230

def primary_energy_use
  xpath(%w[Energy-Consumption-Current])&.to_f
end

#property_age_band ⇒ Object



178
179
180
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 178

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_s_140/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



116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 116

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


91
92
93
94
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 91

def related_party_disclosure_number
  disclosure_number = xpath(%w[Related-Party-Disclosure-Number])
  disclosure_number.nil? ? nil : disclosure_number.to_i
end


87
88
89
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 87

def related_party_disclosure_text
  xpath(%w[Related-Party-Disclosure-Text])
end

#report_type ⇒ Object



424
425
426
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 424

def report_type
  xpath(%w[Report-Type])
end

#scheme_assessor_id ⇒ Object



32
33
34
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 32

def scheme_assessor_id
  xpath(%w[Identification-Number Membership-Number]) or xpath(%w[Identification-Number Certificate-Number])
end

#secondary_fuel_type ⇒ Object



292
293
294
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 292

def secondary_fuel_type
  xpath(%w[Secondary-Fuel-Type])
end

#secondary_heating_description ⇒ Object



388
389
390
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 388

def secondary_heating_description
  xpath(%w[Secondary-Heating Description])
end

#secondary_heating_energy_efficiency_rating ⇒ Object



392
393
394
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 392

def secondary_heating_energy_efficiency_rating
  xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
end

#secondary_heating_environmental_efficiency_rating ⇒ Object



396
397
398
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 396

def secondary_heating_environmental_efficiency_rating
  xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
end

#solar_water_heating_flag ⇒ Object



448
449
450
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 448

def solar_water_heating_flag
  xpath(%w[Solar-Water-Heating])
end

#storey_count ⇒ Object



316
317
318
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 316

def storey_count
  xpath(%w[Storey-Count])&.to_i
end

#tenure ⇒ Object



182
183
184
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 182

def tenure
  nil
end

#top_storey ⇒ Object



312
313
314
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 312

def top_storey
  xpath(%w[Top-Storey])
end

#total_floor_area ⇒ Object



170
171
172
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 170

def total_floor_area
  xpath(%w[Property-Summary Total-Floor-Area])
end

#town ⇒ Object



24
25
26
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 24

def town
  xpath(%w[Property Address Post-Town])
end

#transaction_type ⇒ Object



186
187
188
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 186

def transaction_type
  xpath(%w[Transaction-Type])
end

#unheated_corridor_length ⇒ Object



372
373
374
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 372

def unheated_corridor_length
  xpath(%w[Unheated-Corridor-Length])
end

#water_heating_fuel ⇒ Object



296
297
298
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 296

def water_heating_fuel
  xpath(%w[Water-Heating-Fuel])
end

#wind_turbine_count ⇒ Object



364
365
366
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 364

def wind_turbine_count
  xpath(%w[Wind-Turbines-Count])&.to_i
end

#window_description ⇒ Object



376
377
378
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 376

def window_description
  xpath(%w[Window Description])
end

#window_energy_efficiency_rating ⇒ Object



380
381
382
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 380

def window_energy_efficiency_rating
  xpath(%w[Window Energy-Efficiency-Rating])
end

#window_environmental_efficiency_rating ⇒ Object



384
385
386
# File 'lib/view_model/rd_sap_schema_s_140/common_schema.rb', line 384

def window_environmental_efficiency_rating
  xpath(%w[Window Environmental-Efficiency-Rating])
end