epb_view_models 2.2.17 → 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.
@@ -0,0 +1,171 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns="http://www.est.org.uk/epc/estcrV1/DCLG-CEPC" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pfdt="http://www.est.org.uk/epc/estcrV1/DCLG-HIP/BaseDataTypes" xmlns:HIP="http://www.est.org.uk/epc/estcrV1/DCLG-HIP" xmlns:SAP="http://www.est.org.uk/epc/estcrV1/DCLG-SAP09" targetNamespace="http://www.est.org.uk/epc/estcrV1/DCLG-CEPC" elementFormDefault="qualified" version="LIG-16.0">
3
+ <xs:annotation>
4
+ <xs:documentation>© Department of Communities and Local Government. © Crown copyright, 2007. The Home Condition Report logo and associated wording is a registered trade mark - any unlicensed use is not permitted. Copyright in the typographical arrangement of this document rests with the Crown. This publication, excluding logos, may be reproduced free of charge in any format or medium for research, private study, for internal circulation within an organisation or by registered scheme users. This is subject to it being reproduced accurately and not used in a misleading context.</xs:documentation>
5
+ </xs:annotation>
6
+ <xs:include schemaLocation="./BaseDataTypes.xsd"/>
7
+ <!--xs:include schemaLocation="./HCR-Domains.xsd"/-->
8
+ <!--<xs:include schemaLocation="../Templates/Property.xsd"/>-->
9
+ <xs:include schemaLocation="./Property.xsd"/>
10
+ <xs:element name="Energy-Assessor" type="Energy-Assessor"/>
11
+ <xs:complexType name="Energy-Assessor">
12
+ <xs:annotation>
13
+ <xs:documentation>
14
+ A Energy-Assessor is a person certified by a Accrediation Scheme as being qualified to carry out an Energy Assessment and produce an Energy Performance Certificate.
15
+ </xs:documentation>
16
+ </xs:annotation>
17
+ <xs:sequence>
18
+ <xs:element name="Membership-Number" type="xs:string" minOccurs="1" maxOccurs="1">
19
+ <xs:annotation>
20
+ <xs:documentation>The unique identifier assigned to the Energy Assessor by the Approved Organisation by which they can be identified throughout their membership of the scheme.</xs:documentation>
21
+ </xs:annotation>
22
+ </xs:element>
23
+ <xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1">
24
+ <xs:annotation>
25
+ <xs:documentation>The name by which the Energy Assessor is registered. This is a structured name containing prefix, first name + surname.</xs:documentation>
26
+ </xs:annotation>
27
+ </xs:element>
28
+ <xs:element name="Approved-Organisation-Name" type="xs:string" minOccurs="1" maxOccurs="1">
29
+ <xs:annotation>
30
+ <xs:documentation>The name of the Approved Organisation that certified the Energy Assessor.</xs:documentation>
31
+ </xs:annotation>
32
+ </xs:element>
33
+ <xs:element name="Approved-Organisation-Web-Address" type="xs:string" minOccurs="1" maxOccurs="1">
34
+ <xs:annotation>
35
+ <xs:documentation>The web address of the Approved Organisation that certified the Energy Assessor.</xs:documentation>
36
+ </xs:annotation>
37
+ </xs:element>
38
+ <xs:element name="Trading-Address" type="xs:string" minOccurs="0" maxOccurs="1">
39
+ <xs:annotation>
40
+ <xs:documentation>The address that any written correspondence can be sent to. This is not the same as the Registered Address because it may, of course, be a Post Office Box.</xs:documentation>
41
+ </xs:annotation>
42
+ </xs:element>
43
+ <xs:element name="Company-Name" type="xs:string" minOccurs="0" maxOccurs="1">
44
+ <xs:annotation>
45
+ <xs:documentation>The Name of the Company that the Energy Assessor is empolyed by.</xs:documentation>
46
+ </xs:annotation>
47
+ </xs:element>
48
+ <xs:element name="Status" type="EAStatusCode" minOccurs="0" maxOccurs="1">
49
+ <xs:annotation>
50
+ <xs:documentation>The Status of the Energy Assessor - at the time of producing and lodging a report this shoudl be "Registered" but any of the values can be present on the EA Register itself.</xs:documentation>
51
+ </xs:annotation>
52
+ </xs:element>
53
+ <xs:element name="E-Mail" type="xs:string" minOccurs="0" maxOccurs="1">
54
+ <xs:annotation>
55
+ <xs:documentation>Optional e-mail address for the Energy Assessor</xs:documentation>
56
+ </xs:annotation>
57
+ </xs:element>
58
+ <xs:element name="Telephone-Number" type="xs:string" minOccurs="0" maxOccurs="1"/>
59
+ <xs:element name="Base-Postcode-Location" type="PostcodeType" minOccurs="0" maxOccurs="1">
60
+ <xs:annotation>
61
+ <xs:documentation>The full postcode that the Energy Assessor works from.</xs:documentation>
62
+ </xs:annotation>
63
+ </xs:element>
64
+ </xs:sequence>
65
+ </xs:complexType>
66
+ <xs:simpleType name="EAStatusCode">
67
+ <xs:restriction base="xs:string">
68
+ <xs:enumeration value="Inactive">
69
+ <xs:annotation>
70
+ <xs:documentation>Inactive</xs:documentation>
71
+ </xs:annotation>
72
+ </xs:enumeration>
73
+ <xs:enumeration value="Registered">
74
+ <xs:annotation>
75
+ <xs:documentation>Registered</xs:documentation>
76
+ </xs:annotation>
77
+ </xs:enumeration>
78
+ <xs:enumeration value="Struck-Off">
79
+ <xs:annotation>
80
+ <xs:documentation>Struck Off</xs:documentation>
81
+ </xs:annotation>
82
+ </xs:enumeration>
83
+ <xs:enumeration value="Suspended">
84
+ <xs:annotation>
85
+ <xs:documentation>Suspended</xs:documentation>
86
+ </xs:annotation>
87
+ </xs:enumeration>
88
+ </xs:restriction>
89
+ </xs:simpleType>
90
+ <xs:simpleType name="InspectorTypeCode">
91
+ <xs:restriction base="xs:string">
92
+ <xs:enumeration value="1">
93
+ <xs:annotation>
94
+ <xs:documentation>Home Inspector</xs:documentation>
95
+ </xs:annotation>
96
+ </xs:enumeration>
97
+ <xs:enumeration value="2">
98
+ <xs:annotation>
99
+ <xs:documentation>Domestic Energy Assessor</xs:documentation>
100
+ </xs:annotation>
101
+ </xs:enumeration>
102
+ </xs:restriction>
103
+ </xs:simpleType>
104
+ <xs:element name="Mortgage-Lender" type="Mortgage-Lender"/>
105
+ <xs:complexType name="Mortgage-Lender">
106
+ <xs:annotation>
107
+ <xs:documentation>A Mortgage Lender is an organisation that may lend money to the Buyer for the purpose of purchasing the Property.
108
+
109
+ As part of this decision making the Mortgage Lender may use an Automated Valuation Model (AVM) to value the Property and requires access to the underlying data in the Home Condition Report or the content of the Energy Performance Certificate in order to complete this valuation.</xs:documentation>
110
+ </xs:annotation>
111
+ <xs:all/>
112
+ </xs:complexType>
113
+ <xs:simpleType name="Postcode-CoverageType">
114
+ <xs:restriction base="xs:string">
115
+ <xs:maxLength value="500"/>
116
+ <xs:pattern value="[A-Z]{1,2}[0-9]{0,2}(,[A-Z]{1,2}[0-9]{0,2})*"/>
117
+ </xs:restriction>
118
+ </xs:simpleType>
119
+ <xs:element name="Certification-Scheme" type="Certification-Scheme"/>
120
+ <xs:complexType name="Certification-Scheme">
121
+ <xs:annotation>
122
+ <xs:documentation>The Certification Scheme is the "regulatory" body responsible for regulating the activities of the Home Inspectors.
123
+
124
+ A Certification Scheme will carry out certain primary functions in accordance with the standards, focussed around certifying, managing and regulating Home Inspectors and registering Home Condition Reports.
125
+
126
+ Although covered by a different regulatory regime a Certification Scheme is synonymous with the role of an Accreditation Body in the production of an Energy Performance Certificate.</xs:documentation>
127
+ </xs:annotation>
128
+ <xs:all>
129
+ <xs:element name="Scheme-Name" type="xs:string"/>
130
+ <xs:element name="Complaints-Address" type="AddressType" minOccurs="0">
131
+ <xs:annotation>
132
+ <xs:documentation>The address to which any complaints should be sent.</xs:documentation>
133
+ </xs:annotation>
134
+ </xs:element>
135
+ <xs:element name="Contact-Address" type="AddressType" minOccurs="0">
136
+ <xs:annotation>
137
+ <xs:documentation>The address that any written correspondence can be sent to. This is not the same as the Registered Address because it may, of course, be a Post Office Box.</xs:documentation>
138
+ </xs:annotation>
139
+ </xs:element>
140
+ <xs:element name="Web-Site" type="xs:string"/>
141
+ <xs:element name="E-Mail" type="xs:string">
142
+ <xs:annotation>
143
+ <xs:documentation>the E-Mail address that the Authorised User can be contacted at.</xs:documentation>
144
+ </xs:annotation>
145
+ </xs:element>
146
+ <xs:element name="Registered-Name" type="xs:string">
147
+ <xs:annotation>
148
+ <xs:documentation>The public name by which the Authorised User is known by - this is either a personal name (e.g. "Mr John Smith") built up from the components of the Person Name if the Authorised User is an individual such as a Home Inspector or a Company Name if the Authorised User is an organisation.
149
+
150
+ In the case of a individual the name may not be unique (e.g. there may be many thousands of people called "Mr John Smith") so this is information about the Authorised User rather than an identifier.</xs:documentation>
151
+ </xs:annotation>
152
+ </xs:element>
153
+ <xs:element name="Fax" type="PhoneNumberType"/>
154
+ <xs:element name="Telephone" type="PhoneNumberType"/>
155
+ </xs:all>
156
+ </xs:complexType>
157
+ <xs:element name="CertificationSchemeKeyFields" type="CertificationSchemeKeyFields"/>
158
+ <xs:complexType name="CertificationSchemeKeyFields">
159
+ <xs:annotation>
160
+ <xs:documentation>Key field definition for the Certification Scheme class.</xs:documentation>
161
+ </xs:annotation>
162
+ <xs:sequence>
163
+ <xs:element name="Registered-Name" type="xs:string"/>
164
+ </xs:sequence>
165
+ </xs:complexType>
166
+ <xs:simpleType name="PhoneNumberType">
167
+ <xs:restriction base="xs:string">
168
+ <xs:pattern value="[0-9\-\.\)\(\+ ]+"/>
169
+ </xs:restriction>
170
+ </xs:simpleType>
171
+ </xs:schema>
@@ -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.17"
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[
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epb_view_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.17
4
+ version: 2.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings
@@ -161,6 +161,14 @@ files:
161
161
  - api/schemas/xml/CEPC-NI-8.0.0/Reports/Performance-Summary.xsd
162
162
  - api/schemas/xml/CEPC-NI-8.0.0/Reports/Report-Header.xsd
163
163
  - api/schemas/xml/CEPC-NI-8.0.0/Reports/Reported-Data.xsd
164
+ - api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd
165
+ - api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd
166
+ - api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd
167
+ - api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd
168
+ - api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd
169
+ - api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd
170
+ - api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd
171
+ - api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd
164
172
  - api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd
165
173
  - api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd
166
174
  - api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd
@@ -1712,6 +1720,7 @@ files:
1712
1720
  - lib/view_model/cepc_ni800/dec.rb
1713
1721
  - lib/view_model/cepc_ni800/dec_rr.rb
1714
1722
  - lib/view_model/cepc_rr_wrapper.rb
1723
+ - lib/view_model/cepc_s_70/cepc.rb
1715
1724
  - lib/view_model/cepc_s_71/cepc.rb
1716
1725
  - lib/view_model/cepc_wrapper.rb
1717
1726
  - lib/view_model/cs63/common_schema.rb