epb_view_models 1.2.3 → 2.0.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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +38 -28
  4. data/epb_view_models.gemspec +1 -1
  5. data/lib/epb_view_models.rb +1 -1
  6. data/lib/presenter/cepc/report.rb +11 -15
  7. data/lib/presenter/cepc/summary.rb +5 -14
  8. data/lib/presenter/dec/report.rb +5 -9
  9. data/lib/presenter/dec/summary.rb +3 -11
  10. data/lib/presenter/dec/xml_summary.rb +2 -2
  11. data/lib/presenter/export/base.rb +4 -4
  12. data/lib/presenter/export/commercial.rb +16 -27
  13. data/lib/presenter/export/domestic.rb +30 -39
  14. data/lib/presenter/rd_sap/domestic_digest.rb +2 -4
  15. data/lib/presenter/rd_sap/report.rb +47 -57
  16. data/lib/presenter/rd_sap/summary.rb +13 -21
  17. data/lib/presenter/sap/domestic_digest.rb +2 -4
  18. data/lib/presenter/sap/report.rb +49 -59
  19. data/lib/presenter/sap/summary.rb +27 -41
  20. data/lib/view_model/cepc31/cepc.rb +4 -44
  21. data/lib/view_model/cepc31/common_schema.rb +1 -1
  22. data/lib/view_model/cepc31/dec.rb +14 -34
  23. data/lib/view_model/cepc40/ac_report.rb +1 -1
  24. data/lib/view_model/cepc40/cepc.rb +6 -30
  25. data/lib/view_model/cepc40/common_schema.rb +1 -1
  26. data/lib/view_model/cepc40/dec.rb +16 -16
  27. data/lib/view_model/cepc50/ac_report.rb +1 -1
  28. data/lib/view_model/cepc50/cepc.rb +6 -10
  29. data/lib/view_model/cepc50/common_schema.rb +1 -1
  30. data/lib/view_model/cepc50/dec.rb +16 -16
  31. data/lib/view_model/cepc51/ac_report.rb +1 -1
  32. data/lib/view_model/cepc51/cepc.rb +6 -6
  33. data/lib/view_model/cepc51/common_schema.rb +1 -1
  34. data/lib/view_model/cepc51/dec.rb +16 -16
  35. data/lib/view_model/cepc60/ac_report.rb +1 -1
  36. data/lib/view_model/cepc60/cepc.rb +6 -10
  37. data/lib/view_model/cepc60/common_schema.rb +1 -1
  38. data/lib/view_model/cepc60/dec.rb +17 -17
  39. data/lib/view_model/cepc70/ac_cert.rb +3 -3
  40. data/lib/view_model/cepc70/ac_report.rb +1 -1
  41. data/lib/view_model/cepc70/cepc.rb +6 -10
  42. data/lib/view_model/cepc70/common_schema.rb +1 -1
  43. data/lib/view_model/cepc70/dec.rb +17 -17
  44. data/lib/view_model/cepc71/ac_cert.rb +3 -3
  45. data/lib/view_model/cepc71/ac_report.rb +1 -1
  46. data/lib/view_model/cepc71/cepc.rb +6 -6
  47. data/lib/view_model/cepc71/common_schema.rb +1 -1
  48. data/lib/view_model/cepc71/dec.rb +17 -17
  49. data/lib/view_model/cepc800/ac_cert.rb +3 -3
  50. data/lib/view_model/cepc800/ac_report.rb +1 -1
  51. data/lib/view_model/cepc800/cepc.rb +6 -11
  52. data/lib/view_model/cepc800/common_schema.rb +1 -1
  53. data/lib/view_model/cepc800/dec.rb +17 -17
  54. data/lib/view_model/cepc_ni800/ac_cert.rb +3 -3
  55. data/lib/view_model/cepc_ni800/ac_report.rb +1 -1
  56. data/lib/view_model/cepc_ni800/cepc.rb +6 -10
  57. data/lib/view_model/cepc_ni800/common_schema.rb +1 -1
  58. data/lib/view_model/cepc_ni800/dec.rb +17 -17
  59. data/lib/view_model/rd_sap_schema_170/common_schema.rb +17 -25
  60. data/lib/view_model/rd_sap_schema_171/common_schema.rb +17 -25
  61. data/lib/view_model/rd_sap_schema_180/common_schema.rb +17 -25
  62. data/lib/view_model/rd_sap_schema_190/common_schema.rb +17 -25
  63. data/lib/view_model/rd_sap_schema_200/common_schema.rb +17 -25
  64. data/lib/view_model/rd_sap_schema_210/common_schema.rb +14 -34
  65. data/lib/view_model/rd_sap_schema_ni_173/common_schema.rb +17 -25
  66. data/lib/view_model/rd_sap_schema_ni_174/common_schema.rb +17 -25
  67. data/lib/view_model/rd_sap_schema_ni_180/common_schema.rb +17 -25
  68. data/lib/view_model/rd_sap_schema_ni_190/common_schema.rb +17 -25
  69. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +17 -25
  70. data/lib/view_model/sap_schema_102/common_schema.rb +13 -85
  71. data/lib/view_model/sap_schema_102/rdsap.rb +3 -3
  72. data/lib/view_model/sap_schema_110/common_schema.rb +13 -65
  73. data/lib/view_model/sap_schema_110/rdsap.rb +3 -19
  74. data/lib/view_model/sap_schema_110/sap.rb +1 -1
  75. data/lib/view_model/sap_schema_112/common_schema.rb +13 -65
  76. data/lib/view_model/sap_schema_112/rdsap.rb +3 -19
  77. data/lib/view_model/sap_schema_112/sap.rb +1 -1
  78. data/lib/view_model/sap_schema_120/common_schema.rb +13 -61
  79. data/lib/view_model/sap_schema_120/rdsap.rb +3 -19
  80. data/lib/view_model/sap_schema_120/sap.rb +1 -1
  81. data/lib/view_model/sap_schema_130/common_schema.rb +13 -61
  82. data/lib/view_model/sap_schema_130/rdsap.rb +3 -19
  83. data/lib/view_model/sap_schema_130/sap.rb +1 -1
  84. data/lib/view_model/sap_schema_140/common_schema.rb +14 -58
  85. data/lib/view_model/sap_schema_140/rdsap.rb +3 -19
  86. data/lib/view_model/sap_schema_140/sap.rb +1 -1
  87. data/lib/view_model/sap_schema_141/common_schema.rb +14 -58
  88. data/lib/view_model/sap_schema_141/rdsap.rb +3 -19
  89. data/lib/view_model/sap_schema_141/sap.rb +1 -1
  90. data/lib/view_model/sap_schema_142/common_schema.rb +14 -58
  91. data/lib/view_model/sap_schema_142/rdsap.rb +3 -19
  92. data/lib/view_model/sap_schema_142/sap.rb +1 -1
  93. data/lib/view_model/sap_schema_150/common_schema.rb +14 -58
  94. data/lib/view_model/sap_schema_150/rdsap.rb +3 -19
  95. data/lib/view_model/sap_schema_150/sap.rb +1 -1
  96. data/lib/view_model/sap_schema_160/common_schema.rb +14 -58
  97. data/lib/view_model/sap_schema_160/rdsap.rb +3 -19
  98. data/lib/view_model/sap_schema_160/sap.rb +1 -1
  99. data/lib/view_model/sap_schema_161/common_schema.rb +14 -58
  100. data/lib/view_model/sap_schema_161/rdsap.rb +3 -19
  101. data/lib/view_model/sap_schema_161/sap.rb +1 -1
  102. data/lib/view_model/sap_schema_162/common_schema.rb +14 -58
  103. data/lib/view_model/sap_schema_162/rdsap.rb +3 -19
  104. data/lib/view_model/sap_schema_162/sap.rb +1 -1
  105. data/lib/view_model/sap_schema_163/common_schema.rb +13 -53
  106. data/lib/view_model/sap_schema_163/rdsap.rb +3 -19
  107. data/lib/view_model/sap_schema_163/sap.rb +1 -1
  108. data/lib/view_model/sap_schema_170/common_schema.rb +13 -65
  109. data/lib/view_model/sap_schema_171/common_schema.rb +13 -65
  110. data/lib/view_model/sap_schema_1800/common_schema.rb +12 -64
  111. data/lib/view_model/sap_schema_1900/common_schema.rb +10 -50
  112. data/lib/view_model/sap_schema_1910/common_schema.rb +10 -50
  113. data/lib/view_model/sap_schema_ni_112/common_schema.rb +13 -61
  114. data/lib/view_model/sap_schema_ni_112/rdsap.rb +3 -19
  115. data/lib/view_model/sap_schema_ni_112/sap.rb +1 -1
  116. data/lib/view_model/sap_schema_ni_120/common_schema.rb +13 -61
  117. data/lib/view_model/sap_schema_ni_120/rdsap.rb +3 -19
  118. data/lib/view_model/sap_schema_ni_120/sap.rb +1 -1
  119. data/lib/view_model/sap_schema_ni_130/common_schema.rb +13 -61
  120. data/lib/view_model/sap_schema_ni_130/rdsap.rb +3 -19
  121. data/lib/view_model/sap_schema_ni_130/sap.rb +1 -1
  122. data/lib/view_model/sap_schema_ni_140/common_schema.rb +14 -58
  123. data/lib/view_model/sap_schema_ni_140/rdsap.rb +3 -19
  124. data/lib/view_model/sap_schema_ni_140/sap.rb +1 -1
  125. data/lib/view_model/sap_schema_ni_141/common_schema.rb +14 -58
  126. data/lib/view_model/sap_schema_ni_141/rdsap.rb +3 -19
  127. data/lib/view_model/sap_schema_ni_141/sap.rb +1 -1
  128. data/lib/view_model/sap_schema_ni_142/common_schema.rb +14 -58
  129. data/lib/view_model/sap_schema_ni_142/rdsap.rb +3 -19
  130. data/lib/view_model/sap_schema_ni_142/sap.rb +1 -1
  131. data/lib/view_model/sap_schema_ni_150/common_schema.rb +14 -58
  132. data/lib/view_model/sap_schema_ni_150/rdsap.rb +3 -19
  133. data/lib/view_model/sap_schema_ni_150/sap.rb +1 -1
  134. data/lib/view_model/sap_schema_ni_160/common_schema.rb +14 -54
  135. data/lib/view_model/sap_schema_ni_160/rdsap.rb +3 -19
  136. data/lib/view_model/sap_schema_ni_160/sap.rb +1 -1
  137. data/lib/view_model/sap_schema_ni_161/common_schema.rb +14 -50
  138. data/lib/view_model/sap_schema_ni_161/rdsap.rb +3 -19
  139. data/lib/view_model/sap_schema_ni_161/sap.rb +1 -1
  140. data/lib/view_model/sap_schema_ni_170/common_schema.rb +14 -54
  141. data/lib/view_model/sap_schema_ni_170/rdsap.rb +3 -19
  142. data/lib/view_model/sap_schema_ni_170/sap.rb +1 -1
  143. data/lib/view_model/sap_schema_ni_171/common_schema.rb +14 -54
  144. data/lib/view_model/sap_schema_ni_171/rdsap.rb +3 -19
  145. data/lib/view_model/sap_schema_ni_171/sap.rb +1 -1
  146. data/lib/view_model/sap_schema_ni_172/common_schema.rb +14 -54
  147. data/lib/view_model/sap_schema_ni_172/rdsap.rb +3 -23
  148. data/lib/view_model/sap_schema_ni_172/sap.rb +1 -1
  149. data/lib/view_model/sap_schema_ni_173/common_schema.rb +10 -78
  150. data/lib/view_model/sap_schema_ni_174/common_schema.rb +10 -78
  151. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +10 -78
  152. metadata +4 -4
