epb_view_models 1.0.1 → 1.0.2
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/Makefile +1 -1
- data/lib/epb_view_models.rb +1 -1
- data/lib/helper/ac_report_extraction.rb +26 -28
- data/lib/view_model/cepc50/cepc.rb +0 -4
- data/lib/view_model/cepc60/cepc.rb +0 -4
- data/lib/view_model/cepc71/dec.rb +0 -4
- data/lib/view_model/cepc_ni800/ac_report.rb +3 -2
- data/lib/view_model/rd_sap_schema_200/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_102/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_110/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_112/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_120/common_schema.rb +0 -8
- data/lib/view_model/sap_schema_140/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_171/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_1800/common_schema.rb +0 -4
- data/lib/view_model/sap_schema_ni_1800/common_schema.rb +0 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b71b827370438edcfacfdd4d8d44e8272526fde8cbd7e58bc77df2d60b5ef1a7
|
4
|
+
data.tar.gz: 374238b4324acea447bcce054ed895960b3c9c684e8efc0e229a418077eb64c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e34f118818e142c9d9a9e38628f8f56eb9e02373a41571b632e842674370e84ed36d7bc3fff85e6687af6c06dd61579056050a2f1d34bbb793f21fc125d869ee
|
7
|
+
data.tar.gz: 2b023ad18d63ea973dba32b6849307045372101debda793711a27bca16ebd7bef2459e9c426c1e7e544bdb9835663d07f1905015caca35b90b4ffea3e46953e4
|
data/Makefile
CHANGED
@@ -4,7 +4,7 @@ SHELL := /bin/bash
|
|
4
4
|
.PHONY: help install test format
|
5
5
|
|
6
6
|
help: ## Print help documentation
|
7
|
-
@echo -e "Makefile Help for epb-
|
7
|
+
@echo -e "Makefile Help for epb-view-models"
|
8
8
|
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
9
9
|
|
10
10
|
install: ## Install required libraries and setup
|
data/lib/epb_view_models.rb
CHANGED
@@ -12,43 +12,41 @@ module Helper
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def checklist_values(checklist, skip_state: false)
|
15
|
-
|
16
|
-
checklist&.element_children&.map { |node|
|
17
|
-
next if xpath(%w[Flag], node).nil? && !skip_state
|
15
|
+
return {} if checklist.nil? || checklist.element_children.nil?
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
{ checklist_item => { note: xpath(%w[Note], node) } }
|
22
|
-
else
|
23
|
-
{
|
24
|
-
checklist_item => {
|
25
|
-
state: xpath(%w[Flag], node) == "Yes",
|
26
|
-
note: xpath(%w[Note], node),
|
27
|
-
},
|
28
|
-
}
|
29
|
-
end
|
30
|
-
}&.compact.inject(&:merge)
|
31
|
-
|
32
|
-
results.nil? ? {} : results
|
33
|
-
end
|
34
|
-
|
35
|
-
def checklist_values_with_guidance(checklist)
|
36
|
-
results =
|
37
|
-
checklist&.element_children&.map { |node|
|
38
|
-
next if xpath(%w[Flag], node).nil?
|
39
|
-
|
40
|
-
checklist_item = node.name.underscore.to_sym
|
17
|
+
checklist.element_children.map { |node|
|
18
|
+
next if xpath(%w[Flag], node).nil? && !skip_state
|
41
19
|
|
20
|
+
checklist_item = node.name.underscore.to_sym
|
21
|
+
if skip_state
|
22
|
+
{ checklist_item => { note: xpath(%w[Note], node) } }
|
23
|
+
else
|
42
24
|
{
|
43
25
|
checklist_item => {
|
44
26
|
state: xpath(%w[Flag], node) == "Yes",
|
45
27
|
note: xpath(%w[Note], node),
|
46
|
-
guidance: xpath(%w[Text], node),
|
47
28
|
},
|
48
29
|
}
|
49
|
-
|
30
|
+
end
|
31
|
+
}.compact.inject(&:merge)
|
32
|
+
end
|
33
|
+
|
34
|
+
def checklist_values_with_guidance(checklist)
|
35
|
+
return {} if checklist.nil? || checklist.element_children.nil?
|
36
|
+
|
37
|
+
checklist.element_children.map { |node|
|
38
|
+
next if xpath(%w[Flag], node).nil?
|
50
39
|
|
51
|
-
|
40
|
+
checklist_item = node.name.underscore.to_sym
|
41
|
+
|
42
|
+
{
|
43
|
+
checklist_item => {
|
44
|
+
state: xpath(%w[Flag], node) == "Yes",
|
45
|
+
note: xpath(%w[Note], node),
|
46
|
+
guidance: xpath(%w[Text], node),
|
47
|
+
},
|
48
|
+
}
|
49
|
+
}.compact.inject(&:merge)
|
52
50
|
end
|
53
51
|
|
54
52
|
def guidance(guidance_elements)
|
@@ -10,12 +10,13 @@ module ViewModel
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def extract_aci_recommendations(nodes)
|
13
|
-
nodes.map
|
13
|
+
recommendations = nodes.map do |node|
|
14
14
|
{
|
15
15
|
sequence: node.at("Seq-Number").content,
|
16
16
|
text: node.at("Text").content,
|
17
17
|
}
|
18
|
-
|
18
|
+
end
|
19
|
+
recommendations.reject { |node| node[:text].nil? || node[:text].empty? }
|
19
20
|
end
|
20
21
|
|
21
22
|
def key_recommendations_efficiency
|
@@ -297,10 +297,6 @@ module ViewModel
|
|
297
297
|
@xml_doc.search("Secondary-Heating/Description").map(&:content)
|
298
298
|
end
|
299
299
|
|
300
|
-
def all_main_heating_controls_descriptions
|
301
|
-
@xml_doc.search("Main-Heating-Controls/Description").map(&:content)
|
302
|
-
end
|
303
|
-
|
304
300
|
def all_sap_floor_dimensions
|
305
301
|
@xml_doc.search("SAP-Floor-Dimension").select(&:element?).map { |node|
|
306
302
|
{ total_floor_area: xpath(%w[Total-Floor-Area], node).to_f }
|
@@ -397,10 +397,6 @@ module ViewModel
|
|
397
397
|
xpath(%w[Wind-Turbines-Count])
|
398
398
|
end
|
399
399
|
|
400
|
-
def unheated_corridor_length
|
401
|
-
xpath(%w[Unheated-Corridor-Length])
|
402
|
-
end
|
403
|
-
|
404
400
|
def all_main_heating_descriptions
|
405
401
|
@xml_doc.search("Main-Heating/Description").map(&:content)
|
406
402
|
end
|
@@ -392,10 +392,6 @@ module ViewModel
|
|
392
392
|
xpath(%w[Wind-Turbines-Count])
|
393
393
|
end
|
394
394
|
|
395
|
-
def unheated_corridor_length
|
396
|
-
xpath(%w[Unheated-Corridor-Length])
|
397
|
-
end
|
398
|
-
|
399
395
|
def all_main_heating_descriptions
|
400
396
|
@xml_doc.search("Main-Heating/Description").map(&:content)
|
401
397
|
end
|
@@ -494,10 +490,6 @@ module ViewModel
|
|
494
490
|
@xml_doc.search("Storey-Height").map(&:content)
|
495
491
|
end
|
496
492
|
|
497
|
-
def all_main_heating_energy_efficiency
|
498
|
-
@xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
|
499
|
-
end
|
500
|
-
|
501
493
|
def all_main_heating_controls_energy_efficiency
|
502
494
|
@xml_doc
|
503
495
|
.search("Main-Heating-Controls/Energy-Efficiency-Rating")
|
@@ -391,10 +391,6 @@ module ViewModel
|
|
391
391
|
xpath(%w[Wind-Turbines-Count])
|
392
392
|
end
|
393
393
|
|
394
|
-
def unheated_corridor_length
|
395
|
-
xpath(%w[Unheated-Corridor-Length])
|
396
|
-
end
|
397
|
-
|
398
394
|
def all_main_heating_descriptions
|
399
395
|
@xml_doc.search("Main-Heating/Description").map(&:content)
|
400
396
|
end
|
@@ -491,24 +491,6 @@ module ViewModel
|
|
491
491
|
@xml_doc.search("Storey-Height").map(&:content)
|
492
492
|
end
|
493
493
|
|
494
|
-
def main_dwelling_construction_age_band_or_year
|
495
|
-
sap_building_parts =
|
496
|
-
@xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
|
497
|
-
sap_building_parts.each do |sap_building_part|
|
498
|
-
building_part_number = sap_building_part.at("Building-Part-Number")
|
499
|
-
|
500
|
-
# Identifies the Main Dwelling
|
501
|
-
if building_part_number&.content == "1"
|
502
|
-
return(
|
503
|
-
sap_building_part.at_xpath(
|
504
|
-
"Construction-Age-Band | Construction-Year",
|
505
|
-
)&.content
|
506
|
-
)
|
507
|
-
end
|
508
|
-
end
|
509
|
-
nil
|
510
|
-
end
|
511
|
-
|
512
494
|
def all_main_heating_environmental_efficiency
|
513
495
|
@xml_doc
|
514
496
|
.search("Main-Heating/Environmental-Efficiency-Rating")
|
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.2
|
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: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|