Class: ViewModel::RdSapSchemaNi200::CommonSchema

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

Instance Method Summary collapse

Methods inherited from DomesticEpcViewModel

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

Instance Method Details

#address_id ⇒ Object



62
63
64
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 62

def address_id
  xpath(%w[UPRN])
end

#address_line1 ⇒ Object



10
11
12
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 10

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

#address_line2 ⇒ Object



14
15
16
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 14

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

#address_line3 ⇒ Object



18
19
20
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 18

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

#address_line4 ⇒ Object



22
23
24
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 22

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

#all_building_parts ⇒ Object



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 307

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



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

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

#all_floor_energy_efficiency_rating ⇒ Object



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

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



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

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

#all_hot_water_descriptions ⇒ Object



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

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

#all_lighting_descriptions ⇒ Object



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

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

#all_main_heating_controls_descriptions ⇒ Object



259
260
261
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 259

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

#all_main_heating_controls_energy_efficiency ⇒ Object



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

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



532
533
534
535
536
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 532

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

#all_main_heating_descriptions ⇒ Object



255
256
257
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 255

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

#all_main_heating_energy_efficiency ⇒ Object



263
264
265
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 263

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

#all_main_heating_environmental_efficiency ⇒ Object



267
268
269
270
271
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 267

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

#all_roof_descriptions ⇒ Object



239
240
241
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 239

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

#all_roof_energy_efficiency_rating ⇒ Object



243
244
245
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 243

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

#all_roof_env_energy_efficiency_rating ⇒ Object



247
248
249
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 247

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

#all_sap_floor_dimensions ⇒ Object



285
286
287
288
289
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 285

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



281
282
283
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 281

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

#all_wall_descriptions ⇒ Object



482
483
484
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 482

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

#all_wall_energy_efficiency_rating ⇒ Object



486
487
488
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 486

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

#all_wall_env_energy_efficiency_rating ⇒ Object



490
491
492
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 490

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

#all_window_descriptions ⇒ Object



251
252
253
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 251

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

#assessment_id ⇒ Object



6
7
8
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 6

def assessment_id
  xpath(%w[RRN])
end

#assessor_email ⇒ Object



42
43
44
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 42

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

#assessor_name ⇒ Object



38
39
40
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 38

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

#assessor_telephone ⇒ Object



46
47
48
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 46

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

#boiler_flue_type ⇒ Object



350
351
352
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 350

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

#building_part_number ⇒ Object



303
304
305
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 303

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

#built_form ⇒ Object



470
471
472
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 470

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

#co2_emissions_current_per_floor_area ⇒ Object



366
367
368
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 366

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

#country_code ⇒ Object



362
363
364
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 362

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

#current_carbon_emission ⇒ Object



149
150
151
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 149

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

#current_energy_rating ⇒ Object



157
158
159
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 157

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

#current_space_heating_demand ⇒ Object



185
186
187
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 185

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

#current_water_heating_demand ⇒ Object



189
190
191
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 189

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

#cylinder_insul_thickness ⇒ Object



564
565
566
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 564

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

#cylinder_insulation_type ⇒ Object



560
561
562
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 560

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

#cylinder_size ⇒ Object



568
569
570
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 568

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

#date_of_assessment ⇒ Object



50
51
52
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 50

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

#date_of_completion ⇒ Object



58
59
60
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 58

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

#date_of_expiry ⇒ Object



66
67
68
69
70
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 66

def date_of_expiry
  expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10

  expires_at.to_s
end

#date_of_registration ⇒ Object



54
55
56
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 54

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

#dwelling_type ⇒ Object



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

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

#energy_consumption_potential ⇒ Object



235
236
237
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 235

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

#energy_rating_current ⇒ Object



215
216
217
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 215

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

#energy_rating_potential ⇒ Object



219
220
221
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 219

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

#environmental_impact_current ⇒ Object



223
224
225
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 223

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

#environmental_impact_potential ⇒ Object



227
228
229
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 227

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

#estimated_energy_cost ⇒ Object



161
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 161

def estimated_energy_cost; end

#extensions_count ⇒ Object



474
475
476
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 474

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

#fixed_lighting_outlets_count ⇒ Object



394
395
396
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 394

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

#floor_heat_loss ⇒ Object



330
331
332
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 330

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

#floor_height ⇒ Object



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

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

#floor_level ⇒ Object



494
495
496
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 494

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

#glazed_area ⇒ Object



382
383
384
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 382

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

#glazing_type ⇒ Object



538
539
540
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 538

def glazing_type
  @xml_doc.search("Glazing-Type").map(&:content)
end

#habitable_room_count ⇒ Object



211
212
213
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 211

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

