epb_view_models 2.7.1 → 2.8.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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +19 -2
  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/CEPC-S-8.0.0/Reports/BaseDataTypes.xsd +302 -0
  21. data/api/schemas/xml/CEPC-S-8.0.0/Reports/CEPC-Reports.xsd +69 -0
  22. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Input-Data.xsd +39 -0
  23. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Performance-Summary.xsd +130 -0
  24. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Property.xsd +72 -0
  25. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Report-Header.xsd +182 -0
  26. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Reported-Data.xsd +411 -0
  27. data/api/schemas/xml/CEPC-S-8.0.0/Reports/UserManagement.xsd +175 -0
  28. data/api/schemas/xml/CS63-S-8.0.0/ActionPlan.xsd +822 -0
  29. data/api/schemas/xml/DECAR-S-8.0.0/DEC-Summary.xsd +399 -0
  30. data/api/schemas/xml/DECAR-S-8.0.0/Reports/BaseDataTypes.xsd +187 -0
  31. data/api/schemas/xml/DECAR-S-8.0.0/Reports/CEPC-Reports.xsd +78 -0
  32. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Input-Data.xsd +313 -0
  33. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Performance-Summary.xsd +111 -0
  34. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Report-Header.xsd +455 -0
  35. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Reported-Data.xsd +408 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  37. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  38. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  39. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  40. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  41. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  42. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  43. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  44. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  45. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  46. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  47. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  48. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  49. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  50. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  51. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  52. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  53. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  54. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  55. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  56. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  57. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  58. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  59. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  60. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  61. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  62. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  63. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  64. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  65. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  66. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  67. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  68. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  69. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  70. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  71. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  72. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  73. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  74. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  75. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  76. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  77. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  78. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  79. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  80. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  81. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  82. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  83. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  84. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  85. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  86. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  87. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  88. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/ExternalDefinitions.xml +1832 -0
  89. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/ExternalDefinitions.xsd +267 -0
  90. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/AssessorManagement.xsd +212 -0
  91. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/EPC-Certificate.xsd +399 -0
  92. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/EPC-CollectedData.xsd +1453 -0
  93. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/Property.xsd +67 -0
  94. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/RdSAP-Report.xsd +179 -0
  95. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/UDT/EPC-Domains.xsd +943 -0
  96. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/UDT/SAP-Domains.xsd +3557 -0
  97. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/ExternalDefinitions.txt +236 -236
  98. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/ExternalDefinitions.xml +1456 -1456
  99. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/EPC-Certificate.xsd +433 -433
  100. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/Property.xsd +69 -69
  101. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/SAP09-CollectedData.xsd +1326 -1326
  102. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/SAP09-Report.xsd +196 -196
  103. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/UserManagement.xsd +217 -217
  104. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/BaseDataTypes.xsd +175 -175
  105. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/EPC-Domains.xsd +813 -813
  106. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/SAP09-Domains.xsd +3457 -3457
  107. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/SharedDomains.xsd +317 -317
  108. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/ExternalDefinitions.xml +1456 -1456
  109. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/ExternalDefinitions.xsd +236 -236
  110. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/AssessorManagement.xsd +216 -216
  111. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/EPC-Certificate.xsd +457 -457
  112. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/ExceptionList.xsd +18 -18
  113. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/Property.xsd +62 -62
  114. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/ReportList.xsd +26 -26
  115. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/SAP-CollectedData.xsd +1444 -1444
  116. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/SAP-Report.xsd +193 -193
  117. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/UDT/EPC-Domains.xsd +558 -558
  118. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/UDT/SAP-Domains.xsd +2975 -2975
  119. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/ExternalDefinitions.xml +1352 -0
  120. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/ExternalDefinitions.xsd +242 -0
  121. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/AssessorManagement.xsd +210 -0
  122. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/EPC-Certificate.xsd +495 -0
  123. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/ExceptionList.xsd +23 -0
  124. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/Property.xsd +77 -0
  125. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/ReportList.xsd +30 -0
  126. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-CollectedData.xsd +1800 -0
  127. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-Compliance-Report.xsd +40 -0
  128. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-Report.xsd +206 -0
  129. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/UDT/EPC-Domains.xsd +564 -0
  130. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/UDT/SAP-Domains.xsd +3140 -0
  131. data/lib/epb_view_models/version.rb +1 -1
  132. data/lib/view_model/cepc800/common_schema.rb +7 -7
  133. data/lib/view_model/cepc_s_800/cepc.rb +184 -0
  134. data/lib/view_model/cepc_wrapper.rb +2 -0
  135. data/lib/view_model/{cs63 → cs63_70}/common_schema.rb +1 -1
  136. data/lib/view_model/cs63_800/common_schema.rb +211 -0
  137. data/lib/view_model/cs63_wrapper.rb +15 -3
  138. data/lib/view_model/dec_rr_wrapper.rb +2 -0
  139. data/lib/view_model/dec_summary_wrapper.rb +2 -0
  140. data/lib/view_model/dec_wrapper.rb +2 -0
  141. data/lib/view_model/decar_s_800/common_schema.rb +109 -0
  142. data/lib/view_model/decar_s_800/dec.rb +235 -0
  143. data/lib/view_model/decar_s_800/dec_rr.rb +102 -0
  144. data/lib/view_model/factory.rb +6 -1
  145. data/lib/view_model/rd_sap_schema_s_2200/common_schema.rb +685 -0
  146. data/lib/view_model/rd_sap_wrapper.rb +4 -2
  147. data/lib/view_model/sap_schema_s_2000/common_schema.rb +619 -0
  148. data/lib/view_model/sap_wrapper.rb +2 -0
  149. metadata +46 -2
