epb_view_models 2.2.21 → 2.3.0

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 (119) 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-14.0/RdSAP/CommonFiles/CommonStructures.xsd +160 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/Exceptions.xsd +72 -0
  22. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/ExternalDefinitions.xsd +147 -0
  23. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessRequest_1.xsd +44 -0
  24. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessResponse_1.xsd +47 -0
  25. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusRequest_1.xsd +44 -0
  26. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusResponse_1.xsd +47 -0
  27. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd +41 -0
  28. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateResponse_1.xsd +52 -0
  29. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveRequest_1.xsd +52 -0
  30. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveResponse_1.xsd +87 -0
  31. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateRequest_1.xsd +44 -0
  32. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateResponse_1.xsd +28 -0
  33. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusRequest_1.xsd +30 -0
  34. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusResponse_1.xsd +52 -0
  35. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationRequest_1.xsd +44 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationResponse_1.xsd +46 -0
  37. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/EPC-Certificate.xsd +270 -0
  38. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/Property.xsd +68 -0
  39. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-CollectedData.xsd +1188 -0
  40. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-Report.xsd +195 -0
  41. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/UserManagement.xsd +215 -0
  42. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/BaseDataTypes.xsd +175 -0
  43. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/EPC-Domains.xsd +703 -0
  44. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SAP05-Domains.xsd +3007 -0
  45. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SharedDomains.xsd +311 -0
  46. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-Certificate.xsd +252 -0
  47. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-CollectedData.xsd +444 -0
  48. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -0
  49. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -0
  50. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -0
  51. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -0
  52. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -0
  53. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-RiskAssessment.xsd +297 -0
  54. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HIP-Reports.xsd +220 -0
  55. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/Property.xsd +73 -0
  56. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/UserManagement.xsd +257 -0
  57. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/BaseDataTypes.xsd +176 -0
  58. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/EPC-Domains.xsd +743 -0
  59. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/HCR-Domains.xsd +1773 -0
  60. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SAP-Domains.xsd +1134 -0
  61. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SharedDomains.xsd +660 -0
  62. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/TypeDefinitions.xsd +19 -0
  63. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  64. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  65. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  66. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  67. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  68. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  69. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  70. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  71. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  72. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  73. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  74. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  75. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  76. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  77. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  78. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  79. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  80. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  81. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  82. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  83. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  84. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  85. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  86. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  87. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  88. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  89. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  90. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  91. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  92. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  93. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  94. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  95. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  96. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  97. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  98. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  99. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  100. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  101. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  102. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  103. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  104. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  105. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  106. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  107. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  108. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  109. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  110. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  111. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  112. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  113. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  114. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  115. data/lib/epb_view_models.rb +1 -1
  116. data/lib/view_model/factory.rb +1 -0
  117. data/lib/view_model/rd_sap_schema_s_140/common_schema.rb +550 -0
  118. data/lib/view_model/rd_sap_wrapper.rb +2 -0
  119. metadata +45 -1
@@ -5,7 +5,7 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "2.2.21"
8
+ VERSION = "2.3.0"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -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-14.0
44
45
  ].freeze