#has_cylinder_thermostat ⇒ Object



572
573
574
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 572

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

#heat_loss_corridor ⇒ Object



422
423
424
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 422

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

#heated_room_count ⇒ Object



386
387
388
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 386

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

#heating_cost_current ⇒ Object



137
138
139
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 137

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

#heating_cost_potential ⇒ Object



125
126
127
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 125

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

#hot_water_cost_current ⇒ Object



133
134
135
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 133

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

#hot_water_cost_potential ⇒ Object



121
122
123
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 121

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

#hot_water_description ⇒ Object



406
407
408
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 406

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

#hot_water_energy_efficiency_rating ⇒ Object



410
411
412
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 410

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

#hot_water_environmental_efficiency_rating ⇒ Object



414
415
416
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 414

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

#immersion_heating_type ⇒ Object



334
335
336
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 334

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

#impact_of_cavity_insulation ⇒ Object



193
194
195
196
197
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 193

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



199
200
201
202
203
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 199

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



205
206
207
208
209
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 205

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 98

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



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

def level
  xpath(%w[Level])
end

#lighting_cost_current ⇒ Object



141
142
143
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 141

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

#lighting_cost_potential ⇒ Object



129
130
131
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 129

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

#lighting_description ⇒ Object



454
455
456
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 454

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

#lighting_energy_efficiency_rating ⇒ Object



458
459
460
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 458

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

#lighting_environmental_efficiency_rating ⇒ Object



462
463
464
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 462

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

#low_energy_fixed_lighting_outlets_count ⇒ Object



398
399
400
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 398

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

#low_energy_lighting ⇒ Object



390
391
392
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 390

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

#main_dwelling_construction_age_band_or_year ⇒ Object



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 542

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



338
339
340
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 338

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

#main_heating_controls ⇒ Object



374
375
376
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 374

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

#mains_gas ⇒ Object



370
371
372
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 370

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

#mechanical_ventilation ⇒ Object



502
503
504
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 502

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

#meter_type ⇒ Object



354
355
356
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 354

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

#multiple_glazed_proportion ⇒ Object



378
379
380
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 378

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

#open_fireplaces_count ⇒ Object



402
403
404
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 402

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

#photovoltaic_roof_area_percent ⇒ Object



466
467
468
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 466

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

#postcode ⇒ Object



30
31
32
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 30

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

#potential_carbon_emission ⇒ Object



145
146
147
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 145

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

#potential_energy_rating ⇒ Object



153
154
155
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 153

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

#potential_energy_saving ⇒ Object



171
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 171

def potential_energy_saving; end

#primary_energy_use ⇒ Object



231
232
233
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 231

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

#property_age_band ⇒ Object



173
174
175
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 173

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

#property_summary ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 72

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



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 576

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-NI-20.0.0", improvement_number: improvement_code).summary : xpath(%w[Improvement-Summary], node),
      improvement_description: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-NI-20.0.0", improvement_number: improvement_code).description : xpath(%w[Improvement-Description], node),
      indicative_cost: xpath(%w[Indicative-Cost], node),
    }
  end
end


93
94
95
96
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 93

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


89
90
91
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 89

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

#report_type ⇒ Object



478
479
480
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 478

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

#sap_main_heating_code ⇒ Object



358
359
360
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 358

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

#scheme_assessor_id ⇒ Object



34
35
36
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 34

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

#secondary_fuel_type ⇒ Object



342
343
344
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 342

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

#secondary_heating_description ⇒ Object



442
443
444
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 442

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

#secondary_heating_energy_efficiency_rating ⇒ Object



446
447
448
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 446

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

#secondary_heating_environmental_efficiency_rating ⇒ Object



450
451
452
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 450

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

#solar_water_heating_flag ⇒ Object



498
499
500
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 498

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

#storey_count ⇒ Object



299
300
301
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 299

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

#tenure ⇒ Object



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

def tenure
  xpath(%w[Tenure])
end

#top_storey ⇒ Object



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

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

#total_floor_area ⇒ Object



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

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

#town ⇒ Object



26
27
28
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 26

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

#transaction_type ⇒ Object



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

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

#unheated_corridor_length ⇒ Object



426
427
428
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 426

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

#water_heating_fuel ⇒ Object



346
347
348
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 346

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

#wind_turbine_count ⇒ Object



418
419
420
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 418

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

#window_description ⇒ Object



430
431
432
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 430

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

#window_energy_efficiency_rating ⇒ Object



434
435
436
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 434

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

#window_environmental_efficiency_rating ⇒ Object



438
439
440
# File 'lib/view_model/rd_sap_schema_ni_200/common_schema.rb', line 438

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