epb_view_models 1.2.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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,15 +62,15 @@ 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 special_energy_uses
@@ -78,7 +78,7 @@ module ViewModel
78
78
  end
79
79
 
80
80
  def year2_energy_efficiency_rating
81
- xpath(%w[Year2-Assessment Energy-Rating])
81
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
82
82
  end
83
83
 
84
84
  def occupancy_level
@@ -98,7 +98,7 @@ module ViewModel
98
98
  end
99
99
 
100
100
  def asset_rating
101
- xpath(%w[OR-Previous-Data Asset-Rating])
101
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
102
102
  end
103
103
 
104
104
  def annual_energy_use_fuel_thermal
@@ -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
@@ -202,11 +202,11 @@ module ViewModel
202
202
  end
203
203
 
204
204
  def ac_kw_rating
205
- xpath(%w[AC-kW-Rating])
205
+ xpath(%w[AC-kW-Rating])&.to_i
206
206
  end
207
207
 
208
208
  def estimated_ac_kw_rating
209
- xpath(%w[AC-Estimated-Output])
209
+ xpath(%w[AC-Estimated-Output])&.to_i
210
210
  end
211
211
 
212
212
  def building_category
@@ -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
@@ -22,11 +22,11 @@ module ViewModel
22
22
  end
23
23
 
24
24
  def building_level
25
- xpath(%w[Building-Level])
25
+ xpath(%w[Building-Level])&.to_i
26
26
  end
27
27
 
28
28
  def energy_efficiency_rating
29
- xpath(%w[Asset-Rating])
29
+ xpath(%w[Asset-Rating])&.to_i
30
30
  end
31
31
 
32
32
  def epc_related_party_disclosure
@@ -34,11 +34,11 @@ module ViewModel
34
34
  end
35
35
 
36
36
  def estimated_ac_kw_rating
37
- xpath(%w[AC-Estimated-Output])
37
+ xpath(%w[AC-Estimated-Output])&.to_i
38
38
  end
39
39
 
40
40
  def existing_build_rating
41
- xpath(%w[Existing-Stock-Benchmark])
41
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
42
42
  end
43
43
 
44
44
  def floor_area
@@ -50,7 +50,7 @@ module ViewModel
50
50
  end
51
51
 
52
52
  def new_build_rating
53
- xpath(%w[New-Build-Benchmark])
53
+ xpath(%w[New-Build-Benchmark])&.to_i
54
54
  end
55
55
 
56
56
  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,15 +62,15 @@ 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 special_energy_uses
@@ -78,7 +78,7 @@ module ViewModel
78
78
  end
79
79
 
80
80
  def year2_energy_efficiency_rating
81
- xpath(%w[Year2-Assessment Energy-Rating])
81
+ xpath(%w[Year2-Assessment Energy-Rating])&.to_i
82
82
  end
83
83
 
84
84
  def occupancy_level
@@ -98,7 +98,7 @@ module ViewModel
98
98
  end
99
99
 
100
100
  def asset_rating
101
- xpath(%w[OR-Previous-Data Asset-Rating])
101
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
102
102
  end
103
103
 
104
104
  def annual_energy_use_fuel_thermal
@@ -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
@@ -202,11 +202,11 @@ module ViewModel
202
202
  end
203
203
 
204
204
  def ac_kw_rating
205
- xpath(%w[AC-kW-Rating])
205
+ xpath(%w[AC-kW-Rating])&.to_i
206
206
  end
207
207
 
208
208
  def estimated_ac_kw_rating
209
- xpath(%w[AC-Estimated-Output])
209
+ xpath(%w[AC-Estimated-Output])&.to_i
210
210
  end
211
211
 
212
212
  def building_category
@@ -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
@@ -22,7 +22,7 @@ module ViewModel
22
22
  end
23
23
 
24
24
  def building_level
25
- xpath(%w[Building-Level])
25
+ xpath(%w[Building-Level])&.to_i
26
26
  end
27
27
 
28
28
  def floor_area
@@ -30,7 +30,7 @@ module ViewModel
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 main_heating_fuel
@@ -50,17 +50,13 @@ module ViewModel
50
50
  end
51
51
 
52
52
  def new_build_rating
53
- xpath(%w[New-Build-Benchmark])
53
+ xpath(%w[New-Build-Benchmark])&.to_i
54
54
  end
55
55
 
56
56
  def other_fuel_description
57
57
  xpath(%w[Other-Fuel-Description])
58
58
  end
59
59
 
60
- def primary_energy_use
61
- nil
62
- end
63
-
64
60
  def property_type
65
61
  xpath(%w[Property-Type])
66
62
  end
@@ -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
@@ -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
@@ -22,11 +22,11 @@ module ViewModel
22
22
  end
23
23
 
24
24
  def building_level
25
- xpath(%w[Building-Level])
25
+ xpath(%w[Building-Level])&.to_i
26
26
  end
27
27
 
28
28
  def energy_efficiency_rating
29
- xpath(%w[Asset-Rating])
29
+ xpath(%w[Asset-Rating])&.to_i
30
30
  end
31
31
 
32
32
  def epc_related_party_disclosure
@@ -34,11 +34,11 @@ module ViewModel
34
34
  end
35
35
 
36
36
  def estimated_ac_kw_rating
37
- xpath(%w[AC-Estimated-Output])
37
+ xpath(%w[AC-Estimated-Output])&.to_i
38
38
  end
39
39
 
40
40
  def existing_build_rating
41
- xpath(%w[Existing-Stock-Benchmark])
41
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
42
42
  end
43
43
 
44
44
  def floor_area
@@ -50,17 +50,13 @@ module ViewModel
50
50
  end
51
51
 
52
52
  def new_build_rating
53
- xpath(%w[New-Build-Benchmark])
53
+ xpath(%w[New-Build-Benchmark])&.to_i
54
54
  end
55
55
 
56
56
  def other_fuel_description
57
57
  xpath(%w[Other-Fuel-Description])
58
58
  end
59
59
 
60
- def primary_energy_use
61
- nil
62
- end
63
-
64
60
  def property_type
65
61
  xpath(%w[Property-Type])
66
62
  end
@@ -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
@@ -98,7 +98,7 @@ module ViewModel
98
98
  end
99
99
 
100
100
  def asset_rating
101
- xpath(%w[OR-Previous-Data Asset-Rating])
101
+ xpath(%w[OR-Previous-Data Asset-Rating])&.to_i
102
102
  end
103
103
 
104
104
  def annual_energy_use_fuel_thermal
@@ -159,7 +159,7 @@ module ViewModel
159
159
  .map do |node|
160
160
  {
161
161
  name: xpath(%w[Name], node),
162
- id: xpath(%w[Benchmark-ID], node),
162
+ id: xpath(%w[Benchmark-ID], node)&.to_i,
163
163
  tufa: xpath(%w[TUFA], node),
164
164
  }
165
165
  end
@@ -175,7 +175,7 @@ module ViewModel
175
175
  consumption: xpath(%w[Consumption], node),
176
176
  start_date: xpath(%w[Start-Date], node),
177
177
  end_date: xpath(%w[End-Date], node),
178
- estimate: xpath(%w[Estimate], node),
178
+ estimate: xpath(%w[Estimate], node)&.to_i,
179
179
  name: node.name,
180
180
  }
181
181
  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