Class: ViewModel::RdSapSchema210::CommonSchema

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

Instance Method Summary collapse

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

#initialize, #xpath

Constructor Details

This class inherits a constructor from ViewModel::BaseViewModel

Instance Method Details

#address_idObject



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

def address_id
  xpath(%w[UPRN])
end

#address_line1Object



8
9
10
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 8

def address_line1
  xpath(%w[Property Address Address-Line-1])
end

#address_line2Object



12
13
14
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 12

def address_line2
  xpath(%w[Property Address Address-Line-2]).to_s
end

#address_line3Object



16
17
18
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 16

def address_line3
  xpath(%w[Property Address Address-Line-3]).to_s
end

#address_line4Object



20
21
22
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 20

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

#all_building_partsObject



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 321

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_descriptionsObject



504
505
506
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 504

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

#all_floor_energy_efficiency_ratingObject



508
509
510
511
512
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 508

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

#all_floor_env_energy_efficiency_ratingObject



514
515
516
517
518
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 514

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

#all_hot_water_descriptionsObject



287
288
289
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 287

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

#all_lighting_descriptionsObject



291
292
293
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 291

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

#all_main_heating_controls_descriptionsObject



273
274
275
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 273

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

#all_main_heating_controls_energy_efficiencyObject



520
521
522
523
524
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 520

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

#all_main_heating_controls_environmental_efficiencyObject



526
527
528
529
530
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 526

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

#all_main_heating_descriptionsObject



269
270
271
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 269

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

#all_main_heating_energy_efficiencyObject



277
278
279
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 277

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

#all_main_heating_environmental_efficiencyObject



281
282
283
284
285
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 281

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

#all_roof_descriptionsObject



253
254
255
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 253

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

#all_roof_energy_efficiency_ratingObject



257
258
259
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 257

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

#all_roof_env_energy_efficiency_ratingObject



261
262
263
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 261

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

#all_sap_floor_dimensionsObject



299
300
301
302
303
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 299

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_descriptionsObject



295
296
297
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 295

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

#all_wall_descriptionsObject



476
477
478
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 476

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

#all_wall_energy_efficiency_ratingObject



480
481
482
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 480

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

#all_wall_env_energy_efficiency_ratingObject



484
485
486
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 484

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

#all_window_descriptionsObject



265
266
267
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 265

def all_window_descriptions
  @xml_doc.search("Window/Description").map(&:content)
end

#assessment_idObject



4
5
6
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 4

def assessment_id
  xpath(%w[RRN])
end

#assessor_emailObject



40
41
42
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 40

def assessor_email
  xpath(%w[Energy-Assessor E-Mail])
end

#assessor_nameObject



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

def assessor_name
  xpath(%w[Energy-Assessor Name])
end

#assessor_telephoneObject



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

def assessor_telephone
  xpath(%w[Energy-Assessor Telephone])
end

#boiler_flue_typeObject



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

def boiler_flue_type
  xpath(%w[Boiler-Flue-Type])
end

#building_part_numberObject



317
318
319
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 317

def building_part_number
  xpath(%w[Building-Part-Number])
end

#built_formObject



464
465
466
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 464

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

#co2_emissions_current_per_floor_areaObject



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

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

#country_codeObject



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

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

#current_carbon_emissionObject



163
164
165
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 163

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

#current_energy_ratingObject



171
172
173
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 171

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

#current_space_heating_demandObject



199
200
201
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 199

def current_space_heating_demand
  xpath(%w[Space-Heating-Existing-Dwelling])
end

#current_water_heating_demandObject



203
204
205
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 203

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

#cylinder_insul_thicknessObject



550
551
552
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 550

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

#cylinder_insulation_typeObject



554
555
556
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 554

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

#cylinder_sizeObject



558
559
560
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 558

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

#date_of_assessmentObject



48
49
50
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 48

def date_of_assessment
  xpath(%w[Inspection-Date])
end

#date_of_completionObject



56
57
58
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 56

def date_of_completion
  xpath(%w[Completion-Date])
end

#date_of_expiryObject



64
65
66
67
68
# File 'lib/view_model/rd_sap_schema_210/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_registrationObject



52
53
54
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 52

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

#dwelling_typeObject



181
182
183
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 181

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

#electricity_smart_meter_presentObject



570
571
572
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 570

def electricity_smart_meter_present
  Helper::ToBool.execute(xpath(%w[Electricity-Smart-Meter-Present]))
end

#energy_consumption_potentialObject



249
250
251
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 249

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

#energy_rating_currentObject



229
230
231
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 229

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

#energy_rating_potentialObject



233
234
235
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 233

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

#environmental_impact_currentObject



237
238
239
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 237

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

#environmental_impact_potentialObject



241
242
243
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 241

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

