epb_view_models 2.2.20 → 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 (140) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +21 -21
  5. data/api/schemas/data/orchestrate.json +4 -0
  6. data/api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd +296 -296
  7. data/api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd +63 -63
  8. data/api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd +34 -34
  9. data/api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd +120 -120
  10. data/api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd +67 -67
  11. data/api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd +178 -178
  12. data/api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd +391 -391
  13. data/api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd +171 -171
  14. data/api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd +300 -300
  15. data/api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd +66 -66
  16. data/api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd +34 -34
  17. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd +125 -125
  18. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd.bak +123 -123
  19. data/api/schemas/xml/CEPC-S-7.1/Reports/Property.xsd +67 -67
  20. data/api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd +178 -178
  21. data/api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd +406 -406
  22. data/api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd +174 -174
  23. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/CommonStructures.xsd +160 -0
  24. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/Exceptions.xsd +72 -0
  25. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/ExternalDefinitions.xsd +147 -0
  26. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessRequest_1.xsd +44 -0
  27. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeAccessResponse_1.xsd +47 -0
  28. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusRequest_1.xsd +44 -0
  29. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportChangeStatusResponse_1.xsd +47 -0
  30. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd +41 -0
  31. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateResponse_1.xsd +52 -0
  32. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveRequest_1.xsd +52 -0
  33. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportRetrieveResponse_1.xsd +87 -0
  34. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateRequest_1.xsd +44 -0
  35. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateResponse_1.xsd +28 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusRequest_1.xsd +30 -0
  37. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/HomeInspectorRegisterUpdateStatusResponse_1.xsd +52 -0
  38. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationRequest_1.xsd +44 -0
  39. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/PropertyUPRNValidationResponse_1.xsd +46 -0
  40. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/EPC-Certificate.xsd +270 -0
  41. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/Property.xsd +68 -0
  42. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-CollectedData.xsd +1188 -0
  43. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/SAP05-Report.xsd +195 -0
  44. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/Templates/UserManagement.xsd +215 -0
  45. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/BaseDataTypes.xsd +175 -0
  46. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/EPC-Domains.xsd +703 -0
  47. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SAP05-Domains.xsd +3007 -0
  48. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/SAP-EPC/UDT/SharedDomains.xsd +311 -0
  49. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-Certificate.xsd +252 -0
  50. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-CollectedData.xsd +444 -0
  51. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -0
  52. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -0
  53. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -0
  54. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -0
  55. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -0
  56. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-RiskAssessment.xsd +297 -0
  57. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HIP-Reports.xsd +220 -0
  58. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/Property.xsd +73 -0
  59. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/UserManagement.xsd +257 -0
  60. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/BaseDataTypes.xsd +176 -0
  61. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/EPC-Domains.xsd +743 -0
  62. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/HCR-Domains.xsd +1773 -0
  63. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SAP-Domains.xsd +1134 -0
  64. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SharedDomains.xsd +660 -0
  65. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/TypeDefinitions.xsd +19 -0
  66. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  67. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  68. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  69. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  70. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  71. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  72. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  73. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  74. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  75. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  76. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  77. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  78. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  79. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  80. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  81. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  82. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  83. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  84. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  85. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  86. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  87. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  88. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  89. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  90. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  91. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  92. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  93. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  94. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  95. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  96. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  97. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  98. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  99. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  100. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  101. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  102. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  103. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  104. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  105. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  106. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  107. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  108. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  109. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  110. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  111. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  112. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  113. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  114. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  115. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  116. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  117. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  118. data/epb_view_models.gemspec +3 -2
  119. data/lib/epb_view_models.rb +1 -1
  120. data/lib/view_model/cepc_s_70/cepc.rb +5 -5
  121. data/lib/view_model/cepc_s_71/cepc.rb +5 -5
  122. data/lib/view_model/cs63/common_schema.rb +1 -1
  123. data/lib/view_model/factory.rb +1 -0
  124. data/lib/view_model/rd_sap_schema_ni_173/common_schema.rb +8 -8
  125. data/lib/view_model/rd_sap_schema_ni_174/common_schema.rb +8 -8
  126. data/lib/view_model/rd_sap_schema_ni_180/common_schema.rb +8 -8
  127. data/lib/view_model/rd_sap_schema_ni_190/common_schema.rb +8 -8
  128. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +8 -8
  129. data/lib/view_model/rd_sap_schema_s_140/common_schema.rb +550 -0
  130. data/lib/view_model/rd_sap_schema_s_190/common_schema.rb +41 -41
  131. data/lib/view_model/rd_sap_schema_s_210/common_schema.rb +35 -35
  132. data/lib/view_model/rd_sap_wrapper.rb +2 -0
  133. data/lib/view_model/sap_schema_1900/common_schema.rb +6 -6
  134. data/lib/view_model/sap_schema_1910/common_schema.rb +6 -6
  135. data/lib/view_model/sap_schema_1920/common_schema.rb +6 -6
  136. data/lib/view_model/sap_schema_ni_173/common_schema.rb +8 -8
  137. data/lib/view_model/sap_schema_ni_174/common_schema.rb +8 -8
  138. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +8 -8
  139. data/lib/view_model/sap_schema_s_1900/common_schema.rb +11 -11
  140. metadata +62 -4
