epb_view_models 2.2.21 → 2.4.0

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.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +8 -0
  3. data/api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd +296 -296
  4. data/api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd +63 -63
  5. data/api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd +34 -34
  6. data/api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd +120 -120
  7. data/api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd +67 -67
  8. data/api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd +178 -178
  9. data/api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd +391 -391
  10. data/api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd +171 -171
  11. data/api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd +300 -300
  12. data/api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd +66 -66
  13. data/api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd +34 -34
  14. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd +125 -125
  15. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd.bak +123 -123
  16. data/api/schemas/xml/CEPC-S-7.1/Reports/Property.xsd +67 -67
  17. data/api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd +178 -178
  18. data/api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd +406 -406
  19. data/api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd +174 -174
  20. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/CommonFiles/CommonStructures.xsd +160 -0
  21. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/CommonFiles/Exceptions.xsd +72 -0
  22. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd +53 -0
  23. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/EPC-Certificate.xsd +213 -0
  24. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/EPC-CollectedData.xsd +445 -0
  25. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -0
  26. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -0
  27. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -0
  28. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -0
  29. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -0
  30. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HCR-RiskAssessment.xsd +297 -0
  31. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/HIP-Reports.xsd +203 -0
  32. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/Property.xsd +73 -0
  33. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/Templates/UserManagement.xsd +252 -0
  34. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/BaseDataTypes.xsd +177 -0
  35. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/EPC-Domains.xsd +68 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/HCR-Domains.xsd +1773 -0
  37. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/SAP-Domains.xsd +1101 -0
  38. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/SharedDomains.xsd +596 -0
  39. data/api/schemas/xml/RdSAP-Schema-S-12.0/RdSAP/UDT/TypeDefinitions.xsd +19 -0
  40. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/CommonStructures.xsd +160 -0
  41. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/CommonFiles/Exceptions.xsd +72 -0
  42. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Messages/ConditionReportCreateRequest_1.xsd +41 -0
  43. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-Certificate.xsd +252 -0
  44. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/EPC-CollectedData.xsd +444 -0
  45. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -0
  46. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -0
  47. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -0
  48. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -0
  49. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -0
  50. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HCR-RiskAssessment.xsd +297 -0
  51. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/HIP-Reports.xsd +220 -0
  52. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/Property.xsd +73 -0
  53. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/Templates/UserManagement.xsd +257 -0
  54. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/BaseDataTypes.xsd +176 -0
  55. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/EPC-Domains.xsd +743 -0
  56. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/HCR-Domains.xsd +1773 -0
  57. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SAP-Domains.xsd +1134 -0
  58. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/SharedDomains.xsd +660 -0
  59. data/api/schemas/xml/RdSAP-Schema-S-14.0/RdSAP/UDT/TypeDefinitions.xsd +19 -0
  60. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  61. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  62. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  63. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  64. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  65. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  66. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  67. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  68. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  69. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  70. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  71. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  72. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  73. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  74. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  75. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  76. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  77. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  78. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  79. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  80. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  81. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  82. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  83. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  84. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  85. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  86. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  87. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  88. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  89. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  90. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  91. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  92. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  93. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  94. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  95. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  96. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  97. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  98. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  99. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  100. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  101. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  102. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  103. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  104. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  105. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  106. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  107. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  108. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  109. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  110. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  111. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  112. data/lib/epb_view_models/version.rb +5 -0
  113. data/lib/epb_view_models.rb +1 -3
  114. data/lib/helper/rrn_helper.rb +4 -4
  115. data/lib/view_model/cs63/common_schema.rb +18 -18
  116. data/lib/view_model/factory.rb +2 -0
  117. data/lib/view_model/rd_sap_schema_s_120/common_schema.rb +547 -0
  118. data/lib/view_model/rd_sap_schema_s_140/common_schema.rb +550 -0
  119. data/lib/view_model/rd_sap_wrapper.rb +4 -0
  120. metadata +47 -13
  121. data/.buildspec.yml +0 -13
  122. data/.gitignore +0 -19
  123. data/.rspec +0 -2
  124. data/.rubocop.yml +0 -8
  125. data/.ruby-version +0 -1
  126. data/Gemfile +0 -15
  127. data/Gemfile.lock +0 -122
  128. data/Makefile +0 -17
  129. data/Rakefile +0 -12
  130. data/epb_view_models.gemspec +0 -27
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EpbViewModels
4
+ VERSION = "2.4.0"
5
+ end
@@ -4,9 +4,7 @@ require "zeitwerk"
4
4
  loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
