epb_view_models 2.2.2 → 2.2.4

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +3 -0
  3. data/api/schemas/xml/DECAR-S-7.0/CommonFiles/CommonStructures.xsd +24 -0
  4. data/api/schemas/xml/DECAR-S-7.0/CommonFiles/Exceptions.xsd +69 -0
  5. data/api/schemas/xml/DECAR-S-7.0/Messages/LodgeReportRequest.xsd +14 -0
  6. data/api/schemas/xml/DECAR-S-7.0/Reports/BaseDataTypes.xsd +181 -0
  7. data/api/schemas/xml/DECAR-S-7.0/Reports/CEPC-Reports.xsd +66 -0
  8. data/api/schemas/xml/DECAR-S-7.0/Reports/Input-Data.xsd +307 -0
  9. data/api/schemas/xml/DECAR-S-7.0/Reports/Performance-Summary.xsd +105 -0
  10. data/api/schemas/xml/DECAR-S-7.0/Reports/Report-Header.xsd +449 -0
  11. data/api/schemas/xml/DECAR-S-7.0/Reports/Reported-Data.xsd +403 -0
  12. data/lib/epb_view_models.rb +1 -1
  13. data/lib/presenter/cepc/certificate_summary.rb +5 -3
  14. data/lib/presenter/dec/certificate_summary.rb +91 -0
  15. data/lib/presenter/dec_rr/certificate_summary.rb +62 -0
  16. data/lib/presenter/dec_rr/summary.rb +1 -3
  17. data/lib/presenter/rd_sap/certificate_summary.rb +3 -0
  18. data/lib/presenter/sap/certificate_summary.rb +3 -0
  19. data/lib/view_model/cepc31/dec_rr.rb +4 -0
  20. data/lib/view_model/cepc40/dec_rr.rb +4 -0
  21. data/lib/view_model/cepc50/dec_rr.rb +4 -0
  22. data/lib/view_model/cepc51/dec_rr.rb +4 -0
  23. data/lib/view_model/cepc60/dec_rr.rb +4 -0
  24. data/lib/view_model/cepc70/dec_rr.rb +4 -0
  25. data/lib/view_model/cepc71/dec_rr.rb +4 -0
  26. data/lib/view_model/cepc800/dec_rr.rb +4 -0
  27. data/lib/view_model/cepc_ni800/dec_rr.rb +4 -0
  28. data/lib/view_model/cepc_s_71/cepc.rb +14 -18
  29. data/lib/view_model/dec_rr_wrapper.rb +7 -0
  30. data/lib/view_model/dec_summary_wrapper.rb +2 -0
  31. data/lib/view_model/dec_wrapper.rb +7 -0
  32. data/lib/view_model/decar_s_70/common_schema.rb +109 -0
  33. data/lib/view_model/decar_s_70/dec.rb +235 -0
  34. data/lib/view_model/decar_s_70/dec_rr.rb +102 -0
  35. data/lib/view_model/domestic_epc_view_model.rb +14 -0
  36. data/lib/view_model/factory.rb +4 -1
  37. metadata +15 -1
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module Cepc50
3
3
  class DecRr < ViewModel::Cepc50::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
6
10
 
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module Cepc51
3
3
  class DecRr < ViewModel::Cepc51::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
6
10
 
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module Cepc60
3
3
  class DecRr < ViewModel::Cepc60::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
6
10
 
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module Cepc70
3
3
  class DecRr < ViewModel::Cepc70::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
6
10
 
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module Cepc71
3
3
  class DecRr < ViewModel::Cepc71::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
6
10
 
@@ -3,6 +3,10 @@ require "date"
3
3
  module ViewModel
4
4
  module Cepc800
5
5
  class DecRr < ViewModel::Cepc800::CommonSchema
6
+ def type_of_assessment
7
+ "DEC-RR"
8
+ end
9
+
6
10
  def date_of_expiry
7
11
  floor_area = xpath(%w[Advisory-Report Technical-Information Floor-Area])
8
12
 
@@ -1,6 +1,10 @@
1
1
  module ViewModel
2
2
  module CepcNi800
3
3
  class DecRr < ViewModel::CepcNi800::CommonSchema
4
+ def type_of_assessment
5
+ "DEC-RR"
6
+ end
7
+
4
8
  def date_of_expiry
5
9
  expiry_date = (Date.parse(date_of_issue) - 1).next_year 7
6
10
 
@@ -20,23 +20,19 @@ module ViewModel
20
20
  end
21
21
 
22
22
  def potential_energy_rating
23
- xpath(%w[Potential-Rating])
23
+ xpath(%w[Potential-Rating])&.to_i
24
24
  end
25
25
 
26
26
  def potential_energy_band
27
27
  xpath(%w[Potential-Band])
28
28
  end
29
29
 
30
- def new_build_benchmark_rating
31
- xpath(%w[New-Build-Benchmark])
32
- end
33
-
34
30
  def new_build_benchmark_band
35
31
  xpath(%w[New-Build-Benchmark-Band])
36
32
  end
