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,235 @@
1
+ require "date"
2
+
3
+ module ViewModel
4
+ module DecarS800
5
+ class Dec < ViewModel::DecarS800::CommonSchema
6
+ def date_of_expiry
7
+ floor_area =
8
+ xpath(%w[Display-Certificate Technical-Information Floor-Area])
9
+
10
+ expiry_date = Date.parse(current_assessment_date)
11
+
12
+ expiry_date =
13
+ if floor_area.to_i <= 1000 && !postcode.start_with?("BT")
14
+ (expiry_date - 1).next_year 10
15
+ else
16
+ (expiry_date - 1).next_year 1
17
+ end
18
+
19
+ expiry_date.strftime("%F")
20
+ end
21
+
22
+ def energy_efficiency_rating
23
+ xpath(%w[This-Assessment Energy-Rating])&.to_i
24
+ end
25
+
26
+ def current_assessment_date
27
+ xpath(%w[This-Assessment Nominated-Date])
28
+ end
29
+
30
+ def current_heating_co2
31
+ xpath(%w[This-Assessment Heating-CO2])&.to_i
32
+ end
33
+
34
+ def current_electricity_co2
35
+ xpath(%w[This-Assessment Electricity-CO2])&.to_i
36
+ end
37
+
38
+ def current_renewables_co2
39
+ xpath(%w[This-Assessment Renewables-CO2])&.to_i
40
+ end
41
+
42
+ def year1_assessment_date
43
+ xpath(%w[Year1-Assessment Nominated-Date])
44
+ end
45
+
46
+ def year1_heating_co2
47
+ xpath(%w[Year1-Assessment Heating-CO2])&.to_i
48
+ end
49
+
50
+ def year1_electricity_co2
51
+ xpath(%w[Year1-Assessment Electricity-CO2])&.to_i
52
+ end
53
+
54
+ def year1_renewables_co2
55
+ xpath(%w[Year1-Assessment Renewables-CO2])&.to_i
56
+ end
57
+
58
+ def year1_energy_efficiency_rating
59
+ xpath(%w[Year1-Assessment Energy-Rating])&.to_i
60
+ end
61
+
62
+ def year2_assessment_date
63
+ xpath(%w[Year2-Assessment Nominated-Date])
64
+ end
65
+
66
+ def year2_heating_co2
67
+ xpath(%w[Year2-Assessment Heating-CO2])&.to_i
68
+ end
69
+
70
+ def year2_electricity_co2
71
+ xpath(%w[Year2-Assessment Electricity-CO2])&.to_i
72
+ end
73
+
74
+ def year2_renewables_co2
75
+ xpath(%w[Year2-Assessment Renewables-CO2])&.to_i
76
+ end
77
+
78
+ def year2_energy_efficiency_rating
79
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
80
+ end
81
+
82
+ def main_heating_fuel
83
+ xpath(%w[Technical-Information Main-Heating-Fuel])
84
+ end
85
+
86
+ def building_environment
87
+ xpath(%w[Technical-Information Building-Environment])
88
+ end
89
+
90
+ def floor_area
91
+ xpath(%w[Technical-Information Floor-Area])&.to_f
92
+ end
93
+
94
+ def asset_rating
95
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
96
+ end
97
+
98
+ def annual_energy_use_fuel_thermal
99
+ xpath(%w[Annual-Energy-Use-Fuel-Thermal])&.to_i
100
+ end
101
+
102
+ def annual_energy_use_electrical
103
+ xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Electrical])&.to_i
104
+ end
105
+
106
+ def typical_thermal_use
107
+ xpath(%w[DEC-Annual-Energy-Summary Typical-Thermal-Use])&.to_i
108
+ end
109
+
110
+ def typical_electrical_use
111
+ xpath(%w[DEC-Annual-Energy-Summary Typical-Electrical-Use])&.to_i
112
+ end
113
+
114
+ def renewables_fuel_thermal
115
+ xpath(%w[DEC-Annual-Energy-Summary Renewables-Fuel-Thermal])&.to_i
116
+ end
117
+
118
+ def renewables_electrical
119
+ xpath(%w[DEC-Annual-Energy-Summary Renewables-Electrical])&.to_i
120
+ end
121
+
122
+ def dec_status
123
+ xpath(%w[DEC-Status])
124
+ end
125
+
126
+ def dec_related_party_disclosure
127
+ xpath(%w[DEC-Related-Party-Disclosure])
128
+ end
129
+
130
+ def calculation_tool
131
+ xpath(%w[Calculation-Details Calculation-Tool])
132
+ end
133
+
134
+ def related_rrn
135
+ xpath(%w[Related-RRN])
136
+ end
137
+
138
+ def output_engine
139
+ xpath(%w[Output-Engine])
140
+ end
141
+
142
+ def or_assessment_start_date
143
+ xpath(%w[OR-Operational-Rating OR-Assessment-Start-Date])
144
+ end
145
+
146
+ def occupier
147
+ xpath(%w[Occupier])
148
+ end
149
+
150
+ def benchmarks
151
+ @xml_doc
152
+ .search("Benchmarks/Benchmark")
153
+ .map do |node|
154
+ {
155
+ name: xpath(%w[Name], node),
156
+ id: xpath(%w[Benchmark-ID], node)&.to_i,
157
+ tufa: xpath(%w[TUFA], node),
158
+ }
159
+ end
160
+ end
161
+
162
+ def or_energy_consumption
163
+ @xml_doc
164
+ .search("OR-Energy-Consumption")
165
+ .children
166
+ .select(&:element?)
167
+ .map do |node|
168
+ {
169
+ consumption: xpath(%w[Consumption], node),
170
+ start_date: xpath(%w[Start-Date], node),
171
+ end_date: xpath(%w[End-Date], node),
172
+ estimate: xpath(%w[Estimate], node)&.to_i,
173
+ name: node.name,
174
+ }
175
+ end
176
+ end
177
+
178
+ def annual_energy_summary
179
+ summary = @xml_doc.search("DEC-Annual-Energy-Summary")
180
+ {
181
+ electrical: xpath(%w[Annual-Energy-Use-Electrical], summary),
182
+ fuel_thermal: xpath(%w[Annual-Energy-Use-Fuel-Thermal], summary),
183
+ renewables_fuel_thermal: xpath(%w[Renewables-Fuel-Thermal], summary),
184
+ renewables_electrical: xpath(%w[Renewables-Electrical], summary),
185
+ typical_thermal_use: xpath(%w[Typical-Thermal-Use], summary),
186
+ typical_electrical_use: xpath(%w[Typical-Electrical-Use], summary),
187
+ }
188
+ end
189
+
190
+ def property_type
191
+ xpath(%w[Property-Type])
192
+ end
193
+
194
+ def main_benchmark
195
+ xpath(%w[OR-Benchmark-Data Main-Benchmark])
196
+ end
197
+
198
+ def other_fuel
199
+ xpath(%w[Technical-Information Other-Fuel-Description])
200
+ end
201
+
202
+ def special_energy_uses
203
+ xpath(%w[Technical-Information Special-Energy-Uses])
204
+ end
205
+
206
+ def occupancy_level
207
+ xpath(%w[Benchmarks Benchmark Occupancy-Level])
208
+ end
209
+
210
+ def ac_inspection_commissioned
211
+ xpath(%w[AC-Inspection-Commissioned])
212
+ end
213
+
214
+ def ac_present
215
+ xpath(%w[AC-Present])
216
+ end
217
+
218
+ def ac_kw_rating
219
+ xpath(%w[AC-kW-Rating])&.to_i
220
+ end
221
+
222
+ def estimated_ac_kw_rating
223
+ xpath(%w[AC-Estimated-Output])&.to_i
224
+ end
225
+
226
+ def building_category
227
+ xpath(%w[Building-Category])
228
+ end
229
+
230
+ def renewable_sources
231
+ xpath(%w[Renewable-Sources])
232
+ end
233
+ end
234
+ end
235
+ end
@@ -0,0 +1,102 @@
1
+ require "date"
2
+
3
+ module ViewModel
4
+ module DecarS800
5
+ class DecRr < ViewModel::DecarS800::CommonSchema
6
+ def type_of_assessment
7
+ "DEC-AR"
8
+ end
9
+
10
+ def date_of_expiry
11
+ floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
12
+
13
+ expiry_date = Date.parse(date_of_issue)
14
+
15
+ expiry_date =
16
+ if floor_area.to_f <= 1000 && !postcode.start_with?("BT")
17
+ (expiry_date - 1).next_year 10
18
+ else
19
+ (expiry_date - 1).next_year 7
20
+ end
21
+
22
+ expiry_date.strftime("%F")
23
+ end
24
+
25
+ def recommendations(payback)
26
+ @xml_doc
27
+ .search("AR-Recommendations/#{payback}")
28
+ .map do |node|
29
+ {
30
+ code: node.at("Recommendation-Code").content,
31
+ text: node.at("Recommendation").content,
32
+ cO2Impact: node.at("CO2-Impact").content,
33
+ }
34
+ end
35
+ end
36
+
37
+ def site_services(service)
38
+ {
39
+ description:
40
+ @xml_doc.at("Site-Services/#{service}/Description").content,
41
+ quantity: @xml_doc.at("Site-Services/#{service}/Quantity").content&.to_i,
42
+ }
43
+ end
44
+
45
+ def site_service_one
46
+ site_services("Service-1")
47
+ end
48
+
49
+ def site_service_two
50
+ site_services("Service-2")
51
+ end
52
+
53
+ def site_service_three
54
+ site_services("Service-3")
55
+ end
56
+
57
+ def short_payback_recommendations
58
+ recommendations("Short-Payback")
59
+ end
60
+
61
+ def medium_payback_recommendations
62
+ recommendations("Medium-Payback")
63
+ end
64
+
65
+ def long_payback_recommendations
66
+ recommendations("Long-Payback")
67
+ end
68
+
69
+ def other_recommendations
70
+ recommendations("Other-Payback")
71
+ end
72
+
73
+ def floor_area
74
+ xpath(%w[Advisory-Report Technical-Information Floor-Area])&.to_f
75
+ end
76
+
77
+ def building_environment
78
+ xpath(%w[Advisory-Report Technical-Information Building-Environment])
79
+ end
80
+
81
+ def related_rrn
82
+ xpath(%w[Related-RRN])
83
+ end
84
+
85
+ def occupier
86
+ xpath(%w[Occupier])
87
+ end
88
+
89
+ def property_type
90
+ xpath(%w[Property-Type])
91
+ end
92
+
93
+ def renewable_sources
94
+ xpath(%w[Renewable-Sources])
95
+ end
96
+
97
+ def discounted_energy
98
+ xpath(%w[Special-Energy-Uses])
99
+ end
100
+ end
101
+ end
102
+ end
@@ -3,10 +3,12 @@
3
3
  module ViewModel
