epb_view_models 2.2.14 → 2.2.16

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +8 -0
  3. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -0
  4. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -0
  5. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -0
  6. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -0
  7. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -0
  8. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -0
  9. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -0
  10. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -0
  11. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -0
  12. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -0
  13. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -0
  14. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/ExternalDefinitions.xml +1832 -0
  15. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/ExternalDefinitions.xsd +267 -0
  16. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/AssessorManagement.xsd +212 -0
  17. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/EPC-Certificate.xsd +399 -0
  18. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/EPC-CollectedData.xsd +1453 -0
  19. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/Property.xsd +67 -0
  20. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.xsd +179 -0
  22. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/UDT/EPC-Domains.xsd +940 -0
  23. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/UDT/SAP-Domains.xsd +3557 -0
  24. data/lib/epb_view_models.rb +1 -1
  25. data/lib/view_model/factory.rb +2 -0
  26. data/lib/view_model/rd_sap_schema_s_180/common_schema.rb +541 -0
  27. data/lib/view_model/rd_sap_schema_s_190/common_schema.rb +44 -44
  28. data/lib/view_model/rd_sap_schema_s_210/common_schema.rb +670 -0
  29. data/lib/view_model/rd_sap_wrapper.rb +4 -0
  30. data/lib/view_model/sap_schema_s_1900/common_schema.rb +6 -10
  31. metadata +24 -1
