epb_view_models 2.4.0 → 2.5.1

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +4 -0
  3. data/api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd +296 -296
  4. data/api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd +63 -63
  5. data/api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd +34 -34
  6. data/api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd +120 -120
  7. data/api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd +67 -67
  8. data/api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd +178 -178
  9. data/api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd +391 -391
  10. data/api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd +171 -171
  11. data/api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd +300 -300
  12. data/api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd +66 -66
  13. data/api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd +34 -34
  14. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd +125 -125
  15. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd.bak +123 -123
  16. data/api/schemas/xml/CEPC-S-7.1/Reports/Property.xsd +67 -67
  17. data/api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd +178 -178
  18. data/api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd +406 -406
  19. data/api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd +174 -174
  20. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/CommonFiles/CommonStructures.xsd +166 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/CommonFiles/Exceptions.xsd +77 -0
  22. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeAccessRequest_1.xsd +53 -0
  23. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeAccessResponse_1.xsd +58 -0
  24. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeStatusRequest_1.xsd +54 -0
  25. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeStatusResponse_1.xsd +58 -0
  26. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd +52 -0
  27. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportCreateResponse_1.xsd +63 -0
  28. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportRetrieveRequest_1.xsd +63 -0
  29. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportRetrieveResponse_1.xsd +99 -0
  30. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ExternalDefinitions.xml +907 -0
  31. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ExternalDefinitions.xsd +147 -0
  32. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateRequest_1.xsd +55 -0
  33. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateResponse_1.xsd +39 -0
  34. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusRequest_1.xsd +41 -0
  35. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusResponse_1.xsd +64 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/PropertyUPRNValidationRequest_1.xsd +55 -0
  37. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/PropertyUPRNValidationResponse_1.xsd +57 -0
  38. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/EPC-Certificate.xsd +337 -0
  39. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/Property.xsd +76 -0
  40. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/SAP09-CollectedData.xsd +1334 -0
  41. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/SAP09-Report.xsd +209 -0
  42. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/UserManagement.xsd +225 -0
  43. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/BaseDataTypes.xsd +181 -0
  44. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/EPC-Domains.xsd +725 -0
  45. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/SAP09-Domains.xsd +3397 -0
  46. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/SharedDomains.xsd +323 -0
  47. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/EPC-Certificate.xsd +298 -0
  48. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/EPC-CollectedData.xsd +549 -0
  49. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesExternal.xsd +290 -0
  50. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd +229 -0
  51. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesInternal.xsd +212 -0
  52. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesServices.xsd +318 -0
  53. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-PropertyDetails.xsd +387 -0
  54. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-RiskAssessment.xsd +306 -0
  55. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HIP-Reports.xsd +228 -0
  56. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/Property.xsd +79 -0
  57. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/UserManagement.xsd +265 -0
  58. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/BaseDataTypes.xsd +182 -0
  59. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/EPC-Domains.xsd +778 -0
  60. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/HCR-Domains.xsd +1786 -0
  61. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/SAP-Domains.xsd +1397 -0
  62. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/SharedDomains.xsd +774 -0
  63. data/api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/TypeDefinitions.xsd +26 -0
  64. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  65. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  66. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  67. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  68. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  69. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  70. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  71. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  72. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  73. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  74. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  75. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  76. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  77. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  78. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  79. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  80. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  81. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  82. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  83. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  84. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  85. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  86. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  87. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  88. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  89. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  90. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  91. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  92. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  93. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  94. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  95. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  96. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  97. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  98. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  99. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  100. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  101. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  102. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  103. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  104. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  105. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  106. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  107. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  108. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  109. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  110. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  111. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  112. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  113. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  114. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  115. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  116. data/lib/epb_view_models/version.rb +1 -1
  117. data/lib/view_model/factory.rb +1 -0
  118. data/lib/view_model/rd_sap_schema_s_150/common_schema.rb +517 -0
  119. data/lib/view_model/rd_sap_wrapper.rb +2 -0
  120. metadata +46 -1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpbViewModels
4
- VERSION = "2.4.0"
4
+ VERSION = "2.5.1"
5
5
  end
@@ -41,6 +41,7 @@ module ViewModel
41
41
  RdSAP-Schema-S-18.0
42
42
  RdSAP-Schema-S-17.00