@@ -21,7 +21,7 @@ module ViewModel
21
21
  end
22
22
 
23
23
  def ac_rated_output
24
- xpath(%w[AC-Rated-Output AC-kW-Rating])
24
+ xpath(%w[AC-Rated-Output AC-kW-Rating])&.to_i
25
25
  end
26
26
 
27
27
  def random_sampling
@@ -29,7 +29,7 @@ module ViewModel
29
29
  end
30
30
 
31
31
  def treated_floor_area
32
- xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])
32
+ xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])&.to_i
33
33
  end
34
34
 
35
35
  def ac_system_metered
@@ -41,7 +41,7 @@ module ViewModel
41
41
  def refrigerant_charge
42
42
  xpath(
43
43
  %w[Air-Conditioning-Inspection-Certificate Refrigerant-Charge-Total],
44
- )
44
+ )&.to_i
45
45
  end
46
46
 
47
47
  def related_rrn
@@ -13,7 +13,7 @@ module ViewModel
13
13
  nodes.filter_map do |node|
14
14
  unless node.at("Text").content.nil? || node.at("Text").content.empty?
15
15
  {
16
- sequence: node.at("Seq-Number").content,
16
+ sequence: node.at("Seq-Number").content&.to_i,
17
17
  text: node.at("Text").content,
18
18
  }