4
4
  class Factory
5
5
  TYPES_OF_DECAR = %i[
6
+ DECAR-S-8.0.0
6
7
  DECAR-S-7.0
7
8
  ].freeze
8
9
  TYPES_OF_CS63 = %i[
9
10
  CS63-S-7.0
11
+ CS63-S-8.0.0
10
12
  ].freeze
11
13
  TYPES_OF_CEPC = %i[
12
14
  CEPC-8.0.0
@@ -20,6 +22,7 @@ module ViewModel
20
22
  CEPC-3.1
21
23
  CEPC-S-7.0
22
24
  CEPC-S-7.1
25
+ CEPC-S-8.0.0
23
26
  ].freeze
24
27
  TYPES_OF_RD_SAP = %i[
25
28
  RdSAP-Schema-21.0.1
@@ -36,8 +39,9 @@ module ViewModel
36
39
  RdSAP-Schema-NI-18.0
37
40
  RdSAP-Schema-NI-17.4
38
41
  RdSAP-Schema-NI-17.3
39
- RdSAP-Schema-S-19.0
42
+ RdSAP-Schema-S-22.0.0
40
43
  RdSAP-Schema-S-21.0
44
+ RdSAP-Schema-S-19.0
41
45
  RdSAP-Schema-S-18.0
42
46
  RdSAP-Schema-S-17.00
43
47
  RdSAP-Schema-S-16.1
@@ -80,6 +84,7 @@ module ViewModel
80
84
  SAP-Schema-NI-13.0
81
85
  SAP-Schema-NI-12.0
82
86
  SAP-Schema-NI-11.2
87
+ SAP-Schema-S-20.0.0
83
88
  SAP-Schema-S-19.0.0
84
89
  SAP-Schema-S-17.0
85
90
  SAP-Schema-S-16.1