43
43
  RdSAP-Schema-S-16.1
44
+ RdSAP-Schema-S-15.0
44
45
  RdSAP-Schema-S-14.0
45
46
  RdSAP-Schema-S-12.0
46
47
  ].freeze
@@ -0,0 +1,517 @@
1
+ module ViewModel
2
+ module RdSapSchemaS150
3
+ class CommonSchema < ViewModel::DomesticEpcViewModel
4
+ def assessment_id
5
+ xpath(%w[RRN])
6
+ end
7
+
8
+ def address_line1
9
+ xpath(%w[Property Address Address-Line-1])
10
+ end
11
+
12
+ def address_line2
13
+ xpath(%w[Property Address Address-Line-2]).to_s
14
+ end
15
+
16
+ def address_line3
17
+ xpath(%w[Property Address Address-Line-3]).to_s
18
+ end
19
+
20
+ def address_line4
21
+ xpath(%w[Property Address Address-Line-4]).to_s
22
+ end
23
+
24
+ def town
25
+ xpath(%w[Property Address Post-Town])
26
+ end
27
+
28
+ def postcode
29
+ xpath(%w[Property Address Postcode])
30
+ end
31
+
32
+ def scheme_assessor_id
33
+ xpath(%w[Identification-Number Membership-Number]) or xpath(%w[Identification-Number Certificate-Number])
34
+ end
35
+
36
+ def assessor_name
37
+ [
38
+ xpath(%w[Home-Inspector Name Prefix]),
39
+ xpath(%w[Home-Inspector Name First-Name]),
40
+ xpath(%w[Home-Inspector Name Surname]),
41
+ xpath(%w[Home-Inspector Name Suffix]),
42
+ ].reject { |e| e.to_s.empty? }.join(" ")
43
+ end
44
+
45
+ def assessor_email
46
+ xpath(%w[Home-Inspector/E-Mail])
47
+ end
48
+
49
+ def assessor_telephone
50
+ xpath(%w[Home-Inspector/Telephone])
51
+ end
52
+
53
+ def date_of_assessment
54
+ xpath(%w[Inspection-Date])
55
+ end
56
+
57
+ def date_of_registration
58
+ xpath(%w[Registration-Date])
59
+ end
60
+
61
+ def address_id
62
+ "LPRN-#{xpath(%w[UPRN])}"
63
+ end
64
+
65
+ def date_of_expiry
66
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
67
+
68
+ expires_at.to_s
69
+ end
70
+
71
+ def property_summary
72
+ @xml_doc.search("Energy-Assessment Property-Summary").children.select(
73
+ &:element?
74
+ ).map { |node|
75
+ next if xpath(%w[Energy-Efficiency-Rating], node).nil?
76
+
77
+ {
78
+ energy_efficiency_rating:
79
+ xpath(%w[Energy-Efficiency-Rating], node).to_i,
80
+ environmental_efficiency_rating:
81
+ xpath(%w[Environmental-Efficiency-Rating], node).to_i,
82
+ name: node.name.underscore,
83
+ description: xpath(%w[Description], node),
84
+ }
85
+ }.compact
86
+ end
87
+
88
+ def related_party_disclosure_text
89
+ xpath(%w[Related-Party-Disclosure-Text])
90
+ end
91
+
92
+ def related_party_disclosure_number
93
+ xpath(%w[Related-Party-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 primary_energy_use
175
+ xpath(%w[Energy-Consumption-Current])
176
+ end
177
+
178
+ def energy_consumption_potential
179
+ xpath(%w[Energy-Consumption-Potential])
180
+ end
181
+
182
+ def estimated_energy_cost; end
183
+
184
+ def total_floor_area
185
+ xpath(%w[Property-Summary Total-Floor-Area])
186
+ end
187
+
188
+ def dwelling_type
189
+ xpath(%w[Dwelling-Type])
190
+ end
191
+
192
+ def potential_energy_saving; end
193
+
194
+ def property_age_band
195
+ xpath(%w[Construction-Year])
196
+ end
197
+
198
+ def transaction_type
199
+ xpath(%w[Transaction-Type])
200
+ end
201
+
202
+ def current_space_heating_demand
203
+ xpath(%w[Space-Heating]) or xpath(%w[Space-Heating-Existing-Dwelling])
204
+ end
205
+
206
+ def current_water_heating_demand
207
+ xpath(%w[Water-Heating])
208
+ end
209
+
210
+ def impact_of_cavity_insulation
211
+ if xpath(%w[Impact-Of-Cavity-Insulation])
212
+ xpath(%w[Impact-Of-Cavity-Insulation])&.to_i
213
+ end
214
+ end
215
+
216
+ def impact_of_loft_insulation
217
+ if xpath(%w[Impact-Of-Loft-Insulation])
218
+ xpath(%w[Impact-Of-Loft-Insulation])&.to_i
219
+ end
220
+ end
221
+
222
+ def impact_of_solid_wall_insulation
223
+ if xpath(%w[Impact-Of-Solid-Wall-Insulation])
224
+ xpath(%w[Impact-Of-Solid-Wall-Insulation])&.to_i
225
+ end
226
+ end
227
+
228
+ def country_code
229
+ xpath(%w[Country-Code])
230
+ end
231
+
232
+ def main_fuel_type
233
+ xpath(%w[Main-Fuel-Type])
234
+ end
235
+
236
+ def secondary_fuel_type
237
+ xpath(%w[Secondary-Fuel-Type])
238
+ end
239
+
240
+ def type_of_assessment
241
+ case xpath(%w[Report-Type])&.to_i
242
+ when 1
243
+ "HCR"
244
+ when 2
245
+ "RdSAP"
246
+ when 3
247
+ "SAP"
248
+ end
249
+ end
250
+
251
+ def environmental_impact_current
252
+ xpath(%w[Environmental-Impact-Current])&.to_i
253
+ end
254
+
255
+ def environmental_impact_potential
256
+ xpath(%w[Environmental-Impact-Potential])&.to_i
257
+ end
258
+
259
+ def co2_emissions_current_per_floor_area
260
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])
261
+ end
262
+
263
+ def level
264
+ xpath(%w[Level])
265
+ end
266
+
267
+ def top_storey
268
+ flat_level_code = xpath(%w[Level])
269
+ flat_level_code == "3" ? "Y" : "N"
270
+ end
271
+
272
+ def main_heating_controls
273
+ xpath(%w[Main-Heating-Controls Description])
274
+ end
275
+
276
+ def multiple_glazed_proportion
277
+ xpath(%w[Multiple-Glazed-Proportion])
278
+ end
279
+
280
+ def low_energy_lighting
281
+ xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Percentage])
282
+ end
283
+
284
+ def fixed_lighting_outlets_count
285
+ xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i
286
+ end
287
+
288
+ def low_energy_fixed_lighting_outlets_count
289
+ xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i
290
+ end
291
+
292
+ def open_fireplaces_count
293
+ xpath(%w[Open-Fireplaces-Count])&.to_i
294
+ end
295
+
296
+ def hot_water_description
297
+ xpath(%w[Hot-Water Description])
298
+ end
299
+
300
+ def hot_water_energy_efficiency_rating
301
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
302
+ end
303
+
304
+ def hot_water_environmental_efficiency_rating
305
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
306
+ end
307
+
308
+ def window_description
309
+ xpath(%w[Windows Description])
310
+ end
311
+
312
+ def window_energy_efficiency_rating
313
+ xpath(%w[Windows Energy-Efficiency-Rating])
314
+ end
315
+
316
+ def window_environmental_efficiency_rating
317
+ xpath(%w[Windows Environmental-Efficiency-Rating])
318
+ end
319
+
320
+ def secondary_heating_description
321
+ xpath(%w[Secondary-Heating Description])
322
+ end
323
+
324
+ def secondary_heating_energy_efficiency_rating
325
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
326
+ end
327
+
328
+ def secondary_heating_environmental_efficiency_rating
329
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
330
+ end
331
+
332
+ def lighting_description
333
+ xpath(%w[Lighting Description])
334
+ end
335
+
336
+ def lighting_energy_efficiency_rating
337
+ xpath(%w[Lighting Energy-Efficiency-Rating])
338
+ end
339
+
340
+ def lighting_environmental_efficiency_rating
341
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
342
+ end
343
+
344
+ def built_form
345
+ xpath(%w[Built-Form])
346
+ end
347
+
348
+ def heat_loss_corridor
349
+ xpath(%w[Heat-Loss-Corridor])
350
+ end
351
+
352
+ def wind_turbine_count
353
+ xpath(%w[Wind-Turbines-Count])&.to_i
354
+ end
355
+
356
+ def unheated_corridor_length
357
+ xpath(%w[Unheated-Corridor-Length])
358
+ end
359
+
360
+ def all_main_heating_descriptions
361
+ @xml_doc.search("Main-Heating/Description").map(&:content)
362
+ end
363
+
364
+ def extensions_count
365
+ xpath(%w[Extensions-Count])&.to_i
366
+ end
367
+
368
+ def all_main_heating_controls_descriptions
369
+ @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
370
+ end
371
+
372
+ def report_type
373
+ xpath(%w[Report-Type])
374
+ end
375
+
376
+ def all_roof_descriptions
377
+ @xml_doc.search("Roof/Description").map(&:content)
378
+ end
379
+
380
+ def all_roof_energy_efficiency_rating
381
+ @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
382
+ end
383
+
384
+ def all_roof_env_energy_efficiency_rating
385
+ @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
386
+ end
387
+
388
+ def all_wall_descriptions
389
+ @xml_doc.search("Walls/Description").map(&:content)
390
+ end
391
+
392
+ def all_wall_energy_efficiency_rating
393
+ @xml_doc.search("Walls/Energy-Efficiency-Rating").map(&:content)
394
+ end
395
+
396
+ def all_wall_env_energy_efficiency_rating
397
+ @xml_doc.search("Walls/Environmental-Efficiency-Rating").map(&:content)
398
+ end
399
+
400
+ def floor_level
401
+ xpath(%w[SAP-Flat-Details Level])
402
+ end
403
+
404
+ def all_main_heating_energy_efficiency
405
+ @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
406
+ end
407
+
408
+ def main_dwelling_construction_age_band_or_year
409
+ sap_building_parts =
410
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
411
+ sap_building_parts.each do |sap_building_part|
412
+ building_part_number = sap_building_part.at("Building-Part-Number")
413
+
414
+ # Identifies the Main Dwelling
415
+ if building_part_number&.content == "1"
416
+ return (
417
+ sap_building_part.at_xpath(
418
+ "Construction-Age-Band | Construction-Year",
419
+ )&.content
420
+ )
421
+ end
422
+ end
423
+ nil
424
+ end
425
+
426
+ def all_floor_descriptions
427
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
428
+ end
429
+
430
+ def all_floor_energy_efficiency_rating
431
+ @xml_doc
432
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
433
+ .map(&:content)
434
+ end
435
+
436
+ def all_floor_env_energy_efficiency_rating
437
+ @xml_doc
438
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
439
+ .map(&:content)
440
+ end
441
+
442
+ def all_main_heating_controls_energy_efficiency
443
+ @xml_doc
444
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
445
+ .map(&:content)
446
+ end
447
+
448
+ def all_main_heating_controls_environmental_efficiency
449
+ @xml_doc
450
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
451
+ .map(&:content)
452
+ end
453
+
454
+ def all_main_heating_environmental_efficiency
455
+ @xml_doc
456
+ .search("Main-Heating/Environmental-Efficiency-Rating")
457
+ .map(&:content)
458
+ end
459
+
460
+ def mechanical_ventilation
461
+ xpath(%w[Mechanical-Ventilation])
462
+ end
463
+
464
+ def glazed_area
465
+ xpath(%w[Glazed-Area])
466
+ end
467
+
468
+ def habitable_room_count
469
+ xpath(%w[Habitable-Room-Count])&.to_i
470
+ end
471
+
472
+ def heated_room_count
473
+ xpath(%w[Heated-Room-Count])&.to_i
474
+ end
475
+
476
+ def photovoltaic_roof_area_percent
477
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
478
+ end
479
+
480
+ def solar_water_heating_flag
481
+ xpath(%w[Solar-Water-Heating])
482
+ end
483
+
484
+ def floor_height
485
+ @xml_doc.search("Room-Height").map(&:content)
486
+ end
487
+
488
+ def storey_count
489
+ xpath(%w[Storey-Count])&.to_i
490
+ end
491
+
492
+ def energy_tariff
493
+ xpath(%w[Meter-Type])
494
+ end
495
+
496
+ def cylinder_insul_thickness
497
+ xpath(%w[Cylinder-Insulation-Thickness])
498
+ end
499
+
500
+ def cylinder_insulation_type
501
+ xpath(%w[Cylinder-Insulation-Type])
502
+ end
503
+
504
+ def cylinder_size
505
+ xpath(%w[Cylinder-Size])
506
+ end
507
+
508
+ def has_cylinder_thermostat
509
+ xpath(%w[Cylinder-Thermostat])
510
+ end
511
+
512
+ def water_heating_fuel
513
+ xpath(%w[Water-Heating-Fuel])
514
+ end
515
+ end
516
+ end
517
+ end
@@ -93,6 +93,8 @@ module ViewModel
93
93
  ViewModel::RdSapSchemaS1700::CommonSchema.new xml_doc