19
19
  end
@@ -6,7 +6,7 @@ module ViewModel
6
6
  end
7
7
 
8
8
  def ac_kw_rating
9
- xpath(%w[AC-kW-Rating])
9
+ xpath(%w[AC-kW-Rating])&.to_i
10
10
  end
11
11
 
12
12
  def ac_present
@@ -26,11 +26,11 @@ module ViewModel
26
26
  end
27
27
 
28
28
  def building_level
29
- xpath(%w[Building-Level])
29
+ xpath(%w[Building-Level])&.to_i
30
30
  end
31
31
 
32
32
  def energy_efficiency_rating
33
- xpath(%w[Asset-Rating])
33
+ xpath(%w[Asset-Rating])&.to_i
34
34
  end
35
35
 
36
36
  def epc_related_party_disclosure
@@ -38,11 +38,11 @@ module ViewModel
38
38
  end
39
39
 
40
40
  def estimated_ac_kw_rating
41
- xpath(%w[AC-Estimated-Output])
41
+ xpath(%w[AC-Estimated-Output])&.to_i
42
42
  end
43
43
 
44
44
  def existing_build_rating
45
- xpath(%w[Existing-Stock-Benchmark])
45
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
46
46
  end
47
47
 
48
48
  def floor_area
@@ -54,7 +54,7 @@ module ViewModel
54
54
  end
