epb_view_models 1.0.12 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +10 -10
- data/Gemfile.lock +32 -39
- data/api/schemas/data/orchestrate.json +4 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/ExternalDefinitions.xml +1352 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/ExternalDefinitions.xsd +236 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/AssessorManagement.xsd +207 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/EPC-Certificate.xsd +476 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/ExceptionList.xsd +18 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/Property.xsd +71 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/ReportList.xsd +25 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-CollectedData.xsd +1793 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-Compliance-Report.xsd +36 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-Report.xsd +196 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/EPC-Domains.xsd +558 -0
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/SAP-Domains.xsd +3127 -0
- data/lib/epb_view_models.rb +1 -1
- data/lib/presenter/ac_cert/export_configuration.rb +7 -0
- data/lib/presenter/ac_report/export_configuration.rb +7 -0
- data/lib/presenter/cepc/export_configuration.rb +7 -0
- data/lib/presenter/cepc_rr/export_configuration.rb +7 -0
- data/lib/presenter/dec/export_configuration.rb +7 -0
- data/lib/presenter/dec_rr/export_configuration.rb +7 -0
- data/lib/presenter/export/statistics.rb +18 -0
- data/lib/presenter/rd_sap/export_configuration.rb +57 -0
- data/lib/presenter/sap/export_configuration.rb +7 -0
- data/lib/presenter/to_warehouse/base_configuration.rb +23 -0
- data/lib/presenter/xml/parser.rb +226 -0
- data/lib/view_model/factory.rb +1 -0
- data/lib/view_model/sap_schema_1900/common_schema.rb +587 -0
- data/lib/view_model/sap_wrapper.rb +2 -0
- data/lib/view_model_gateway/xsd_files_gateway.rb +4 -3
- metadata +26 -2
@@ -0,0 +1,587 @@
|
|
1
|
+
module ViewModel
|
2
|
+
module SapSchema1900
|
3
|
+
class CommonSchema < ViewModel::DomesticEpcViewModel
|
4
|
+
def assessment_id
|
5
|
+
xpath(%w[Report-Header RRN])
|
6
|
+
end
|
7
|
+
|
8
|
+
def address_line1
|
9
|
+
xpath(%w[Report-Header Property Address Address-Line-1])
|
10
|
+
end
|
11
|
+
|
12
|
+
def address_line2
|
13
|
+
xpath(%w[Report-Header Property Address Address-Line-2])
|
14
|
+
end
|
15
|
+
|
16
|
+
def address_line3
|
17
|
+
xpath(%w[Report-Header Property Address Address-Line-3])
|
18
|
+
end
|
19
|
+
|
20
|
+
def town
|
21
|
+
xpath(%w[Report-Header Property Address Post-Town])
|
22
|
+
end
|
23
|
+
|
24
|
+
def postcode
|
25
|
+
xpath(%w[Report-Header Property Address Postcode])
|
26
|
+
end
|
27
|
+
|
28
|
+
def scheme_assessor_id
|
29
|
+
xpath(%w[Certificate-Number])
|
30
|
+
end
|
31
|
+
|
32
|
+
def assessor_name
|
33
|
+
xpath(%w[Home-Inspector Name])
|
34
|
+
end
|
35
|
+
|
36
|
+
def assessor_email
|
37
|
+
xpath(%w[Home-Inspector/E-Mail])
|
38
|
+
end
|
39
|
+
|
40
|
+
def assessor_telephone
|
41
|
+
xpath(%w[Home-Inspector/Telephone])
|
42
|
+
end
|
43
|
+
|
44
|
+
def date_of_assessment
|
45
|
+
xpath(%w[Inspection-Date])
|
46
|
+
end
|
47
|
+
|
48
|
+
def date_of_registration
|
49
|
+
xpath(%w[Registration-Date])
|
50
|
+
end
|
51
|
+
|
52
|
+
def date_of_completion
|
53
|
+
xpath(%w[Completion-Date])
|
54
|
+
end
|
55
|
+
|
56
|
+
def address_id
|
57
|
+
xpath(%w[UPRN])
|
58
|
+
end
|
59
|
+
|
60
|
+
def date_of_expiry
|
61
|
+
expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
|
62
|
+
|
63
|
+
expires_at.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def property_summary
|
67
|
+
@xml_doc.search("Energy-Assessment Property-Summary").children.select(
|
68
|
+
&:element?
|
69
|
+
).map { |node|
|
70
|
+
next if xpath(%w[Energy-Efficiency-Rating], node).nil?
|
71
|
+
|
72
|
+
{
|
73
|
+
energy_efficiency_rating:
|
74
|
+
xpath(%w[Energy-Efficiency-Rating], node).to_i,
|
75
|
+
environmental_efficiency_rating:
|
76
|
+
xpath(%w[Environmental-Efficiency-Rating], node).to_i,
|
77
|
+
name: node.name.underscore,
|
78
|
+
description: xpath(%w[Description], node),
|
79
|
+
}
|
80
|
+
}.compact
|
81
|
+
end
|
82
|
+
|
83
|
+
def related_party_disclosure_text
|
84
|
+
xpath(%w[Related-Party-Disclosure-Text])
|
85
|
+
end
|
86
|
+
|
87
|
+
def related_party_disclosure_number
|
88
|
+
xpath(%w[Related-Party-Disclosure-Number])&.to_i
|
89
|
+
end
|
90
|
+
|
91
|
+
def improvements
|
92
|
+
@xml_doc
|
93
|
+
.search("Suggested-Improvements Improvement")
|
94
|
+
.map do |node|
|
95
|
+
{
|
96
|
+
energy_performance_rating_improvement:
|
97
|
+
xpath(%w[Energy-Performance-Rating], node).to_i,
|
98
|
+
environmental_impact_rating_improvement:
|
99
|
+
xpath(%w[Environmental-Impact-Rating], node).to_i,
|
100
|
+
green_deal_category_code: xpath(%w[Green-Deal-Category], node),
|
101
|
+
improvement_category: xpath(%w[Improvement-Category], node),
|
102
|
+
improvement_code:
|
103
|
+
xpath(%w[Improvement-Details Improvement-Number], node),
|
104
|
+
improvement_description: xpath(%w[Improvement-Description], node),
|
105
|
+
improvement_title: improvement_title(node),
|
106
|
+
improvement_type: xpath(%w[Improvement-Type], node),
|
107
|
+
indicative_cost: xpath(%w[Indicative-Cost], node),
|
108
|
+
sequence: xpath(%w[Sequence], node).to_i,
|
109
|
+
typical_saving: xpath(%w[Typical-Saving], node),
|
110
|
+
}
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def recommendations_for_report
|
115
|
+
@xml_doc
|
116
|
+
.search("Suggested-Improvements Improvement")
|
117
|
+
.map do |node|
|
118
|
+
{
|
119
|
+
sequence: xpath(%w[Sequence], node).to_i,
|
120
|
+
improvement_summary: xpath(%w[Improvement-Summary], node),
|
121
|
+
improvement_description: xpath(%w[Improvement-Description], node),
|
122
|
+
improvement_code:
|
123
|
+
xpath(%w[Improvement-Details Improvement-Number], node),
|
124
|
+
indicative_cost: xpath(%w[Indicative-Cost], node),
|
125
|
+
}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def hot_water_cost_potential
|
130
|
+
xpath(%w[Hot-Water-Cost-Potential])
|
131
|
+
end
|
132
|
+
|
133
|
+
def heating_cost_potential
|
134
|
+
xpath(%w[Heating-Cost-Potential])
|
135
|
+
end
|
136
|
+
|
137
|
+
def lighting_cost_potential
|
138
|
+
xpath(%w[Lighting-Cost-Potential])
|
139
|
+
end
|
140
|
+
|
141
|
+
def hot_water_cost_current
|
142
|
+
xpath(%w[Hot-Water-Cost-Current])
|
143
|
+
end
|
144
|
+
|
145
|
+
def heating_cost_current
|
146
|
+
xpath(%w[Heating-Cost-Current])
|
147
|
+
end
|
148
|
+
|
149
|
+
def lighting_cost_current
|
150
|
+
xpath(%w[Lighting-Cost-Current])
|
151
|
+
end
|
152
|
+
|
153
|
+
def potential_carbon_emission
|
154
|
+
xpath(%w[CO2-Emissions-Potential])
|
155
|
+
end
|
156
|
+
|
157
|
+
def current_carbon_emission
|
158
|
+
xpath(%w[CO2-Emissions-Current])
|
159
|
+
end
|
160
|
+
|
161
|
+
def potential_energy_rating
|
162
|
+
xpath(%w[Energy-Rating-Potential]).to_i
|
163
|
+
end
|
164
|
+
|
165
|
+
def current_energy_rating
|
166
|
+
xpath(%w[Energy-Rating-Current]).to_i
|
167
|
+
end
|
168
|
+
|
169
|
+
def primary_energy_use
|
170
|
+
xpath(%w[Energy-Consumption-Current])
|
171
|
+
end
|
172
|
+
|
173
|
+
def energy_consumption_potential
|
174
|
+
xpath(%w[Energy-Consumption-Potential])
|
175
|
+
end
|
176
|
+
|
177
|
+
def estimated_energy_cost
|
178
|
+
xpath(%w[Estimated-Energy-Cost])
|
179
|
+
end
|
180
|
+
|
181
|
+
def total_floor_area
|
182
|
+
xpath(%w[Property-Summary Total-Floor-Area]).to_i
|
183
|
+
end
|
184
|
+
|
185
|
+
def dwelling_type
|
186
|
+
xpath(%w[Dwelling-Type])
|
187
|
+
end
|
188
|
+
|
189
|
+
def potential_energy_saving; end
|
190
|
+
|
191
|
+
def property_age_band
|
192
|
+
xpath(%w[Construction-Year])
|
193
|
+
end
|
194
|
+
|
195
|
+
def main_dwelling_construction_age_band_or_year
|
196
|
+
sap_building_parts =
|
197
|
+
@xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
|
198
|
+
sap_building_parts.each do |sap_building_part|
|
199
|
+
building_part_number = sap_building_part.at("Building-Part-Number")
|
200
|
+
|
201
|
+
# Identifies the Main Dwelling
|
202
|
+
if building_part_number&.content == "1"
|
203
|
+
return(
|
204
|
+
sap_building_part.at_xpath(
|
205
|
+
"Construction-Age-Band | Construction-Year",
|
206
|
+
)&.content
|
207
|
+
)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
nil
|
211
|
+
end
|
212
|
+
|
213
|
+
def tenure
|
214
|
+
xpath(%w[Tenure])
|
215
|
+
end
|
216
|
+
|
217
|
+
def transaction_type
|
218
|
+
xpath(%w[Transaction-Type])
|
219
|
+
end
|
220
|
+
|
221
|
+
def current_space_heating_demand
|
222
|
+
xpath(%w[Space-Heating]) or xpath(%w[Space-Heating-Existing-Dwelling])
|
223
|
+
end
|
224
|
+
|
225
|
+
def current_water_heating_demand
|
226
|
+
xpath(%w[Water-Heating])
|
227
|
+
end
|
228
|
+
|
229
|
+
def impact_of_cavity_insulation
|
230
|
+
if xpath(%w[Impact-Of-Cavity-Insulation])
|
231
|
+
xpath(%w[Impact-Of-Cavity-Insulation]).to_i
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def impact_of_loft_insulation
|
236
|
+
if xpath(%w[Impact-Of-Loft-Insulation])
|
237
|
+
xpath(%w[Impact-Of-Loft-Insulation]).to_i
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def impact_of_solid_wall_insulation
|
242
|
+
if xpath(%w[Impact-Of-Solid-Wall-Insulation])
|
243
|
+
xpath(%w[Impact-Of-Solid-Wall-Insulation]).to_i
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def all_sap_floor_dimensions
|
248
|
+
@xml_doc.search("SAP-Floor-Dimension").select(&:element?).map { |node|
|
249
|
+
{ total_floor_area: xpath(%w[Total-Floor-Area], node).to_f }
|
250
|
+
}.compact
|
251
|
+
end
|
252
|
+
|
253
|
+
def type_of_assessment
|
254
|
+
"SAP"
|
255
|
+
end
|
256
|
+
|
257
|
+
def level
|
258
|
+
xpath(%w[Level])
|
259
|
+
end
|
260
|
+
|
261
|
+
def top_storey
|
262
|
+
flat_level_code = xpath(%w[Level])
|
263
|
+
flat_level_code == "3" ? "Y" : "N"
|
264
|
+
end
|
265
|
+
|
266
|
+
def storey_count
|
267
|
+
nil
|
268
|
+
end
|
269
|
+
|
270
|
+
def building_part_number
|
271
|
+
xpath(%w[Building-Part-Number])
|
272
|
+
end
|
273
|
+
|
274
|
+
def all_building_parts
|
275
|
+
@xml_doc
|
276
|
+
.search("SAP-Building-Parts/SAP-Building-Part")
|
277
|
+
.map do |part|
|
278
|
+
{
|
279
|
+
roof_insulation_thickness:
|
280
|
+
if part.xpath("Roof-Insulation-Thickness").empty?
|
281
|
+
nil
|
282
|
+
else
|
283
|
+
part.xpath("Roof-Insulation-Thickness").text
|
284
|
+
end,
|
285
|
+
rafter_insulation_thickness:
|
286
|
+
xpath(%w[Rafter-Insulation-Thickness], part),
|
287
|
+
flat_roof_insulation_thickness:
|
288
|
+
xpath(%w[Flat-Roof-Insulation-Thickness], part),
|
289
|
+
sloping_ceiling_insulation_thickness:
|
290
|
+
xpath(%w[Sloping-Ceiling-Insulation-Thickness], part),
|
291
|
+
roof_u_value: xpath(%w[Roof-U-Value], part),
|
292
|
+
}
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def floor_heat_loss
|
297
|
+
xpath(%w[Floor-Heat-Loss])
|
298
|
+
end
|
299
|
+
|
300
|
+
def immersion_heating_type
|
301
|
+
xpath(%w[Immersion-Heating-Type])
|
302
|
+
end
|
303
|
+
|
304
|
+
def main_heating_category
|
305
|
+
xpath(%w[Main-Heating-Category])
|
306
|
+
end
|
307
|
+
|
308
|
+
def main_fuel_type
|
309
|
+
xpath(%w[Main-Fuel-Type])
|
310
|
+
end
|
311
|
+
|
312
|
+
def secondary_fuel_type
|
313
|
+
xpath(%w[Secondary-Fuel-Type])
|
314
|
+
end
|
315
|
+
|
316
|
+
def water_heating_fuel
|
317
|
+
xpath(%w[Water-Fuel-Type])
|
318
|
+
end
|
319
|
+
|
320
|
+
def boiler_flue_type
|
321
|
+
xpath(%w[Boiler-Flue-Type])
|
322
|
+
end
|
323
|
+
|
324
|
+
def meter_type
|
325
|
+
xpath(%w[Meter-Type])
|
326
|
+
end
|
327
|
+
|
328
|
+
def sap_main_heating_code
|
329
|
+
xpath(%w[SAP-Main-Heating-Code])
|
330
|
+
end
|
331
|
+
|
332
|
+
def country_code
|
333
|
+
xpath(%w[Country-Code])
|
334
|
+
end
|
335
|
+
|
336
|
+
def environmental_impact_current
|
337
|
+
xpath(%w[Environmental-Impact-Current])
|
338
|
+
end
|
339
|
+
|
340
|
+
def environmental_impact_potential
|
341
|
+
xpath(%w[Environmental-Impact-Potential])
|
342
|
+
end
|
343
|
+
|
344
|
+
def co2_emissions_current_per_floor_area
|
345
|
+
xpath(%w[CO2-Emissions-Current-Per-Floor-Area])
|
346
|
+
end
|
347
|
+
|
348
|
+
def mains_gas
|
349
|
+
nil
|
350
|
+
end
|
351
|
+
|
352
|
+
def main_heating_controls
|
353
|
+
xpath(%w[Main-Heating-Controls Description])
|
354
|
+
end
|
355
|
+
|
356
|
+
def multiple_glazed_proportion
|
357
|
+
xpath(%w[Multiple-Glazed-Percentage])
|
358
|
+
end
|
359
|
+
|
360
|
+
def glazed_area
|
361
|
+
nil
|
362
|
+
end
|
363
|
+
|
364
|
+
def habitable_room_count
|
365
|
+
nil
|
366
|
+
end
|
367
|
+
|
368
|
+
def heated_room_count
|
369
|
+
nil
|
370
|
+
end
|
371
|
+
|
372
|
+
def low_energy_lighting
|
373
|
+
xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Percentage])
|
374
|
+
end
|
375
|
+
|
376
|
+
def fixed_lighting_outlets_count
|
377
|
+
xpath(%w[Fixed-Lighting-Outlets-Count])
|
378
|
+
end
|
379
|
+
|
380
|
+
def low_energy_fixed_lighting_outlets_count
|
381
|
+
xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])
|
382
|
+
end
|
383
|
+
|
384
|
+
def open_fireplaces_count
|
385
|
+
xpath(%w[Open-Fireplaces-Count])
|
386
|
+
end
|
387
|
+
|
388
|
+
def hot_water_description
|
389
|
+
xpath(%w[Hot-Water Description])
|
390
|
+
end
|
391
|
+
|
392
|
+
def hot_water_energy_efficiency_rating
|
393
|
+
xpath(%w[Hot-Water Energy-Efficiency-Rating])
|
394
|
+
end
|
395
|
+
|
396
|
+
def hot_water_environmental_efficiency_rating
|
397
|
+
xpath(%w[Hot-Water Environmental-Efficiency-Rating])
|
398
|
+
end
|
399
|
+
|
400
|
+
def window_description
|
401
|
+
xpath(%w[Windows Description])
|
402
|
+
end
|
403
|
+
|
404
|
+
def window_energy_efficiency_rating
|
405
|
+
xpath(%w[Windows Energy-Efficiency-Rating])
|
406
|
+
end
|
407
|
+
|
408
|
+
def window_environmental_efficiency_rating
|
409
|
+
xpath(%w[Windows Environmental-Efficiency-Rating])
|
410
|
+
end
|
411
|
+
|
412
|
+
def secondary_heating_description
|
413
|
+
xpath(%w[Secondary-Heating Description])
|
414
|
+
end
|
415
|
+
|
416
|
+
def secondary_heating_energy_efficiency_rating
|
417
|
+
xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
|
418
|
+
end
|
419
|
+
|
420
|
+
def secondary_heating_environmental_efficiency_rating
|
421
|
+
xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
|
422
|
+
end
|
423
|
+
|
424
|
+
def lighting_description
|
425
|
+
xpath(%w[Lighting Description])
|
426
|
+
end
|
427
|
+
|
428
|
+
def lighting_energy_efficiency_rating
|
429
|
+
xpath(%w[Lighting Energy-Efficiency-Rating])
|
430
|
+
end
|
431
|
+
|
432
|
+
def lighting_environmental_efficiency_rating
|
433
|
+
xpath(%w[Lighting Environmental-Efficiency-Rating])
|
434
|
+
end
|
435
|
+
|
436
|
+
def photovoltaic_roof_area_percent
|
437
|
+
nil
|
438
|
+
end
|
439
|
+
|
440
|
+
def built_form
|
441
|
+
xpath(%w[Built-Form])
|
442
|
+
end
|
443
|
+
|
444
|
+
def wind_turbine_count
|
445
|
+
xpath(%w[Wind-Turbines-Count])
|
446
|
+
end
|
447
|
+
|
448
|
+
def unheated_corridor_length
|
449
|
+
nil
|
450
|
+
end
|
451
|
+
|
452
|
+
def heat_loss_corridor
|
453
|
+
nil
|
454
|
+
end
|
455
|
+
|
456
|
+
def all_main_heating_descriptions
|
457
|
+
@xml_doc.search("Main-Heating/Description").map(&:content)
|
458
|
+
end
|
459
|
+
|
460
|
+
def all_main_heating_controls_descriptions
|
461
|
+
@xml_doc.search("Main-Heating-Controls/Description").map(&:content)
|
462
|
+
end
|
463
|
+
|
464
|
+
def report_type
|
465
|
+
xpath(%w[Report-Type])
|
466
|
+
end
|
467
|
+
|
468
|
+
def all_roof_descriptions
|
469
|
+
@xml_doc.search("Roof/Description").map(&:content)
|
470
|
+
end
|
471
|
+
|
472
|
+
def all_roof_env_energy_efficiency_rating
|
473
|
+
@xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
|
474
|
+
end
|
475
|
+
|
476
|
+
def all_roof_energy_efficiency_rating
|
477
|
+
@xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
|
478
|
+
end
|
479
|
+
|
480
|
+
def all_wall_descriptions
|
481
|
+
@xml_doc.search("Walls/Description").map(&:content)
|
482
|
+
end
|
483
|
+
|
484
|
+
def all_wall_energy_efficiency_rating
|
485
|
+
@xml_doc.search("Walls/Energy-Efficiency-Rating").map(&:content)
|
486
|
+
end
|
487
|
+
|
488
|
+
def all_wall_env_energy_efficiency_rating
|
489
|
+
@xml_doc.search("Walls/Environmental-Efficiency-Rating").map(&:content)
|
490
|
+
end
|
491
|
+
|
492
|
+
def energy_tariff
|
493
|
+
xpath(%w[Electricity-Tariff])
|
494
|
+
end
|
495
|
+
|
496
|
+
def floor_level
|
497
|
+
xpath(%w[SAP-Flat-Details Level])
|
498
|
+
end
|
499
|
+
|
500
|
+
def all_main_heating_energy_efficiency
|
501
|
+
@xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
|
502
|
+
end
|
503
|
+
|
504
|
+
def extensions_count
|
505
|
+
nil
|
506
|
+
end
|
507
|
+
|
508
|
+
def solar_water_heating_flag
|
509
|
+
nil
|
510
|
+
end
|
511
|
+
|
512
|
+
def mechanical_ventilation
|
513
|
+
nil
|
514
|
+
end
|
515
|
+
|
516
|
+
def floor_height
|
517
|
+
@xml_doc.search("Storey-Height").map(&:content)
|
518
|
+
end
|
519
|
+
|
520
|
+
def all_floor_descriptions
|
521
|
+
@xml_doc.search("Property-Summary/Floor/Description").map(&:content)
|
522
|
+
end
|
523
|
+
|
524
|
+
def all_floor_energy_efficiency_rating
|
525
|
+
@xml_doc
|
526
|
+
.search("Property-Summary/Floor/Energy-Efficiency-Rating")
|
527
|
+
.map(&:content)
|
528
|
+
end
|
529
|
+
|
530
|
+
def all_floor_env_energy_efficiency_rating
|
531
|
+
@xml_doc
|
532
|
+
.search("Property-Summary/Floor/Environmental-Efficiency-Rating")
|
533
|
+
.map(&:content)
|
534
|
+
end
|
535
|
+
|
536
|
+
def all_main_heating_controls_energy_efficiency
|
537
|
+
@xml_doc
|
538
|
+
.search("Main-Heating-Controls/Energy-Efficiency-Rating")
|
539
|
+
.map(&:content)
|
540
|
+
end
|
541
|
+
|
542
|
+
def all_main_heating_controls_environmental_efficiency
|
543
|
+
@xml_doc
|
544
|
+
.search("Main-Heating-Controls/Environmental-Efficiency-Rating")
|
545
|
+
.map(&:content)
|
546
|
+
end
|
547
|
+
|
548
|
+
def all_main_heating_environmental_efficiency
|
549
|
+
@xml_doc
|
550
|
+
.search("Main-Heating/Environmental-Efficiency-Rating")
|
551
|
+
.map(&:content)
|
552
|
+
end
|
553
|
+
|
554
|
+
def cylinder_insul_thickness
|
555
|
+
xpath(%w[Hot-Water-Store-Insulation-Thickness])
|
556
|
+
end
|
557
|
+
|
558
|
+
def cylinder_insulation_type
|
559
|
+
xpath(%w[Hot-Water-Store-Insulation-Type])
|
560
|
+
end
|
561
|
+
|
562
|
+
def cylinder_size
|
563
|
+
xpath(%w[Hot-Water-Store-Size])
|
564
|
+
end
|
565
|
+
|
566
|
+
def has_cylinder_thermostat
|
567
|
+
xpath(%w[Has-Cylinder-Thermostat])
|
568
|
+
end
|
569
|
+
|
570
|
+
def mech_vent_sys_index_number
|
571
|
+
xpath(%w[Mechanical-Vent-System-Index-Number])
|
572
|
+
end
|
573
|
+
|
574
|
+
def mechanical_vent_data_source
|
575
|
+
xpath(%w[Mechanical-Ventilation-Data-Source])
|
576
|
+
end
|
577
|
+
|
578
|
+
def thermal_store
|
579
|
+
xpath(%w[Thermal-Store])
|
580
|
+
end
|
581
|
+
|
582
|
+
def ventilation_type
|
583
|
+
xpath(%w[Ventilation-Type])
|
584
|
+
end
|
585
|
+
end
|
586
|
+
end
|
587
|
+
end
|
@@ -38,6 +38,8 @@ module ViewModel
|
|
38
38
|
|
39
39
|
def build_view_model(xml_doc, schema_type, report_type)
|
40
40
|
case schema_type
|
41
|
+
when :"SAP-Schema-19.0.0"
|
42
|
+
return ViewModel::SapSchema1900::CommonSchema.new xml_doc
|
41
43
|
when :"SAP-Schema-18.0.0"
|
42
44
|
return ViewModel::SapSchema1800::CommonSchema.new xml_doc
|
43
45
|
when :"SAP-Schema-17.1"
|
@@ -15,7 +15,7 @@ module ViewModelGateway
|
|
15
15
|
def schema_version(file)
|
16
16
|
api_path_start = file.index(API_PATH) + API_PATH.length
|
17
17
|
schema_version = file[api_path_start..].split("/").first
|
18
|
-
|
18
|
+
sap_defined_in_rdsap_dir?(file) ? "#{schema_version}/SAP" : schema_version
|
19
19
|
end
|
20
20
|
|
21
21
|
def xsd_files
|
@@ -29,7 +29,8 @@ module ViewModelGateway
|
|
29
29
|
cepc_xsd_files
|
30
30
|
end
|
31
31
|
else
|
32
|
-
|
32
|
+
@glob_path = "#{@dir_path}#{@xsd_dir_path}"
|
33
|
+
Dir.glob(@glob_path)
|
33
34
|
end
|
34
35
|
|
35
36
|
raise ViewModelBoundary::XsdFilesNotFound, "No xsd files were found in #{@glob_path} directory" if files.nil? || files.empty?
|
@@ -39,7 +40,7 @@ module ViewModelGateway
|
|
39
40
|
|
40
41
|
private
|
41
42
|
|
42
|
-
def
|
43
|
+
def sap_defined_in_rdsap_dir?(file)
|
43
44
|
assessment_type == "SAP" && file.end_with?("SAP-Domains.xsd")
|
44
45
|
end
|
45
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epb_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MHCLG Energy Performance of Buildings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -1025,6 +1025,18 @@ files:
|
|
1025
1025
|
- api/schemas/xml/SAP-Schema-18.0.0/SAP/Templates/SAP-Report.xsd
|
1026
1026
|
- api/schemas/xml/SAP-Schema-18.0.0/SAP/UDT/EPC-Domains.xsd
|
1027
1027
|
- api/schemas/xml/SAP-Schema-18.0.0/SAP/UDT/SAP-Domains.xsd
|
1028
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/ExternalDefinitions.xml
|
1029
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/ExternalDefinitions.xsd
|
1030
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/AssessorManagement.xsd
|
1031
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/EPC-Certificate.xsd
|
1032
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/ExceptionList.xsd
|
1033
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/Property.xsd
|
1034
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/ReportList.xsd
|
1035
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-CollectedData.xsd
|
1036
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-Compliance-Report.xsd
|
1037
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-Report.xsd
|
1038
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/EPC-Domains.xsd
|
1039
|
+
- api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/SAP-Domains.xsd
|
1028
1040
|
- api/schemas/xml/SAP-Schema-NI-11.2/CommonFiles/CommonStructures.xsd
|
1029
1041
|
- api/schemas/xml/SAP-Schema-NI-11.2/CommonFiles/Exceptions.xsd
|
1030
1042
|
- api/schemas/xml/SAP-Schema-NI-11.2/Messages/ConditionReportChangeAccessRequest_1.xsd
|
@@ -1641,26 +1653,37 @@ files:
|
|
1641
1653
|
- lib/helper/rrn_helper.rb
|
1642
1654
|
- lib/helper/schema_list_helper.rb
|
1643
1655
|
- lib/helper/xml_enums_to_output.rb
|
1656
|
+
- lib/presenter/ac_cert/export_configuration.rb
|
1644
1657
|
- lib/presenter/ac_cert/summary.rb
|
1658
|
+
- lib/presenter/ac_report/export_configuration.rb
|
1645
1659
|
- lib/presenter/ac_report/summary.rb
|
1660
|
+
- lib/presenter/cepc/export_configuration.rb
|
1646
1661
|
- lib/presenter/cepc/report.rb
|
1647
1662
|
- lib/presenter/cepc/summary.rb
|
1663
|
+
- lib/presenter/cepc_rr/export_configuration.rb
|
1648
1664
|
- lib/presenter/cepc_rr/recommendation_report.rb
|
1649
1665
|
- lib/presenter/cepc_rr/summary.rb
|
1666
|
+
- lib/presenter/dec/export_configuration.rb
|
1650
1667
|
- lib/presenter/dec/report.rb
|
1651
1668
|
- lib/presenter/dec/summary.rb
|
1652
1669
|
- lib/presenter/dec/xml_summary.rb
|
1670
|
+
- lib/presenter/dec_rr/export_configuration.rb
|
1653
1671
|
- lib/presenter/dec_rr/recommendation_report.rb
|
1654
1672
|
- lib/presenter/dec_rr/summary.rb
|
1655
1673
|
- lib/presenter/export/base.rb
|
1656
1674
|
- lib/presenter/export/commercial.rb
|
1657
1675
|
- lib/presenter/export/domestic.rb
|
1676
|
+
- lib/presenter/export/statistics.rb
|
1677
|
+
- lib/presenter/rd_sap/export_configuration.rb
|
1658
1678
|
- lib/presenter/rd_sap/recommendation_report.rb
|
1659
1679
|
- lib/presenter/rd_sap/report.rb
|
1660
1680
|
- lib/presenter/rd_sap/summary.rb
|
1681
|
+
- lib/presenter/sap/export_configuration.rb
|
1661
1682
|
- lib/presenter/sap/recommendation_report.rb
|
1662
1683
|
- lib/presenter/sap/report.rb
|
1663
1684
|
- lib/presenter/sap/summary.rb
|
1685
|
+
- lib/presenter/to_warehouse/base_configuration.rb
|
1686
|
+
- lib/presenter/xml/parser.rb
|
1664
1687
|
- lib/presenter/xsd.rb
|
1665
1688
|
- lib/view_model/ac_cert_wrapper.rb
|
1666
1689
|
- lib/view_model/ac_report_wrapper.rb
|
@@ -1781,6 +1804,7 @@ files:
|
|
1781
1804
|
- lib/view_model/sap_schema_170/common_schema.rb
|
1782
1805
|
- lib/view_model/sap_schema_171/common_schema.rb
|
1783
1806
|
- lib/view_model/sap_schema_1800/common_schema.rb
|
1807
|
+
- lib/view_model/sap_schema_1900/common_schema.rb
|
1784
1808
|
- lib/view_model/sap_schema_ni_112/common_schema.rb
|
1785
1809
|
- lib/view_model/sap_schema_ni_112/rdsap.rb
|
1786
1810
|
- lib/view_model/sap_schema_ni_112/sap.rb
|