epb_view_models 1.0.17 → 1.0.20
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/.buildspec.yml +2 -2
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +32 -31
- data/Makefile +1 -1
- data/api/schemas/xml/SAP-Schema-19.0.0/SAP/UDT/SAP-Domains.xsd +1 -1
- data/epb_view_models.gemspec +1 -1
- data/lib/epb_view_models.rb +1 -1
- data/lib/helper/xml_enums_to_output.rb +20 -0
- data/lib/presenter/export/domestic.rb +2 -2
- data/lib/presenter/rd_sap/{hera.rb → domestic_digest.rb} +14 -7
- data/lib/presenter/rd_sap/summary.rb +1 -1
- data/lib/presenter/sap/domestic_digest.rb +39 -0
- data/lib/presenter/sap/summary.rb +1 -1
- data/lib/view_model/rd_sap_wrapper.rb +9 -2
- data/lib/view_model/sap_schema_1900/common_schema.rb +42 -9
- data/lib/view_model/sap_wrapper.rb +9 -2
- metadata +6 -6
- data/lib/presenter/sap/hera.rb +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa9d8934087e8309c6b8c03395fbbbb93e9b7353964126b93438d52feb6ad7b6
|
|
4
|
+
data.tar.gz: 27c06482c14b7b0dec995f24e69b4fa0b2d595632b2fa998e2030269ebe96b94
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d274a8af83d9a7d9b98a0aed40aa07ab22c795196d1110e309ba947cdb0e33b29782aa0f3d76be73e4353e61f1eefa1a982e3831be7631ad9fb423120573920f
|
|
7
|
+
data.tar.gz: 030110e0f77c01c48a4b695d086e6e00d337520eb40fdd3fab2f9074ba4c47d134210b00c187922650da323a0f05f332f435496e4dfd09d1b876491c1c0bf6fa
|
data/.buildspec.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.1.2
|
data/Gemfile
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
ruby "
|
|
3
|
+
ruby ">=2.7", "<3.2"
|
|
4
4
|
|
|
5
5
|
source "https://rubygems.org"
|
|
6
6
|
|
|
7
7
|
group :test do
|
|
8
8
|
gem "rake", "~> 13.0.6"
|
|
9
9
|
gem "rspec", "~> 3.0"
|
|
10
|
-
gem "rubocop-govuk", "~> 4.
|
|
10
|
+
gem "rubocop-govuk", "~> 4.7.0", require: false
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
gem "nokogiri", "~> 1.11"
|
data/Gemfile.lock
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
activesupport (7.0.
|
|
4
|
+
activesupport (7.0.3.1)
|
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
6
6
|
i18n (>= 1.6, < 2)
|
|
7
7
|
minitest (>= 5.1)
|
|
8
8
|
tzinfo (~> 2.0)
|
|
9
9
|
ast (2.4.2)
|
|
10
|
-
concurrent-ruby (1.1.
|
|
10
|
+
concurrent-ruby (1.1.10)
|
|
11
11
|
diff-lcs (1.5.0)
|
|
12
|
-
i18n (1.
|
|
12
|
+
i18n (1.12.0)
|
|
13
13
|
concurrent-ruby (~> 1.0)
|
|
14
|
+
json (2.6.2)
|
|
14
15
|
mini_portile2 (2.8.0)
|
|
15
|
-
minitest (5.
|
|
16
|
-
nokogiri (1.13.
|
|
16
|
+
minitest (5.16.3)
|
|
17
|
+
nokogiri (1.13.8)
|
|
17
18
|
mini_portile2 (~> 2.8.0)
|
|
18
19
|
racc (~> 1.4)
|
|
19
|
-
parallel (1.
|
|
20
|
-
parser (3.1.1
|
|
20
|
+
parallel (1.22.1)
|
|
21
|
+
parser (3.1.2.1)
|
|
21
22
|
ast (~> 2.4.1)
|
|
22
23
|
racc (1.6.0)
|
|
23
|
-
rack (2.2.
|
|
24
|
+
rack (2.2.4)
|
|
24
25
|
rainbow (3.1.1)
|
|
25
26
|
rake (13.0.6)
|
|
26
|
-
regexp_parser (2.
|
|
27
|
+
regexp_parser (2.5.0)
|
|
27
28
|
rexml (3.2.5)
|
|
28
29
|
rspec (3.11.0)
|
|
29
30
|
rspec-core (~> 3.11.0)
|
|
@@ -34,40 +35,40 @@ GEM
|
|
|
34
35
|
rspec-expectations (3.11.0)
|
|
35
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
37
|
rspec-support (~> 3.11.0)
|
|
37
|
-
rspec-mocks (3.11.
|
|
38
|
+
rspec-mocks (3.11.1)
|
|
38
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
40
|
rspec-support (~> 3.11.0)
|
|
40
41
|
rspec-support (3.11.0)
|
|
41
|
-
rubocop (1.
|
|
42
|
+
rubocop (1.35.0)
|
|
43
|
+
json (~> 2.3)
|
|
42
44
|
parallel (~> 1.10)
|
|
43
|
-
parser (>= 3.
|
|
45
|
+
parser (>= 3.1.2.1)
|
|
44
46
|
rainbow (>= 2.2.2, < 4.0)
|
|
45
47
|
regexp_parser (>= 1.8, < 3.0)
|
|
46
|
-
rexml
|
|
47
|
-
rubocop-ast (>= 1.
|
|
48
|
+
rexml (>= 3.2.5, < 4.0)
|
|
49
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
|
48
50
|
ruby-progressbar (~> 1.7)
|
|
49
51
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
50
|
-
rubocop-ast (1.
|
|
51
|
-
parser (>= 3.
|
|
52
|
-
rubocop-govuk (4.
|
|
53
|
-
rubocop (
|
|
54
|
-
rubocop-ast (
|
|
55
|
-
rubocop-rails (
|
|
56
|
-
rubocop-rake (= 0.
|
|
57
|
-
rubocop-rspec (
|
|
58
|
-
rubocop-rails (2.
|
|
52
|
+
rubocop-ast (1.21.0)
|
|
53
|
+
parser (>= 3.1.1.0)
|
|
54
|
+
rubocop-govuk (4.7.0)
|
|
55
|
+
rubocop (= 1.35.0)
|
|
56
|
+
rubocop-ast (= 1.21.0)
|
|
57
|
+
rubocop-rails (= 2.15.2)
|
|
58
|
+
rubocop-rake (= 0.6.0)
|
|
59
|
+
rubocop-rspec (= 2.12.1)
|
|
60
|
+
rubocop-rails (2.15.2)
|
|
59
61
|
activesupport (>= 4.2.0)
|
|
60
62
|
rack (>= 1.1)
|
|
61
63
|
rubocop (>= 1.7.0, < 2.0)
|
|
62
|
-
rubocop-rake (0.
|
|
63
|
-
rubocop
|
|
64
|
-
rubocop-rspec (2.3.0)
|
|
64
|
+
rubocop-rake (0.6.0)
|
|
65
65
|
rubocop (~> 1.0)
|
|
66
|
-
|
|
66
|
+
rubocop-rspec (2.12.1)
|
|
67
|
+
rubocop (~> 1.31)
|
|
67
68
|
ruby-progressbar (1.11.0)
|
|
68
|
-
tzinfo (2.0.
|
|
69
|
+
tzinfo (2.0.5)
|
|
69
70
|
concurrent-ruby (~> 1.0)
|
|
70
|
-
unicode-display_width (2.
|
|
71
|
+
unicode-display_width (2.2.0)
|
|
71
72
|
zeitwerk (2.4.2)
|
|
72
73
|
|
|
73
74
|
PLATFORMS
|
|
@@ -78,11 +79,11 @@ DEPENDENCIES
|
|
|
78
79
|
rake (~> 13.0.6)
|
|
79
80
|
rexml (~> 3.2, >= 3.2.5)
|
|
80
81
|
rspec (~> 3.0)
|
|
81
|
-
rubocop-govuk (~> 4.
|
|
82
|
+
rubocop-govuk (~> 4.7.0)
|
|
82
83
|
zeitwerk (~> 2.4.2)
|
|
83
84
|
|
|
84
85
|
RUBY VERSION
|
|
85
86
|
ruby 2.7.5p203
|
|
86
87
|
|
|
87
88
|
BUNDLED WITH
|
|
88
|
-
2.
|
|
89
|
+
2.3.15
|
data/Makefile
CHANGED
|
@@ -1360,7 +1360,7 @@
|
|
|
1360
1360
|
</xs:enumeration>
|
|
1361
1361
|
</xs:restriction>
|
|
1362
1362
|
</xs:simpleType>
|
|
1363
|
-
|
|
1363
|
+
<xs:simpleType name="SAP-FlatLevelCode">
|
|
1364
1364
|
<xs:annotation>
|
|
1365
1365
|
<xs:documentation>Codes which indicates where a flat is located within a building.</xs:documentation>
|
|
1366
1366
|
</xs:annotation>
|
data/epb_view_models.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.summary = "Library used to parse Energy Performance Certificates (EPC)"
|
|
11
11
|
spec.homepage = "https://github.com/communitiesuk/epb-view-models"
|
|
12
12
|
spec.license = "MIT"
|
|
13
|
-
spec.required_ruby_version = ">=
|
|
13
|
+
spec.required_ruby_version = ">= 3.1"
|
|
14
14
|
|
|
15
15
|
# Specify which files should be added to the gem when it is released.
|
|
16
16
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
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
|
|
@@ -68,8 +68,8 @@ module Presenter::Export
|
|
|
68
68
|
view[:lighting_environmental_efficiency_rating] =
|
|
69
69
|
@view_model.lighting_environmental_efficiency_rating.to_i
|
|
70
70
|
view[:low_energy_fixed_lighting_outlets_count] =
|
|
71
|
-
@view_model.low_energy_fixed_lighting_outlets_count.to_i
|
|
72
|
-
view[:low_energy_lighting] = @view_model.low_energy_lighting.to_i
|
|
71
|
+
@view_model.low_energy_fixed_lighting_outlets_count.nil? ? nil : @view_model.low_energy_fixed_lighting_outlets_count.to_i
|
|
72
|
+
view[:low_energy_lighting] = @view_model.low_energy_lighting.nil? ? nil : @view_model.low_energy_lighting.to_i
|
|
73
73
|
view[:main_fuel_type] = @view_model.main_fuel_type
|
|
74
74
|
view[:main_heating_controls_descriptions] =
|
|
75
75
|
@view_model.all_main_heating_controls_descriptions
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
module Presenter
|
|
2
2
|
module RdSap
|
|
3
|
-
class
|
|
3
|
+
class DomesticDigest
|
|
4
4
|
TYPE_OF_ASSESSMENT = "RdSAP".freeze
|
|
5
5
|
private_constant :TYPE_OF_ASSESSMENT
|
|
6
6
|
|
|
7
|
-
def initialize(view_model)
|
|
7
|
+
def initialize(view_model, schema_type)
|
|
8
8
|
@view_model = view_model
|
|
9
|
+
@schema_type = schema_type
|
|
9
10
|
end
|
|
10
11
|
|
|
11
|
-
def
|
|
12
|
+
def to_domestic_digest
|
|
12
13
|
{
|
|
13
14
|
type_of_assessment: TYPE_OF_ASSESSMENT,
|
|
14
15
|
assessment_id: @view_model.assessment_id,
|
|
@@ -22,11 +23,17 @@ module Presenter
|
|
|
22
23
|
postcode: @view_model.postcode,
|
|
23
24
|
},
|
|
24
25
|
dwelling_type: @view_model.dwelling_type,
|
|
25
|
-
built_form: @view_model.built_form,
|
|
26
|
-
main_dwelling_construction_age_band_or_year:
|
|
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
|
+
),
|
|
27
32
|
property_summary: @view_model.property_summary,
|
|
28
|
-
main_heating_category: @view_model.main_heating_category,
|
|
29
|
-
main_fuel_type: @view_model.main_fuel_type,
|
|
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),
|
|
30
37
|
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
|
31
38
|
}
|
|
32
39
|
end
|
|
@@ -54,7 +54,7 @@ module Presenter
|
|
|
54
54
|
),
|
|
55
55
|
current_energy_efficiency_rating: @view_model.current_energy_rating,
|
|
56
56
|
dwelling_type: @view_model.dwelling_type,
|
|
57
|
-
estimated_energy_cost
|
|
57
|
+
estimated_energy_cost:,
|
|
58
58
|
main_fuel_type: @view_model.main_fuel_type,
|
|
59
59
|
heat_demand: {
|
|
60
60
|
current_space_heating_demand:
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Presenter
|
|
2
|
+
module Sap
|
|
3
|
+
class DomesticDigest
|
|
4
|
+
def initialize(view_model, schema_type)
|
|
5
|
+
@view_model = view_model
|
|
6
|
+
@schema_type = schema_type
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def to_domestic_digest
|
|
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
|
|
@@ -51,7 +51,7 @@ module Presenter
|
|
|
51
51
|
),
|
|
52
52
|
current_energy_efficiency_rating: @view_model.current_energy_rating,
|
|
53
53
|
dwelling_type: @view_model.dwelling_type,
|
|
54
|
-
estimated_energy_cost
|
|
54
|
+
estimated_energy_cost:,
|
|
55
55
|
main_fuel_type: @view_model.main_fuel_type,
|
|
56
56
|
heat_demand: {
|
|
57
57
|
current_space_heating_demand:
|
|
@@ -8,7 +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
|
-
@
|
|
11
|
+
@domestic_digest = Presenter::RdSap::DomesticDigest.new(view_model, schema_type)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def type
|
|
@@ -31,10 +31,17 @@ module ViewModel
|
|
|
31
31
|
@recommendation_report.to_hash
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def to_domestic_digest
|
|
35
|
+
@domestic_digest.to_domestic_digest
|
|
36
|
+
end
|
|
37
|
+
|
|
34
38
|
def to_hera_hash
|
|
35
|
-
|
|
39
|
+
to_domestic_digest
|
|
36
40
|
end
|
|
37
41
|
|
|
42
|
+
extend Gem::Deprecate
|
|
43
|
+
deprecate :to_hera_hash, :to_domestic_digest, 2022, 9
|
|
44
|
+
|
|
38
45
|
def get_view_model
|
|
39
46
|
view_model
|
|
40
47
|
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module ViewModel
|
|
2
2
|
module SapSchema1900
|
|
3
3
|
class CommonSchema < ViewModel::DomesticEpcViewModel
|
|
4
|
+
THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY = 65
|
|
5
|
+
|
|
4
6
|
def assessment_id
|
|
5
7
|
xpath(%w[Report-Header RRN])
|
|
6
8
|
end
|
|
@@ -259,12 +261,12 @@ module ViewModel
|
|
|
259
261
|
end
|
|
260
262
|
|
|
261
263
|
def top_storey
|
|
262
|
-
flat_level_code = xpath(%w[
|
|
264
|
+
flat_level_code = xpath(%w[SAP-FlatLevelCode])
|
|
263
265
|
flat_level_code == "3" ? "Y" : "N"
|
|
264
266
|
end
|
|
265
267
|
|
|
266
268
|
def storey_count
|
|
267
|
-
|
|
269
|
+
xpath(%w[Storeys])
|
|
268
270
|
end
|
|
269
271
|
|
|
270
272
|
def building_part_number
|
|
@@ -365,20 +367,51 @@ module ViewModel
|
|
|
365
367
|
nil
|
|
366
368
|
end
|
|
367
369
|
|
|
368
|
-
def
|
|
369
|
-
|
|
370
|
+
def fixed_lighting_outlets_count
|
|
371
|
+
@xml_doc.search("Fixed-Lights/Fixed-Light/Lighting-Outlets").map(&:content).map(&:to_i).sum
|
|
370
372
|
end
|
|
371
373
|
|
|
372
|
-
def
|
|
373
|
-
|
|
374
|
+
def format_fixed_light_array
|
|
375
|
+
@xml_doc
|
|
376
|
+
.search("Fixed-Lights/Fixed-Light")
|
|
377
|
+
.map do |part|
|
|
378
|
+
{
|
|
379
|
+
lighting_efficacy:
|
|
380
|
+
xpath(%w[Lighting-Efficacy], part),
|
|
381
|
+
lighting_outlets:
|
|
382
|
+
xpath(%w[Lighting-Outlets], part),
|
|
383
|
+
}
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def low_energy_lighting
|
|
388
|
+
total_energy_outlet_count = []
|
|
389
|
+
low_energy_outlet_count = []
|
|
390
|
+
|
|
391
|
+
format_fixed_light_array.each do |outlet|
|
|
392
|
+
if outlet[:lighting_efficacy].to_i > THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY
|
|
393
|
+
low_energy_outlet_count << outlet[:lighting_outlets].to_i
|
|
394
|
+
end
|
|
395
|
+
total_energy_outlet_count << outlet[:lighting_outlets].to_f
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
(low_energy_outlet_count.sum / total_energy_outlet_count.sum * 100).round
|
|
374
399
|
end
|
|
375
400
|
|
|
376
401
|
def low_energy_fixed_lighting_outlets_count
|
|
377
|
-
|
|
402
|
+
low_energy_outlet_count = []
|
|
403
|
+
|
|
404
|
+
format_fixed_light_array.each do |outlet|
|
|
405
|
+
if outlet[:lighting_efficacy].to_i > THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY
|
|
406
|
+
low_energy_outlet_count << outlet[:lighting_outlets].to_i
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
low_energy_outlet_count.sum
|
|
378
411
|
end
|
|
379
412
|
|
|
380
413
|
def open_fireplaces_count
|
|
381
|
-
xpath(%w[Open-
|
|
414
|
+
xpath(%w[Open-Chimneys-Count])
|
|
382
415
|
end
|
|
383
416
|
|
|
384
417
|
def hot_water_description
|
|
@@ -438,7 +471,7 @@ module ViewModel
|
|
|
438
471
|
end
|
|
439
472
|
|
|
440
473
|
def wind_turbine_count
|
|
441
|
-
|
|
474
|
+
@xml_doc.search("Wind-Turbines/Wind-Turbine").map(&:content).count
|
|
442
475
|
end
|
|
443
476
|
|
|
444
477
|
def unheated_corridor_length
|
|
@@ -8,7 +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
|
-
@
|
|
11
|
+
@domestic_digest = Presenter::Sap::DomesticDigest.new(view_model, schema_type)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def type
|
|
@@ -31,10 +31,17 @@ module ViewModel
|
|
|
31
31
|
@recommendation_report.to_hash
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def to_domestic_digest
|
|
35
|
+
@domestic_digest.to_domestic_digest
|
|
36
|
+
end
|
|
37
|
+
|
|
34
38
|
def to_hera_hash
|
|
35
|
-
|
|
39
|
+
to_domestic_digest
|
|
36
40
|
end
|
|
37
41
|
|
|
42
|
+
extend Gem::Deprecate
|
|
43
|
+
deprecate :to_hera_hash, :to_domestic_digest, 2022, 9
|
|
44
|
+
|
|
38
45
|
def get_view_model
|
|
39
46
|
view_model
|
|
40
47
|
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.20
|
|
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-09-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -1674,13 +1674,13 @@ files:
|
|
|
1674
1674
|
- lib/presenter/export/commercial.rb
|
|
1675
1675
|
- lib/presenter/export/domestic.rb
|
|
1676
1676
|
- lib/presenter/export/statistics.rb
|
|
1677
|
+
- lib/presenter/rd_sap/domestic_digest.rb
|
|
1677
1678
|
- lib/presenter/rd_sap/export_configuration.rb
|
|
1678
|
-
- lib/presenter/rd_sap/hera.rb
|
|
1679
1679
|
- lib/presenter/rd_sap/recommendation_report.rb
|
|
1680
1680
|
- lib/presenter/rd_sap/report.rb
|
|
1681
1681
|
- lib/presenter/rd_sap/summary.rb
|
|
1682
|
+
- lib/presenter/sap/domestic_digest.rb
|
|
1682
1683
|
- lib/presenter/sap/export_configuration.rb
|
|
1683
|
-
- lib/presenter/sap/hera.rb
|
|
1684
1684
|
- lib/presenter/sap/recommendation_report.rb
|
|
1685
1685
|
- lib/presenter/sap/report.rb
|
|
1686
1686
|
- lib/presenter/sap/summary.rb
|
|
@@ -1863,14 +1863,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
1863
1863
|
requirements:
|
|
1864
1864
|
- - ">="
|
|
1865
1865
|
- !ruby/object:Gem::Version
|
|
1866
|
-
version:
|
|
1866
|
+
version: '3.1'
|
|
1867
1867
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1868
1868
|
requirements:
|
|
1869
1869
|
- - ">="
|
|
1870
1870
|
- !ruby/object:Gem::Version
|
|
1871
1871
|
version: '0'
|
|
1872
1872
|
requirements: []
|
|
1873
|
-
rubygems_version: 3.
|
|
1873
|
+
rubygems_version: 3.3.7
|
|
1874
1874
|
signing_key:
|
|
1875
1875
|
specification_version: 4
|
|
1876
1876
|
summary: Library used to parse Energy Performance Certificates (EPC)
|
data/lib/presenter/sap/hera.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module Presenter
|
|
2
|
-
module Sap
|
|
3
|
-
class Hera
|
|
4
|
-
def initialize(view_model)
|
|
5
|
-
@view_model = view_model
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def to_hera_hash
|
|
9
|
-
{
|
|
10
|
-
type_of_assessment: @view_model.type_of_assessment,
|
|
11
|
-
assessment_id: @view_model.assessment_id,
|
|
12
|
-
date_of_registration: @view_model.date_of_registration,
|
|
13
|
-
address: {
|
|
14
|
-
address_line1: @view_model.address_line1,
|
|
15
|
-
address_line2: @view_model.address_line2,
|
|
16
|
-
address_line3: @view_model.address_line3,
|
|
17
|
-
address_line4: nil,
|
|
18
|
-
town: @view_model.town,
|
|
19
|
-
postcode: @view_model.postcode,
|
|
20
|
-
},
|
|
21
|
-
dwelling_type: @view_model.dwelling_type,
|
|
22
|
-
built_form: @view_model.built_form,
|
|
23
|
-
main_dwelling_construction_age_band_or_year: @view_model.main_dwelling_construction_age_band_or_year,
|
|
24
|
-
property_summary: @view_model.property_summary,
|
|
25
|
-
main_heating_category: @view_model.main_heating_category,
|
|
26
|
-
main_fuel_type: @view_model.main_fuel_type,
|
|
27
|
-
has_hot_water_cylinder: @view_model.has_hot_water_cylinder,
|
|
28
|
-
}
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|