epb_view_models 2.2.1 → 2.2.3
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.
- checksums.yaml +4 -4
- data/api/schemas/data/orchestrate.json +6 -0
- data/api/schemas/xml/CS63-S-7.0/ActionPlan.xsd +818 -0
- data/api/schemas/xml/DECAR-S-7.0/CommonFiles/CommonStructures.xsd +24 -0
- data/api/schemas/xml/DECAR-S-7.0/CommonFiles/Exceptions.xsd +69 -0
- data/api/schemas/xml/DECAR-S-7.0/Messages/LodgeReportRequest.xsd +14 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/BaseDataTypes.xsd +181 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/CEPC-Reports.xsd +66 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/Input-Data.xsd +307 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/Performance-Summary.xsd +105 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/Report-Header.xsd +449 -0
- data/api/schemas/xml/DECAR-S-7.0/Reports/Reported-Data.xsd +403 -0
- data/lib/epb_view_models.rb +1 -1
- data/lib/presenter/cs63/certificate_summary.rb +56 -0
- data/lib/presenter/cs63/export_configuration.rb +7 -0
- data/lib/presenter/cs63/summary.rb +44 -0
- data/lib/presenter/dec_rr/summary.rb +1 -3
- data/lib/view_model/cepc31/dec_rr.rb +4 -0
- data/lib/view_model/cepc40/dec_rr.rb +4 -0
- data/lib/view_model/cepc50/dec_rr.rb +4 -0
- data/lib/view_model/cepc51/dec_rr.rb +4 -0
- data/lib/view_model/cepc60/dec_rr.rb +4 -0
- data/lib/view_model/cepc70/dec_rr.rb +4 -0
- data/lib/view_model/cepc71/dec_rr.rb +4 -0
- data/lib/view_model/cepc800/dec_rr.rb +4 -0
- data/lib/view_model/cepc_ni800/dec_rr.rb +4 -0
- data/lib/view_model/cs63/common_schema.rb +195 -0
- data/lib/view_model/cs63_wrapper.rb +28 -0
- data/lib/view_model/dec_rr_wrapper.rb +2 -0
- data/lib/view_model/dec_summary_wrapper.rb +2 -0
- data/lib/view_model/dec_wrapper.rb +2 -0
- data/lib/view_model/decar_s_70/common_schema.rb +109 -0
- data/lib/view_model/decar_s_70/dec.rb +235 -0
- data/lib/view_model/decar_s_70/dec_rr.rb +102 -0
- data/lib/view_model/factory.rb +9 -1
- data/lib/view_model_gateway/xsd_files_gateway.rb +7 -0
- metadata +19 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
require "date"
|
|
2
|
+
|
|
3
|
+
module ViewModel
|
|
4
|
+
module Cs63
|
|
5
|
+
class CommonSchema < ViewModel::DomesticEpcViewModel
|
|
6
|
+
THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY = 65
|
|
7
|
+
|
|
8
|
+
def assessment_id
|
|
9
|
+
xpath(%w[Report-Header RRN])
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def epc_assessment_id
|
|
13
|
+
xpath(%w[Report-Header EPC-RRN])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def sale_lease_date
|
|
17
|
+
xpath(%w[Report-Header Sale-Lease-Date])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def assessment_date
|
|
21
|
+
xpath(%w[Report-Header Assessment-Date])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def plan_report_date
|
|
25
|
+
xpath(%w[Report-Header Plan-Report-Date])
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def report_type
|
|
29
|
+
xpath(%w[Report-Header Report-Type])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def address_line1
|
|
33
|
+
xpath(%w[Report-Header Property Address Address-Line-1])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def address_line2
|
|
37
|
+
xpath(%w[Report-Header Property Address Address-Line-2])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def address_line3
|
|
41
|
+
xpath(%w[Report-Header Property Address Address-Line-3])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def address_line4
|
|
45
|
+
xpath(%w[Report-Header Property Address Address-Line-4])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def town
|
|
49
|
+
xpath(%w[Report-Header Property Address Post-Town])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def postcode
|
|
53
|
+
xpath(%w[Report-Header Property Address Postcode])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def scheme_assessor_id
|
|
57
|
+
xpath(%w[Energy-Assessor Membership-Number]) or xpath(%w[Energy-Assessor Certificate-Number])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def assessor_name
|
|
61
|
+
xpath(%w[Energy-Assessor Name])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# def approved_organisation_name
|
|
65
|
+
# xpath(%w[Energy-Assessor Approved-Organisation-Name])
|
|
66
|
+
# end
|
|
67
|
+
#
|
|
68
|
+
# def approved_organisation_web_address
|
|
69
|
+
# xpath(%w[Energy-Assessor Approved-Organisation-Name])
|
|
70
|
+
# end
|
|
71
|
+
|
|
72
|
+
def trading_address
|
|
73
|
+
xpath(%w[Energy-Assessor Trading-Address])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def company_name
|
|
77
|
+
xpath(%w[Energy-Assessor Company-Name])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def status
|
|
81
|
+
xpath(%w[Energy-Assessor Status])
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def assessor_email
|
|
85
|
+
xpath(%w[Energy-Assessor/E-Mail])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def assessor_telephone
|
|
89
|
+
xpath(%w[Energy-Assessor/Telephone-Number])
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def address_id
|
|
93
|
+
xpath(%w[UPRN])
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# def type_of_assessment
|
|
97
|
+
# "CS63"
|
|
98
|
+
# end
|
|
99
|
+
|
|
100
|
+
def owner_commission_report
|
|
101
|
+
xpath(%w[Owner-Commission-Report])
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def delegated_person_commission_report
|
|
105
|
+
xpath(%w[Delegated-Person-Commission-Report])
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def property_type_short_description
|
|
109
|
+
xpath(%w[Property-Type Short-Description])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def property_type_long_description
|
|
113
|
+
xpath(%w[Property-Type Long-Description])
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def building_improvements
|
|
117
|
+
xpath(%w[Improvement-Type Building-Improvements])
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def operational_ratings
|
|
121
|
+
xpath(%w[Improvement-Type Operational-Rating])
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def dec
|
|
125
|
+
xpath(%w[Operational-Rating-System Display-Energy-Certificate])
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def planned_completion_date
|
|
129
|
+
xpath(%w[Improvements-Completion Planned-Completion-Date])
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def actual_completion_date
|
|
133
|
+
xpath(%w[Improvements-Completion Actual-Completion-Date])
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def target_emission_savings
|
|
137
|
+
xpath(%w[Target-Savings Target-Emission-Savings])
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def target_energy_savings
|
|
141
|
+
xpath(%w[Target-Savings Target-Energy-Savings])
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def accept_prescriptive_improvements
|
|
145
|
+
xpath(%w[Prescriptive-Improvements Accept-Prescriptive-Improvements])
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def prescriptive_improvements
|
|
149
|
+
@xml_doc
|
|
150
|
+
.search("Prescriptive-Improvements Prescriptive-Scenario")
|
|
151
|
+
.map do |node|
|
|
152
|
+
{
|
|
153
|
+
measure_description_short:
|
|
154
|
+
xpath(%w[Measure-Description-Short], node),
|
|
155
|
+
measure_description_long:
|
|
156
|
+
xpath(%w[Measure-Description-Long], node),
|
|
157
|
+
measure_valid: xpath(%w[Measure-Valid], node),
|
|
158
|
+
measure_type: xpath(%w[Measure-Type], node),
|
|
159
|
+
}
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def alternative_improvements
|
|
164
|
+
@xml_doc
|
|
165
|
+
.search("Alternative-Improvements Alternative-Scenario")
|
|
166
|
+
.map do |node|
|
|
167
|
+
{
|
|
168
|
+
measure_description_short:
|
|
169
|
+
xpath(%w[Measure-Description-Short], node),
|
|
170
|
+
measure_description_long:
|
|
171
|
+
xpath(%w[Measure-Description-Long], node),
|
|
172
|
+
measure_valid: xpath(%w[Measure-Valid], node),
|
|
173
|
+
measure_type: xpath(%w[Measure-Type], node),
|
|
174
|
+
}
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def date_of_registration
|
|
179
|
+
xpath(%w[Report-Header Plan-Report-Date])
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def date_of_expiry
|
|
183
|
+
Date.parse(date_of_registration).next_month(42).to_s
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def date_of_assessment
|
|
187
|
+
xpath(%w[Report-Header Assessment-Date])
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def related_rrn
|
|
191
|
+
nil
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module ViewModel
|
|
2
|
+
class Cs63Wrapper
|
|
3
|
+
attr_reader :view_model
|
|
4
|
+
|
|
5
|
+
def initialize(xml_doc, _schema_type, _additional_data = {})
|
|
6
|
+
@view_model = ViewModel::Cs63::CommonSchema.new xml_doc
|
|
7
|
+
# @view_model = build_view_model(xml_doc, schema_type)
|
|
8
|
+
@summary = Presenter::Cs63::Summary.new(view_model)
|
|
9
|
+
@certificate_summary = Presenter::Cs63::CertificateSummary.new(view_model)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def type
|
|
13
|
+
:CS63
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def to_hash
|
|
17
|
+
@summary.to_hash
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_certificate_summary
|
|
21
|
+
@certificate_summary.to_certificate_summary
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def get_view_model
|
|
25
|
+
view_model
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -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
|