epb_view_models 2.2.18 → 2.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +4 -0
  3. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -0
  4. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -0
  5. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/All-HIP.xsd +25 -0
  6. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -0
  7. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -0
  8. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -0
  9. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -0
  10. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -0
  11. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -0
  12. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -0
  13. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -0
  14. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -0
  15. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -0
  16. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -0
  17. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -0
  18. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -0
  19. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -0
  20. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -0
  22. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -0
  23. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -0
  24. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +6 -1
  25. data/lib/epb_view_models.rb +1 -1
  26. data/lib/presenter/xsd.rb +1 -8
  27. data/lib/view_model/factory.rb +1 -0
  28. data/lib/view_model/rd_sap_schema_s_161/common_schema.rb +556 -0
  29. data/lib/view_model/rd_sap_schema_s_1700/common_schema.rb +15 -0
  30. data/lib/view_model/rd_sap_schema_s_180/common_schema.rb +15 -0
  31. data/lib/view_model/rd_sap_schema_s_190/common_schema.rb +15 -0
  32. data/lib/view_model/rd_sap_schema_s_210/common_schema.rb +15 -0
  33. data/lib/view_model/rd_sap_wrapper.rb +2 -0
  34. metadata +23 -1
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.est.org.uk/epc/estcrV1/DCLG-HIP" xmlns:HIP="http://www.est.org.uk/epc/estcrV1/DCLG-HIP" xmlns:pfdt="http://www.est.org.uk/epc/estcrV1/DCLG-HIP/BaseDataTypes" targetNamespace="http://www.est.org.uk/epc/estcrV1/DCLG-HIP" elementFormDefault="qualified" version="LIG-16.1">
3
+ <xs:annotation>
4
+ <xs:documentation>© Department of Communities and Local Government. © Crown copyright, 2007. The Home Condition Report logo and associated wording is a registered trade mark - any unlicensed use is not permitted. Copyright in the typographical arrangement of this document rests with the Crown. This publication, excluding logos, may be reproduced free of charge in any format or medium for research, private study, for internal circulation within an organisation or by registered scheme users. This is subject to it being reproduced accurately and not used in a misleading context.
5
+
6
+ Type Definitions (TypeDefinitions.xsd) are constrained variants of a primitive datatype whose allowed values must meet some predefined rules
7
+
8
+ Exactly what is a type definition is a bit subjective because it is generally up to the data modeller to make the decision between what is a Value-Type and what is an Entity-Type.
9
+
10
+ For example in some contexts an Address (House Number, Street, Town, Postcode) may be declared as a composite datatype where the value of each Address is recorded against the Addressable Entity but in another context the Address (where there are details to be gathered about the Address itself) it could be a defined referenced Business Entity instead.
11
+
12
+ However, even allowing for some fuzziness at the boundary, a general rule of thumb is that a Type Definition is a data-item that is generally defined outside of the domain and it is not within the domains authority to extend or redefine. There is also only ever one definition in force at any time.
13
+ </xs:documentation>
14
+ </xs:annotation>
15
+ <xs:element name="UValue" type="UValue"/>
16
+ <xs:complexType name="UValue">
17
+ <xs:sequence/>
18
+ </xs:complexType>
19
+ </xs:schema>
@@ -1,6 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- edited with XMLSpy v2006 rel. 3 U (http://www.altova.com) by Jim Bowery (Landmark Information Group Ltd.) -->
3
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.epcregister.com/xsd/rdsap" targetNamespace="http://www.epcregister.com/xsd/rdsap" elementFormDefault="qualified" attributeFormDefault="unqualified" version="LIG-17.00">
3
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ xmlns="http://www.epcregister.com/xsd/rdsap"
5
+ targetNamespace="http://www.epcregister.com/xsd/rdsap"
6
+ elementFormDefault="qualified"
7
+ attributeFormDefault="unqualified"
8
+ version="LIG-17.00">
4
9
  <xs:annotation>
5
10
  <xs:documentation>© Department of Communities and Local Government. © Crown copyright, 2007. The Home Condition Report logo and associated wording is a registered trade mark - any unlicensed use is not permitted. Copyright in the typographical arrangement of this document rests with the Crown. This publication, excluding logos, may be reproduced free of charge in any format or medium for research, private study, for internal circulation within an organisation or by registered scheme users. This is subject to it being reproduced accurately and not used in a misleading context.</xs:documentation>
6
11
  </xs:annotation>
@@ -5,7 +5,7 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "2.2.18"
8
+ VERSION = "2.2.19"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
data/lib/presenter/xsd.rb CHANGED
@@ -25,15 +25,8 @@ module Presenter
25
25
  end
26
26
 
27
27
  def unique_enums(domain_arguments)
28
- uniq_enums = []
29
28
  enums = get_enums_by_type(domain_arguments).values
30
-
31
- enums.each_with_index do |_hash, i|
32
- if i.positive? && (enums[i].to_a != enums[i + 1].to_a)
33
- uniq_enums << enums[i]
34
- end
35
- end
36
- uniq_enums
29
+ enums.group_by(&:inspect).values.map(&:first)
37
30
  end
38
31
 
39
32
  def variation_between_schema_versions?(enums_hash)
@@ -40,6 +40,7 @@ module ViewModel
40
40
  RdSAP-Schema-S-21.0
41
41
  RdSAP-Schema-S-18.0
42
42
  RdSAP-Schema-S-17.00
43
+ RdSAP-Schema-S-16.1
43
44
  ].freeze