55
55
 
56
56
  def new_build_rating
57
- xpath(%w[New-Build-Benchmark])
57
+ xpath(%w[New-Build-Benchmark])&.to_i
58
58
  end
59
59
 
60
60
  def other_fuel_description
@@ -102,7 +102,7 @@ module ViewModel
102
102
  end
103
103
 
104
104
  def building_level
105
- xpath(%w[Building-Level])
105
+ xpath(%w[Building-Level])&.to_i
106
106
  end
107
107
  end
108
108
  end
@@ -18,7 +18,7 @@ module ViewModel
18
18
  end
19
19
 
20
20
  def energy_efficiency_rating
21
- xpath(%w[This-Assessment Energy-Rating])
21
+ xpath(%w[This-Assessment Energy-Rating])&.to_i
22
22
  end
23
23
 
24
24
  def current_assessment_date
@@ -26,15 +26,15 @@ module ViewModel
26
26
  end
27
27
 
28
28
  def current_heating_co2
29
- xpath(%w[This-Assessment Heating-CO2])
29
+ xpath(%w[This-Assessment Heating-CO2])&.to_i
30
30
  end
31
31
 
32
32
  def current_electricity_co2
33
- xpath(%w[This-Assessment Electricity-CO2])
33
+ xpath(%w[This-Assessment Electricity-CO2])&.to_i
34
34
  end
35
35
 
36
36
  def current_renewables_co2
37
- xpath(%w[This-Assessment Renewables-CO2])
37
+ xpath(%w[This-Assessment Renewables-CO2])&.to_i
38
38
  end
39
39
 
40
40
  def year1_assessment_date
@@ -42,19 +42,19 @@ module ViewModel
42
42
  end
43
43
 
44
44
  def year1_heating_co2
45
- xpath(%w[Year1-Assessment Heating-CO2])
45
+ xpath(%w[Year1-Assessment Heating-CO2])&.to_i
46
46
  end
47
47
 
48
48
  def year1_electricity_co2
49
- xpath(%w[Year1-Assessment Electricity-CO2])
49
+ xpath(%w[Year1-Assessment Electricity-CO2])&.to_i
50
50
  end
51
51
 
52
52
  def year1_renewables_co2
53
- xpath(%w[Year1-Assessment Renewables-CO2])
53
+ xpath(%w[Year1-Assessment Renewables-CO2])&.to_i
54
54
  end
55
55
 
56
56
  def year1_energy_efficiency_rating
57
- xpath(%w[Year1-Assessment Energy-Rating])
57
+ xpath(%w[Year1-Assessment Energy-Rating])&.to_i
58
58
  end
59
59
 
60
60
  def year2_assessment_date
@@ -62,19 +62,19 @@ module ViewModel
62
62
  end
63
63
 
64
64
  def year2_heating_co2
65
- xpath(%w[Year2-Assessment Heating-CO2])
65
+ xpath(%w[Year2-Assessment Heating-CO2])&.to_i
66
66
  end
67
67
 
68
68
  def year2_electricity_co2
69
- xpath(%w[Year2-Assessment Electricity-CO2])
69
+ xpath(%w[Year2-Assessment Electricity-CO2])&.to_i
70
70
  end
71
71
 
72
72
  def year2_renewables_co2
73
- xpath(%w[Year2-Assessment Renewables-CO2])
73
+ xpath(%w[Year2-Assessment Renewables-CO2])&.to_i
74
74
  end
75
75
 
76
76
  def year2_energy_efficiency_rating
77
- xpath(%w[Year2-Assessment Energy-Rating])
77
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
78
78
  end
79
79
 
80
80
  def main_heating_fuel
@@ -94,7 +94,7 @@ module ViewModel
94
94
  end
95
95
 
