epb_view_models 2.2.16 → 2.2.18

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +7 -0
  3. data/api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd +296 -0
  4. data/api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd +63 -0
  5. data/api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd +34 -0
  6. data/api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd +120 -0
  7. data/api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd +67 -0
  8. data/api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd +178 -0
  9. data/api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd +391 -0
  10. data/api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd +171 -0
  11. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -0
  12. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -0
  13. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -0
  14. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -0
  15. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -0
  16. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -0
  17. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -0
  18. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +175 -0
  19. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -0
  20. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -0
  22. data/lib/epb_view_models.rb +1 -1
  23. data/lib/view_model/cepc_s_70/cepc.rb +184 -0
  24. data/lib/view_model/cepc_wrapper.rb +2 -0
  25. data/lib/view_model/factory.rb +2 -0
  26. data/lib/view_model/rd_sap_schema_s_1700/common_schema.rb +541 -0
  27. data/lib/view_model/rd_sap_wrapper.rb +2 -0
  28. metadata +22 -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.16"
8
+ VERSION = "2.2.18"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -0,0 +1,184 @@
1
+ module ViewModel
2
+ module CepcS70
3
+ class Cepc < ViewModel::Cepc71::CommonSchema
4
+ def date_of_expiry
5
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
6
+
7
+ expires_at.to_s
8
+ end
9
+
10
+ def building_environment
11
+ xpath(%w[Building-Environment])
12
+ end
13
+
14
+ def energy_efficiency_rating
15
+ xpath(%w[Asset-Rating])&.to_i
16
+ end
17
+
18
+ def current_energy_efficiency_band
19
+ xpath(%w[Energy-Band])
20
+ end
21
+
22
+ def potential_energy_rating
23
+ xpath(%w[Potential-Rating])&.to_i
24
+ end
25
+
26
+ def potential_energy_band
27
+ xpath(%w[Potential-Band])
28
+ end
29
+
30
+ def new_build_benchmark_band
31
+ xpath(%w[New-Build-Benchmark-Band])
32
+ end
33
+
34
+ def comparative_asset_rating
35
+ xpath(%w[Comparative-Asset-Rating])&.to_i
36
+ end
37
+
38
+ def comparative_asset_band
39
+ xpath(%w[Comparative-Energy-Band])
40
+ end
41
+
42
+ def epc_rating_ber
43
+ xpath(%w[BER])&.to_f
44
+ end
45
+
46
+ def approximate_energy_use
47
+ xpath(%w[Approximate-Energry-Use])&.to_i
48
+ end
49
+
50
+ def floor_area
51
+ xpath(%w[Technical-Information Floor-Area])&.to_i
52
+ end
53
+
54
+ def main_heating_fuel
55
+ xpath(%w[Main-Heating-Fuel])
56
+ end
57
+
58
+ def property_type
59
+ xpath(%w[Property-Type Long-Description])
60
+ end
61
+
62
+ def property_long_description
63
+ xpath(%w[Property-Type Long-Description])
64
+ end
65
+
66
+ def property_short_description
67
+ xpath(%w[Property-Type Short-Description])
68
+ end
69
+
70
+ def compliant_2002
71
+ nil
72
+ end
73
+
74
+ def renewable_energy_sources
75
+ @xml_doc.search("Renewable-Energy-Sources").children.search("Renewable-Energy-Source").map(&:content)
76
+ end
77
+
78
+ def electricity_sources
79
+ @xml_doc.search("Electricity-Sources").children.search("Electricity-Source").map(&:content)
80
+ end
81
+
82
+ def primary_energy_indicator
83
+ xpath(%w[Primary-Energry-Indicator])&.to_i
84
+ end
85
+
86
+ def calculation_tool
87
+ xpath(%w[Calculation-Tool])
88
+ end
89
+
90
+ def ter_2002
91
+ nil
92
+ end
93
+
94
+ def ter
95
+ xpath(%w[TER])&.to_f
96
+ end
97
+
98
+ def recommendations(payback = "")
99
+ if payback.empty?
100
+ # return an enumerable of all nodes
101
+ @xml_doc.xpath "Recommendations-Report RR-Recommendations"
102
+ else
103
+ @xml_doc
104
+ .search("Recommendations-Report RR-Recommendations/#{payback}")
105
+ .map do |node|
106
+ {
107
+ code: node.at("Recommendation-Code").content,
108
+ text: node.at("Recommendation").content,
109
+ cO2Impact: node.at("CO2-Impact").content,
110
+ }
111
+ end
112
+ end
113
+ end
114
+
115
+ def short_payback_recommendations
116
+ recommendations("Short-Payback")
117
+ end
118
+
119
+ def medium_payback_recommendations
120
+ recommendations("Medium-Payback")
121
+ end
122
+
123
+ def long_payback_recommendations
124
+ recommendations("Long-Payback")
125
+ end
126
+
127
+ def other_payback_recommendations
128
+ recommendations("Other-Payback")
129
+ end
130
+
131
+ def related_rrn
132
+ nil
133
+ end
134
+
135
+ def new_build_rating
136
+ xpath(%w[New-Build-Benchmark])&.to_i
137
+ end
138
+
139
+ def existing_build_rating
140
+ nil
141
+ end
142
+
143
+ def epc_related_party_disclosure
144
+ nil
145
+ end
146
+
147
+ def trading_address
148
+ xpath(%w[Trading-Address])
149
+ end
150
+
151
+ def company_name
152
+ xpath(%w[Company-Name])
153
+ end
154
+
155
+ def insurer
156
+ xpath(%w[Insurer])
157
+ end
158
+
159
+ def policy_no
160
+ xpath(%w[Policy-No])
161
+ end
162
+
163
+ def insurer_effective_date
164
+ xpath(%w[Effective-Date])
165
+ end
166
+
167
+ def insurer_expiry_date
168
+ xpath(%w[Expiry-Date])
169
+ end
170
+
171
+ def insurer_pi_limit
172
+ xpath(%w[PI-Limit])
173
+ end
174
+
175
+ def inspection_date
176
+ xpath(%w[Inspection-Date])
177
+ end
178
+
179
+ def completion_date
180
+ xpath(%w[Completion-Date])
181
+ end
182
+ end
183
+ end
184
+ end
@@ -61,6 +61,8 @@ module ViewModel
61
61
  ViewModel::Cepc40::Cepc.new xml_doc
62
62
  when :"CEPC-3.1"
63
63
  ViewModel::Cepc31::Cepc.new xml_doc
64
+ when :"CEPC-S-7.0"
65
+ ViewModel::CepcS70::Cepc.new xml_doc
64
66
  when :"CEPC-S-7.1"
65
67
  ViewModel::CepcS71::Cepc.new xml_doc
66
68
  else
@@ -18,6 +18,7 @@ module ViewModel
18
18
  CEPC-5.0
19
19
  CEPC-4.0
20
20
  CEPC-3.1
21
+ CEPC-S-7.0
21
22
  CEPC-S-7.1
22
23
  ].freeze
23
24
  TYPES_OF_RD_SAP = %i[
@@ -38,6 +39,7 @@ module ViewModel
38
39
  RdSAP-Schema-S-19.0
39
40
  RdSAP-Schema-S-21.0
40
41
  RdSAP-Schema-S-18.0
42
+ RdSAP-Schema-S-17.00
41
43
  ].freeze
42
44
  TYPES_OF_SAP = %i[
43
45
  SAP-Schema-19.2.0