#estimated_energy_costObject



175
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 175

def estimated_energy_cost; end

#extensions_countObject



468
469
470
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 468

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

#floor_heat_lossObject



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

def floor_heat_loss
  xpath(%w[Floor-Heat-Loss])
end

#floor_heightObject



500
501
502
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 500

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

#floor_levelObject



488
489
490
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 488

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

#gas_smart_meter_presentObject



566
567
568
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 566

def gas_smart_meter_present
  Helper::ToBool.execute(xpath(%w[Gas-Smart-Meter-Present]))
end

#habitable_room_countObject



225
226
227
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 225

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

#has_cylinder_thermostatObject



562
563
564
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 562

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

#heat_loss_corridorObject



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

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

#heated_room_countObject



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

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

#heating_cost_currentObject



151
152
153
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 151

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

#heating_cost_potentialObject



139
140
141
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 139

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

#hot_water_cost_currentObject



147
148
149
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 147

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

#hot_water_cost_potentialObject



135
136
137
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 135

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

#hot_water_descriptionObject



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

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

#hot_water_energy_efficiency_ratingObject



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

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

#hot_water_environmental_efficiency_ratingObject



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

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

#immersion_heating_typeObject



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

def immersion_heating_type
  xpath(%w[Immersion-Heating-Type])
end

#impact_of_cavity_insulationObject



207
208
209
210
211
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 207

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_insulationObject



213
214
215
216
217
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 213

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_insulationObject



219
220
221
222
223
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 219

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

#improvementsObject



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

#levelObject



305
306
307
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 305

def level
  xpath(%w[Level])
end

#lighting_cost_currentObject



155
156
157
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 155

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

#lighting_cost_potentialObject



143
144
145
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 143

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

#lighting_descriptionObject



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

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

#lighting_energy_efficiency_ratingObject



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

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

#lighting_environmental_efficiency_ratingObject



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

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

#main_dwelling_construction_age_band_or_yearObject



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 532

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_typeObject



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

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

#main_heating_controlsObject



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

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

#mains_gasObject



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

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

#mechanical_ventilationObject



496
497
498
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 496

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

#meter_typeObject



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

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

#multiple_glazed_proportionObject



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

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

#photovoltaic_roof_area_percentObject



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

def photovoltaic_roof_area_percent
  xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
end

#postcodeObject



28
29
30
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 28

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

#potential_carbon_emissionObject



159
160
161
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 159

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

#potential_energy_ratingObject



167
168
169
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 167

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

#potential_energy_savingObject



185
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 185

def potential_energy_saving; end

#primary_energy_useObject



245
246
247
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 245

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

#property_age_bandObject



187
188
189
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 187

def property_age_band
  xpath(%w[Construction-Age-Band])
end

#property_summaryObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/view_model/rd_sap_schema_210/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_reportObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 119

def recommendations_for_report
  accessor = Accessor::DomesticRecommendationsAccessor.instance
  @xml_doc
    .search("Suggested-Improvements Improvement")
    .map do |node|
      improvement_code = xpath(%w[Improvement-Details Improvement-Number], node)
      {
        sequence: xpath(%w[Sequence], node).to_i,
        improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
        improvement_summary: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).summary : xpath(%w[Improvement-Summary], node),
        improvement_description: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).description : xpath(%w[Improvement-Description], node),
        indicative_cost: xpath(%w[Indicative-Cost], node),
      }
    end
end


91
92
93
94
# File 'lib/view_model/rd_sap_schema_210/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_210/common_schema.rb', line 87

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

#report_typeObject



472
473
474
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 472

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

#sap_main_heating_codeObject



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

def sap_main_heating_code
  xpath(%w[SAP-Main-Heating-Code])
end

#scheme_assessor_idObject



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

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

#secondary_fuel_typeObject



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

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

#secondary_heating_descriptionObject



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

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

#secondary_heating_energy_efficiency_ratingObject



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

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

#secondary_heating_environmental_efficiency_ratingObject



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

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

#solar_water_heating_flagObject



492
493
494
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 492

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

#storey_countObject



313
314
315
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 313

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

#tenureObject



191
192
193
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 191

def tenure
  xpath(%w[Tenure])
end

#top_storeyObject



309
310
311
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 309

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

#total_floor_areaObject



177
178
179
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 177

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

#townObject



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

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

#transaction_typeObject



195
196
197
# File 'lib/view_model/rd_sap_schema_210/common_schema.rb', line 195

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

#unheated_corridor_lengthObject



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

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

#water_heating_fuelObject



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

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

#wind_turbine_countObject



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

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

#window_descriptionObject



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

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

#window_energy_efficiency_ratingObject



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

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

#window_environmental_efficiency_ratingObject



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

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