epb_view_models 1.0.16 → 1.0.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.
- checksums.yaml +4 -4
- data/.buildspec.yml +2 -2
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/SAP-Domains.xsd +1 -1
- data/lib/epb_view_models.rb +1 -1
- data/lib/helper/xml_enums_to_output.rb +20 -0
- data/lib/presenter/export/domestic.rb +2 -2
- data/lib/presenter/rd_sap/hera.rb +42 -0
- data/lib/presenter/sap/hera.rb +39 -0
- data/lib/view_model/domestic_epc_view_model.rb +10 -0
- data/lib/view_model/rd_sap_schema_200/common_schema.rb +0 -4
- data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +0 -4
- data/lib/view_model/rd_sap_wrapper.rb +5 -0
- data/lib/view_model/sap_schema_1800/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_1900/common_schema.rb +40 -13
- data/lib/view_model/sap_schema_ni_1800/common_schema.rb +0 -4
- data/lib/view_model/sap_wrapper.rb +5 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c9e0148c91fdfa17b8230647b7f44630d9197877639f5f8da2948d329afb8e6
|
4
|
+
data.tar.gz: db0feff6c2a220fef4810e938bb53d6382df34df65355ff3946443b58ada8950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e51bceb16b9c4ec62cb2a724ccb58e4daf1d8699b67672a755533278b568c00c7f13ee119f7d78983f913bb13a2cd69b36a1d1372e43a4dc4f62f82b89bb03
|
7
|
+
data.tar.gz: 9813262b24abc17231f36b6d5b4bf0eac81f58a31d103b80172e518b228e1974b15176af4c97f6ffeee7bea8cd8ac47cd74b08286554ff57883f6ec9fb3085e3
|
data/.buildspec.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1360,7 +1360,7 @@
|
|
1360
1360
|
</xs:enumeration>
|
1361
1361
|
</xs:restriction>
|
1362
1362
|
</xs:simpleType>
|
1363
|
-
|
1363
|
+
<xs:simpleType name="SAP-FlatLevelCode">
|
1364
1364
|
<xs:annotation>
|
1365
1365
|
<xs:documentation>Codes which indicates where a flat is located within a building.</xs:documentation>
|
1366
1366
|
</xs:annotation>
|
data/lib/epb_view_models.rb
CHANGED
@@ -274,6 +274,20 @@ module Helper
|
|
274
274
|
"76" => "bioethanol from any biomass source",
|
275
275
|
"99" => "Community heating schemes: special fuel",
|
276
276
|
}.freeze
|
277
|
+
MAIN_HEATING_CATEGORY = {
|
278
|
+
"1" => "none",
|
279
|
+
"2" => "boiler with radiators or underfloor heating",
|
280
|
+
"3" => "micro-cogeneration",
|
281
|
+
"4" => "heat pump with radiators or underfloor heating",
|
282
|
+
"5" => "heat pump with warm air distribution",
|
283
|
+
"6" => "community heating system",
|
284
|
+
"7" => "electric storage heaters",
|
285
|
+
"8" => "electric underfloor heating",
|
286
|
+
"9" => "warm air system (not heat pump)",
|
287
|
+
"10" => "room heaters",
|
288
|
+
"11" => "other system",
|
289
|
+
"12" => "not recorded",
|
290
|
+
}.freeze
|
277
291
|
|
278
292
|
def self.built_form_string(number)
|
279
293
|
BUILT_FORM[number]
|
@@ -358,6 +372,7 @@ module Helper
|
|
358
372
|
]
|
359
373
|
|
360
374
|
schemes_that_use_l = %i[
|
375
|
+
SAP-Schema-19.0.0
|
361
376
|
SAP-Schema-18.0.0
|
362
377
|
SAP-Schema-17.1
|
363
378
|
SAP-Schema-17.0
|
@@ -561,6 +576,7 @@ module Helper
|
|
561
576
|
]
|
562
577
|
|
563
578
|
sap = %i[
|
579
|
+
SAP-Schema-19.0.0
|
564
580
|
SAP-Schema-18.0.0
|
565
581
|
SAP-Schema-17.1
|
566
582
|
SAP-Schema-17.0
|
@@ -611,6 +627,10 @@ module Helper
|
|
611
627
|
end
|
612
628
|
end
|
613
629
|
|
630
|
+
def self.main_heating_category(value:)
|
631
|
+
MAIN_HEATING_CATEGORY[value] || value
|
632
|
+
end
|
633
|
+
|
614
634
|
private_class_method :is_rdsap, :is_sap
|
615
635
|
end
|
616
636
|
end
|
@@ -68,8 +68,8 @@ module Presenter::Export
|
|
68
68
|
view[:lighting_environmental_efficiency_rating] =
|
69
69
|
@view_model.lighting_environmental_efficiency_rating.to_i
|
70
70
|
view[:low_energy_fixed_lighting_outlets_count] =
|
71
|
-
@view_model.low_energy_fixed_lighting_outlets_count.to_i
|
72
|
-
view[:low_energy_lighting] = @view_model.low_energy_lighting.to_i
|
71
|
+
@view_model.low_energy_fixed_lighting_outlets_count.nil? ? nil : @view_model.low_energy_fixed_lighting_outlets_count.to_i
|
72
|
+
view[:low_energy_lighting] = @view_model.low_energy_lighting.nil? ? nil : @view_model.low_energy_lighting.to_i
|
73
73
|
view[:main_fuel_type] = @view_model.main_fuel_type
|
74
74
|
view[:main_heating_controls_descriptions] =
|
75
75
|
@view_model.all_main_heating_controls_descriptions
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Presenter
|
2
|
+
module RdSap
|
3
|
+
class Hera
|
4
|
+
TYPE_OF_ASSESSMENT = "RdSAP".freeze
|
5
|
+
private_constant :TYPE_OF_ASSESSMENT
|
6
|
+
|
7
|
+
def initialize(view_model, schema_type)
|
8
|
+
@view_model = view_model
|
9
|
+
@schema_type = schema_type
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_hera_hash
|
13
|
+
{
|
14
|
+
type_of_assessment: TYPE_OF_ASSESSMENT,
|
15
|
+
assessment_id: @view_model.assessment_id,
|
16
|
+
date_of_registration: @view_model.date_of_registration,
|
17
|
+
address: {
|
18
|
+
address_line1: @view_model.address_line1,
|
19
|
+
address_line2: @view_model.address_line2,
|
20
|
+
address_line3: @view_model.address_line3,
|
21
|
+
address_line4: @view_model.address_line4,
|
22
|
+
town: @view_model.town,
|
23
|
+
postcode: @view_model.postcode,
|
24
|
+
},
|
25
|
+
dwelling_type: @view_model.dwelling_type,
|
26
|
+
built_form: Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
|
27
|
+
main_dwelling_construction_age_band_or_year: Helper::XmlEnumsToOutput.construction_age_band_lookup(
|
28
|
+
@view_model.main_dwelling_construction_age_band_or_year,
|
29
|
+
@schema_type,
|
30
|
+
@view_model.report_type,
|
31
|
+
),
|
32
|
+
property_summary: @view_model.property_summary,
|
33
|
+
main_heating_category: Helper::XmlEnumsToOutput.main_heating_category(value: @view_model.main_heating_category),
|
34
|
+
main_fuel_type: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
|
35
|
+
@schema_type,
|
36
|
+
@view_model.report_type),
|
37
|
+
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Presenter
|
2
|
+
module Sap
|
3
|
+
class Hera
|
4
|
+
def initialize(view_model, schema_type)
|
5
|
+
@view_model = view_model
|
6
|
+
@schema_type = schema_type
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hera_hash
|
10
|
+
{
|
11
|
+
type_of_assessment: @view_model.type_of_assessment,
|
12
|
+
assessment_id: @view_model.assessment_id,
|
13
|
+
date_of_registration: @view_model.date_of_registration,
|
14
|
+
address: {
|
15
|
+
address_line1: @view_model.address_line1,
|
16
|
+
address_line2: @view_model.address_line2,
|
17
|
+
address_line3: @view_model.address_line3,
|
18
|
+
address_line4: nil,
|
19
|
+
town: @view_model.town,
|
20
|
+
postcode: @view_model.postcode,
|
21
|
+
},
|
22
|
+
dwelling_type: @view_model.dwelling_type,
|
23
|
+
built_form: Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
|
24
|
+
main_dwelling_construction_age_band_or_year: Helper::XmlEnumsToOutput.construction_age_band_lookup(
|
25
|
+
@view_model.main_dwelling_construction_age_band_or_year,
|
26
|
+
@schema_type,
|
27
|
+
@view_model.report_type,
|
28
|
+
),
|
29
|
+
property_summary: @view_model.property_summary,
|
30
|
+
main_heating_category: Helper::XmlEnumsToOutput.main_heating_category(value: @view_model.main_heating_category),
|
31
|
+
main_fuel_type: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
|
32
|
+
@schema_type,
|
33
|
+
@view_model.report_type),
|
34
|
+
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -54,6 +54,16 @@ module ViewModel
|
|
54
54
|
xpath(%w[Water-Heating-Code])
|
55
55
|
end
|
56
56
|
|
57
|
+
def has_hot_water_cylinder
|
58
|
+
return "false" if xpath(%w[Has-Hot-Water-Cylinder]).nil?
|
59
|
+
|
60
|
+
xpath(%w[Has-Hot-Water-Cylinder])
|
61
|
+
end
|
62
|
+
|
63
|
+
def main_heating_category
|
64
|
+
xpath(%w[Main-Heating-Category])
|
65
|
+
end
|
66
|
+
|
57
67
|
private
|
58
68
|
|
59
69
|
def fetch_addendum_numbers
|
@@ -8,6 +8,7 @@ module ViewModel
|
|
8
8
|
@summary = Presenter::RdSap::Summary.new(view_model)
|
9
9
|
@report = Presenter::RdSap::Report.new(view_model, schema_type, additional_data)
|
10
10
|
@recommendation_report = Presenter::RdSap::RecommendationReport.new(view_model)
|
11
|
+
@hera = Presenter::RdSap::Hera.new(view_model, schema_type)
|
11
12
|
end
|
12
13
|
|
13
14
|
def type
|
@@ -30,6 +31,10 @@ module ViewModel
|
|
30
31
|
@recommendation_report.to_hash
|
31
32
|
end
|
32
33
|
|
34
|
+
def to_hera_hash
|
35
|
+
@hera.to_hera_hash
|
36
|
+
end
|
37
|
+
|
33
38
|
def get_view_model
|
34
39
|
view_model
|
35
40
|
end
|
@@ -259,12 +259,12 @@ module ViewModel
|
|
259
259
|
end
|
260
260
|
|
261
261
|
def top_storey
|
262
|
-
flat_level_code = xpath(%w[
|
262
|
+
flat_level_code = xpath(%w[SAP-FlatLevelCode])
|
263
263
|
flat_level_code == "3" ? "Y" : "N"
|
264
264
|
end
|
265
265
|
|
266
266
|
def storey_count
|
267
|
-
|
267
|
+
xpath(%w[Storeys])
|
268
268
|
end
|
269
269
|
|
270
270
|
def building_part_number
|
@@ -301,10 +301,6 @@ module ViewModel
|
|
301
301
|
xpath(%w[Immersion-Heating-Type])
|
302
302
|
end
|
303
303
|
|
304
|
-
def main_heating_category
|
305
|
-
xpath(%w[Main-Heating-Category])
|
306
|
-
end
|
307
|
-
|
308
304
|
def main_fuel_type
|
309
305
|
xpath(%w[Main-Fuel-Type])
|
310
306
|
end
|
@@ -369,20 +365,51 @@ module ViewModel
|
|
369
365
|
nil
|
370
366
|
end
|
371
367
|
|
372
|
-
def
|
373
|
-
|
368
|
+
def fixed_lighting_outlets_count
|
369
|
+
@xml_doc.search("Fixed-Lights/Fixed-Light/Lighting-Outlets").map(&:content).map(&:to_i).sum
|
374
370
|
end
|
375
371
|
|
376
|
-
def
|
377
|
-
|
372
|
+
def format_fixed_light_array
|
373
|
+
@xml_doc
|
374
|
+
.search("Fixed-Lights/Fixed-Light")
|
375
|
+
.map do |part|
|
376
|
+
{
|
377
|
+
lighting_efficacy:
|
378
|
+
xpath(%w[Lighting-Efficacy], part),
|
379
|
+
lighting_outlets:
|
380
|
+
xpath(%w[Lighting-Outlets], part),
|
381
|
+
}
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
def low_energy_lighting
|
386
|
+
total_energy_outlet_count = []
|
387
|
+
low_energy_outlet_count = []
|
388
|
+
|
389
|
+
format_fixed_light_array.each do |outlet|
|
390
|
+
if outlet[:lighting_efficacy].to_i > 65
|
391
|
+
low_energy_outlet_count << outlet[:lighting_outlets].to_i
|
392
|
+
end
|
393
|
+
total_energy_outlet_count << outlet[:lighting_outlets].to_f
|
394
|
+
end
|
395
|
+
|
396
|
+
(low_energy_outlet_count.sum / total_energy_outlet_count.sum * 100).round
|
378
397
|
end
|
379
398
|
|
380
399
|
def low_energy_fixed_lighting_outlets_count
|
381
|
-
|
400
|
+
low_energy_outlet_count = []
|
401
|
+
|
402
|
+
format_fixed_light_array.each do |outlet|
|
403
|
+
if outlet[:lighting_efficacy].to_i > 65
|
404
|
+
low_energy_outlet_count << outlet[:lighting_outlets].to_i
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
low_energy_outlet_count.sum
|
382
409
|
end
|
383
410
|
|
384
411
|
def open_fireplaces_count
|
385
|
-
xpath(%w[Open-
|
412
|
+
xpath(%w[Open-Chimneys-Count])
|
386
413
|
end
|
387
414
|
|
388
415
|
def hot_water_description
|
@@ -442,7 +469,7 @@ module ViewModel
|
|
442
469
|
end
|
443
470
|
|
444
471
|
def wind_turbine_count
|
445
|
-
|
472
|
+
@xml_doc.search("Wind-Turbines/Wind-Turbine").map(&:content).count
|
446
473
|
end
|
447
474
|
|
448
475
|
def unheated_corridor_length
|
@@ -8,6 +8,7 @@ module ViewModel
|
|
8
8
|
@summary = Presenter::Sap::Summary.new(view_model)
|
9
9
|
@report = Presenter::Sap::Report.new(view_model, schema_type, additional_data)
|
10
10
|
@recommendation_report = Presenter::Sap::RecommendationReport.new(view_model)
|
11
|
+
@hera = Presenter::Sap::Hera.new(view_model, schema_type)
|
11
12
|
end
|
12
13
|
|
13
14
|
def type
|
@@ -30,6 +31,10 @@ module ViewModel
|
|
30
31
|
@recommendation_report.to_hash
|
31
32
|
end
|
32
33
|
|
34
|
+
def to_hera_hash
|
35
|
+
@hera.to_hera_hash
|
36
|
+
end
|
37
|
+
|
33
38
|
def get_view_model
|
34
39
|
view_model
|
35
40
|
end
|
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.19
|
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: 2022-
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -1675,10 +1675,12 @@ files:
|
|
1675
1675
|
- lib/presenter/export/domestic.rb
|
1676
1676
|
- lib/presenter/export/statistics.rb
|
1677
1677
|
- lib/presenter/rd_sap/export_configuration.rb
|
1678
|
+
- lib/presenter/rd_sap/hera.rb
|
1678
1679
|
- lib/presenter/rd_sap/recommendation_report.rb
|
1679
1680
|
- lib/presenter/rd_sap/report.rb
|
1680
1681
|
- lib/presenter/rd_sap/summary.rb
|
1681
1682
|
- lib/presenter/sap/export_configuration.rb
|
1683
|
+
- lib/presenter/sap/hera.rb
|
1682
1684
|
- lib/presenter/sap/recommendation_report.rb
|
1683
1685
|
- lib/presenter/sap/report.rb
|
1684
1686
|
- lib/presenter/sap/summary.rb
|
@@ -1868,7 +1870,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1868
1870
|
- !ruby/object:Gem::Version
|
1869
1871
|
version: '0'
|
1870
1872
|
requirements: []
|
1871
|
-
rubygems_version: 3.
|
1873
|
+
rubygems_version: 3.3.7
|
1872
1874
|
signing_key:
|
1873
1875
|
specification_version: 4
|
1874
1876
|
summary: Library used to parse Energy Performance Certificates (EPC)
|