5
  loader.setup
6
6
 
7
- module EpbViewModels
8
- VERSION = "2.2.21"
9
- end
7
+ require "epb_view_models/version"
10
8
 
11
9
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
12
10
  # Source: http://jeffgardner.org/2011/08/04/rails-string-to-boolean-method/
@@ -2,9 +2,9 @@ require "digest"
2
2
 
3
3
  module Helper
4
4
  class RrnHelper
5
- class RrnNotValid < StandardError
6
- end
7
- VALID_RRN = "^(\\d{4}-){4}\\d{4}$".freeze
5
+ class RrnNotValid < StandardError; end
6
+
7
+ VALID_RRN = /\A(\d{4}-){4}\d{4}\z/
8
8
 
9
9
  def self.normalise_rrn_format(rrn)
10
10
  # Strip surrounding whitespace
@@ -16,7 +16,7 @@ module Helper
16
16
 
17
17
  # Add a hyphen every four characters to give desired RRN format
18
18
  rrn = rrn.scan(/.{1,4}/).join("-")
19
- raise RrnNotValid unless Regexp.new(VALID_RRN).match(rrn)
19
+ raise RrnNotValid unless VALID_RRN.match?(rrn)
20
20
 
21
21
  rrn
22
22
  end
@@ -157,14 +157,14 @@ module ViewModel
157
157
  @xml_doc
158
158
  .search("Prescriptive-Improvements Prescriptive-Scenario")
159
159
  .map do |node|
160
- {
161
- measure_description_short:
162
- xpath(%w[Measure-Description-Short], node),
163
- measure_description_long:
164
- xpath(%w[Measure-Description-Long], node),
165
- measure_valid: xpath(%w[Measure-Valid], node),
166
- measure_type: xpath(%w[Measure-Type], node),
167
- }
160
+ {
161
+ measure_description_short:
162
+ xpath(%w[Measure-Description-Short], node),
163
+ measure_description_long:
164
+ xpath(%w[Measure-Description-Long], node),
165
+ measure_valid: xpath(%w[Measure-Valid], node),
166
+ measure_type: xpath(%w[Measure-Type], node),
167
+ }
168
168
  end
169
169
  end
170
170
 
@@ -172,14 +172,14 @@ module ViewModel
172
172
  @xml_doc
173
173
  .search("Alternative-Improvements Alternative-Scenario")
174
174
  .map do |node|
175
- {
176
- measure_description_short:
177
- xpath(%w[Measure-Description-Short], node),
178
- measure_description_long:
179
- xpath(%w[Measure-Description-Long], node),
180
- measure_valid: xpath(%w[Measure-Valid], node),
181
- measure_type: xpath(%w[Measure-Type], node),
182
- }
175
+ {
176
+ measure_description_short:
177
+ xpath(%w[Measure-Description-Short], node),
178
+ measure_description_long:
179
+ xpath(%w[Measure-Description-Long], node),
180
+ measure_valid: xpath(%w[Measure-Valid], node),
181
+ measure_type: xpath(%w[Measure-Type], node),
182
+ }
183
183
  end
184
184
  end
185
185
 
@@ -200,11 +200,11 @@ module ViewModel
200
200
  end
201
201
 
202
202
  def total_emission_savings
203
- xpath(%w[Total-Emission-Savings])
203
+ xpath(%w[Total-Emission-Savings])
204
204
  end
205
205
 
206
206
  def total_energy_savings
207
- xpath(%w[Total-Energy-Savings])
207
+ xpath(%w[Total-Energy-Savings])
208
208
  end
209
209
  end
210
210
  end
@@ -41,6 +41,8 @@ module ViewModel
41
41
  RdSAP-Schema-S-18.0
42
42
  RdSAP-Schema-S-17.00
43
43
  RdSAP-Schema-S-16.1
44
+ RdSAP-Schema-S-14.0
45
+ RdSAP-Schema-S-12.0
44
46
  ].freeze