37
33
 
38
34
  def comparative_asset_rating
39
- xpath(%w[Comparative-Asset-Rating])
35
+ xpath(%w[Comparative-Asset-Rating])&.to_i
40
36
  end
41
37
 
42
38
  def comparative_asset_band
@@ -44,11 +40,11 @@ module ViewModel
44
40
  end
45
41
 
46
42
  def epc_rating_ber
47
- xpath(%w[BER])
43
+ xpath(%w[BER])&.to_f
48
44
  end
49
45
 
50
46
  def approximate_energy_use
51
- xpath(%w[Approximate-Energy-Use])
47
+ xpath(%w[Approximate-Energy-Use])&.to_i
52
48
  end
53
49
 
54
50
  def floor_area
@@ -60,7 +56,11 @@ module ViewModel
60
56
  end
61
57
 
62
58
  def property_type
63
- xpath(%w[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
64
  end
65
65
 
66
66
  def property_short_description
@@ -72,15 +72,15 @@ module ViewModel
72
72
  end
73
73
 
74
74
  def renewable_energy_sources
75
- @xml_doc.search("Renewable-Energy-Sources").map(&:content)
75
+ @xml_doc.search("Renewable-Energy-Sources").children.search("Renewable-Energy-Source").map(&:content)
76
76
  end
77
77
 
78
78
  def electricity_sources
79
- @xml_doc.search("Electricity-Sources").map(&:content)
79
+ @xml_doc.search("Electricity-Sources").children.search("Electricity-Source").map(&:content)
80
80
  end
81
81
 
82
82
  def primary_energy_indicator
83
- xpath(%w[Primary-Energy-Indicator])
83
+ xpath(%w[Primary-Energy-Indicator])&.to_i
84
84
  end
85
85
 
86
86
  def calculation_tool
@@ -88,15 +88,11 @@ module ViewModel
88
88
  end
89
89
 
90
90
  def ter_2002
91
- xpath(%w[TER-2002])
91
+ xpath(%w[TER-2002])&.to_f
92
92
  end
93
93
 
94
94
  def ter
95
- xpath(%w[TER])
96
- end
97
-
98
- def renewable_sources
99
- xpath(%w[Renewable-Sources])
95
+ xpath(%w[TER])&.to_f
100
96
  end
101
97
 
102
98
  def recommendations(payback = "")
@@ -6,6 +6,7 @@ module ViewModel
6
6
  @view_model = build_view_model(xml_doc, schema_type)
7
7
  @summary = Presenter::DecRr::Summary.new(view_model)
8
8
  @recommendation_report = Presenter::DecRr::RecommendationReport.new(view_model)
9
+ @certificate_summary = Presenter::DecRr::CertificateSummary.new(view_model)
9
10
  end
10
11
 
11
12
  def type
@@ -21,6 +22,10 @@ module ViewModel
21
22
  @recommendation_report.to_hash
22
23
  end
23
24
 
25
+ def to_certificate_summary
26
+ @certificate_summary.to_hash
27
+ end
28
+
24
29
  def get_view_model
25
30
  view_model
26
31
  end
@@ -29,6 +34,8 @@ module ViewModel
29
34
 
30
35
  def build_view_model(xml_doc, schema_type)
31
36
  case schema_type
37
+ when :"DECAR-S-7.0"
38
+ ViewModel::DecarS70::DecRr.new xml_doc
32
39
  when :"CEPC-8.0.0"
33
40
  ViewModel::Cepc800::DecRr.new xml_doc
34
41
  when :"CEPC-NI-8.0.0"
@@ -29,6 +29,8 @@ module ViewModel
29
29
 
30
30
  def build_view_model(xml_doc, schema_type)
31
31
  case schema_type
32
+ when :"DECAR-S-7.0"
33
+ ViewModel::DecarS70::Dec.new xml_doc
32
34
  when :"CEPC-8.0.0"
33
35
  ViewModel::Cepc800::Dec.new xml_doc
34
36
  when :"CEPC-NI-8.0.0"
@@ -6,6 +6,7 @@ module ViewModel
6
6
  @view_model = build_view_model(xml_doc, schema_type)
7
7
  @summary = Presenter::Dec::Summary.new(view_model, schema_type)
8
8
  @report = Presenter::Dec::Report.new(view_model, additional_data)
9
+ @certificate_summary = Presenter::Dec::CertificateSummary.new(view_model, schema_type)
9
10
  end
10
11
 
11
12
  def type
@@ -22,6 +23,10 @@ module ViewModel
22
23
  @report.to_hash
23
24
  end
24
25
 
26
+ def to_certificate_summary
27
+ @certificate_summary.to_hash
28
+ end
29
+
25
30
  def get_view_model
26
31
  view_model
27
32
  end
@@ -30,6 +35,8 @@ module ViewModel
30
35
 
31
36
  def build_view_model(xml_doc, schema_type)
32
37
  case schema_type
38
+ when :"DECAR-S-7.0"
39
+ ViewModel::DecarS70::Dec.new xml_doc
33
40
  when :"CEPC-8.0.0"
34
41
  ViewModel::Cepc800::Dec.new xml_doc
35
42
  when :"CEPC-NI-8.0.0"
@@ -0,0 +1,109 @@
1
+ module ViewModel
2
+ module DecarS70
3
+ class CommonSchema < ViewModel::BaseViewModel
4
+ def assessment_id
5
+ xpath(%w[RRN])
6
+ end
7
+
8
+ def date_of_expiry
9
+ xpath(%w[Valid-Until])
10
+ end
11
+
12
+ def report_type
13
+ xpath(%w[Report-Type])
14
+ end
15
+
16
+ def address_line1
17
+ xpath(%w[Property-Address Address-Line-1])
18
+ end
19
+
20
+ def address_line2
21
+ xpath(%w[Property-Address Address-Line-2])
22
+ end
23
+
24
+ def address_line3
25
+ xpath(%w[Property-Address Address-Line-3])
26
+ end
27
+
28
+ def address_line4
29
+ xpath(%w[Property-Address Address-Line-4])
30
+ end
31
+
32
+ def town
33
+ xpath(%w[Property-Address Post-Town])
34
+ end
35
+
36
+ def postcode
37
+ xpath(%w[Property-Address Postcode])
38
+ end
39
+
40
+ def scheme_assessor_id
41
+ xpath(%w[Certificate-Number])
42
+ end
43
+
44
+ def assessor_name
45
+ xpath(%w[Energy-Assessor Name])
46
+ end
47
+
48
+ def assessor_email
49
+ xpath(%w[Energy-Assessor E-Mail])
50
+ end
51
+
52
+ def assessor_telephone
53
+ xpath(%w[Energy-Assessor Telephone-Number])
54
+ end
55
+
56
+ def company_name
57
+ xpath(%w[Energy-Assessor Company-Name])
58
+ end
59
+
60
+ def company_address
61
+ xpath(%w[Energy-Assessor Trading-Address])
62
+ end
63
+
64
+ def date_of_assessment
65
+ xpath(%w[Inspection-Date])
66
+ end
67
+
68
+ def date_of_registration
69
+ xpath(%w[Registration-Date])
70
+ end
71
+
72
+ def date_of_issue
73
+ xpath(%w[Issue-Date])
74
+ end
75
+
76
+ def address_id
77
+ xpath(%w[UPRN])
78
+ end
79
+
80
+ def all_start_dates
81
+ @xml_doc.search("Start-Date").map(&:content)
82
+ end
83
+
84
+ def all_energy_types
85
+ @xml_doc.search("Energy-Type").map(&:content)
86
+ end
87
+
88
+ def all_reason_types
89
+ @xml_doc.search("Reason-Type").map(&:content)
90
+ end
91
+
92
+ def or_assessment_end_date
93
+ xpath(%w[OR-Operational-Rating OR-Assessment-End-Date])
94
+ end
95
+
96
+ def calculation_tool
97
+ xpath(%w[Calculation-Details Calculation-Tool])
98
+ end
99
+
100
+ def inspection_type
101
+ xpath(%w[Calculation-Details Inspection-Type])
102
+ end
103
+
104
+ def building_level
105
+ xpath(%w[Building-Level])&.to_i
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,235 @@
1
+ require "date"
2
+
3
+ module ViewModel
4
+ module DecarS70
5
+ class Dec < ViewModel::DecarS70::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])
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])
100
+ end
101
+
102
+ def annual_energy_use_electrical
103
+ xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Electrical])
104
+ end
105
+
106
+ def typical_thermal_use
107
+ xpath(%w[DEC-Annual-Energy-Summary Typical-Thermal-Use])
108
+ end
109
+
110
+ def typical_electrical_use
111
+ xpath(%w[DEC-Annual-Energy-Summary Typical-Electrical-Use])
112
+ end
113
+
114
+ def renewables_fuel_thermal
115
+ xpath(%w[DEC-Annual-Energy-Summary Renewables-Fuel-Thermal])
116
+ end
117
+
118
+ def renewables_electrical
119
+ xpath(%w[DEC-Annual-Energy-Summary Renewables-Electrical])
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 DecarS70
5
+ class DecRr < ViewModel::DecarS70::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,
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])
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
@@ -64,6 +64,20 @@ module ViewModel
64
64
  xpath(%w[Main-Heating-Category])
65
65
  end
66
66
 
67
+ def assessor_contact_address
68
+ address = xpath(%w[Energy-Assessor Contact-Address]).nil? ? xpath(%w[Home-Inspector Contact-Address]) : xpath(%w[Energy-Assessor Contact-Address])
69
+ format_address = address&.split("\n")&.map(&:strip)
70
+ format_address&.reject(&:empty?)&.join(", ")
71
+ end
72
+
73
+ def company_name
74
+ xpath(%w[Company-Name])
75
+ end
76
+
77
+ def co2_emissions_current_per_floor_area
78
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])
79
+ end
80
+
67
81
  private
68
82
 
69
83
  def fetch_addendum_numbers