@@ -0,0 +1,670 @@
1
+ module ViewModel
2
+ module RdSapSchemaS210
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[Membership-Number]) or xpath(%w[Certificate-Number])
34
+ end
35
+
36
+ def assessor_name
37
+ xpath(%w[Energy-Assessor Name])
38
+ end
39
+
40
+ def assessor_email
41
+ xpath(%w[Energy-Assessor E-Mail])
42
+ end
43
+
44
+ def assessor_telephone
45
+ xpath(%w[Energy-Assessor 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; end
343
+
344
+ def heated_room_count
345
+ xpath(%w[Heated-Room-Count])&.to_i
346
+ end
347
+
348
+ def low_energy_lighting
349
+ if fixed_lighting_outlets_count.zero?
350
+ return 0
351
+ end
352
+
353
+ ((low_energy_fixed_lighting_outlets_count.to_f / fixed_lighting_outlets_count) * 100).round
354
+ end
355
+
356
+ def fixed_lighting_outlets_count
357
+ fixed_lighting_outlets_count = low_energy_fixed_lighting_outlets_count
358
+ if xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])
359
+ fixed_lighting_outlets_count += xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])&.to_i
360
+ end
361
+ fixed_lighting_outlets_count
362
+ end
363
+
364
+ def low_energy_fixed_lighting_outlets_count
365
+ low_energy_fixed_lighting_outlets_count = 0
366
+ if xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])
367
+ low_energy_fixed_lighting_outlets_count += xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])&.to_i
368
+ end
369
+ if xpath(%w[LED-Fixed-Lighting-Bulbs-Count])
370
+ low_energy_fixed_lighting_outlets_count += xpath(%w[LED-Fixed-Lighting-Bulbs-Count])&.to_i
371
+ end
372
+ if xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])
373
+ low_energy_fixed_lighting_outlets_count += xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])&.to_i
374
+ end
375
+ low_energy_fixed_lighting_outlets_count
376
+ end
377
+
378
+ def open_fireplaces_count
379
+ xpath(%w[Open-Chimneys-Count])&.to_i
380
+ end
381
+
382
+ def hot_water_description
383
+ xpath(%w[Hot-Water Description])
384
+ end
385
+
386
+ def hot_water_energy_efficiency_rating
387
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
388
+ end
389
+
390
+ def hot_water_environmental_efficiency_rating
391
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
392
+ end
393
+
394
+ def wind_turbine_count
395
+ xpath(%w[Wind-Turbines-Count])&.to_i
396
+ end
397
+
398
+ def heat_loss_corridor
399
+ xpath(%w[Heat-Loss-Corridor])
400
+ end
401
+
402
+ def unheated_corridor_length
403
+ xpath(%w[Unheated-Corridor-Length])
404
+ end
405
+
406
+ def window_description
407
+ xpath(%w[Window Description])
408
+ end
409
+
410
+ def window_energy_efficiency_rating
411
+ xpath(%w[Window Energy-Efficiency-Rating])
412
+ end
413
+
414
+ def window_environmental_efficiency_rating
415
+ xpath(%w[Window Environmental-Efficiency-Rating])
416
+ end
417
+
418
+ def secondary_heating_description
419
+ xpath(%w[Secondary-Heating Description])
420
+ end
421
+
422
+ def secondary_heating_energy_efficiency_rating
423
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
424
+ end
425
+
426
+ def secondary_heating_environmental_efficiency_rating
427
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
428
+ end
429
+
430
+ def lighting_description
431
+ xpath(%w[Lighting Description])
432
+ end
433
+
434
+ def lighting_energy_efficiency_rating
435
+ xpath(%w[Lighting Energy-Efficiency-Rating])
436
+ end
437
+
438
+ def lighting_environmental_efficiency_rating
439
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
440
+ end
441
+
442
+ def photovoltaic_roof_area_percent
443
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
444
+ end
445
+
446
+ def built_form
447
+ xpath(%w[Built-Form])
448
+ end
449
+
450
+ def extensions_count
451
+ xpath(%w[Extensions-Count])&.to_i
452
+ end
453
+
454
+ def report_type
455
+ xpath(%w[Report-Type])
456
+ end
457
+
458
+ def all_wall_descriptions
459
+ @xml_doc.search("Wall/Description").map(&:content)
460
+ end
461
+
462
+ def all_wall_energy_efficiency_rating
463
+ @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
464
+ end
465
+
466
+ def all_wall_env_energy_efficiency_rating
467
+ @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
468
+ end
469
+
470
+ def meter_type
471
+ xpath(%w[Meter-Type])
472
+ end
473
+
474
+ def gas_smart_meter_present
475
+ Helper::ToBool.execute(xpath(%w[Gas-Smart-Meter-Present]))
476
+ end
477
+
478
+ def electricity_smart_meter_present
479
+ Helper::ToBool.execute(xpath(%w[Electricity-Smart-Meter-Present]))
480
+ end
481
+
482
+ def floor_level
483
+ xpath(%w[Flat-Location])
484
+ end
485
+
486
+ def solar_water_heating_flag
487
+ xpath(%w[Solar-Water-Heating])
488
+ end
489
+
490
+ def mechanical_ventilation
491
+ xpath(%w[Mechanical-Ventilation])
492
+ end
493
+
494
+ def floor_height
495
+ @xml_doc.search("Room-Height").map(&:content)
496
+ end
497
+
498
+ def all_floor_descriptions
499
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
500
+ end
501
+
502
+ def all_floor_energy_efficiency_rating
503
+ @xml_doc
504
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
505
+ .map(&:content)
506
+ end
507
+
508
+ def all_floor_env_energy_efficiency_rating
509
+ @xml_doc
510
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
511
+ .map(&:content)
512
+ end
513
+
514
+ def all_main_heating_controls_energy_efficiency
515
+ @xml_doc
516
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
517
+ .map(&:content)
518
+ end
519
+
520
+ def all_main_heating_controls_environmental_efficiency
521
+ @xml_doc
522
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
523
+ .map(&:content)
524
+ end
525
+
526
+ def main_dwelling_construction_age_band_or_year
527
+ sap_building_parts =
528
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
529
+ sap_building_parts.each do |sap_building_part|
530
+ building_part_number = sap_building_part.at("Building-Part-Number")
531
+
532
+ # Identifies the Main Dwelling
533
+ if building_part_number&.content == "1"
534
+ return (
535
+ sap_building_part.at_xpath(
536
+ "Construction-Age-Band | Construction-Year",
537
+ )&.content
538
+ )
539
+ end
540
+ end
541
+ nil
542
+ end
543
+
544
+ def cylinder_insul_thickness
545
+ xpath(%w[Cylinder-Insulation-Thickness])
546
+ end
547
+
548
+ def cylinder_insulation_type
549
+ xpath(%w[Cylinder-Insulation-Type])
550
+ end
551
+
552
+ def cylinder_size
553
+ xpath(%w[Cylinder-Size])
554
+ end
555
+
556
+ def has_cylinder_thermostat
557
+ xpath(%w[Cylinder-Thermostat])
558
+ end
559
+
560
+ def party_wall_construction
561
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
562
+ end
563
+
564
+ # For lodgement rules
565
+
566
+ def party_walls_construction
567
+ @xml_doc
568
+ .search("SAP-Building-Part")
569
+ .map do |node|
570
+ xpath(%w[Party-Wall-Construction], node)
571
+ end
572
+ end
573
+
574
+ def walls_thickness
575
+ @xml_doc
576
+ .search("SAP-Building-Part")
577
+ .map do |node|
578
+ {
579
+ alternative_wall_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness")&.content,
580
+ alternative_wall_thickness_measured: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness-Measured")&.content,
581
+ alternative_wall_construction: node.at_xpath("SAP-Alternative-Wall/Wall-Construction")&.content,
582
+ alternative_wall_u_value: node.at_xpath("SAP-Alternative-Wall/Wall-U-Value")&.content,
583
+ alternative_wall_insulation_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Insulation-Thickness")&.content,
584
+ wall_thickness: node.at_xpath("Wall-Thickness")&.content,
585
+ wall_construction: node.at_xpath("Wall-Construction")&.content,
586
+ wall_thickness_measured: node.at_xpath("Wall-Thickness-Measured")&.content,
587
+ }
588
+ end
589
+ end
590
+
591
+ def rooves_construction_and_insulation
592
+ @xml_doc
593
+ .search("SAP-Building-Part")
594
+ .map do |node|
595
+ {
596
+ roof_insulation_location: node.at_xpath("Roof-Insulation-Location")&.content,
597
+ roof_construction: node.at_xpath("Roof-Construction")&.content,
598
+ }
599
+ end
600
+ end
601
+
602
+ def rooms_in_roof_insulation
603
+ nil
604
+ end
605
+
606
+ def floors_insulation
607
+ @xml_doc
608
+ .search("SAP-Building-Part")
609
+ .map do |node|
610
+ {
611
+ floor_u_value: node.at_xpath("Floor-U-Value")&.content,
612
+ floor_insulation_thickness: node.at_xpath("Floor-Insulation-Thickness")&.content,
613
+ }
614
+ end
615
+ end
616
+
617
+ def rooves_insulation
618
+ @xml_doc
619
+ .search("SAP-Building-Part")
620
+ .map do |node|
621
+ {
622
+ roof_u_value: node.at_xpath("Roof-U-Value")&.content,
623
+ roof_insulation_thickness: node.at_xpath("Roof-Insulation-Thickness")&.content,
624
+ rafter_insulation_thickness: node.at_xpath("Rafter-Insulation-Thickness")&.content,
625
+ flat_roof_insulation_thickness: node.at_xpath("Flat-Roof-Insulation-Thickness")&.content,
626
+ sloping_ceiling_insulation_thickness: node.at_xpath("Sloping-Ceiling-Insulation-Thickness")&.content,
627
+ }
628
+ end
629
+ end
630
+
631
+ def walls_insulation
632
+ @xml_doc
633
+ .search("SAP-Building-Part")
634
+ .map do |node|
635
+ {
636
+ wall_u_value: node.at_xpath("Wall-U-Value")&.content,
637
+ wall_insulation_thickness: node.at_xpath("Wall-Insulation-Thickness")&.content,
638
+ }
639
+ end
640
+ end
641
+
642
+ def rooms_in_roof
643
+ nil
644
+ end
645
+
646
+ def rooms_in_roof_roof_insulation
647
+ nil
648
+ end
649
+
650
+ def main_heating_details
651
+ @xml_doc
652
+ .search("Main-Heating")
653
+ .map do |_node|
654
+ {
655
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
656
+ sap_main_heating_code: xpath(%w[SAP-Main-Heating-Code]),
657
+ main_fuel_type: xpath(%w[Main-Fuel-Type]),
658
+ }
659
+ end
660
+ end
661
+
662
+ def water_heating
663
+ {
664
+ water_heating_fuel: xpath(%w[Water-Heating-Fuel]),
665
+ water_heating_code: xpath(%w[Water-Heating-Code]),
666
+ }
667
+ end
668
+ end
669
+ end
670
+ end
@@ -85,6 +85,10 @@ module ViewModel
85
85
  ViewModel::RdSapSchemaNi173::CommonSchema.new xml_doc
