epb_view_models 1.0.15 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/Property.xsd +4 -4
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/Templates/SAP-Report.xsd +9 -1
- data/lib/epb_view_models.rb +1 -1
- data/lib/helper/xml_enums_to_output.rb +20 -0
- data/lib/presenter/rd_sap/hera.rb +42 -0
- data/lib/presenter/sap/hera.rb +39 -0
- data/lib/view_model/domestic_epc_view_model.rb +10 -0
- data/lib/view_model/rd_sap_schema_200/common_schema.rb +0 -4
- data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +0 -4
- data/lib/view_model/rd_sap_wrapper.rb +5 -0
- data/lib/view_model/sap_schema_1800/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_1900/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_ni_1800/common_schema.rb +0 -4
- data/lib/view_model/sap_wrapper.rb +5 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21ae4bba2efbc28d42200e7a331a4111b76071399e0a1f901313c2d57035196a
|
4
|
+
data.tar.gz: 0e244cf4dec75c6213a3c3e8bac4aa2fea2c02f44c9958419d5bf9b9bb2f4f38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e9785b8c3141d8eaf2b1bf5c1cd647efe67022417b5922e94e44af3b57ce157dab168f4499d4a1b1bce1a6092d8aa87ef954a8ab09cc03335b5bc0a1417571
|
7
|
+
data.tar.gz: dcf95783220f96004c33f270bd844dd22de531f57136d7f9d230e7244a42b880c310088ca070b60aaedaf78dfb2f766f7f783098603302ca5cb2085b1afbc03f
|
@@ -18,7 +18,7 @@ As such the broad description of a Property can be regarded as a framework, cont
|
|
18
18
|
<xs:documentation>Address for the property.</xs:documentation>
|
19
19
|
</xs:annotation>
|
20
20
|
</xs:element>
|
21
|
-
<xs:element name="UPRN" type="UPRNType">
|
21
|
+
<xs:element name="UPRN" type="UPRNType" minOccurs="0">
|
22
22
|
<xs:annotation>
|
23
23
|
<xs:documentation>Unique Property Reference Number</xs:documentation>
|
24
24
|
</xs:annotation>
|
@@ -43,7 +43,7 @@ As such the broad description of a Property can be regarded as a framework, cont
|
|
43
43
|
</xs:documentation>
|
44
44
|
</xs:annotation>
|
45
45
|
<xs:sequence>
|
46
|
-
<xs:element name="Address-Line-1" type="xs:string"
|
46
|
+
<xs:element name="Address-Line-1" type="xs:string"/>
|
47
47
|
<xs:element name="Address-Line-2" type="xs:string" minOccurs="0"/>
|
48
48
|
<xs:element name="Address-Line-3" type="xs:string" minOccurs="0"/>
|
49
49
|
<xs:element name="Post-Town" type="xs:string"/>
|
@@ -57,10 +57,10 @@ As such the broad description of a Property can be regarded as a framework, cont
|
|
57
57
|
</xs:complexType>
|
58
58
|
<xs:simpleType name="UPRNType">
|
59
59
|
<xs:annotation>
|
60
|
-
<xs:documentation>Unique Property Reference Number
|
60
|
+
<xs:documentation>Unique Property Reference Number</xs:documentation>
|
61
61
|
</xs:annotation>
|
62
62
|
<xs:restriction base="xs:string">
|
63
|
-
<xs:pattern value="[0-9]{10}"/>
|
63
|
+
<xs:pattern value="UPRN-[0-9]{10,12}|RRN-[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}"/>
|
64
64
|
</xs:restriction>
|
65
65
|
</xs:simpleType>
|
66
66
|
<xs:simpleType name="PostcodeType">
|
@@ -54,7 +54,15 @@
|
|
54
54
|
<xs:element name="Report-Header" type="Report-Header"/>
|
55
55
|
<xs:element name="Energy-Assessment" type="Energy-Assessment"/>
|
56
56
|
<xs:element name="SAP10-Data" type="SAP10-Data"/>
|
57
|
-
<xs:element name="PDF" type="xs:base64Binary" minOccurs="0"
|
57
|
+
<xs:element name="PDF" type="xs:base64Binary" minOccurs="0">
|
58
|
+
<xs:annotation>
|
59
|
+
<xs:documentation>
|
60
|
+
DEPRECATED - DO NOT USE
|
61
|
+
This element is allowed for backwards-compatibility but any data sent here will
|
62
|
+
not be read, processed or stored by the register.
|
63
|
+
</xs:documentation>
|
64
|
+
</xs:annotation>
|
65
|
+
</xs:element>
|
58
66
|
<xs:element name="Insurance-Details" type="Insurance-Details" minOccurs="0"/>
|
59
67
|
<xs:element name="ExternalDefinitions-Revision-Number" type="xs:string">
|
60
68
|
<xs:annotation>
|
data/lib/epb_view_models.rb
CHANGED
@@ -274,6 +274,20 @@ module Helper
|
|
274
274
|
"76" => "bioethanol from any biomass source",
|
275
275
|
"99" => "Community heating schemes: special fuel",
|
276
276
|
}.freeze
|
277
|
+
MAIN_HEATING_CATEGORY = {
|
278
|
+
"1" => "none",
|
279
|
+
"2" => "boiler with radiators or underfloor heating",
|
280
|
+
"3" => "micro-cogeneration",
|
281
|
+
"4" => "heat pump with radiators or underfloor heating",
|
282
|
+
"5" => "heat pump with warm air distribution",
|
283
|
+
"6" => "community heating system",
|
284
|
+
"7" => "electric storage heaters",
|
285
|
+
"8" => "electric underfloor heating",
|
286
|
+
"9" => "warm air system (not heat pump)",
|
287
|
+
"10" => "room heaters",
|
288
|
+
"11" => "other system",
|
289
|
+
"12" => "not recorded",
|
290
|
+
}.freeze
|
277
291
|
|
278
292
|
def self.built_form_string(number)
|
279
293
|
BUILT_FORM[number]
|
@@ -358,6 +372,7 @@ module Helper
|
|
358
372
|
]
|
359
373
|
|
360
374
|
schemes_that_use_l = %i[
|
375
|
+
SAP-Schema-19.0.0
|
361
376
|
SAP-Schema-18.0.0
|
362
377
|
SAP-Schema-17.1
|
363
378
|
SAP-Schema-17.0
|
@@ -561,6 +576,7 @@ module Helper
|
|
561
576
|
]
|
562
577
|
|
563
578
|
sap = %i[
|
579
|
+
SAP-Schema-19.0.0
|
564
580
|
SAP-Schema-18.0.0
|
565
581
|
SAP-Schema-17.1
|
566
582
|
SAP-Schema-17.0
|
@@ -611,6 +627,10 @@ module Helper
|
|
611
627
|
end
|
612
628
|
end
|
613
629
|
|
630
|
+
def self.main_heating_category(value:)
|
631
|
+
MAIN_HEATING_CATEGORY[value] || value
|
632
|
+
end
|
633
|
+
|
614
634
|
private_class_method :is_rdsap, :is_sap
|
615
635
|
end
|
616
636
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Presenter
|
2
|
+
module RdSap
|
3
|
+
class Hera
|
4
|
+
TYPE_OF_ASSESSMENT = "RdSAP".freeze
|
5
|
+
private_constant :TYPE_OF_ASSESSMENT
|
6
|
+
|
7
|
+
def initialize(view_model, schema_type)
|
8
|
+
@view_model = view_model
|
9
|
+
@schema_type = schema_type
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_hera_hash
|
13
|
+
{
|
14
|
+
type_of_assessment: TYPE_OF_ASSESSMENT,
|
15
|
+
assessment_id: @view_model.assessment_id,
|
16
|
+
date_of_registration: @view_model.date_of_registration,
|
17
|
+
address: {
|
18
|
+
address_line1: @view_model.address_line1,
|
19
|
+
address_line2: @view_model.address_line2,
|
20
|
+
address_line3: @view_model.address_line3,
|
21
|
+
address_line4: @view_model.address_line4,
|
22
|
+
town: @view_model.town,
|
23
|
+
postcode: @view_model.postcode,
|
24
|
+
},
|
25
|
+
dwelling_type: @view_model.dwelling_type,
|
26
|
+
built_form: Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
|
27
|
+
main_dwelling_construction_age_band_or_year: Helper::XmlEnumsToOutput.construction_age_band_lookup(
|
28
|
+
@view_model.main_dwelling_construction_age_band_or_year,
|
29
|
+
@schema_type,
|
30
|
+
@view_model.report_type,
|
31
|
+
),
|
32
|
+
property_summary: @view_model.property_summary,
|
33
|
+
main_heating_category: Helper::XmlEnumsToOutput.main_heating_category(value: @view_model.main_heating_category),
|
34
|
+
main_fuel_type: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
|
35
|
+
@schema_type,
|
36
|
+
@view_model.report_type),
|
37
|
+
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Presenter
|
2
|
+
module Sap
|
3
|
+
class Hera
|
4
|
+
def initialize(view_model, schema_type)
|
5
|
+
@view_model = view_model
|
6
|
+
@schema_type = schema_type
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hera_hash
|
10
|
+
{
|
11
|
+
type_of_assessment: @view_model.type_of_assessment,
|
12
|
+
assessment_id: @view_model.assessment_id,
|
13
|
+
date_of_registration: @view_model.date_of_registration,
|
14
|
+
address: {
|
15
|
+
address_line1: @view_model.address_line1,
|
16
|
+
address_line2: @view_model.address_line2,
|
17
|
+
address_line3: @view_model.address_line3,
|
18
|
+
address_line4: nil,
|
19
|
+
town: @view_model.town,
|
20
|
+
postcode: @view_model.postcode,
|
21
|
+
},
|
22
|
+
dwelling_type: @view_model.dwelling_type,
|
23
|
+
built_form: Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
|
24
|
+
main_dwelling_construction_age_band_or_year: Helper::XmlEnumsToOutput.construction_age_band_lookup(
|
25
|
+
@view_model.main_dwelling_construction_age_band_or_year,
|
26
|
+
@schema_type,
|
27
|
+
@view_model.report_type,
|
28
|
+
),
|
29
|
+
property_summary: @view_model.property_summary,
|
30
|
+
main_heating_category: Helper::XmlEnumsToOutput.main_heating_category(value: @view_model.main_heating_category),
|
31
|
+
main_fuel_type: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
|
32
|
+
@schema_type,
|
33
|
+
@view_model.report_type),
|
34
|
+
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -54,6 +54,16 @@ module ViewModel
|
|
54
54
|
xpath(%w[Water-Heating-Code])
|
55
55
|
end
|
56
56
|
|
57
|
+
def has_hot_water_cylinder
|
58
|
+
return "false" if xpath(%w[Has-Hot-Water-Cylinder]).nil?
|
59
|
+
|
60
|
+
xpath(%w[Has-Hot-Water-Cylinder])
|
61
|
+
end
|
62
|
+
|
63
|
+
def main_heating_category
|
64
|
+
xpath(%w[Main-Heating-Category])
|
65
|
+
end
|
66
|
+
|
57
67
|
private
|
58
68
|
|
59
69
|
def fetch_addendum_numbers
|
@@ -8,6 +8,7 @@ module ViewModel
|
|
8
8
|
@summary = Presenter::RdSap::Summary.new(view_model)
|
9
9
|
@report = Presenter::RdSap::Report.new(view_model, schema_type, additional_data)
|
10
10
|
@recommendation_report = Presenter::RdSap::RecommendationReport.new(view_model)
|
11
|
+
@hera = Presenter::RdSap::Hera.new(view_model, schema_type)
|
11
12
|
end
|
12
13
|
|
13
14
|
def type
|
@@ -30,6 +31,10 @@ module ViewModel
|
|
30
31
|
@recommendation_report.to_hash
|
31
32
|
end
|
32
33
|
|
34
|
+
def to_hera_hash
|
35
|
+
@hera.to_hera_hash
|
36
|
+
end
|
37
|
+
|
33
38
|
def get_view_model
|
34
39
|
view_model
|
35
40
|
end
|
@@ -8,6 +8,7 @@ module ViewModel
|
|
8
8
|
@summary = Presenter::Sap::Summary.new(view_model)
|
9
9
|
@report = Presenter::Sap::Report.new(view_model, schema_type, additional_data)
|
10
10
|
@recommendation_report = Presenter::Sap::RecommendationReport.new(view_model)
|
11
|
+
@hera = Presenter::Sap::Hera.new(view_model, schema_type)
|
11
12
|
end
|
12
13
|
|
13
14
|
def type
|
@@ -30,6 +31,10 @@ module ViewModel
|
|
30
31
|
@recommendation_report.to_hash
|
31
32
|
end
|
32
33
|
|
34
|
+
def to_hera_hash
|
35
|
+
@hera.to_hera_hash
|
36
|
+
end
|
37
|
+
|
33
38
|
def get_view_model
|
34
39
|
view_model
|
35
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epb_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MHCLG Energy Performance of Buildings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -1675,10 +1675,12 @@ files:
|
|
1675
1675
|
- lib/presenter/export/domestic.rb
|
1676
1676
|
- lib/presenter/export/statistics.rb
|
1677
1677
|
- lib/presenter/rd_sap/export_configuration.rb
|
1678
|
+
- lib/presenter/rd_sap/hera.rb
|
1678
1679
|
- lib/presenter/rd_sap/recommendation_report.rb
|
1679
1680
|
- lib/presenter/rd_sap/report.rb
|
1680
1681
|
- lib/presenter/rd_sap/summary.rb
|
1681
1682
|
- lib/presenter/sap/export_configuration.rb
|
1683
|
+
- lib/presenter/sap/hera.rb
|
1682
1684
|
- lib/presenter/sap/recommendation_report.rb
|
1683
1685
|
- lib/presenter/sap/report.rb
|
1684
1686
|
- lib/presenter/sap/summary.rb
|