45
47
  TYPES_OF_SAP = %i[
46
48
  SAP-Schema-19.2.0
@@ -0,0 +1,547 @@
1
+ module ViewModel
2
+ module RdSapSchemaS120
3
+ class CommonSchema < ViewModel::DomesticEpcViewModel
4
+ def assessment_id
5
+ xpath(%w[RRN])
6
+ end
7
+
8
+ def address_line1
9
+ xpath(%w[Property Address Address-Line-1])
10
+ end
11
+
12
+ def address_line2
13
+ xpath(%w[Property Address Address-Line-2]).to_s
14
+ end
15
+
16
+ def address_line3
17
+ xpath(%w[Property Address Address-Line-3]).to_s
18
+ end
19
+
20
+ def address_line4
21
+ xpath(%w[Property Address Address-Line-4]).to_s
22
+ end
23
+
24
+ def town
25
+ xpath(%w[Property Address Post-Town])
26
+ end
27
+
28
+ def postcode
29
+ xpath(%w[Property Address Postcode])
30
+ end
31
+
32
+ def scheme_assessor_id
33
+ xpath(%w[Identification-Number Membership-Number]) or xpath(%w[Identification-Number Certificate-Number])
34
+ end
35
+
36
+ def assessor_name
37
+ "#{xpath(%w[Home-Inspector Name First-Name])} #{xpath(%w[Home-Inspector Name Surname])}"
38
+ end
39
+
40
+ def assessor_email
41
+ xpath(%w[Home-Inspector E-Mail])
42
+ end
43
+
44
+ def assessor_telephone
45
+ xpath(%w[Home-Inspector Telephone])
46
+ end
47
+
48
+ def date_of_assessment
49
+ xpath(%w[Inspection-Date])
50
+ end
51
+
52
+ def date_of_registration
53
+ xpath(%w[Registration-Date])
54
+ end
55
+
56
+ def date_of_completion
57
+ xpath(%w[Completion-Date])
58
+ end
59
+
60
+ def address_id
61
+ "LPRN-#{xpath(%w[UPRN])}"
62
+ end
63
+
64
+ def date_of_expiry
65
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
66
+
67
+ expires_at.to_s
68
+ end
69
+
70
+ def property_summary
71
+ @xml_doc.search("Energy-Assessment Property-Summary").children.select(
72
+ &:element?
73
+ ).map { |node|
74
+ next if xpath(%w[Energy-Efficiency-Rating], node).nil?
75
+
76
+ {
77
+ energy_efficiency_rating:
78
+ xpath(%w[Energy-Efficiency-Rating], node).to_i,
79
+ environmental_efficiency_rating:
80
+ xpath(%w[Environmental-Efficiency-Rating], node).to_i,
81
+ name: node.name.underscore,
82
+ description: xpath(%w[Description], node),
83
+ }
84
+ }.compact
85
+ end
86
+
87
+ def related_party_disclosure_text
88
+ nil
89
+ end
90
+
91
+ def related_party_disclosure_number
92
+ nil
93
+ end
94
+
95
+ def improvements
96
+ @xml_doc
97
+ .search("Suggested-Improvements Improvement")
98
+ .map do |node|
99
+ {
100
+ energy_performance_rating_improvement: xpath(%w[Energy-Performance-Rating], node).to_i,
101
+ environmental_impact_rating_improvement: xpath(%w[Environmental-Impact-Rating], node).to_i,
102
+ green_deal_category_code: nil,
103
+ improvement_category: xpath(%w[Improvement-Category], node),
104
+ improvement_code: nil,
105
+ improvement_description: xpath(%w[Improvement-Description], node),
106
+ improvement_title: improvement_title(node),
107
+ improvement_type: nil,
108
+ indicative_cost: nil,
109
+ sequence: xpath(%w[Sequence], node).to_i,
110
+ typical_saving: xpath(%w[Typical-Saving], node),
111
+ }
112
+ end
113
+ end
114
+
115
+ def recommendations_for_report
116
+ @xml_doc
117
+ .search("Suggested-Improvements Improvement")
118
+ .map do |node|
119
+ {
120
+ sequence: xpath(%w[Sequence], node).to_i,
121
+ improvement_summary: xpath(%w[Improvement-Summary], node),
122
+ improvement_description: xpath(%w[Improvement-Description], node),
123
+ improvement_code: nil,
124
+ indicative_cost: nil,
125
+ }
126
+ end
127
+ end
128
+
129
+ def hot_water_cost_potential
130
+ xpath(%w[Hot-Water-Cost-Potential])
131
+ end
132
+
133
+ def heating_cost_potential
134
+ xpath(%w[Heating-Cost-Potential])
135
+ end
136
+
137
+ def lighting_cost_potential
138
+ xpath(%w[Lighting-Cost-Potential])
139
+ end
140
+
141
+ def hot_water_cost_current
142
+ xpath(%w[Hot-Water-Cost-Current])
143
+ end
144
+
145
+ def heating_cost_current
146
+ xpath(%w[Heating-Cost-Current])
147
+ end
148
+
149
+ def lighting_cost_current
150
+ xpath(%w[Lighting-Cost-Current])
151
+ end
152
+
153
+ def potential_carbon_emission
154
+ xpath(%w[CO2-Emissions-Potential])
155
+ end
156
+
157
+ def current_carbon_emission
158
+ xpath(%w[CO2-Emissions-Current])
159
+ end
160
+
161
+ def potential_energy_rating
162
+ xpath(%w[Energy-Rating-Potential])&.to_i
163
+ end
164
+
165
+ def current_energy_rating
166
+ xpath(%w[Energy-Rating-Current])&.to_i
167
+ end
168
+
169
+ def total_floor_area
170
+ xpath(%w[Total-Floor-Area])
171
+ end
172
+
173
+ def dwelling_type
174
+ ""
175
+ end
176
+
177
+ def property_age_band
178
+ xpath(%w[Construction-Age-Band])
179
+ end
180
+
181
+ def tenure
182
+ nil
183
+ end
184
+
185
+ def transaction_type
186
+ xpath(%w[Transaction-Type])
187
+ end
188
+
189
+ def current_space_heating_demand
190
+ nil
191
+ end
192
+
193
+ def current_water_heating_demand
194
+ nil
195
+ end
196
+
197
+ def impact_of_cavity_insulation
198
+ nil
199
+ end
200
+
201
+ def impact_of_loft_insulation
202
+ nil
203
+ end
204
+
205
+ def impact_of_solid_wall_insulation
206
+ nil
207
+ end
208
+
209
+ def habitable_room_count
210
+ xpath(%w[Habitable-Room-Count])&.to_i
211
+ end
212
+
213
+ def energy_rating_current
214
+ xpath(%w[Energy-Rating-Current])&.to_i
215
+ end
216
+
217
+ def energy_rating_potential
218
+ xpath(%w[Energy-Rating-Potential])&.to_i
219
+ end
220
+
221
+ def environmental_impact_current
222
+ xpath(%w[Environmental-Impact-Current])&.to_i
223
+ end
224
+
225
+ def environmental_impact_potential
226
+ xpath(%w[Environmental-Impact-Potential])&.to_i
227
+ end
228
+
229
+ def primary_energy_use
230
+ xpath(%w[Energy-Consumption-Current])&.to_f
231
+ end
232
+
233
+ def energy_consumption_potential
234
+ xpath(%w[Energy-Consumption-Potential])&.to_f
235
+ end
236
+
237
+ def all_roof_descriptions
238
+ @xml_doc.search("Roof/Description").map(&:content)
239
+ end
240
+
241
+ def all_roof_energy_efficiency_rating
242
+ @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content)
243
+ end
244
+
245
+ def all_roof_env_energy_efficiency_rating
246
+ @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content)
247
+ end
248
+
249
+ def all_window_descriptions
250
+ @xml_doc.search("Window/Description").map(&:content)
251
+ end
252
+
253
+ def all_main_heating_descriptions
254
+ @xml_doc.search("Main-Heating/Description").map(&:content)
255
+ end
256
+
257
+ def all_main_heating_controls_descriptions
258
+ @xml_doc.search("Main-Heating-Controls/Description").map(&:content)
259
+ end
260
+
261
+ def all_main_heating_energy_efficiency
262
+ @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content)
263
+ end
264
+
265
+ def all_main_heating_environmental_efficiency
266
+ @xml_doc
267
+ .search("Main-Heating/Environmental-Efficiency-Rating")
268
+ .map(&:content)
269
+ end
270
+
271
+ def all_hot_water_descriptions
272
+ @xml_doc.search("Hot-Water/Description").map(&:content)
273
+ end
274
+
275
+ def all_lighting_descriptions
276
+ @xml_doc.search("Lighting/Description").map(&:content)
277
+ end
278
+
279
+ def all_secondary_heating_descriptions
280
+ @xml_doc.search("Secondary-Heating/Description").map(&:content)
281
+ end
282
+
283
+ def country_code
284
+ xpath(%w[Country-Code])
285
+ end
286
+
287
+ def main_fuel_type
288
+ xpath(%w[Main-Fuel-Type])
289
+ end
290
+
291
+ def secondary_fuel_type
292
+ xpath(%w[Secondary-Fuel-Type])
293
+ end
294
+
295
+ def water_heating_fuel
296
+ xpath(%w[Water-Heating-Fuel])
297
+ end
298
+
299
+ def co2_emissions_current_per_floor_area
300
+ xpath(%w[CO2-Emissions-Current-Per-Floor-Area])&.to_f
301
+ end
302
+
303
+ def mains_gas
304
+ xpath(%w[Mains-Gas])
305
+ end
306
+
307
+ def level
308
+ xpath(%w[Level])
309
+ end
310
+
311
+ def top_storey
312
+ xpath(%w[Top-Storey])
313
+ end
314
+
315
+ def storey_count
316
+ xpath(%w[Storey-Count])&.to_i
317
+ end
318
+
319
+ def main_heating_controls
320
+ xpath(%w[Main-Heating-Controls Description])
321
+ end
322
+
323
+ def multiple_glazed_proportion
324
+ xpath(%w[Multiple-Glazed-Proportion])
325
+ end
326
+
327
+ def glazed_area
328
+ xpath(%w[Glazed-Area])
329
+ end
330
+
331
+ def heated_room_count
332
+ xpath(%w[Heated-Room-Count])&.to_i
333
+ end
334
+
335
+ def low_energy_lighting
336
+ xpath(%w[Low-Energy-Lighting])
337
+ end
338
+
339
+ def fixed_lighting_outlets_count
340
+ xpath(%w[Fixed-Lighting-Outlets-Count])&.to_i
341
+ end
342
+
343
+ def low_energy_fixed_lighting_outlets_count
344
+ xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count])&.to_i
345
+ end
346
+
347
+ def open_fireplaces_count
348
+ xpath(%w[Open-Fireplaces-Count])&.to_i
349
+ end
350
+
351
+ def hot_water_description
352
+ xpath(%w[Hot-Water Description])
353
+ end
354
+
355
+ def hot_water_energy_efficiency_rating
356
+ xpath(%w[Hot-Water Energy-Efficiency-Rating])
357
+ end
358
+
359
+ def hot_water_environmental_efficiency_rating
360
+ xpath(%w[Hot-Water Environmental-Efficiency-Rating])
361
+ end
362
+
363
+ def wind_turbine_count
364
+ xpath(%w[Wind-Turbines-Count])&.to_i
365
+ end
366
+
367
+ def heat_loss_corridor
368
+ xpath(%w[Heat-Loss-Corridor])
369
+ end
370
+
371
+ def unheated_corridor_length
372
+ xpath(%w[Unheated-Corridor-Length])
373
+ end
374
+
375
+ def window_description
376
+ xpath(%w[Window Description])
377
+ end
378
+
379
+ def window_energy_efficiency_rating
380
+ xpath(%w[Window Energy-Efficiency-Rating])
381
+ end
382
+
383
+ def window_environmental_efficiency_rating
384
+ xpath(%w[Window Environmental-Efficiency-Rating])
385
+ end
386
+
387
+ def secondary_heating_description
388
+ xpath(%w[Secondary-Heating Description])
389
+ end
390
+
391
+ def secondary_heating_energy_efficiency_rating
392
+ xpath(%w[Secondary-Heating Energy-Efficiency-Rating])
393
+ end
394
+
395
+ def secondary_heating_environmental_efficiency_rating
396
+ xpath(%w[Secondary-Heating Environmental-Efficiency-Rating])
397
+ end
398
+
399
+ def lighting_description
400
+ xpath(%w[Lighting Description])
401
+ end
402
+
403
+ def lighting_energy_efficiency_rating
404
+ xpath(%w[Lighting Energy-Efficiency-Rating])
405
+ end
406
+
407
+ def lighting_environmental_efficiency_rating
408
+ xpath(%w[Lighting Environmental-Efficiency-Rating])
409
+ end
410
+
411
+ def photovoltaic_roof_area_percent
412
+ xpath(%w[Photovoltaic-Supply Percent-Roof-Area])
413
+ end
414
+
415
+ def built_form
416
+ xpath(%w[Built-Form])
417
+ end
418
+
419
+ def extensions_count
420
+ xpath(%w[Extensions-Count])&.to_i
421
+ end
422
+
423
+ def report_type
424
+ xpath(%w[Report-Type])
425
+ end
426
+
427
+ def all_wall_descriptions
428
+ @xml_doc.search("Wall/Description").map(&:content)
429
+ end
430
+
431
+ def all_wall_energy_efficiency_rating
432
+ @xml_doc.search("Wall/Energy-Efficiency-Rating").map(&:content)
433
+ end
434
+
435
+ def all_wall_env_energy_efficiency_rating
436
+ @xml_doc.search("Wall/Environmental-Efficiency-Rating").map(&:content)
437
+ end
438
+
439
+ def meter_type
440
+ xpath(%w[Meter-Type])
441
+ end
442
+
443
+ def floor_level
444
+ xpath(%w[Flat-Location])
445
+ end
446
+
447
+ def solar_water_heating_flag
448
+ xpath(%w[Solar-Water-Heating])
449
+ end
450
+
451
+ def mechanical_ventilation
452
+ xpath(%w[Mechanical-Ventilation])
453
+ end
454
+
455
+ def floor_height
456
+ @xml_doc.search("Room-Height").map(&:content)
457
+ end
458
+
459
+ def all_floor_descriptions
460
+ @xml_doc.search("Property-Summary/Floor/Description").map(&:content)
461
+ end
462
+
463
+ def all_floor_energy_efficiency_rating
464
+ @xml_doc
465
+ .search("Property-Summary/Floor/Energy-Efficiency-Rating")
466
+ .map(&:content)
467
+ end
468
+
469
+ def all_floor_env_energy_efficiency_rating
470
+ @xml_doc
471
+ .search("Property-Summary/Floor/Environmental-Efficiency-Rating")
472
+ .map(&:content)
473
+ end
474
+
475
+ def all_main_heating_controls_energy_efficiency
476
+ @xml_doc
477
+ .search("Main-Heating-Controls/Energy-Efficiency-Rating")
478
+ .map(&:content)
479
+ end
480
+
481
+ def all_main_heating_controls_environmental_efficiency
482
+ @xml_doc
483
+ .search("Main-Heating-Controls/Environmental-Efficiency-Rating")
484
+ .map(&:content)
485
+ end
486
+
487
+ def main_dwelling_construction_age_band_or_year
488
+ sap_building_parts =
489
+ @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part")
490
+ sap_building_parts.each do |sap_building_part|
491
+ building_part_number = sap_building_part.at("Building-Part-Number")
492
+
493
+ # Identifies the Main Dwelling
494
+ if building_part_number&.content == "1"
495
+ return (
496
+ sap_building_part.at_xpath(
497
+ "Construction-Age-Band | Construction-Year",
498
+ )&.content
499
+ )
500
+ end
501
+ end
502
+ nil
503
+ end
504
+
505
+ def cylinder_insul_thickness
506
+ xpath(%w[Cylinder-Insulation-Thickness])
507
+ end
508
+
509
+ def cylinder_insulation_type
510
+ xpath(%w[Cylinder-Insulation-Type])
511
+ end
512
+
513
+ def cylinder_size
514
+ xpath(%w[Cylinder-Size])
515
+ end
516
+
517
+ def has_cylinder_thermostat
518
+ xpath(%w[Cylinder-Thermostat])
519
+ end
520
+
521
+ def party_wall_construction
522
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
523
+ end
524
+
525
+ def lzc_energy_sources
526
+ return nil if xpath(%w[LZC-Energy-Sources]).nil?
527
+
528
+ @xml_doc
529
+ .search("LZC-Energy-Sources/LZC-Energy-Source")
530
+ .select(&:element?)
531
+ .map { |n| n.text.to_i }
532
+ end
533
+
534
+ def addendum
535
+ nil
536
+ end
537
+
538
+ def gas_smart_meter_present
539
+ nil
540
+ end
541
+
542
+ def electricity_smart_meter_present
543
+ nil
544
+ end
545
+ end
546
+ end
547
+ end