epb_view_models 1.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/api/schemas/data/orchestrate.json +4 -0
- data/api/schemas/xml/RdSAP-Schema-21.0.0/RdSAP/Templates/EPC-Certificate.xsd +1 -0
- data/api/schemas/xml/RdSAP-Schema-21.0.0/RdSAP/Templates/EPC-CollectedData.xsd +31 -11
- data/api/schemas/xml/RdSAP-Schema-21.0.0/RdSAP/UDT/SAP-Domains.xsd +74 -25
- data/lib/epb_view_models.rb +1 -2
- data/lib/helper/xml_enums_to_output.rb +5 -6
- data/lib/view_model/factory.rb +1 -0
- data/lib/view_model/rd_sap_schema_210/common_schema.rb +587 -0
- data/lib/view_model/rd_sap_wrapper.rb +2 -0
- data/lib/view_model/sap_schema_110/sap.rb +1 -1
- data/lib/view_model/sap_schema_112/sap.rb +1 -1
- data/lib/view_model/sap_schema_120/sap.rb +1 -1
- data/lib/view_model/sap_schema_130/sap.rb +1 -1
- data/lib/view_model/sap_schema_140/sap.rb +1 -1
- data/lib/view_model/sap_schema_141/sap.rb +1 -1
- data/lib/view_model/sap_schema_142/sap.rb +1 -1
- data/lib/view_model/sap_schema_150/sap.rb +1 -1
- data/lib/view_model/sap_schema_160/sap.rb +1 -1
- data/lib/view_model/sap_schema_161/sap.rb +1 -1
- data/lib/view_model/sap_schema_162/sap.rb +1 -1
- data/lib/view_model/sap_schema_163/sap.rb +1 -1
- data/lib/view_model/sap_schema_170/common_schema.rb +1 -1
- data/lib/view_model/sap_schema_171/common_schema.rb +1 -1
- data/lib/view_model/sap_schema_1800/common_schema.rb +1 -1
- data/lib/view_model/sap_schema_1900/common_schema.rb +1 -1
- data/lib/view_model/sap_schema_1910/common_schema.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07537b2b392d7fdbe7d1066f3f8f0d3e0681dec6da114d09f4febaba7f872cd4
|
4
|
+
data.tar.gz: 652a96f51612258618ebf754a20a0c707db6418e727cf36b0a4c3d10c6c0d3ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2bb5e3d9eb8d3b20332ebb1e2b87f9b93450889958beda00c33cd4683675c65b106afb3be9aaccc3945364181247d36d0654990a028fd2c72eb484dbb294188
|
7
|
+
data.tar.gz: 4e408c45ee8e8bd13f7623d687ed96dccfc6a8822e0f0bfb7e39bf7a002ccf2c6e8fc93afbe479aa21cc25c3e56c9b69eacbffd0e51700efc31b528e95a369ee
|
@@ -123,6 +123,10 @@
|
|
123
123
|
"schema_path":
|
124
124
|
"api/schemas/xml/SAP-Schema-NI-11.2/Messages/ConditionReportCreateRequest_1.xsd"
|
125
125
|
},
|
126
|
+
"RdSAP-Schema-21.0.0": {
|
127
|
+
"schema_path":
|
128
|
+
"api/schemas/xml/RdSAP-Schema-21.0.0/RdSAP/Templates/RdSAP-Report.xsd"
|
129
|
+
},
|
126
130
|
"RdSAP-Schema-20.0.0": {
|
127
131
|
"schema_path":
|
128
132
|
"api/schemas/xml/RdSAP-Schema-20.0.0/RdSAP/Templates/RdSAP-Report.xsd"
|
@@ -47,6 +47,7 @@ The report also identifies a number of potential improvements that may be made t
|
|
47
47
|
<xs:element name="Roof" type="PropertySummaryType" maxOccurs="unbounded"/>
|
48
48
|
<xs:element name="Floor" type="PropertySummaryType" maxOccurs="unbounded"/>
|
49
49
|
<xs:element name="Window" type="PropertySummaryType"/>
|
50
|
+
<xs:element name="Air-Tightness" type="PropertySummaryType" minOccurs="0"/>
|
50
51
|
<xs:element name="Main-Heating" type="PropertySummaryType" maxOccurs="2"/>
|
51
52
|
<xs:element name="Main-Heating-Controls" type="PropertySummaryType" maxOccurs="2"/>
|
52
53
|
<xs:element name="Hot-Water" type="PropertySummaryType"/>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<xs:element name="SAP-Property-Details" type="SAP-Property-Details"/>
|
21
21
|
<xs:complexType name="SAP-Property-Details">
|
22
22
|
<xs:all>
|
23
|
-
<xs:element name="Built-Form" type="SAP-BuiltFormCode">
|
23
|
+
<xs:element name="Built-Form" type="SAP-BuiltFormCode" minOccurs="0">
|
24
24
|
<xs:annotation>
|
25
25
|
<xs:documentation>The building type of the Property e.g. Detached, Semi-Detached, Terrace etc.
|
26
26
|
|
@@ -147,19 +147,44 @@ This is actually the type differentiator for Property but only a limited number
|
|
147
147
|
<xs:documentation>The number of flueless gas fires in the Property.</xs:documentation>
|
148
148
|
</xs:annotation>
|
149
149
|
</xs:element>
|
150
|
-
<xs:element name="Mechanical-Ventilation-
|
150
|
+
<xs:element name="Mechanical-Ventilation-Index-Number" type="xs:positiveInteger" minOccurs="0">
|
151
151
|
<xs:annotation>
|
152
152
|
<xs:documentation>Relevant when mechanical ventilation system is from PCDB.</xs:documentation>
|
153
153
|
</xs:annotation>
|
154
154
|
</xs:element>
|
155
|
-
<xs:element name="Mechanical-Ventilation
|
155
|
+
<xs:element name="Mechanical-Ventilation" type="VentilationTypeCode">
|
156
|
+
<xs:annotation>
|
157
|
+
<xs:documentation>Identifies the type of mechanical ventilation the property has. This is required for the RdSAP calculation.</xs:documentation>
|
158
|
+
</xs:annotation>
|
159
|
+
</xs:element>
|
160
|
+
<xs:element name="Mechanical-Vent-Duct-Type" type="SAP-DuctTypeCode" minOccurs="0">
|
161
|
+
<xs:annotation>
|
162
|
+
<xs:documentation>Mechanical vent duct type; if MEV c, MV or MVHR from PCDB.</xs:documentation>
|
163
|
+
</xs:annotation>
|
164
|
+
</xs:element>
|
165
|
+
<xs:element name="Mechanical-Vent-Duct-Placement" type="SAP-DuctPlacement" minOccurs="0">
|
166
|
+
<xs:annotation>
|
167
|
+
<xs:documentation>Mechanical ventilation duct insulation; if MVHR from PCDB.</xs:documentation>
|
168
|
+
</xs:annotation>
|
169
|
+
</xs:element>
|
170
|
+
<xs:element name="Mechanical-Ventilation-Duct-Insulation" type="SAP-DuctInsulationCode" minOccurs="0">
|
156
171
|
<xs:annotation>
|
157
172
|
<xs:documentation>Relevant when mechanical ventilation system is from PCDB.</xs:documentation>
|
158
173
|
</xs:annotation>
|
159
174
|
</xs:element>
|
160
|
-
<xs:element name="Mechanical-
|
175
|
+
<xs:element name="Mechanical-Vent-Duct-Insulation-Level" type="SAP-DuctInsulationLevel" minOccurs="0">
|
161
176
|
<xs:annotation>
|
162
|
-
<xs:documentation>
|
177
|
+
<xs:documentation>Mechanical vent duct insulation; if MVHR from PCDB.</xs:documentation>
|
178
|
+
</xs:annotation>
|
179
|
+
</xs:element>
|
180
|
+
<xs:element name="Mechanical-Vent-Measured-Installation" type="xs:boolean" minOccurs="0">
|
181
|
+
<xs:annotation>
|
182
|
+
<xs:documentation>Mechanical ventilation SPF measured in situ; if MVHR or balanced from pcdb.</xs:documentation>
|
183
|
+
</xs:annotation>
|
184
|
+
</xs:element>
|
185
|
+
<xs:element name="Is-Mechanical-Vent-Approved-Installer-Scheme" type="xs:boolean" minOccurs="0">
|
186
|
+
<xs:annotation>
|
187
|
+
<xs:documentation>If MVHR from pcdb.</xs:documentation>
|
163
188
|
</xs:annotation>
|
164
189
|
</xs:element>
|
165
190
|
<xs:element name="Conservatory-Type" type="SAP-ConservatoryTypeCode">
|
@@ -867,11 +892,6 @@ For the purpose of calculating the overall Energy Assessment for the property de
|
|
867
892
|
</xs:annotation>
|
868
893
|
</xs:element>
|
869
894
|
<xs:element name="Community-Heat-Distribution-Type" type="SAP-HeatingDistributionCode" minOccurs="0"/>
|
870
|
-
<xs:element name="Community-Generator-Type" type="CommunityGeneratorTypeCode" minOccurs="0">
|
871
|
-
<xs:annotation>
|
872
|
-
<xs:documentation>Only required if index number not available.</xs:documentation>
|
873
|
-
</xs:annotation>
|
874
|
-
</xs:element>
|
875
895
|
<xs:element name="Community-Heat-CHP-Electricity-Generation" type="SAP-CHPElectricityGenerationCode" minOccurs="0">
|
876
896
|
<xs:annotation>
|
877
897
|
<xs:documentation>Only if community heating not from pcdb and a heat source with CHP. CHP Electricity generation options from table 12f.</xs:documentation>
|
@@ -951,7 +971,7 @@ If the total peak power has been apportioned between different dwellings within
|
|
951
971
|
<xs:element name="PV-Batteries" type="PV-Batteries"/>
|
952
972
|
<xs:complexType name="PV-Batteries">
|
953
973
|
<xs:sequence>
|
954
|
-
<xs:element name="PV-Battery" type="PV-Battery"/>
|
974
|
+
<xs:element name="PV-Battery" type="PV-Battery" maxOccurs="20"/>
|
955
975
|
</xs:sequence>
|
956
976
|
</xs:complexType>
|
957
977
|
<xs:element name="PV-Battery" type="PV-Battery"/>
|
@@ -52,6 +52,79 @@
|
|
52
52
|
</xs:enumeration>
|
53
53
|
</xs:restriction>
|
54
54
|
</xs:simpleType>
|
55
|
+
<xs:simpleType name="SAP-DuctTypeCode">
|
56
|
+
<xs:annotation>
|
57
|
+
<xs:documentation>Code which indicates the type of duct.</xs:documentation>
|
58
|
+
</xs:annotation>
|
59
|
+
<xs:restriction base="xs:string">
|
60
|
+
<xs:enumeration value="1">
|
61
|
+
<xs:annotation>
|
62
|
+
<xs:documentation>flexible</xs:documentation>
|
63
|
+
</xs:annotation>
|
64
|
+
</xs:enumeration>
|
65
|
+
<xs:enumeration value="2">
|
66
|
+
<xs:annotation>
|
67
|
+
<xs:documentation>rigid</xs:documentation>
|
68
|
+
</xs:annotation>
|
69
|
+
</xs:enumeration>
|
70
|
+
<xs:enumeration value="3">
|
71
|
+
<xs:annotation>
|
72
|
+
<xs:documentation>semi-rigid</xs:documentation>
|
73
|
+
</xs:annotation>
|
74
|
+
</xs:enumeration>
|
75
|
+
</xs:restriction>
|
76
|
+
</xs:simpleType>
|
77
|
+
<xs:simpleType name="SAP-DuctPlacement">
|
78
|
+
<xs:annotation>
|
79
|
+
<xs:documentation>Code which indicates the duct placement.</xs:documentation>
|
80
|
+
</xs:annotation>
|
81
|
+
<xs:restriction base="xs:string">
|
82
|
+
<xs:enumeration value="1">
|
83
|
+
<xs:annotation>
|
84
|
+
<xs:documentation>inside heated envelope</xs:documentation>
|
85
|
+
</xs:annotation>
|
86
|
+
</xs:enumeration>
|
87
|
+
<xs:enumeration value="2">
|
88
|
+
<xs:annotation>
|
89
|
+
<xs:documentation>outside heated envelope</xs:documentation>
|
90
|
+
</xs:annotation>
|
91
|
+
</xs:enumeration>
|
92
|
+
</xs:restriction>
|
93
|
+
</xs:simpleType>
|
94
|
+
<xs:simpleType name="SAP-DuctInsulationLevel">
|
95
|
+
<xs:annotation>
|
96
|
+
<xs:documentation>Code which indicates the level of duct insulation.</xs:documentation>
|
97
|
+
</xs:annotation>
|
98
|
+
<xs:restriction base="xs:string">
|
99
|
+
<xs:enumeration value="1">
|
100
|
+
<xs:annotation>
|
101
|
+
<xs:documentation>level 1</xs:documentation>
|
102
|
+
</xs:annotation>
|
103
|
+
</xs:enumeration>
|
104
|
+
<xs:enumeration value="2">
|
105
|
+
<xs:annotation>
|
106
|
+
<xs:documentation>level 2</xs:documentation>
|
107
|
+
</xs:annotation>
|
108
|
+
</xs:enumeration>
|
109
|
+
</xs:restriction>
|
110
|
+
</xs:simpleType>
|
111
|
+
<xs:simpleType name="SAP-DuctInsulationCode">
|
112
|
+
<xs:annotation>
|
113
|
+
<xs:documentation>Code which indicates the type of duct insulation.</xs:documentation>
|
114
|
+
</xs:annotation>
|
115
|
+
<xs:restriction base="xs:string">
|
116
|
+
<xs:enumeration value="1">
|
117
|
+
<xs:annotation>
|
118
|
+
<xs:documentation>not insulated</xs:documentation>
|
119
|
+
</xs:annotation>
|
120
|
+
</xs:enumeration>
|
121
|
+
<xs:enumeration value="2">
|
122
|
+
<xs:annotation>
|
123
|
+
<xs:documentation>insulated</xs:documentation>
|
124
|
+
</xs:annotation>
|
125
|
+
</xs:enumeration>
|
126
|
+
</xs:restriction>
|
127
|
+
</xs:simpleType>
|
55
128
|
<xs:simpleType name="HeatEmitterCode">
|
56
129
|
<xs:restriction base="xs:string">
|
57
130
|
<xs:enumeration value="0">
|
@@ -887,7 +960,7 @@ Northern Ireland: 2014 onwards (TBA)</xs:documentation>
|
|
887
960
|
</xs:enumeration>
|
888
961
|
<xs:enumeration value="3">
|
889
962
|
<xs:annotation>
|
890
|
-
<xs:documentation>
|
963
|
+
<xs:documentation>stairwell</xs:documentation>
|
891
964
|
</xs:annotation>
|
892
965
|
</xs:enumeration>
|
893
966
|
</xs:restriction>
|
@@ -2983,30 +3056,6 @@ This is a very similar concept to XML ID datatype but is locally defined because
|
|
2983
3056
|
</xs:enumeration>
|
2984
3057
|
</xs:restriction>
|
2985
3058
|
</xs:simpleType>
|
2986
|
-
<xs:simpleType name="CommunityGeneratorTypeCode">
|
2987
|
-
<xs:restriction base="xs:string">
|
2988
|
-
<xs:enumeration value="0">
|
2989
|
-
<xs:annotation>
|
2990
|
-
<xs:documentation>unknown</xs:documentation>
|
2991
|
-
</xs:annotation>
|
2992
|
-
</xs:enumeration>
|
2993
|
-
<xs:enumeration value="1">
|
2994
|
-
<xs:annotation>
|
2995
|
-
<xs:documentation>boilers</xs:documentation>
|
2996
|
-
</xs:annotation>
|
2997
|
-
</xs:enumeration>
|
2998
|
-
<xs:enumeration value="3">
|
2999
|
-
<xs:annotation>
|
3000
|
-
<xs:documentation>CHP and boilers</xs:documentation>
|
3001
|
-
</xs:annotation>
|
3002
|
-
</xs:enumeration>
|
3003
|
-
<xs:enumeration value="4">
|
3004
|
-
<xs:annotation>
|
3005
|
-
<xs:documentation>heat pump</xs:documentation>
|
3006
|
-
</xs:annotation>
|
3007
|
-
</xs:enumeration>
|
3008
|
-
</xs:restriction>
|
3009
|
-
</xs:simpleType>
|
3010
3059
|
<xs:simpleType name="PumpAge">
|
3011
3060
|
<xs:restriction base="xs:string">
|
3012
3061
|
<xs:enumeration value="0">
|
data/lib/epb_view_models.rb
CHANGED
@@ -5,10 +5,9 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
|
5
5
|
loader.setup
|
6
6
|
|
7
7
|
module EpbViewModels
|
8
|
-
VERSION = "1.
|
8
|
+
VERSION = "1.2.0"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
11
|
# Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
|
13
12
|
# Source: http://jeffgardner.org/2011/08/04/rails-string-to-boolean-method/
|
14
13
|
class String
|
@@ -333,10 +333,11 @@ module Helper
|
|
333
333
|
RDSAP_GLAZED_AREA[value]
|
334
334
|
end
|
335
335
|
|
336
|
-
def self.glazed_type_rdsap(value,
|
337
|
-
if value =="6"
|
336
|
+
def self.glazed_type_rdsap(value, schema_type = "")
|
337
|
+
if value == "6" && schemas_post_20.include?(schema_type)
|
338
338
|
return RDSAP_GLAZED_TYPE["#{value}-post20"]
|
339
339
|
end
|
340
|
+
|
340
341
|
RDSAP_GLAZED_TYPE[value]
|
341
342
|
end
|
342
343
|
|
@@ -517,7 +518,6 @@ module Helper
|
|
517
518
|
SAP-Schema-NI-11.2
|
518
519
|
].freeze
|
519
520
|
|
520
|
-
|
521
521
|
if types_of_sap_pre12.include?(schema_type) && is_rdsap(report_type)
|
522
522
|
return MECHANICAL_VENTILATION["#{value}-pre12.0"]
|
523
523
|
end
|
@@ -569,6 +569,7 @@ module Helper
|
|
569
569
|
|
570
570
|
def self.fuel_type(value, schema_type = "", report_type = "2")
|
571
571
|
rdsap = %i[
|
572
|
+
RdSAP-Schema-21.0.0
|
572
573
|
RdSAP-Schema-20.0.0
|
573
574
|
RdSAP-Schema-19.0
|
574
575
|
RdSAP-Schema-18.0
|
@@ -671,12 +672,10 @@ module Helper
|
|
671
672
|
|
672
673
|
def self.schemas_post_20
|
673
674
|
%i[
|
674
|
-
|
675
|
+
RdSAP-Schema-21.0.0
|
675
676
|
]
|
676
677
|
end
|
677
678
|
|
678
679
|
private_class_method :is_rdsap, :is_sap, :schemas_post_20
|
679
|
-
|
680
|
-
|
681
680
|
end
|
682
681
|
end
|
data/lib/view_model/factory.rb
CHANGED
@@ -0,0 +1,587 @@
|
|
1
|
+
module ViewModel
|
2
|
+
module RdSapSchema210
|
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[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
|
+
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
|
+
accessor = Accessor::DomesticRecommendationsAccessor.instance
|
121
|
+
@xml_doc
|
122
|
+
.search("Suggested-Improvements Improvement")
|
123
|
+
.map do |node|
|
124
|
+
improvement_code = xpath(%w[Improvement-Details Improvement-Number], node)
|
125
|
+
{
|
126
|
+
sequence: xpath(%w[Sequence], node).to_i,
|
127
|
+
improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
|
128
|
+
improvement_summary: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).summary : xpath(%w[Improvement-Summary], node),
|
129
|
+
improvement_description: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).description : xpath(%w[Improvement-Description], node),
|
130
|
+
indicative_cost: xpath(%w[Indicative-Cost], node),
|
131
|
+
}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def hot_water_cost_potential
|
136
|
+
xpath(%w[Hot-Water-Cost-Potential])
|
137
|
+
end
|
138
|
+
|
139
|
+
def heating_cost_potential
|
140
|
+
xpath(%w[Heating-Cost-Potential])
|
141
|
+
end
|
142
|
+
|
143
|
+
def lighting_cost_potential
|
144
|
+
xpath(%w[Lighting-Cost-Potential])
|
145
|
+
end
|
146
|
+
|
147
|
+
def hot_water_cost_current
|
148
|
+
xpath(%w[Hot-Water-Cost-Current])
|
149
|
+
end
|
150
|
+
|
151
|
+
def heating_cost_current
|
152
|
+
xpath(%w[Heating-Cost-Current])
|
153
|
+
end
|
154
|
+
|
155
|
+
def lighting_cost_current
|
156
|
+
xpath(%w[Lighting-Cost-Current])
|
157
|
+
end
|
158
|
+
|
159
|
+
def potential_carbon_emission
|
160
|
+
xpath(%w[CO2-Emissions-Potential])
|
161
|
+
end
|
162
|
+
|
163
|
+
def current_carbon_emission
|
164
|
+
xpath(%w[CO2-Emissions-Current])
|
165
|
+
end
|
166
|
+
|
167
|
+
def potential_energy_rating
|
168
|
+
xpath(%w[Energy-Rating-Potential]).to_i
|
169
|
+
end
|
170
|
+
|
171
|
+
def current_energy_rating
|
172
|
+
xpath(%w[Energy-Rating-Current]).to_i
|
173
|
+
end
|
174
|
+
|
175
|
+
def estimated_energy_cost; end
|
176
|
+
|
177
|
+
def total_floor_area
|
178
|
+
xpath(%w[Property-Summary Total-Floor-Area])
|
179
|
+
end
|
180
|
+
|
181
|
+
def dwelling_type
|
182
|
+
xpath(%w[Dwelling-Type])
|
183
|
+
end
|
184
|
+
|
185
|
+
def potential_energy_saving; end
|
186
|
+
|
187
|
+
def property_age_band
|
188
|
+
xpath(%w[Construction-Age-Band])
|
189
|
+
end
|
190
|
+
|
191
|
+
def tenure
|
192
|
+
xpath(%w[Tenure])
|
193
|
+
end
|
194
|
+
|
195
|
+
def transaction_type
|
196
|
+
xpath(%w[Transaction-Type])
|
197
|
+
end
|
198
|
+
|
199
|
+
def current_space_heating_demand
|
200
|
+
xpath(%w[Space-Heating-Existing-Dwelling])
|
201
|
+
end
|
202
|
+
|
203
|
+
def current_water_heating_demand
|
204
|
+
xpath(%w[Water-Heating])
|
205
|
+
end
|
206
|
+
|
207
|
+
def impact_of_cavity_insulation
|
208
|
+
if xpath(%w[Impact-Of-Cavity-Insulation])
|
209
|
+
xpath(%w[Impact-Of-Cavity-Insulation]).to_i
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def impact_of_loft_insulation
|
214
|
+
if xpath(%w[Impact-Of-Loft-Insulation])
|
215
|
+
xpath(%w[Impact-Of-Loft-Insulation]).to_i
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def impact_of_solid_wall_insulation
|
220
|
+
if xpath(%w[Impact-Of-Solid-Wall-Insulation])
|
221
|
+
xpath(%w[Impact-Of-Solid-Wall-Insulation]).to_i
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def habitable_room_count
|
226
|
+
xpath(%w[Habitable-Room-Count])
|
227
|
+
end
|
228
|
+
|
229
|
+
def energy_rating_current
|
230
|
+
xpath(%w[Energy-Rating-Current])
|
231
|
+
end
|
232
|
+
|
233
|
+
def energy_rating_potential
|
234
|
+
xpath(%w[Energy-Rating-Potential])
|
235
|
+
end
|
236
|
+
|
237
|
+
def environmental_impact_current
|
238
|
+
xpath(%w[Environmental-Impact-Current])
|
239
|
+
end
|
240
|
+
|
241
|
+
def environmental_impact_potential
|
242
|
+
xpath(%w[Environmental-Impact-Potential])
|
243
|
+
end
|
244
|
+
|
245
|
+
def primary_energy_use
|
246
|
+
xpath(%w[Energy-Consumption-Current])
|
247
|
+
end
|
248
|
+
|
249
|
+
def energy_consumption_potential
|
250
|
+
xpath(%w[Energy-Consumption-Potential])
|
251
|
+
end
|
252
|
+
|
253
|
+
def all_roof_descriptions
|
254
|
+
@xml_doc.search("Roof/Description").map(&:content)
|
255
|
+
end
|
256
|
+
|
257
|
+
def all_roof_energy_efficiency_rating
|
258
|
+
@xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
|
259
|
+
end
|
260
|
+
|
261
|
+
def all_roof_env_energy_efficiency_rating
|
262
|
+
@xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
|
263
|
+
end
|
264
|
+
|
265
|
+
def all_window_descriptions
|
266
|
+
@xml_doc.search("Window/Description").map(&:content)
|
267
|
+
end
|
268
|
+
|
269
|
+
def all_main_heating_descriptions
|
270
|
+
@xml_doc.search("Main-Heating/Description").map(&:content)
|
271
|
+
end
|
272
|
+
|
273
|
+
def all_main_heating_controls_descriptions
|
274
|
+
@xml_doc.search("Main-Heating-Controls/Description").map(&:content)
|
275
|
+
end
|
276
|
+
|
277
|
+
def all_main_heating_energy_efficiency
|
278
|
+
@xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
|
279
|
+
end
|
280
|
+
|
281
|
+
def all_main_heating_environmental_efficiency
|
282
|
+
@xml_doc
|
283
|
+
.search("Main-Heating/Environmental-Efficiency-Rating")
|
284
|
+
.map(&:content)
|
285
|
+
end
|
286
|
+
|
287
|
+
def all_hot_water_descriptions
|
288
|
+
@xml_doc.search("Hot-Water/Description").map(&:content)
|
289
|
+
end
|
290
|
+
|
291
|
+
def all_lighting_descriptions
|
292
|
+
@xml_doc.search("Lighting/Description").map(&:content)
|
293
|
+
end
|
294
|
+
|
295
|
+
def all_secondary_heating_descriptions
|
296
|
+
@xml_doc.search("Secondary-Heating/Description").map(&:content)
|
297
|
+
end
|
298
|
+
|
299
|
+
def all_sap_floor_dimensions
|
300
|
+
@xml_doc.search("SAP-Floor-Dimension").select(&:element?).map { |node|
|
301
|
+
{ total_floor_area: xpath(%w[Total-Floor-Area], node).to_f }
|
302
|
+
}.compact
|
303
|
+
end
|
304
|
+
|
305
|
+
def level
|
306
|
+
xpath(%w[Level])
|
307
|
+
end
|
308
|
+
|
309
|
+
def top_storey
|
310
|
+
xpath(%w[Top-Storey])
|
311
|
+
end
|
312
|
+
|
313
|
+
def storey_count
|
314
|
+
xpath(%w[Storey-Count])
|
315
|
+
end
|
316
|
+
|
317
|
+
def building_part_number
|
318
|
+
xpath(%w[Building-Part-Number])
|
319
|
+
end
|
320
|
+
|
321
|
+
def all_building_parts
|
322
|
+
@xml_doc
|
323
|
+
.search("SAP-Building-Parts/SAP-Building-Part")
|
324
|
+
.map do |part|
|
325
|
+
{
|
326
|
+
roof_insulation_thickness:
|
327
|
+
if part.xpath("Roof-Insulation-Thickness").empty?
|
328
|
+
nil
|
329
|
+
else
|
330
|
+
part.xpath("Roof-Insulation-Thickness").text
|
331
|
+
end,
|
332
|
+
rafter_insulation_thickness:
|
333
|
+
xpath(%w[Rafter-Insulation-Thickness], part),
|
334
|
+
flat_roof_insulation_thickness:
|
335
|
+
xpath(%w[Flat-Roof-Insulation-Thickness], part),
|
336
|
+
sloping_ceiling_insulation_thickness:
|
337
|
+
xpath(%w[Sloping-Ceiling-Insulation-Thickness], part),
|
338
|
+
roof_u_value: xpath(%w[Roof-U-Value], part),
|
339
|
+
roof_room_connected: xpath(%w[Roof-Room-Connected], part),
|
340
|
+
}
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
def floor_heat_loss
|
345
|
+
xpath(%w[Floor-Heat-Loss])
|
346
|
+
end
|
347
|
+
|
348
|
+
def immersion_heating_type
|
349
|
+
xpath(%w[Immersion-Heating-Type])
|
350
|
+
end
|
351
|
+
|
352
|
+
def main_fuel_type
|
353
|
+
xpath(%w[Main-Fuel-Type])
|
354
|
+
end
|
355
|
+
|
356
|
+
def secondary_fuel_type
|
357
|
+
xpath(%w[Secondary-Fuel-Type])
|
358
|
+
end
|
359
|
+
|
360
|
+
def water_heating_fuel
|
361
|
+
xpath(%w[Water-Heating-Fuel])
|
362
|
+
end
|
363
|
+
|
364
|
+
def boiler_flue_type
|
365
|
+
xpath(%w[Boiler-Flue-Type])
|
366
|
+
end
|
367
|
+
|
368
|
+
def meter_type
|
369
|
+
xpath(%w[Meter-Type])
|
370
|
+
end
|
371
|
+
|
372
|
+
def sap_main_heating_code
|
373
|
+
xpath(%w[SAP-Main-Heating-Code])
|
374
|
+
end
|
375
|
+
|
376
|
+
def country_code
|
377
|
+
xpath(%w[Country-Code])
|
378
|
+
end
|
379
|
+
|
380
|
+
def co2_emissions_current_per_floor_area
|
381
|
+
xpath(%w[CO2-Emissions-Current-Per-Floor-Area])
|
382
|
+
end
|
383
|
+
|
384
|
+
def mains_gas
|
385
|
+
xpath(%w[Mains-Gas])
|
386
|
+
end
|
387
|
+
|
388
|
+
def main_heating_controls
|
389
|
+
xpath(%w[Main-Heating-Controls Description])
|
390
|
+
end
|
391
|
+
|
392
|
+
def multiple_glazed_proportion
|
393
|
+
xpath(%w[Multiple-Glazed-Proportion])
|
394
|
+
end
|
395
|
+
|
396
|
+
def glazed_area
|
397
|
+
xpath(%w[Glazed-Area])
|
398
|
+
end
|
399
|
+
|
400
|
+
def heated_room_count
|
401
|
+
xpath(%w[Heated-Room-Count])
|
402
|
+
end
|
403
|
+
|
404
|
+
def low_energy_lighting
|
405
|
+
xpath(%w[Low-Energy-Lighting])
|
406
|
+
end
|
407
|
+
|
408
|
+
def fixed_lighting_outlets_count
|
409
|
+
xpath(%w[Fixed-Lighting-Outlets-Count])
|
410
|
+
end
|
411
|
+
|
412
|
+
def low_energy_fixed_lighting_outlets_count
|
413
|
+
xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])
|
414
|
+
end
|
415
|
+
|
416
|
+
def open_fireplaces_count
|
417
|
+
xpath(%w[Open-Fireplaces-Count])
|
418
|
+
end
|
419
|
+
|
420
|
+
def hot_water_description
|
421
|
+
xpath(%w[Hot-Water Description])
|
422
|
+
end
|
423
|
+
|
424
|
+
def hot_water_energy_efficiency_rating
|
425
|
+
xpath(%w[Hot-Water Energy-Efficiency-Rating])
|
426
|
+
end
|
427
|
+
|
428
|
+
def hot_water_environmental_efficiency_rating
|
429
|
+
xpath(%w[Hot-Water Environmental-Efficiency-Rating])
|
430
|
+
end
|
431
|
+
|
432
|
+
def wind_turbine_count
|
433
|
+
xpath(%w[Wind-Turbines-Count])
|
434
|
+
end
|
435
|
+
|
436
|
+
def heat_loss_corridor
|
437
|
+
xpath(%w[Heat-Loss-Corridor])
|
438
|
+
end
|
439
|
+
|
440
|
+
def unheated_corridor_length
|
441
|
+
xpath(%w[Unheated-Corridor-Length])
|
442
|
+
end
|
443
|
+
|
444
|
+
def window_description
|
445
|
+
xpath(%w[Window Description])
|
446
|
+
end
|
447
|
+
|
448
|
+
def window_energy_efficiency_rating
|
449
|
+
xpath(%w[Window Energy-Efficiency-Rating])
|
450
|
+
end
|
451
|
+
|
452
|
+
def window_environmental_efficiency_rating
|
453
|
+
xpath(%w[Window Environmental-Efficiency-Rating])
|
454
|
+
end
|
455
|
+
|
456
|
+
def secondary_heating_description
|
457
|
+
xpath(%w[Secondary-Heating Description])
|
458
|
+
end
|
459
|
+
|
460
|
+
def secondary_heating_energy_efficiency_rating
|
461
|
+
xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
|
462
|
+
end
|
463
|
+
|
464
|
+
def secondary_heating_environmental_efficiency_rating
|
465
|
+
xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
|
466
|
+
end
|
467
|
+
|
468
|
+
def lighting_description
|
469
|
+
xpath(%w[Lighting Description])
|
470
|
+
end
|
471
|
+
|
472
|
+
def lighting_energy_efficiency_rating
|
473
|
+
xpath(%w[Lighting Energy-Efficiency-Rating])
|
474
|
+
end
|
475
|
+
|
476
|
+
def lighting_environmental_efficiency_rating
|
477
|
+
xpath(%w[Lighting Environmental-Efficiency-Rating])
|
478
|
+
end
|
479
|
+
|
480
|
+
def photovoltaic_roof_area_percent
|
481
|
+
xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
|
482
|
+
end
|
483
|
+
|
484
|
+
def built_form
|
485
|
+
xpath(%w[Built-Form])
|
486
|
+
end
|
487
|
+
|
488
|
+
def extensions_count
|
489
|
+
xpath(%w[Extensions-Count])
|
490
|
+
end
|
491
|
+
|
492
|
+
def report_type
|
493
|
+
xpath(%w[Report-Type])
|
494
|
+
end
|
495
|
+
|
496
|
+
def all_wall_descriptions
|
497
|
+
@xml_doc.search("Wall/Description").map(&:content)
|
498
|
+
end
|
499
|
+
|
500
|
+
def all_wall_energy_efficiency_rating
|
501
|
+
@xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
|
502
|
+
end
|
503
|
+
|
504
|
+
def all_wall_env_energy_efficiency_rating
|
505
|
+
@xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
|
506
|
+
end
|
507
|
+
|
508
|
+
def floor_level
|
509
|
+
xpath(%w[Flat-Location])
|
510
|
+
end
|
511
|
+
|
512
|
+
def solar_water_heating_flag
|
513
|
+
xpath(%w[Solar-Water-Heating])
|
514
|
+
end
|
515
|
+
|
516
|
+
def mechanical_ventilation
|
517
|
+
xpath(%w[Mechanical-Ventilation])
|
518
|
+
end
|
519
|
+
|
520
|
+
def floor_height
|
521
|
+
@xml_doc.search("Room-Height").map(&:content)
|
522
|
+
end
|
523
|
+
|
524
|
+
def all_floor_descriptions
|
525
|
+
@xml_doc.search("Property-Summary/Floor/Description").map(&:content)
|
526
|
+
end
|
527
|
+
|
528
|
+
def all_floor_energy_efficiency_rating
|
529
|
+
@xml_doc
|
530
|
+
.search("Property-Summary/Floor/Energy-Efficiency-Rating")
|
531
|
+
.map(&:content)
|
532
|
+
end
|
533
|
+
|
534
|
+
def all_floor_env_energy_efficiency_rating
|
535
|
+
@xml_doc
|
536
|
+
.search("Property-Summary/Floor/Environmental-Efficiency-Rating")
|
537
|
+
.map(&:content)
|
538
|
+
end
|
539
|
+
|
540
|
+
def all_main_heating_controls_energy_efficiency
|
541
|
+
@xml_doc
|
542
|
+
.search("Main-Heating-Controls/Energy-Efficiency-Rating")
|
543
|
+
.map(&:content)
|
544
|
+
end
|
545
|
+
|
546
|
+
def all_main_heating_controls_environmental_efficiency
|
547
|
+
@xml_doc
|
548
|
+
.search("Main-Heating-Controls/Environmental-Efficiency-Rating")
|
549
|
+
.map(&:content)
|
550
|
+
end
|
551
|
+
|
552
|
+
def main_dwelling_construction_age_band_or_year
|
553
|
+
sap_building_parts =
|
554
|
+
@xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
|
555
|
+
sap_building_parts.each do |sap_building_part|
|
556
|
+
building_part_number = sap_building_part.at("Building-Part-Number")
|
557
|
+
|
558
|
+
# Identifies the Main Dwelling
|
559
|
+
if building_part_number&.content == "1"
|
560
|
+
return(
|
561
|
+
sap_building_part.at_xpath(
|
562
|
+
"Construction-Age-Band | Construction-Year",
|
563
|
+
)&.content
|
564
|
+
)
|
565
|
+
end
|
566
|
+
end
|
567
|
+
nil
|
568
|
+
end
|
569
|
+
|
570
|
+
def cylinder_insul_thickness
|
571
|
+
xpath(%w[Cylinder-Insulation-Thickness])
|
572
|
+
end
|
573
|
+
|
574
|
+
def cylinder_insulation_type
|
575
|
+
xpath(%w[Cylinder-Insulation-Type])
|
576
|
+
end
|
577
|
+
|
578
|
+
def cylinder_size
|
579
|
+
xpath(%w[Cylinder-Size])
|
580
|
+
end
|
581
|
+
|
582
|
+
def has_cylinder_thermostat
|
583
|
+
xpath(%w[Cylinder-Thermostat])
|
584
|
+
end
|
585
|
+
end
|
586
|
+
end
|
587
|
+
end
|
@@ -50,6 +50,8 @@ module ViewModel
|
|
50
50
|
|
51
51
|
def build_view_model(xml_doc, schema_type)
|
52
52
|
case schema_type
|
53
|
+
when :"RdSAP-Schema-21.0.0"
|
54
|
+
ViewModel::RdSapSchema210::CommonSchema.new xml_doc
|
53
55
|
when :"RdSAP-Schema-20.0.0"
|
54
56
|
ViewModel::RdSapSchema200::CommonSchema.new xml_doc
|
55
57
|
when :"RdSAP-Schema-19.0"
|
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.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DLUHC Energy Performance of Buildings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -1781,6 +1781,7 @@ files:
|
|
1781
1781
|
- lib/view_model/rd_sap_schema_180/common_schema.rb
|
1782
1782
|
- lib/view_model/rd_sap_schema_190/common_schema.rb
|
1783
1783
|
- lib/view_model/rd_sap_schema_200/common_schema.rb
|
1784
|
+
- lib/view_model/rd_sap_schema_210/common_schema.rb
|
1784
1785
|
- lib/view_model/rd_sap_schema_ni_173/common_schema.rb
|
1785
1786
|
- lib/view_model/rd_sap_schema_ni_174/common_schema.rb
|
1786
1787
|
- lib/view_model/rd_sap_schema_ni_180/common_schema.rb
|