96
96
  def asset_rating
97
- xpath(%w[OR-Previous-Data Asset-Rating])
97
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
98
98
  end
99
99
 
100
100
  def annual_energy_use_fuel_thermal
@@ -155,7 +155,7 @@ module ViewModel
155
155
  .map do |node|
156
156
  {
157
157
  name: xpath(%w[Name], node),
158
- id: xpath(%w[Benchmark-ID], node),
158
+ id: xpath(%w[Benchmark-ID], node)&.to_i,
159
159
  tufa: xpath(%w[TUFA], node),
160
160
  }
161
161
  end
@@ -171,7 +171,7 @@ module ViewModel
171
171
  consumption: xpath(%w[Consumption], node),
172
172
  start_date: xpath(%w[Start-Date], node),
173
173
  end_date: xpath(%w[End-Date], node),
174
- estimate: xpath(%w[Estimate], node),
174
+ estimate: xpath(%w[Estimate], node)&.to_i,
175
175
  name: node.name,
176
176
  }
177
177
  end
@@ -210,11 +210,11 @@ module ViewModel
210
210
  end
211
211
 
212
212
  def ac_kw_rating
213
- xpath(%w[AC-kW-Rating])
213
+ xpath(%w[AC-kW-Rating])&.to_i
214
214
  end
215
215
 
216
216
  def estimated_ac_kw_rating
217
- xpath(%w[AC-Estimated-Output])
217
+ xpath(%w[AC-Estimated-Output])&.to_i
218
218
  end
219
219
 
220
220
  def building_category
@@ -21,7 +21,7 @@ module ViewModel
21
21
  end
22
22
 
23
23
  def ac_rated_output
24
- xpath(%w[AC-Rated-Output AC-kW-Rating])
24
+ xpath(%w[AC-Rated-Output AC-kW-Rating])&.to_i
25
25
  end
26
26
 
27
27
  def random_sampling
@@ -29,7 +29,7 @@ module ViewModel
29
29
  end
30
30
 
31
31
  def treated_floor_area
32
- xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])
32
+ xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])&.to_i
33
33
  end
34
34
 
35
35
  def ac_system_metered
@@ -41,7 +41,7 @@ module ViewModel
41
41
  def refrigerant_charge
42
42
  xpath(
43
43
  %w[Air-Conditioning-Inspection-Certificate Refrigerant-Charge-Total],
44
- )
44
+ )&.to_i
45
45
  end
46
46
 
47
47
  def related_rrn
@@ -20,7 +20,7 @@ module ViewModel
20
20
  nodes.filter_map do |node|
21
21
  unless node.at("Text").content.nil? || node.at("Text").content.empty?
22
22
  {
23
- sequence: node.at("Seq-Number").content,
23
+ sequence: node.at("Seq-Number").content&.to_i,
24
24
  text: node.at("Text").content,
25
25
  }
26
26
  end
@@ -6,18 +6,13 @@ module ViewModel
6
6
  end
7
7
 
8
8
  def ac_kw_rating
9
- xpath(%w[AC-kW-Rating])
9
+ xpath(%w[AC-kW-Rating])&.to_i
10
10
  end
11
11
 
12
12
  def ac_present
13
13
  xpath(%w[AC-Present])
14
14
  end
15
15
 
16
- def building_emissions
17
- xpath(%w[BER])
18
- end
19
-
20
- # This would seem to be a copy? Is the method name used?
21
16
  def building_emission_rate
22
17
  xpath(%w[BER])
23
18
  end
@@ -27,7 +22,7 @@ module ViewModel
27
22
  end
28
23
 
29
24
  def building_level
30
- xpath(%w[Building-Level])
25
+ xpath(%w[Building-Level])&.to_i
31
26
  end
32
27
 
33
28
  # Is this used?
@@ -36,7 +31,7 @@ module ViewModel
36
31
  end
37
32
 
38
33
  def energy_efficiency_rating
39
- xpath(%w[Asset-Rating])
34
+ xpath(%w[Asset-Rating])&.to_i
40
35
  end
41
36
 
42
37
  def epc_related_party_disclosure
@@ -44,11 +39,11 @@ module ViewModel
44
39
  end
45
40
 
46
41
  def estimated_ac_kw_rating
47
- xpath(%w[AC-Estimated-Output])
42
+ xpath(%w[AC-Estimated-Output])&.to_i
48
43
  end
49
44
 
50
45
  def existing_build_rating
51
- xpath(%w[Existing-Stock-Benchmark])
46
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
52
47
  end
53
48
 
54
49
  def floor_area
@@ -61,7 +56,7 @@ module ViewModel
61
56
 