@@ -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
@@ -543,7 +543,7 @@ module ViewModel
543
543
  @xml_doc
544
544
  .search("SAP-Building-Part")
545
545
  .map do |node|
546
- xpath(%w[Party-Wall-Construction], node)
546
+ xpath(%w[Party-Wall-Construction], node)
547
547
  end
548
548
  end
549
549
 
@@ -551,16 +551,16 @@ module ViewModel
551
551
  @xml_doc
552
552
  .search("SAP-Building-Part")
553
553
  .map do |node|
554
- {
555
- alternative_wall_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness")&.content,
556
- alternative_wall_thickness_measured: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness-Measured")&.content,
557
- alternative_wall_construction: node.at_xpath("SAP-Alternative-Wall/Wall-Construction")&.content,
558
- alternative_wall_u_value: node.at_xpath("SAP-Alternative-Wall/Wall-U-Value")&.content,
559
- alternative_wall_insulation_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Insulation-Thickness")&.content,
560
- wall_thickness: node.at_xpath("Wall-Thickness")&.content,
561
- wall_construction: node.at_xpath("Wall-Construction")&.content,
562
- wall_thickness_measured: node.at_xpath("Wall-Thickness-Measured")&.content,
563
- }
554
+ {
555
+ alternative_wall_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness")&.content,
556
+ alternative_wall_thickness_measured: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness-Measured")&.content,
557
+ alternative_wall_construction: node.at_xpath("SAP-Alternative-Wall/Wall-Construction")&.content,
558
+ alternative_wall_u_value: node.at_xpath("SAP-Alternative-Wall/Wall-U-Value")&.content,
559
+ alternative_wall_insulation_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Insulation-Thickness")&.content,
560
+ wall_thickness: node.at_xpath("Wall-Thickness")&.content,
561
+ wall_construction: node.at_xpath("Wall-Construction")&.content,
562
+ wall_thickness_measured: node.at_xpath("Wall-Thickness-Measured")&.content,
563
+ }
564
564
  end
565
565
  end
566
566
 
@@ -568,10 +568,10 @@ module ViewModel
568
568
  @xml_doc
569
569
  .search("SAP-Building-Part")
570
570
  .map do |node|
571
- {
572
- roof_insulation_location: node.at_xpath("Roof-Insulation-Location")&.content,
573
- roof_construction: node.at_xpath("Roof-Construction")&.content,
574
- }
571
+ {
572
+ roof_insulation_location: node.at_xpath("Roof-Insulation-Location")&.content,
573
+ roof_construction: node.at_xpath("Roof-Construction")&.content,
574
+ }
575
575
  end
576
576
  end
577
577
 
@@ -579,7 +579,7 @@ module ViewModel
579
579
  @xml_doc
580
580
  .search("SAP-Building-Part")
581
581
  .map do |_node|
582
- xpath(%w[SAP-Room-In-Roof Insulation])
582
+ xpath(%w[SAP-Room-In-Roof Insulation])
583
583
  end
584
584
  end
585
585
 
@@ -587,10 +587,10 @@ module ViewModel
587
587
  @xml_doc
588
588
  .search("SAP-Building-Part")
589
589
  .map do |node|