44
45
  TYPES_OF_SAP = %i[
45
46
  SAP-Schema-19.2.0
@@ -0,0 +1,556 @@
1
+ module ViewModel
2
+ module RdSapSchemaS161
3
+ class CommonSchema < ViewModel::DomesticEpcViewModel
4
+ def assessment_id
5
+ xpath(%w[RRN])
6
+ end
7
+
8
+ def address_line1
9
+ xpath(%w[Property Address Address-Line-1])
10
+ end
11
+
12
+ def address_line2
13
+ xpath(%w[Property Address Address-Line-2]).to_s
14
+ end
15
+
16
+ def address_line3
17
+ xpath(%w[Property Address Address-Line-3]).to_s
18
+ end
19
+
20
+ def address_line4
21
+ xpath(%w[Property Address Address-Line-4]).to_s
22
+ end
23
+
24
+ def town
25
+ xpath(%w[Property Address Post-Town])
26
+ end
27
+
28
+ def postcode
29
+ xpath(%w[Property Address Postcode])
30
+ end
31
+
32
+ def scheme_assessor_id
33
+ xpath(%w[Identification-Number Membership-Number]) or xpath(%w[Identification-Number Certificate-Number])
34
+ end
35
+
36
+ def assessor_name
37
+ "#{xpath(%w[Home-Inspector Name First-Name])} #{xpath(%w[Home-Inspector Name Surname])}"
38
+ end
39
+
40
+ def assessor_email
41
+ xpath(%w[Home-Inspector E-Mail])
42
+ end
43
+
44
+ def assessor_telephone
45
+ xpath(%w[Home-Inspector Telephone])
46
+ end
47
+
48
+ def date_of_assessment
49
+ xpath(%w[Inspection-Date])
50
+ end
51
+
52
+ def date_of_registration
53
+ xpath(%w[Registration-Date])
54
+ end
55
+
56
+ def date_of_completion
57
+ xpath(%w[Completion-Date])
58
+ end
59
+
60
+ def address_id
61
+ "LPRN-#{xpath(%w[UPRN])}"
62
+ end
63
+
64
+ def date_of_expiry
65
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
66
+
67
+ expires_at.to_s
68
+ end
69
+
70
+ def property_summary
71
+ @xml_doc.search("Energy-Assessment Property-Summary").children.select(
72
+ &:element?
73
+ ).map { |node|
74
+ next if xpath(%w[Energy-Efficiency-Rating], node).nil?
75
+
76
+ {
77
+ energy_efficiency_rating:
78
+ xpath(%w[Energy-Efficiency-Rating], node).to_i,
79
+ environmental_efficiency_rating:
80
+ xpath(%w[Environmental-Efficiency-Rating], node).to_i,
81
+ name: node.name.underscore,
82
+ description: xpath(%w[Description], node),
83
+ }
84
+ }.compact
85
+ end
86
+
87
+ def related_party_disclosure_text
88
+ xpath(%w[Related-Party-Disclosure-Text])
89
+ end
90
+
91
+ def related_party_disclosure_number
92
+ disclosure_number = xpath(%w[Related-Party-Disclosure-Number])
93
+ disclosure_number.nil? ? nil : disclosure_number.to_i
94
+ end
95
+
96
+ def improvements
97
+ @xml_doc
98
+ .search("Suggested-Improvements Improvement")
99
+ .map do |node|
100
+ {
101
+ energy_performance_rating_improvement:
102
+ xpath(%w[Energy-Performance-Rating], node).to_i,
103
+ environmental_impact_rating_improvement:
104
+ xpath(%w[Environmental-Impact-Rating], node).to_i,
105
+ green_deal_category_code: xpath(%w[Green-Deal-Category], node),
106
+ improvement_category: xpath(%w[Improvement-Category], node),
107
+ improvement_code:
108
+ xpath(%w[Improvement-Details Improvement-Number], node),
109
+ improvement_description: xpath(%w[Improvement-Description], node),
110
+ improvement_title: improvement_title(node),
111
+ improvement_type: xpath(%w[Improvement-Type], node),
112
+ indicative_cost: xpath(%w[Indicative-Cost], node),
113
+ sequence: xpath(%w[Sequence], node).to_i,
114
+ typical_saving: xpath(%w[Typical-Saving], node),
115
+ }
116
+ end
117
+ end
118
+
119
+ def recommendations_for_report
120
+ @xml_doc
121
+ .search("Suggested-Improvements Improvement")
122
+ .map do |node|
123
+ {
124
+ sequence: xpath(%w[Sequence], node).to_i,
125
+ improvement_summary: xpath(%w[Improvement-Summary], node),
126
+ improvement_description: xpath(%w[Improvement-Description], node),
127
+ improvement_code:
128
+ xpath(%w[Improvement-Details Improvement-Number], node),
129
+ indicative_cost: xpath(%w[Indicative-Cost], node),
130
+ }
131
+ end
132
+ end
133
+
134
+ def hot_water_cost_potential
135
+ xpath(%w[Hot-Water-Cost-Potential])
136
+ end
137
+
138
+ def heating_cost_potential
139
+ xpath(%w[Heating-Cost-Potential])
140
+ end
141
+
142
+ def lighting_cost_potential
143
+ xpath(%w[Lighting-Cost-Potential])
144
+ end
145
+
146
+ def hot_water_cost_current
147
+ xpath(%w[Hot-Water-Cost-Current])
148
+ end
149
+
150
+ def heating_cost_current
151
+ xpath(%w[Heating-Cost-Current])
152
+ end
153
+
154
+ def lighting_cost_current
155
+ xpath(%w[Lighting-Cost-Current])
156
+ end
157
+
158
+ def potential_carbon_emission
159
+ xpath(%w[CO2-Emissions-Potential])
160
+ end
161
+
162
+ def current_carbon_emission
163
+ xpath(%w[CO2-Emissions-Current])
164
+ end
165
+
166
+ def potential_energy_rating
167
+ xpath(%w[Energy-Rating-Potential])&.to_i
168
+ end
169
+
170
+ def current_energy_rating
171
+ xpath(%w[Energy-Rating-Current])&.to_i
172
+ end
173
+
174
+ def estimated_energy_cost; end
175
+
176
+ def total_floor_area
177
+ xpath(%w[Property-Summary Total-Floor-Area])
178
+ end
179
+
180
+ def dwelling_type
181
+ xpath(%w[Dwelling-Type])
182
+ end
183
+
184
+ def potential_energy_saving; end
185
+
186
+ def property_age_band
187
+ xpath(%w[Construction-Age-Band])
188
+ end
189
+
190
+ def tenure
191
+ xpath(%w[Tenure])
192
+ end
193
+
194
+ def transaction_type
195
+ xpath(%w[Transaction-Type])
196
+ end
197
+
198
+ def current_space_heating_demand
199
+ xpath(%w[Space-Heating-Existing-Dwelling])
200
+ end
201
+
202
+ def current_water_heating_demand
203
+ xpath(%w[Water-Heating])
204
+ end
205
+
206
+ def impact_of_cavity_insulation
207
+ if xpath(%w[Impact-Of-Cavity-Insulation])
208
+ xpath(%w[Impact-Of-Cavity-Insulation])&.to_i
209
+ end
210
+ end
211
+
212
+ def impact_of_loft_insulation
213
+ if xpath(%w[Impact-Of-Loft-Insulation])
214
+ xpath(%w[Impact-Of-Loft-Insulation])&.to_i
215
+ end
216
+ end
217
+
218
+ def impact_of_solid_wall_insulation
219
+ if xpath(%w[Impact-Of-Solid-Wall-Insulation])
220
+ xpath(%w[Impact-Of-Solid-Wall-Insulation])&.to_i
221
+ end
222
+ end
223
+
224
+ def habitable_room_count
225
+ xpath(%w[Habitable-Room-Count])&.to_i
226
+ end
227
+
228
+ def energy_rating_current
229
+ xpath(%w[Energy-Rating-Current])&.to_i
230
+ end
231
+
232
+ def energy_rating_potential
233
+ xpath(%w[Energy-Rating-Potential])&.to_i
234
+ end
235
+
236
+ def environmental_impact_current
237
+ xpath(%w[Environmental-Impact-Current])&.to_i
238
+ end
239
+
240
+ def environmental_impact_potential
241
+ xpath(%w[Environmental-Impact-Potential])&.to_i
242
+ end
243
+
244
+ def primary_energy_use
245
+ xpath(%w[Energy-Consumption-Current])&.to_f
246
+ end
247
+
248
+ def energy_consumption_potential
249
+ xpath(%w[Energy-Consumption-Potential])&.to_f
250
+ end
251
+
252
+ def all_roof_descriptions
253
+ @xml_doc.search("Roof/Description").map(&:content)
254
+ end
255
+
256
+ def all_roof_energy_efficiency_rating
257
+ @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
258
+ end
259
+
260
+ def all_roof_env_energy_efficiency_rating
261
+ @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
262
+ end
263
+
264
+ def all_window_descriptions
265
+ @xml_doc.search("Window/Description").map(&:content)
266
+ end
267
+
268
+ def all_main_heating_descriptions
269
+ @xml_doc.search("Main-Heating/Description").map(&:content)
270
+ end
271
+
272
+ def all_main_heating_controls_descriptions
273
+ @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
274
+ end
275
+
276
+ def all_main_heating_energy_efficiency
277
+ @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
278
+ end
279
+
280
+ def all_main_heating_environmental_efficiency
281
+ @xml_doc
282
+ .search("Main-Heating/Environmental-Efficiency-Rating")
283
+ .map(&:content)
284
+ end
285
+
286
+ def all_hot_water_descriptions
287
+ @xml_doc.search("Hot-Water/Description").map(&:content)
288
+ end
289
+
290
+ def all_lighting_descriptions
291
+ @xml_doc.search("Lighting/Description").map(&:content)
292
+ end
293
+
294
+ def all_secondary_heating_descriptions
295
+ @xml_doc.search("Secondary-Heating/Description").map(&:content)
296
+ end
297
+
298
+ def country_code
299
+ xpath(%w[Country-Code])
300
+ end
301
+
302
+ def main_fuel_type
303
+ xpath(%w[Main-Fuel-Type])
304
+ end
305
+
306
+ def secondary_fuel_type
307
+ xpath(%w[Secondary-Fuel-Type])
308
+ end
309
+
310
+ def water_heating_fuel
311
+ xpath(%w[Water-Heating-Fuel])
312
+ end
313
+
314
+ def co2_emissions_current_per_floor_area
315
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])&.to_f
316
+ end
317
+
318
+ def mains_gas
319
+ xpath(%w[Mains-Gas])
320
+ end
321
+
322
+ def level
323
+ xpath(%w[Level])
324
+ end
325
+
326
+ def top_storey
327
+ xpath(%w[Top-Storey])
328
+ end
329
+
330
+ def storey_count
331
+ xpath(%w[Storey-Count])&.to_i
332
+ end
333
+
334
+ def main_heating_controls
335
+ xpath(%w[Main-Heating-Controls Description])
336
+ end
337
+
338
+ def multiple_glazed_proportion
339
+ xpath(%w[Multiple-Glazed-Proportion])
340
+ end
341
+
342
+ def glazed_area
343
+ xpath(%w[Glazed-Area])
344
+ end
345
+
346
+ def heated_room_count
347
+ xpath(%w[Heated-Room-Count])&.to_i
348
+ end
349
+
350
+ def low_energy_lighting
351
+ xpath(%w[Low-Energy-Lighting])
352
+ end
353
+
354
+ def fixed_lighting_outlets_count
355
+ xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i
356
+ end
357
+
358
+ def low_energy_fixed_lighting_outlets_count
359
+ xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i
360
+ end
361
+
362
+ def open_fireplaces_count
363
+ xpath(%w[Open-Fireplaces-Count])&.to_i
364
+ end
365
+
366
+ def hot_water_description
367
+ xpath(%w[Hot-Water Description])
368
+ end
369
+
370
+ def hot_water_energy_efficiency_rating
371
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
372
+ end
373
+
374
+ def hot_water_environmental_efficiency_rating
375
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
376
+ end
377
+
378
+ def wind_turbine_count
379
+ xpath(%w[Wind-Turbines-Count])&.to_i
380
+ end
381
+
382
+ def heat_loss_corridor
383
+ xpath(%w[Heat-Loss-Corridor])
384
+ end
385
+
386
+ def unheated_corridor_length
387
+ xpath(%w[Unheated-Corridor-Length])
388
+ end
389
+
390
+ def window_description
391
+ xpath(%w[Window Description])
392
+ end
393
+
394
+ def window_energy_efficiency_rating
395
+ xpath(%w[Window Energy-Efficiency-Rating])
396
+ end
397
+
398
+ def window_environmental_efficiency_rating
399
+ xpath(%w[Window Environmental-Efficiency-Rating])
400
+ end
401
+
402
+ def secondary_heating_description
403
+ xpath(%w[Secondary-Heating Description])
404
+ end
405
+
406
+ def secondary_heating_energy_efficiency_rating
407
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
408
+ end
409
+
410
+ def secondary_heating_environmental_efficiency_rating
411
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
412
+ end
413
+
414
+ def lighting_description
415
+ xpath(%w[Lighting Description])
416
+ end
417
+
418
+ def lighting_energy_efficiency_rating
419
+ xpath(%w[Lighting Energy-Efficiency-Rating])
420
+ end
421
+
422
+ def lighting_environmental_efficiency_rating
423
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
424
+ end
425
+
426
+ def photovoltaic_roof_area_percent
427
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
428
+ end
429
+
430
+ def built_form
431
+ xpath(%w[Built-Form])
432
+ end
433
+
434
+ def extensions_count
435
+ xpath(%w[Extensions-Count])&.to_i
436
+ end
437
+
438
+ def report_type
439
+ xpath(%w[Report-Type])
440
+ end
441
+
442
+ def all_wall_descriptions
443
+ @xml_doc.search("Wall/Description").map(&:content)
444
+ end
445
+
446
+ def all_wall_energy_efficiency_rating
447
+ @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
448
+ end
449
+
450
+ def all_wall_env_energy_efficiency_rating
451
+ @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
452
+ end
453
+
454
+ def meter_type
455
+ xpath(%w[Meter-Type])
456
+ end
457
+
458
+ def floor_level
459
+ xpath(%w[Flat-Location])
460
+ end
461
+
462
+ def solar_water_heating_flag
463
+ xpath(%w[Solar-Water-Heating])
464
+ end
465
+
466
+ def mechanical_ventilation
467
+ xpath(%w[Mechanical-Ventilation])
468
+ end
469
+
470
+ def floor_height
471
+ @xml_doc.search("Room-Height").map(&:content)
472
+ end
473
+
474
+ def all_floor_descriptions
475
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
476
+ end
477
+
478
+ def all_floor_energy_efficiency_rating
479
+ @xml_doc
480
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
481
+ .map(&:content)
482
+ end
483
+
484
+ def all_floor_env_energy_efficiency_rating
485
+ @xml_doc
486
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
487
+ .map(&:content)
488
+ end
489
+
490
+ def all_main_heating_controls_energy_efficiency
491
+ @xml_doc
492
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
493
+ .map(&:content)
494
+ end
495
+
496
+ def all_main_heating_controls_environmental_efficiency
497
+ @xml_doc
498
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
499
+ .map(&:content)
500
+ end
501
+
502
+ def main_dwelling_construction_age_band_or_year
503
+ sap_building_parts =
504
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
505
+ sap_building_parts.each do |sap_building_part|
506
+ building_part_number = sap_building_part.at("Building-Part-Number")
507
+
508
+ # Identifies the Main Dwelling
509
+ if building_part_number&.content == "1"
510
+ return (
511
+ sap_building_part.at_xpath(
512
+ "Construction-Age-Band | Construction-Year",
513
+ )&.content
514
+ )
515
+ end
516
+ end
517
+ nil
518
+ end
519
+
520
+ def cylinder_insul_thickness
521
+ xpath(%w[Cylinder-Insulation-Thickness])
522
+ end
523
+
524
+ def cylinder_insulation_type
525
+ xpath(%w[Cylinder-Insulation-Type])
526
+ end
527
+
528
+ def cylinder_size
529
+ xpath(%w[Cylinder-Size])
530
+ end
531
+
532
+ def has_cylinder_thermostat
533
+ xpath(%w[Cylinder-Thermostat])
534
+ end
535
+
536
+ def party_wall_construction
537
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
538
+ end
539
+
540
+ def lzc_energy_sources
541
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
542
+
543
+ @xml_doc
544
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
545
+ .select(&:element?)
546
+ .map { |n| n.text.to_i }
547
+ end
548
+
549
+ def addendum
550
+ return nil if xpath(%w[Addendum]).nil?
551
+
552
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
553
+ end
554
+ end
555
+ end
556
+ end
@@ -536,6 +536,21 @@ module ViewModel
536
536
  def party_wall_construction