45
46
  TYPES_OF_SAP = %i[
46
47
  SAP-Schema-19.2.0
@@ -0,0 +1,550 @@
1
+ module ViewModel
2
+ module RdSapSchemaS140
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
+ "#{xpath(%w[Home-Inspector Name First-Name])} #{xpath(%w[Home-Inspector Name Surname])}"
38
+ end
39
+
40
+ def assessor_email
41
+ xpath(%w[Home-Inspector E-Mail])
42
+ end
43
+
44
+ def assessor_telephone
45
+ xpath(%w[Home-Inspector Telephone])
46
+ end
47
+
48
+ def date_of_assessment
49
+ xpath(%w[Inspection-Date])
50
+ end
51
+
52
+ def date_of_registration
53
+ xpath(%w[Registration-Date])
54
+ end
55
+
56
+ def date_of_completion
57
+ xpath(%w[Completion-Date])
58
+ end
59
+
60
+ def address_id
61
+ "LPRN-#{xpath(%w[UPRN])}"
62
+ end
63
+
64
+ def date_of_expiry
65
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
66
+
67
+ expires_at.to_s
68
+ end
69
+
70
+ def property_summary
71
+ @xml_doc.search("Energy-Assessment Property-Summary").children.select(
72
+ &:element?
73
+ ).map { |node|
74
+ next if xpath(%w[Energy-Efficiency-Rating], node).nil?
75
+
76
+ {
77
+ energy_efficiency_rating:
78
+ xpath(%w[Energy-Efficiency-Rating], node).to_i,
79
+ environmental_efficiency_rating:
80
+ xpath(%w[Environmental-Efficiency-Rating], node).to_i,
81
+ name: node.name.underscore,
82
+ description: xpath(%w[Description], node),
83
+ }
84
+ }.compact
85
+ end
86
+
87
+ def related_party_disclosure_text
88
+ xpath(%w[Related-Party-Disclosure-Text])
89
+ end
90
+
91
+ def related_party_disclosure_number
92
+ disclosure_number = xpath(%w[Related-Party-Disclosure-Number])
93
+ disclosure_number.nil? ? nil : disclosure_number.to_i
94
+ end
95
+
96
+ def improvements
97
+ @xml_doc
98
+ .search("Suggested-Improvements Improvement")
99
+ .map do |node|
100
+ {
101
+ energy_performance_rating_improvement: xpath(%w[Energy-Performance-Rating], node).to_i,
102
+ environmental_impact_rating_improvement: xpath(%w[Environmental-Impact-Rating], node).to_i,
103
+ green_deal_category_code: nil,
104
+ improvement_category: xpath(%w[Improvement-Category], node),
105
+ improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
106
+ improvement_description: nil,
107
+ improvement_title: "",
108
+ improvement_type: xpath(%w[Improvement-Type], node),
109
+ indicative_cost: nil,
110
+ sequence: xpath(%w[Sequence], node).to_i,
111
+ typical_saving: xpath(%w[Typical-Saving], node),
112
+ }
113
+ end
114
+ end
115
+
116
+ def recommendations_for_report
117
+ @xml_doc
118
+ .search("Suggested-Improvements Improvement")
119
+ .map do |node|
120
+ {
121
+ sequence: xpath(%w[Sequence], node).to_i,
122
+ improvement_summary: xpath(%w[Improvement-Summary], node),
123
+ improvement_description: xpath(%w[Improvement-Description], node),
124
+ improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
125
+ indicative_cost: xpath(%w[Indicative-Cost], node),
126
+ }
127
+ end
128
+ end
129
+
130
+ def hot_water_cost_potential
131
+ xpath(%w[Hot-Water-Cost-Potential])
132
+ end
133
+
134
+ def heating_cost_potential
135
+ xpath(%w[Heating-Cost-Potential])
136
+ end
137
+
138
+ def lighting_cost_potential
139
+ xpath(%w[Lighting-Cost-Potential])
140
+ end
141
+
142
+ def hot_water_cost_current
143
+ xpath(%w[Hot-Water-Cost-Current])
144
+ end
145
+
146
+ def heating_cost_current
147
+ xpath(%w[Heating-Cost-Current])
148
+ end
149
+
150
+ def lighting_cost_current
151
+ xpath(%w[Lighting-Cost-Current])
152
+ end
153
+
154
+ def potential_carbon_emission
155
+ xpath(%w[CO2-Emissions-Potential])
156
+ end
157
+
158
+ def current_carbon_emission
159
+ xpath(%w[CO2-Emissions-Current])
160
+ end
161
+
162
+ def potential_energy_rating
163
+ xpath(%w[Energy-Rating-Potential])&.to_i
164
+ end
165
+
166
+ def current_energy_rating
167
+ xpath(%w[Energy-Rating-Current])&.to_i
168
+ end
169
+
170
+ def total_floor_area
171
+ xpath(%w[Property-Summary Total-Floor-Area])
172
+ end
173
+
174
+ def dwelling_type
175
+ xpath(%w[Dwelling-Type])
176
+ end
177
+
178
+ def property_age_band
179
+ xpath(%w[Construction-Age-Band])
180
+ end
181
+
182
+ def tenure
183
+ nil
184
+ end
185
+
186
+ def transaction_type
187
+ xpath(%w[Transaction-Type])
188
+ end
189
+
190
+ def current_space_heating_demand
191
+ nil
192
+ end
193
+
194
+ def current_water_heating_demand
195
+ nil
196
+ end
197
+
198
+ def impact_of_cavity_insulation
199
+ nil
200
+ end
201
+
202
+ def impact_of_loft_insulation
203
+ nil
204
+ end
205
+
206
+ def impact_of_solid_wall_insulation
207
+ nil
208
+ end
209
+
210
+ def habitable_room_count
211
+ xpath(%w[Habitable-Room-Count])&.to_i
212
+ end
213
+
214
+ def energy_rating_current
215
+ xpath(%w[Energy-Rating-Current])&.to_i
216
+ end
217
+
218
+ def energy_rating_potential
219
+ xpath(%w[Energy-Rating-Potential])&.to_i
220
+ end
221
+
222
+ def environmental_impact_current
223
+ xpath(%w[Environmental-Impact-Current])&.to_i
224
+ end
225
+
226
+ def environmental_impact_potential
227
+ xpath(%w[Environmental-Impact-Potential])&.to_i
228
+ end
229
+
230
+ def primary_energy_use
231
+ xpath(%w[Energy-Consumption-Current])&.to_f
232
+ end
233
+
234
+ def energy_consumption_potential
235
+ xpath(%w[Energy-Consumption-Potential])&.to_f
236
+ end
237
+
238
+ def all_roof_descriptions
239
+ @xml_doc.search("Roof/Description").map(&:content)
240
+ end
241
+
242
+ def all_roof_energy_efficiency_rating
243
+ @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
244
+ end
245
+
246
+ def all_roof_env_energy_efficiency_rating
247
+ @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
248
+ end
249
+
250
+ def all_window_descriptions
251
+ @xml_doc.search("Window/Description").map(&:content)
252
+ end
253
+
254
+ def all_main_heating_descriptions
255
+ @xml_doc.search("Main-Heating/Description").map(&:content)
256
+ end
257
+
258
+ def all_main_heating_controls_descriptions
259
+ @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
260
+ end
261
+
262
+ def all_main_heating_energy_efficiency
263
+ @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
264
+ end
265
+
266
+ def all_main_heating_environmental_efficiency
267
+ @xml_doc
268
+ .search("Main-Heating/Environmental-Efficiency-Rating")
269
+ .map(&:content)
270
+ end
271
+
272
+ def all_hot_water_descriptions
273
+ @xml_doc.search("Hot-Water/Description").map(&:content)
274
+ end
275
+
276
+ def all_lighting_descriptions
277
+ @xml_doc.search("Lighting/Description").map(&:content)
278
+ end
279
+
280
+ def all_secondary_heating_descriptions
281
+ @xml_doc.search("Secondary-Heating/Description").map(&:content)
282
+ end
283
+
284
+ def country_code
285
+ xpath(%w[Country-Code])
286
+ end
287
+
288
+ def main_fuel_type
289
+ xpath(%w[Main-Fuel-Type])
290
+ end
291
+
292
+ def secondary_fuel_type
293
+ xpath(%w[Secondary-Fuel-Type])
294
+ end
295
+
296
+ def water_heating_fuel
297
+ xpath(%w[Water-Heating-Fuel])
298
+ end
299
+
300
+ def co2_emissions_current_per_floor_area
301
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])&.to_f
302
+ end
303
+
304
+ def mains_gas
305
+ xpath(%w[Mains-Gas])
306
+ end
307
+
308
+ def level
309
+ xpath(%w[Level])
310
+ end
311
+
312
+ def top_storey
313
+ xpath(%w[Top-Storey])
314
+ end
315
+
316
+ def storey_count
317
+ xpath(%w[Storey-Count])&.to_i
318
+ end
319
+
320
+ def main_heating_controls
321
+ xpath(%w[Main-Heating-Controls Description])
322
+ end
323
+
324
+ def multiple_glazed_proportion
325
+ xpath(%w[Multiple-Glazed-Proportion])
326
+ end
327
+
328
+ def glazed_area
329
+ xpath(%w[Glazed-Area])
330
+ end
331
+
332
+ def heated_room_count
333
+ xpath(%w[Heated-Room-Count])&.to_i
334
+ end
335
+
336
+ def low_energy_lighting
337
+ xpath(%w[Low-Energy-Lighting])
338
+ end
339
+
340
+ def fixed_lighting_outlets_count
341
+ xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i
342
+ end
343
+
344
+ def low_energy_fixed_lighting_outlets_count
345
+ xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i
346
+ end
347
+
348
+ def open_fireplaces_count
349
+ xpath(%w[Open-Fireplaces-Count])&.to_i
350
+ end
351
+
352
+ def hot_water_description
353
+ xpath(%w[Hot-Water Description])
354
+ end
355
+
356
+ def hot_water_energy_efficiency_rating
357
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
358
+ end
359
+
360
+ def hot_water_environmental_efficiency_rating
361
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
362
+ end
363
+
364
+ def wind_turbine_count
365
+ xpath(%w[Wind-Turbines-Count])&.to_i
366
+ end
367
+
368
+ def heat_loss_corridor
369
+ xpath(%w[Heat-Loss-Corridor])
370
+ end
371
+
372
+ def unheated_corridor_length
373
+ xpath(%w[Unheated-Corridor-Length])
374
+ end
375
+
376
+ def window_description
377
+ xpath(%w[Window Description])
378
+ end
379
+
380
+ def window_energy_efficiency_rating
381
+ xpath(%w[Window Energy-Efficiency-Rating])
382
+ end
383
+
384
+ def window_environmental_efficiency_rating
385
+ xpath(%w[Window Environmental-Efficiency-Rating])
386
+ end
387
+
388
+ def secondary_heating_description
389
+ xpath(%w[Secondary-Heating Description])
390
+ end
391
+
392
+ def secondary_heating_energy_efficiency_rating
393
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
394
+ end
395
+
396
+ def secondary_heating_environmental_efficiency_rating
397
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
398
+ end
399
+
400
+ def lighting_description
401
+ xpath(%w[Lighting Description])
402
+ end
403
+
404
+ def lighting_energy_efficiency_rating
405
+ xpath(%w[Lighting Energy-Efficiency-Rating])
406
+ end
407
+
408
+ def lighting_environmental_efficiency_rating
409
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
410
+ end
411
+
412
+ def photovoltaic_roof_area_percent
413
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
414
+ end
415
+
416
+ def built_form
417
+ xpath(%w[Built-Form])
418
+ end
419
+
420
+ def extensions_count
421
+ xpath(%w[Extensions-Count])&.to_i
422
+ end
423
+
424
+ def report_type
425
+ xpath(%w[Report-Type])
426
+ end
427
+
428
+ def all_wall_descriptions
429
+ @xml_doc.search("Wall/Description").map(&:content)
430
+ end
431
+
432
+ def all_wall_energy_efficiency_rating
433
+ @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
434
+ end
435
+
436
+ def all_wall_env_energy_efficiency_rating
437
+ @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
438
+ end
439
+
440
+ def meter_type
441
+ xpath(%w[Meter-Type])
442
+ end
443
+
444
+ def floor_level
445
+ xpath(%w[Flat-Location])
446
+ end
447
+
448
+ def solar_water_heating_flag
449
+ xpath(%w[Solar-Water-Heating])
450
+ end
451
+
452
+ def mechanical_ventilation
453
+ xpath(%w[Mechanical-Ventilation])
454
+ end
455
+
456
+ def floor_height
457
+ @xml_doc.search("Room-Height").map(&:content)
458
+ end
459
+
460
+ def all_floor_descriptions
461
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
462
+ end
463
+
464
+ def all_floor_energy_efficiency_rating
465
+ @xml_doc
466
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
467
+ .map(&:content)
468
+ end
469
+
470
+ def all_floor_env_energy_efficiency_rating
471
+ @xml_doc
472
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
473
+ .map(&:content)
474
+ end
475
+
476
+ def all_main_heating_controls_energy_efficiency
477
+ @xml_doc
478
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
479
+ .map(&:content)
480
+ end
481
+
482
+ def all_main_heating_controls_environmental_efficiency
483
+ @xml_doc
484
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
485
+ .map(&:content)
486
+ end
487
+
488
+ def main_dwelling_construction_age_band_or_year
489
+ sap_building_parts =
490
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
491
+ sap_building_parts.each do |sap_building_part|
492
+ building_part_number = sap_building_part.at("Building-Part-Number")
493
+
494
+ # Identifies the Main Dwelling
495
+ if building_part_number&.content == "1"
496
+ return (
497
+ sap_building_part.at_xpath(
498
+ "Construction-Age-Band | Construction-Year",
499
+ )&.content
500
+ )
501
+ end
502
+ end
503
+ nil
504
+ end
505
+
506
+ def cylinder_insul_thickness
507
+ xpath(%w[Cylinder-Insulation-Thickness])
508
+ end
509
+
510
+ def cylinder_insulation_type
511
+ xpath(%w[Cylinder-Insulation-Type])
512
+ end
513
+
514
+ def cylinder_size
515
+ xpath(%w[Cylinder-Size])
516
+ end
517
+
518
+ def has_cylinder_thermostat
519
+ xpath(%w[Cylinder-Thermostat])
520
+ end
521
+
522
+ def party_wall_construction
523
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
524
+ end
525
+
526
+ def lzc_energy_sources
527
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
528
+
529
+ @xml_doc
530
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
531
+ .select(&:element?)
532
+ .map { |n| n.text.to_i }
533
+ end
534
+
535
+ def addendum
536
+ return nil if xpath(%w[Addendum]).nil?
537
+
538
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
539
+ end
540
+
541
+ def gas_smart_meter_present
542
+ nil
543
+ end
544
+
545
+ def electricity_smart_meter_present
546
+ nil
547
+ end
548
+ end
549
+ end
550
+ 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-14.0"
97
+ ViewModel::RdSapSchemaS140::CommonSchema.new xml_doc
96
98
  else