@@ -0,0 +1,685 @@
1
+ module ViewModel
2
+ module RdSapSchemaS2200
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[Membership-Number]) or 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
+ @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 estimated_energy_cost; end
175
+
176
+ def total_floor_area
177
+ xpath(%w[Property-Summary Total-Floor-Area])
178
+ end
179
+
180
+ def dwelling_type
181
+ xpath(%w[Dwelling-Type])
182
+ end
183
+
184
+ def potential_energy_saving; end
185
+
186
+ def property_age_band
187
+ xpath(%w[Construction-Age-Band])
188
+ end
189
+
190
+ def tenure
191
+ xpath(%w[Tenure])
192
+ end
193
+
194
+ def transaction_type
195
+ xpath(%w[Transaction-Type])
196
+ end
197
+
198
+ def current_space_heating_demand
199
+ xpath(%w[Space-Heating-Existing-Dwelling])
200
+ end
201
+
202
+ def current_water_heating_demand
203
+ xpath(%w[Water-Heating])
204
+ end
205
+
206
+ def impact_of_cavity_insulation
207
+ if xpath(%w[Impact-Of-Cavity-Insulation])
208
+ xpath(%w[Impact-Of-Cavity-Insulation])&.to_i
209
+ end
210
+ end
211
+
212
+ def impact_of_loft_insulation
213
+ if xpath(%w[Impact-Of-Loft-Insulation])
214
+ xpath(%w[Impact-Of-Loft-Insulation])&.to_i
215
+ end
216
+ end
217
+
218
+ def impact_of_solid_wall_insulation
219
+ if xpath(%w[Impact-Of-Solid-Wall-Insulation])
220
+ xpath(%w[Impact-Of-Solid-Wall-Insulation])&.to_i
221
+ end
222
+ end
223
+
224
+ def habitable_room_count
225
+ xpath(%w[Habitable-Room-Count])&.to_i
226
+ end
227
+
228
+ def energy_rating_current
229
+ xpath(%w[Energy-Rating-Current])&.to_i
230
+ end
231
+
232
+ def energy_rating_potential
233
+ xpath(%w[Energy-Rating-Potential])&.to_i
234
+ end
235
+
236
+ def environmental_impact_current
237
+ xpath(%w[Environmental-Impact-Current])&.to_i
238
+ end
239
+
240
+ def environmental_impact_potential
241
+ xpath(%w[Environmental-Impact-Potential])&.to_i
242
+ end
243
+
244
+ def primary_energy_use
245
+ xpath(%w[Energy-Consumption-Current])&.to_f
246
+ end
247
+
248
+ def energy_consumption_potential
249
+ xpath(%w[Energy-Consumption-Potential])&.to_f
250
+ end
251
+
252
+ def all_roof_descriptions
253
+ @xml_doc.search("Roof/Description").map(&:content)
254
+ end
255
+
256
+ def all_roof_energy_efficiency_rating
257
+ @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
258
+ end
259
+
260
+ def all_roof_env_energy_efficiency_rating
261
+ @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
262
+ end
263
+
264
+ def all_window_descriptions
265
+ @xml_doc.search("Window/Description").map(&:content)
266
+ end
267
+
268
+ def all_main_heating_descriptions
269
+ @xml_doc.search("Main-Heating/Description").map(&:content)
270
+ end
271
+
272
+ def all_main_heating_controls_descriptions
273
+ @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
274
+ end
275
+
276
+ def all_main_heating_energy_efficiency
277
+ @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
278
+ end
279
+
280
+ def all_main_heating_environmental_efficiency
281
+ @xml_doc
282
+ .search("Main-Heating/Environmental-Efficiency-Rating")
283
+ .map(&:content)
284
+ end
285
+
286
+ def all_hot_water_descriptions
287
+ @xml_doc.search("Hot-Water/Description").map(&:content)
288
+ end
289
+
290
+ def all_lighting_descriptions
291
+ @xml_doc.search("Lighting/Description").map(&:content)
292
+ end
293
+
294
+ def all_secondary_heating_descriptions
295
+ @xml_doc.search("Secondary-Heating/Description").map(&:content)
296
+ end
297
+
298
+ def country_code
299
+ xpath(%w[Country-Code])
300
+ end
301
+
302
+ def main_fuel_type
303
+ xpath(%w[Main-Fuel-Type])
304
+ end
305
+
306
+ def secondary_fuel_type
307
+ xpath(%w[Secondary-Fuel-Type])
308
+ end
309
+
310
+ def water_heating_fuel
311
+ xpath(%w[Water-Heating-Fuel])
312
+ end
313
+
314
+ def co2_emissions_current_per_floor_area
315
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])&.to_f
316
+ end
317
+
318
+ def mains_gas
319
+ xpath(%w[Mains-Gas])
320
+ end
321
+
322
+ def level
323
+ xpath(%w[Level])
324
+ end
325
+
326
+ def top_storey
327
+ xpath(%w[Top-Storey])
328
+ end
329
+
330
+ def storey_count
331
+ xpath(%w[Storey-Count])&.to_i
332
+ end
333
+
334
+ def main_heating_controls
335
+ xpath(%w[Main-Heating-Controls Description])
336
+ end
337
+
338
+ def multiple_glazed_proportion
339
+ xpath(%w[Multiple-Glazed-Proportion])
340
+ end
341
+
342
+ def glazed_area; end
343
+
344
+ def heated_room_count
345
+ xpath(%w[Heated-Room-Count])&.to_i
346
+ end
347
+
348
+ def low_energy_lighting
349
+ if fixed_lighting_outlets_count.zero?
350
+ return 0
351
+ end
352
+
353
+ ((low_energy_fixed_lighting_outlets_count.to_f / fixed_lighting_outlets_count) * 100).round
354
+ end
355
+
356
+ def fixed_lighting_outlets_count
357
+ fixed_lighting_outlets_count = low_energy_fixed_lighting_outlets_count
358
+ if xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])
359
+ fixed_lighting_outlets_count += xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])&.to_i
360
+ end
361
+ fixed_lighting_outlets_count
362
+ end
363
+
364
+ def low_energy_fixed_lighting_outlets_count
365
+ low_energy_fixed_lighting_outlets_count = 0
366
+ if xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])
367
+ low_energy_fixed_lighting_outlets_count += xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])&.to_i
368
+ end
369
+ if xpath(%w[LED-Fixed-Lighting-Bulbs-Count])
370
+ low_energy_fixed_lighting_outlets_count += xpath(%w[LED-Fixed-Lighting-Bulbs-Count])&.to_i
371
+ end
372
+ if xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])
373
+ low_energy_fixed_lighting_outlets_count += xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])&.to_i
374
+ end
375
+ low_energy_fixed_lighting_outlets_count
376
+ end
377
+
378
+ def open_fireplaces_count
379
+ xpath(%w[Open-Chimneys-Count])&.to_i
380
+ end
381
+
382
+ def hot_water_description
383
+ xpath(%w[Hot-Water Description])
384
+ end
385
+
386
+ def hot_water_energy_efficiency_rating
387
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
388
+ end
389
+
390
+ def hot_water_environmental_efficiency_rating
391
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
392
+ end
393
+
394
+ def wind_turbine_count
395
+ xpath(%w[Wind-Turbines-Count])&.to_i
396
+ end
397
+
398
+ def heat_loss_corridor
399
+ xpath(%w[Heat-Loss-Corridor])
400
+ end
401
+
402
+ def unheated_corridor_length
403
+ xpath(%w[Unheated-Corridor-Length])
404
+ end
405
+
406
+ def window_description
407
+ xpath(%w[Window Description])
408
+ end
409
+
410
+ def window_energy_efficiency_rating
411
+ xpath(%w[Window Energy-Efficiency-Rating])
412
+ end
413
+
414
+ def window_environmental_efficiency_rating
415
+ xpath(%w[Window Environmental-Efficiency-Rating])
416
+ end
417
+
418
+ def secondary_heating_description
419
+ xpath(%w[Secondary-Heating Description])
420
+ end
421
+
422
+ def secondary_heating_energy_efficiency_rating
423
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
424
+ end
425
+
426
+ def secondary_heating_environmental_efficiency_rating
427
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
428
+ end
429
+
430
+ def lighting_description
431
+ xpath(%w[Lighting Description])
432
+ end
433
+
434
+ def lighting_energy_efficiency_rating
435
+ xpath(%w[Lighting Energy-Efficiency-Rating])
436
+ end
437
+
438
+ def lighting_environmental_efficiency_rating
439
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
440
+ end
441
+
442
+ def photovoltaic_roof_area_percent
443
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
444
+ end
445
+
446
+ def built_form
447
+ xpath(%w[Built-Form])
448
+ end
449
+
450
+ def extensions_count
451
+ xpath(%w[Extensions-Count])&.to_i
452
+ end
453
+
454
+ def report_type
455
+ xpath(%w[Report-Type])
456
+ end
457
+
458
+ def all_wall_descriptions
459
+ @xml_doc.search("Wall/Description").map(&:content)
460
+ end
461
+
462
+ def all_wall_energy_efficiency_rating
463
+ @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
464
+ end
465
+
466
+ def all_wall_env_energy_efficiency_rating
467
+ @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
468
+ end
469
+
470
+ def meter_type
471
+ xpath(%w[Meter-Type])
472
+ end
473
+
474
+ def gas_smart_meter_present
475
+ Helper::ToBool.execute(xpath(%w[Gas-Smart-Meter-Present]))
476
+ end
477
+
478
+ def electricity_smart_meter_present
479
+ Helper::ToBool.execute(xpath(%w[Electricity-Smart-Meter-Present]))
480
+ end
481
+
482
+ def floor_level
483
+ xpath(%w[Flat-Location])
484
+ end
485
+
486
+ def solar_water_heating_flag
487
+ xpath(%w[Solar-Water-Heating])
488
+ end
489
+
490
+ def mechanical_ventilation
491
+ xpath(%w[Mechanical-Ventilation])
492
+ end
493
+
494
+ def floor_height
495
+ @xml_doc.search("Room-Height").map(&:content)
496
+ end
497
+
498
+ def all_floor_descriptions
499
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
500
+ end
501
+
502
+ def all_floor_energy_efficiency_rating
503
+ @xml_doc
504
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
505
+ .map(&:content)
506
+ end
507
+
508
+ def all_floor_env_energy_efficiency_rating
509
+ @xml_doc
510
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
511
+ .map(&:content)
512
+ end
513
+
514
+ def all_main_heating_controls_energy_efficiency
515
+ @xml_doc
516
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
517
+ .map(&:content)
518
+ end
519
+
520
+ def all_main_heating_controls_environmental_efficiency
521
+ @xml_doc
522
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
523
+ .map(&:content)
524
+ end
525
+
526
+ def main_dwelling_construction_age_band_or_year
527
+ sap_building_parts =
528
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
529
+ sap_building_parts.each do |sap_building_part|
530
+ building_part_number = sap_building_part.at("Building-Part-Number")
531
+
532
+ # Identifies the Main Dwelling
533
+ if building_part_number&.content == "1"
534
+ return (
535
+ sap_building_part.at_xpath(
536
+ "Construction-Age-Band | Construction-Year",
537
+ )&.content
538
+ )
539
+ end
540
+ end
541
+ nil
542
+ end
543
+
544
+ def cylinder_insul_thickness
545
+ xpath(%w[Cylinder-Insulation-Thickness])
546
+ end
547
+
548
+ def cylinder_insulation_type
549
+ xpath(%w[Cylinder-Insulation-Type])
550
+ end
551
+
552
+ def cylinder_size
553
+ xpath(%w[Cylinder-Size])
554
+ end
555
+
556
+ def has_cylinder_thermostat
557
+ xpath(%w[Cylinder-Thermostat])
558
+ end
559
+
560
+ def party_wall_construction
561
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
562
+ end
563
+
564
+ # For lodgement rules
565
+
566
+ def party_walls_construction
567
+ @xml_doc
568
+ .search("SAP-Building-Part")
569
+ .map do |node|
570
+ xpath(%w[Party-Wall-Construction], node)
571
+ end
572
+ end
573
+
574
+ def walls_thickness
575
+ @xml_doc
576
+ .search("SAP-Building-Part")
577
+ .map do |node|
578
+ {
579
+ alternative_wall_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness")&.content,
580
+ alternative_wall_thickness_measured: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness-Measured")&.content,
581
+ alternative_wall_construction: node.at_xpath("SAP-Alternative-Wall/Wall-Construction")&.content,
582
+ alternative_wall_u_value: node.at_xpath("SAP-Alternative-Wall/Wall-U-Value")&.content,
583
+ alternative_wall_insulation_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Insulation-Thickness")&.content,
584
+ wall_thickness: node.at_xpath("Wall-Thickness")&.content,
585
+ wall_construction: node.at_xpath("Wall-Construction")&.content,
586
+ wall_thickness_measured: node.at_xpath("Wall-Thickness-Measured")&.content,
587
+ }
588
+ end
589
+ end
590
+
591
+ def rooves_construction_and_insulation
592
+ @xml_doc
593
+ .search("SAP-Building-Part")
594
+ .map do |node|
595
+ {
596
+ roof_insulation_location: node.at_xpath("Roof-Insulation-Location")&.content,
597
+ roof_construction: node.at_xpath("Roof-Construction")&.content,
598
+ }
599
+ end
600
+ end
601
+
602
+ def rooms_in_roof_insulation
603
+ nil
604
+ end
605
+
606
+ def floors_insulation
607
+ @xml_doc
608
+ .search("SAP-Building-Part")
609
+ .map do |node|
610
+ {
611
+ floor_u_value: node.at_xpath("Floor-U-Value")&.content,
612
+ floor_insulation_thickness: node.at_xpath("Floor-Insulation-Thickness")&.content,
613
+ }
614
+ end
615
+ end
616
+
617
+ def rooves_insulation
618
+ @xml_doc
619
+ .search("SAP-Building-Part")
620
+ .map do |node|
621
+ {
622
+ roof_u_value: node.at_xpath("Roof-U-Value")&.content,
623
+ roof_insulation_thickness: node.at_xpath("Roof-Insulation-Thickness")&.content,
624
+ rafter_insulation_thickness: node.at_xpath("Rafter-Insulation-Thickness")&.content,
625
+ flat_roof_insulation_thickness: node.at_xpath("Flat-Roof-Insulation-Thickness")&.content,
626
+ sloping_ceiling_insulation_thickness: node.at_xpath("Sloping-Ceiling-Insulation-Thickness")&.content,
627
+ }
628
+ end
629
+ end
630
+
631
+ def walls_insulation
632
+ @xml_doc
633
+ .search("SAP-Building-Part")
634
+ .map do |node|
635
+ {
636
+ wall_u_value: node.at_xpath("Wall-U-Value")&.content,
637
+ wall_insulation_thickness: node.at_xpath("Wall-Insulation-Thickness")&.content,
638
+ }
639
+ end
640
+ end
641
+
642
+ def rooms_in_roof
643
+ nil
644
+ end
645
+
646
+ def rooms_in_roof_roof_insulation
647
+ nil
648
+ end
649
+
650
+ def main_heating_details
651
+ @xml_doc
652
+ .search("Main-Heating")
653
+ .map do |_node|
654
+ {
655
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
656
+ sap_main_heating_code: xpath(%w[SAP-Main-Heating-Code]),
657
+ main_fuel_type: xpath(%w[Main-Fuel-Type]),
658
+ }
659
+ end
660
+ end
661
+
662
+ def water_heating
663
+ {
664
+ water_heating_fuel: xpath(%w[Water-Heating-Fuel]),
665
+ water_heating_code: xpath(%w[Water-Heating-Code]),
666
+ }
667
+ end
668
+
669
+ def lzc_energy_sources
670
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
671
+
672
+ @xml_doc
673
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
674
+ .select(&:element?)
675
+ .map { |n| n.text.to_i }
676
+ end
677
+
678
+ def addendum
679
+ return nil if xpath(%w[Addendum]).nil?
680
+
681
+ fetch_addendum_numbers.merge(fetch_addendum_boolean_nodes)
682
+ end
683
+ end
684
+ end
685
+ end
@@ -83,10 +83,12 @@ module ViewModel
83
83
  ViewModel::RdSapSchemaNi174::CommonSchema.new xml_doc
84
84
  when :"RdSAP-Schema-NI-17.3"
85
85
  ViewModel::RdSapSchemaNi173::CommonSchema.new xml_doc
86
- when :"RdSAP-Schema-S-19.0"
87
- ViewModel::RdSapSchemaS190::CommonSchema.new xml_doc
86
+ when :"RdSAP-Schema-S-22.0.0"
87
+ ViewModel::RdSapSchemaS2200::CommonSchema.new xml_doc
88
88
  when :"RdSAP-Schema-S-21.0"
89
89
  ViewModel::RdSapSchemaS210::CommonSchema.new xml_doc
90
+ when :"RdSAP-Schema-S-19.0"
91
+ ViewModel::RdSapSchemaS190::CommonSchema.new xml_doc
90
92
  when :"RdSAP-Schema-S-18.0"
91
93
  ViewModel::RdSapSchemaS180::CommonSchema.new xml_doc
92
94
  when :"RdSAP-Schema-S-17.00"