62
57
  # This is new_build_benchmark in the CEPC wrapper
63
58
  def new_build_rating
64
- xpath(%w[New-Build-Benchmark])
59
+ xpath(%w[New-Build-Benchmark])&.to_i
65
60
  end
66
61
 
67
62
  def or_assessment_start_date
@@ -102,7 +102,7 @@ module ViewModel
102
102
  end
103
103
 
104
104
  def building_level
105
- xpath(%w[Building-Level])
105
+ xpath(%w[Building-Level])&.to_i
106
106
  end
107
107
  end
108
108
  end
@@ -20,7 +20,7 @@ module ViewModel
20
20
  end
21
21
 
22
22
  def energy_efficiency_rating
23
- xpath(%w[This-Assessment Energy-Rating])
23
+ xpath(%w[This-Assessment Energy-Rating])&.to_i
24
24
  end
25
25
 
26
26
  def current_assessment_date
@@ -28,15 +28,15 @@ module ViewModel
28
28
  end
29
29
 
30
30
  def current_heating_co2
31
- xpath(%w[This-Assessment Heating-CO2])
31
+ xpath(%w[This-Assessment Heating-CO2])&.to_i
32
32
  end
33
33
 
34
34
  def current_electricity_co2
35
- xpath(%w[This-Assessment Electricity-CO2])
35
+ xpath(%w[This-Assessment Electricity-CO2])&.to_i
36
36
  end
37
37
 
38
38
  def current_renewables_co2
39
- xpath(%w[This-Assessment Renewables-CO2])
39
+ xpath(%w[This-Assessment Renewables-CO2])&.to_i
40
40
  end
41
41
 
42
42
  def year1_assessment_date
@@ -44,19 +44,19 @@ module ViewModel
44
44
  end
45
45
 
46
46
  def year1_heating_co2
47
- xpath(%w[Year1-Assessment Heating-CO2])
47
+ xpath(%w[Year1-Assessment Heating-CO2])&.to_i
48
48
  end
49
49
 
50
50
  def year1_electricity_co2
51
- xpath(%w[Year1-Assessment Electricity-CO2])
51
+ xpath(%w[Year1-Assessment Electricity-CO2])&.to_i
52
52
  end
53
53
 
54
54
  def year1_renewables_co2
55
- xpath(%w[Year1-Assessment Renewables-CO2])
55
+ xpath(%w[Year1-Assessment Renewables-CO2])&.to_i
56
56
  end
57
57
 
58
58
  def year1_energy_efficiency_rating
59
- xpath(%w[Year1-Assessment Energy-Rating])
59
+ xpath(%w[Year1-Assessment Energy-Rating])&.to_i
60
60
  end
61
61
 
62
62
  def year2_assessment_date
@@ -64,19 +64,19 @@ module ViewModel
64
64
  end
65
65
 
66
66
  def year2_heating_co2
67
- xpath(%w[Year2-Assessment Heating-CO2])
67
+ xpath(%w[Year2-Assessment Heating-CO2])&.to_i
68
68
  end
69
69
 
70
70
  def year2_electricity_co2
71
- xpath(%w[Year2-Assessment Electricity-CO2])
71
+ xpath(%w[Year2-Assessment Electricity-CO2])&.to_i
72
72
  end
73
73
 
74
74
  def year2_renewables_co2
75
- xpath(%w[Year2-Assessment Renewables-CO2])
75
+ xpath(%w[Year2-Assessment Renewables-CO2])&.to_i
76
76
  end
77
77
 
78
78
  def year2_energy_efficiency_rating
79
- xpath(%w[Year2-Assessment Energy-Rating])
79
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
80
80
  end
81
81
 
82
82
  def main_heating_fuel
@@ -92,7 +92,7 @@ module ViewModel
92
92
  end
93
93
 
94
94
  def asset_rating
95
- xpath(%w[OR-Previous-Data Asset-Rating])
95
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
96
96
  end
97
97
 
98
98
  def annual_energy_use_fuel_thermal
@@ -153,7 +153,7 @@ module ViewModel
153
153
  .map do |node|
154
154
  {
155
155
  name: xpath(%w[Name], node),
156
- id: xpath(%w[Benchmark-ID], node),
156
+ id: xpath(%w[Benchmark-ID], node)&.to_i,
157
157
  tufa: xpath(%w[TUFA], node),
158
158
  }
159
159
  end
@@ -169,7 +169,7 @@ module ViewModel
169
169
  consumption: xpath(%w[Consumption], node),
170
170
  start_date: xpath(%w[Start-Date], node),