94
94
  when :"RdSAP-Schema-S-16.1"
95
95
  ViewModel::RdSapSchemaS161::CommonSchema.new xml_doc
96
+ when :"RdSAP-Schema-S-15.0"
97
+ ViewModel::RdSapSchemaS150::CommonSchema.new xml_doc
96
98
  when :"RdSAP-Schema-S-14.0"
97
99
  ViewModel::RdSapSchemaS140::CommonSchema.new xml_doc
98
100
  when :"RdSAP-Schema-S-12.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epb_view_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings
@@ -373,6 +373,50 @@ files:
373
373
  - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SAP-Domains.xsd
374
374
  - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SharedDomains.xsd
375
375
  - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/TypeDefinitions.xsd
376
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/CommonFiles/CommonStructures.xsd
377
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/CommonFiles/Exceptions.xsd
378
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeAccessRequest_1.xsd
379
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeAccessResponse_1.xsd
380
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeStatusRequest_1.xsd
381
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportChangeStatusResponse_1.xsd
382
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd
383
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportCreateResponse_1.xsd
384
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportRetrieveRequest_1.xsd
385
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ConditionReportRetrieveResponse_1.xsd
386
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ExternalDefinitions.xml
387
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/ExternalDefinitions.xsd
388
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateRequest_1.xsd
389
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateResponse_1.xsd
390
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusRequest_1.xsd
391
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusResponse_1.xsd
392
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/PropertyUPRNValidationRequest_1.xsd
393
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Messages/PropertyUPRNValidationResponse_1.xsd
394
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/EPC-Certificate.xsd
395
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/Property.xsd
396
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/SAP09-CollectedData.xsd
397
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/SAP09-Report.xsd
398
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/Templates/UserManagement.xsd
399
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/BaseDataTypes.xsd
400
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/EPC-Domains.xsd
401
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/SAP09-Domains.xsd
402
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/SAP-EPC/UDT/SharedDomains.xsd
403
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/EPC-Certificate.xsd
404
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/EPC-CollectedData.xsd
405
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesExternal.xsd
406
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd
407
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesInternal.xsd
408
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-FeaturesServices.xsd
409
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-PropertyDetails.xsd
410
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HCR-RiskAssessment.xsd
411
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/HIP-Reports.xsd
412
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/Property.xsd
413
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/Templates/UserManagement.xsd
414
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/BaseDataTypes.xsd
415
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/EPC-Domains.xsd
416
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/HCR-Domains.xsd
417
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/SAP-Domains.xsd
418
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/SharedDomains.xsd
419
+ - api/schemas/xml/RdSAP-Schema-S-15.0/RdSAP/UDT/TypeDefinitions.xsd
376
420
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml
377
421
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd
378
422
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/All-HIP.xsd
@@ -1815,6 +1859,7 @@ files:
1815
1859
  - lib/view_model/rd_sap_schema_ni_2101/common_schema.rb
1816
1860
  - lib/view_model/rd_sap_schema_s_120/common_schema.rb
1817
1861
  - lib/view_model/rd_sap_schema_s_140/common_schema.rb
1862
+ - lib/view_model/rd_sap_schema_s_150/common_schema.rb
1818
1863
  - lib/view_model/rd_sap_schema_s_161/common_schema.rb
1819
1864
  - lib/view_model/rd_sap_schema_s_1700/common_schema.rb
1820
1865
  - lib/view_model/rd_sap_schema_s_180/common_schema.rb