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, #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



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_line1Object



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_line2Object



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_line3Object



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_line4Object



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_partsObject



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_descriptionsObject



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_ratingObject



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_ratingObject



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_descriptionsObject



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_descriptionsObject



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_descriptionsObject



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_efficiencyObject



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_efficiencyObject



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_descriptionsObject



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_efficiencyObject



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_efficiencyObject



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_descriptionsObject



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_ratingObject



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_ratingObject



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_dimensionsObject



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_descriptionsObject



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_descriptionsObject



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_ratingObject



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_ratingObject



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_descriptionsObject



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_idObject



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_emailObject



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_nameObject



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_telephoneObject



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_typeObject



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_numberObject



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_formObject



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_areaObject



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_codeObject



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_emissionObject



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_ratingObject



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_demandObject



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_demandObject



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_thicknessObject



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_typeObject



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_sizeObject



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_assessmentObject



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_completionObject



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_expiryObject



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_registrationObject



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_typeObject



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_potentialObject



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_currentObject



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_potentialObject



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_currentObject



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_potentialObject



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_costObject



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

def estimated_energy_cost; end

#extensions_countObject



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_countObject



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_lossObject



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_heightObject



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_levelObject



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_areaObject



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_typeObject



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_countObject



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_thermostatObject



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_corridorObject



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_countObject



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_currentObject



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_potentialObject



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_currentObject



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_potentialObject



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_descriptionObject



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_ratingObject



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_ratingObject



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_typeObject



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_insulationObject



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_insulationObject



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_insulationObject



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

#improvementsObject



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

#levelObject



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_currentObject



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_potentialObject



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_descriptionObject



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_ratingObject



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_ratingObject



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_countObject



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_lightingObject



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_yearObject



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_typeObject



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_controlsObject



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_gasObject



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_ventilationObject



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_typeObject



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_proportionObject



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_countObject



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_percentObject



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

#postcodeObject



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_emissionObject



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_ratingObject



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_savingObject



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

def potential_energy_saving; end

#primary_energy_useObject



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_bandObject



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_summaryObject



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


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_typeObject



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_codeObject



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_idObject



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_typeObject



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_descriptionObject



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_ratingObject



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_ratingObject



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_flagObject



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_countObject



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

#tenureObject



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

def tenure
  xpath(%w[Tenure])
end

#top_storeyObject



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_areaObject



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

#townObject



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_typeObject



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_lengthObject



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_fuelObject



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_countObject



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_descriptionObject



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_ratingObject



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_ratingObject



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