590
- {
591
- floor_u_value: node.at_xpath("Floor-U-Value")&.content,
592
- floor_insulation_thickness: node.at_xpath("Floor-Insulation-Thickness")&.content,
593
- }
590
+ {
591
+ floor_u_value: node.at_xpath("Floor-U-Value")&.content,
592
+ floor_insulation_thickness: node.at_xpath("Floor-Insulation-Thickness")&.content,
593
+ }
594
594
  end
595
595
  end
596
596
 
@@ -598,13 +598,13 @@ module ViewModel
598
598
  @xml_doc
599
599
  .search("SAP-Building-Part")
600
600
  .map do |node|
601
- {
602
- roof_u_value: node.at_xpath("Roof-U-Value")&.content,
603
- roof_insulation_thickness: node.at_xpath("Roof-Insulation-Thickness")&.content,
604
- rafter_insulation_thickness: node.at_xpath("Rafter-Insulation-Thickness")&.content,
605
- flat_roof_insulation_thickness: node.at_xpath("Flat-Roof-Insulation-Thickness")&.content,
606
- sloping_ceiling_insulation_thickness: node.at_xpath("Sloping-Ceiling-Insulation-Thickness")&.content,
607
- }
601
+ {
602
+ roof_u_value: node.at_xpath("Roof-U-Value")&.content,
603
+ roof_insulation_thickness: node.at_xpath("Roof-Insulation-Thickness")&.content,
604
+ rafter_insulation_thickness: node.at_xpath("Rafter-Insulation-Thickness")&.content,
605
+ flat_roof_insulation_thickness: node.at_xpath("Flat-Roof-Insulation-Thickness")&.content,
606
+ sloping_ceiling_insulation_thickness: node.at_xpath("Sloping-Ceiling-Insulation-Thickness")&.content,
607
+ }
608
608
  end
609
609
  end
610
610
 
@@ -612,10 +612,10 @@ module ViewModel
612
612
  @xml_doc
613
613
  .search("SAP-Building-Part")
614
614
  .map do |node|
615
- {
616
- wall_u_value: node.at_xpath("Wall-U-Value")&.content,
617
- wall_insulation_thickness: node.at_xpath("Wall-Insulation-Thickness")&.content,
618
- }
615
+ {
616
+ wall_u_value: node.at_xpath("Wall-U-Value")&.content,
617
+ wall_insulation_thickness: node.at_xpath("Wall-Insulation-Thickness")&.content,
618
+ }
619
619
  end
620
620
  end
621
621
 
@@ -623,7 +623,7 @@ module ViewModel
623
623
  @xml_doc
624
624
  .search("SAP-Building-Part")
625
625
  .map do |node|
626
- node.at_xpath("SAP-Room-In-Roof")&.content.to_s
626
+ node.at_xpath("SAP-Room-In-Roof")&.content.to_s
627
627
  end
628
628
  end
629
629
 
@@ -631,10 +631,10 @@ module ViewModel
631
631
  @xml_doc
632
632
  .search("SAP-Building-Part")
633
633
  .map do |_node|
634
- {
635
- roof_insulation_thickness: xpath(%w[SAP-Room-In-Roof Roof-Insulation-Thickness]),
636
- room_in_roof_details: xpath(%w[SAP-Room-In-Roof Room-In-Roof-Details]),
637
- }
634
+ {
635
+ roof_insulation_thickness: xpath(%w[SAP-Room-In-Roof Roof-Insulation-Thickness]),
636
+ room_in_roof_details: xpath(%w[SAP-Room-In-Roof Room-In-Roof-Details]),
637
+ }
638
638
  end
639
639
  end
640
640
 
@@ -642,11 +642,11 @@ module ViewModel
642
642
  @xml_doc
643
643
  .search("Main-Heating")
644
644
  .map do |_node|
645
- {
646
- main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
647
- sap_main_heating_code: xpath(%w[SAP-Main-Heating-Code]),
648
- main_fuel_type: xpath(%w[Main-Fuel-Type]),
649
- }
645
+ {
646
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
647
+ sap_main_heating_code: xpath(%w[SAP-Main-Heating-Code]),
648
+ main_fuel_type: xpath(%w[Main-Fuel-Type]),
649
+ }
650
650
  end
651
651
  end
652
652