97
99
  raise ArgumentError, "Unsupported schema type"
98
100
  end
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.2.21
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings
@@ -342,6 +342,49 @@ files:
342
342
  - api/schemas/xml/RdSAP-Schema-NI-21.0.1/RdSAP/Templates/RdSAP-Report.xsd
343
343
  - api/schemas/xml/RdSAP-Schema-NI-21.0.1/RdSAP/UDT/EPC-Domains.xsd
344
344
  - api/schemas/xml/RdSAP-Schema-NI-21.0.1/RdSAP/UDT/SAP-Domains.xsd
345
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/CommonStructures.xsd
346
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/Exceptions.xsd
347
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/ExternalDefinitions.xsd
348
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessRequest_1.xsd
349
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessResponse_1.xsd
350
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusRequest_1.xsd
351
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusResponse_1.xsd
352
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd
353
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateResponse_1.xsd
354
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveRequest_1.xsd
355
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveResponse_1.xsd
356
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateRequest_1.xsd
357
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateResponse_1.xsd
358
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusRequest_1.xsd
359
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusResponse_1.xsd
360
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationRequest_1.xsd
361
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationResponse_1.xsd
362
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/EPC-Certificate.xsd
363
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/Property.xsd
364
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-CollectedData.xsd
365
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-Report.xsd
366
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/UserManagement.xsd
367
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/BaseDataTypes.xsd
368
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/EPC-Domains.xsd
369
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SAP05-Domains.xsd
370
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SharedDomains.xsd
371
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-Certificate.xsd
372
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-CollectedData.xsd
373
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesExternal.xsd
374
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd
375
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesInternal.xsd
376
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesServices.xsd
377
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-PropertyDetails.xsd
378
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-RiskAssessment.xsd
379
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HIP-Reports.xsd
380
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/Property.xsd
381
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/UserManagement.xsd
382
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/BaseDataTypes.xsd
383
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/EPC-Domains.xsd
384
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/HCR-Domains.xsd
385
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SAP-Domains.xsd
386
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SharedDomains.xsd
387
+ - api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/TypeDefinitions.xsd
345
388
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml
346
389
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd
347
390
  - api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/All-HIP.xsd
@@ -1782,6 +1825,7 @@ files:
1782
1825
  - lib/view_model/rd_sap_schema_ni_200/common_schema.rb
1783
1826
  - lib/view_model/rd_sap_schema_ni_210/common_schema.rb
1784
1827
  - lib/view_model/rd_sap_schema_ni_2101/common_schema.rb
1828
+ - lib/view_model/rd_sap_schema_s_140/common_schema.rb
1785
1829
  - lib/view_model/rd_sap_schema_s_161/common_schema.rb
1786
1830
  - lib/view_model/rd_sap_schema_s_1700/common_schema.rb
1787
1831
  - lib/view_model/rd_sap_schema_s_180/common_schema.rb