171
171
  end_date: xpath(%w[End-Date], node),
172
- estimate: xpath(%w[Estimate], node),
172
+ estimate: xpath(%w[Estimate], node)&.to_i,
173
173
  name: node.name,
174
174
  }
175
175
  end
@@ -216,11 +216,11 @@ module ViewModel
216
216
  end
217
217
 
218
218
  def ac_kw_rating
219
- xpath(%w[AC-kW-Rating])
219
+ xpath(%w[AC-kW-Rating])&.to_i
220
220
  end
221
221
 
222
222
  def estimated_ac_kw_rating
223
- xpath(%w[AC-Estimated-Output])
223
+ xpath(%w[AC-Estimated-Output])&.to_i
224
224
  end
225
225
 
226
226
  def building_category
@@ -21,7 +21,7 @@ module ViewModel
21
21
  end
22
22
 
23
23
  def ac_rated_output
24
- xpath(%w[AC-Rated-Output AC-kW-Rating])
24
+ xpath(%w[AC-Rated-Output AC-kW-Rating])&.to_i
25
25
  end
26
26
 
27
27
  def random_sampling
@@ -29,7 +29,7 @@ module ViewModel
29
29
  end
30
30
 
31
31
  def treated_floor_area
32
- xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])
32
+ xpath(%w[Air-Conditioning-Inspection-Certificate Treated-Floor-Area])&.to_i
33
33
  end
34
34
 
35
35
  def ac_system_metered
@@ -41,7 +41,7 @@ module ViewModel
41
41
  def refrigerant_charge
42
42
  xpath(
43
43
  %w[Air-Conditioning-Inspection-Certificate Refrigerant-Charge-Total],
44
- )
44
+ )&.to_i
45
45
  end
46
46
 
47
47
  def related_rrn
@@ -12,7 +12,7 @@ module ViewModel
12
12
  def extract_aci_recommendations(nodes)
13
13
  recommendations = nodes.map do |node|
14
14
  {
15
- sequence: node.at("Seq-Number").content,
15
+ sequence: node.at("Seq-Number").content&.to_i,
16
16
  text: node.at("Text").content,
17
17
  }
18
18
  end
@@ -6,7 +6,7 @@ module ViewModel
6
6
  end
7
7
 
8
8
  def ac_kw_rating
9
- xpath(%w[AC-kW-Rating])
9
+ xpath(%w[AC-kW-Rating])&.to_i
10
10
  end
11
11
 
12
12
  def ac_present
@@ -17,10 +17,6 @@ module ViewModel
17
17
  xpath(%w[AC-Rated-Output])
18
18
  end
19
19
 
20
- def building_emissions
21
- xpath(%w[BER])
22
- end
23
-
24
20
  def building_emission_rate
25
21
  xpath(%w[BER])
26
22
  end
@@ -30,7 +26,7 @@ module ViewModel
30
26
  end
31
27
 
32
28
  def building_level
33
- xpath(%w[Building-Level])
29
+ xpath(%w[Building-Level])&.to_i
34
30
  end
35
31
 
36
32
  def effective_date
@@ -38,7 +34,7 @@ module ViewModel
38
34
  end
39
35
 
40
36
  def energy_efficiency_rating
41
- xpath(%w[Asset-Rating])
37
+ xpath(%w[Asset-Rating])&.to_i
42
38
  end
43
39
 
44
40
  def epc_related_party_disclosure
@@ -46,11 +42,11 @@ module ViewModel
46
42
  end
47
43
 
48
44
  def estimated_ac_kw_rating
49
- xpath(%w[AC-Estimated-Output])
45
+ xpath(%w[AC-Estimated-Output])&.to_i
50
46
  end
51
47
 
52
48
  def existing_build_rating
53
- xpath(%w[Existing-Stock-Benchmark])
49
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
54
50
  end
55
51
 
56
52
  def floor_area
@@ -62,7 +58,7 @@ module ViewModel
62
58
  end
63
59
 
64
60
  def new_build_rating
65
- xpath(%w[New-Build-Benchmark])
61
+ xpath(%w[New-Build-Benchmark])&.to_i
66
62
  end
67
63
 
68
64
  def other_fuel_description
@@ -102,7 +102,7 @@ module ViewModel
102
102
  end
103
103
 
104
104
  def building_level
105
- xpath(%w[Building-Level])
105
+ xpath(%w[Building-Level])&.to_i
106
106
  end
107
107
  end
108
108
  end
@@ -18,7 +18,7 @@ module ViewModel
18
18
  end
19
19
 
20
20
  def energy_efficiency_rating