537
537
  xpath(%w[SAP-Building-Part Party-Wall-Construction])
538
538
  end
539
+
540
+ def lzc_energy_sources
541
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
542
+
543
+ @xml_doc
544
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
545
+ .select(&:element?)
546
+ .map { |n| n.text.to_i }
547
+ end
548
+
549
+ def addendum
550
+ return nil if xpath(%w[Addendum]).nil?
551
+
552
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
553
+ end
539
554
  end
540
555
  end
541
556
  end
@@ -536,6 +536,21 @@ module ViewModel
536
536
  def party_wall_construction
537
537
  xpath(%w[SAP-Building-Part Party-Wall-Construction])
538
538
  end
539
+
540
+ def lzc_energy_sources
541
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
542
+
543
+ @xml_doc
544
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
545
+ .select(&:element?)
546
+ .map { |n| n.text.to_i }
547
+ end
548
+
549
+ def addendum
550
+ return nil if xpath(%w[Addendum]).nil?
551
+
552
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
553
+ end
539
554
  end
540
555
  end
541
556
  end
@@ -656,6 +656,21 @@ module ViewModel
656
656
  water_heating_code: xpath(%w[Water-Heating-Code]),
657
657
  }
658
658
  end
659
+
660
+ def lzc_energy_sources
661
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
662
+
663
+ @xml_doc
664
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
665
+ .select(&:element?)
666
+ .map { |n| n.text.to_i }
667
+ end
668
+
669
+ def addendum
670
+ return nil if xpath(%w[Addendum]).nil?
671
+
672
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
673
+ end
659
674
  end
660
675
  end
661
676
  end