86
86
  when :"RdSAP-Schema-S-19.0"
87
87
  ViewModel::RdSapSchemaS190::CommonSchema.new xml_doc
88
+ when :"RdSAP-Schema-S-21.0"
89
+ ViewModel::RdSapSchemaS210::CommonSchema.new xml_doc
90
+ when :"RdSAP-Schema-S-18.0"
91
+ ViewModel::RdSapSchemaS180::CommonSchema.new xml_doc
88
92
  else
89
93
  raise ArgumentError, "Unsupported schema type"
90
94
  end
@@ -51,10 +51,6 @@ module ViewModel
51
51
  xpath(%w[Registration-Date])
52
52
  end
53
53
 
54
- def date_of_completion
55
- xpath(%w[Completion-Date])
56
- end
57
-
58
54
  def address_id
59
55
  xpath(%w[UPRN])
60
56
  end
@@ -603,11 +599,11 @@ module ViewModel
603
599
  def main_heating_types
604
600
  @xml_doc
605
601
  .search("SAP-Heating/Main-Heating-Details/Main-Heating")
606
- .map do |node|
607
- {
608
- main_heating_code: xpath(%w[Main-Heating-Code]),
609
- main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
610
- }
602
+ .map do |_node|
603
+ {
604
+ main_heating_code: xpath(%w[Main-Heating-Code]),
605
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
606
+ }
611
607
  end
612
608
  end
613
609
 
@@ -615,7 +611,7 @@ module ViewModel
615
611
  @xml_doc
616
612
  .search("SAP-Building-Part")
617
613
  .map do |node|
618
- xpath(%w[Construction-Year], node)
614
+ xpath(%w[Construction-Year], node)
619
615
  end
620
616
  end
621
617
  end