21
- xpath(%w[This-Assessment Energy-Rating])
21
+ xpath(%w[This-Assessment Energy-Rating])&.to_i
22
22
  end
23
23
 
24
24
  def current_assessment_date
@@ -26,15 +26,15 @@ module ViewModel
26
26
  end
27
27
 
28
28
  def current_heating_co2
29
- xpath(%w[This-Assessment Heating-CO2])
29
+ xpath(%w[This-Assessment Heating-CO2])&.to_i
30
30
  end
31
31
 
32
32
  def current_electricity_co2
33
- xpath(%w[This-Assessment Electricity-CO2])
33
+ xpath(%w[This-Assessment Electricity-CO2])&.to_i
34
34
  end
35
35
 
36
36
  def current_renewables_co2
37
- xpath(%w[This-Assessment Renewables-CO2])
37
+ xpath(%w[This-Assessment Renewables-CO2])&.to_i
38
38
  end
39
39
 
40
40
  def year1_assessment_date
@@ -42,19 +42,19 @@ module ViewModel
42
42
  end
43
43
 
44
44
  def year1_heating_co2
45
- xpath(%w[Year1-Assessment Heating-CO2])
45
+ xpath(%w[Year1-Assessment Heating-CO2])&.to_i
46
46
  end
47
47
 
48
48
  def year1_electricity_co2
49
- xpath(%w[Year1-Assessment Electricity-CO2])
49
+ xpath(%w[Year1-Assessment Electricity-CO2])&.to_i
50
50
  end
51
51
 
52
52
  def year1_renewables_co2
53
- xpath(%w[Year1-Assessment Renewables-CO2])
53
+ xpath(%w[Year1-Assessment Renewables-CO2])&.to_i
54
54
  end
55
55
 
56
56
  def year1_energy_efficiency_rating
57
- xpath(%w[Year1-Assessment Energy-Rating])
57
+ xpath(%w[Year1-Assessment Energy-Rating])&.to_i
58
58
  end
59
59
 
60
60
  def year2_assessment_date
@@ -62,19 +62,19 @@ module ViewModel
62
62
  end
63
63
 
64
64
  def year2_heating_co2
65
- xpath(%w[Year2-Assessment Heating-CO2])
65
+ xpath(%w[Year2-Assessment Heating-CO2])&.to_i
66
66
  end
67
67
 
68
68
  def year2_electricity_co2
69
- xpath(%w[Year2-Assessment Electricity-CO2])
69
+ xpath(%w[Year2-Assessment Electricity-CO2])&.to_i
70
70
  end
71
71
 
72
72
  def year2_renewables_co2
73
- xpath(%w[Year2-Assessment Renewables-CO2])
73
+ xpath(%w[Year2-Assessment Renewables-CO2])&.to_i
74
74
  end
75
75
 
76
76
  def year2_energy_efficiency_rating
77
- xpath(%w[Year2-Assessment Energy-Rating])
77
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
78
78
  end
79
79
 
80
80
  def main_heating_fuel
@@ -90,7 +90,7 @@ module ViewModel
90
90
  end
91
91
 
92
92
  def asset_rating
93
- xpath(%w[OR-Previous-Data Asset-Rating])
93
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
94
94
  end
95
95
 
96
96
  def annual_energy_use_fuel_thermal
@@ -151,7 +151,7 @@ module ViewModel
151
151
  .map do |node|
152
152
  {
153
153
  name: xpath(%w[Name], node),
154
- id: xpath(%w[Benchmark-ID], node),
154
+ id: xpath(%w[Benchmark-ID], node)&.to_i,
155
155
  tufa: xpath(%w[TUFA], node),
156
156
  }
157
157
  end
@@ -167,7 +167,7 @@ module ViewModel
167
167
  consumption: xpath(%w[Consumption], node),
168
168
  start_date: xpath(%w[Start-Date], node),
169
169
  end_date: xpath(%w[End-Date], node),
170
- estimate: xpath(%w[Estimate], node),
170
+ estimate: xpath(%w[Estimate], node)&.to_i,
171
171
  name: node.name,
172
172
  }
173
173
  end
@@ -210,11 +210,11 @@ module ViewModel
210
210
  end
211
211
 
212
212
  def ac_kw_rating
213
- xpath(%w[AC-kW-Rating])
213
+ xpath(%w[AC-kW-Rating])&.to_i
214
214
  end
215
215
 
216
216
  def estimated_ac_kw_rating
217
- xpath(%w[AC-Estimated-Output])
217
+ xpath(%w[AC-Estimated-Output])&.to_i
218
218
  end
219
219
 
220
220
  def building_category