epb_view_models 1.0.2 → 1.0.6

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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/.buildspec.yml +13 -0
  3. data/.gitignore +5 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile.lock +22 -17
  6. data/api/schemas/xml/RdSAP-Schema-NI-19.0/RdSAP/Templates/EPC-CollectedData.xsd +13 -12
  7. data/lib/epb_view_models.rb +1 -1
  8. data/lib/helper/energy_band_calculator.rb +1 -1
  9. data/lib/helper/xml_enums_to_output.rb +356 -136
  10. data/lib/presenter/export/domestic.rb +1 -1
  11. data/lib/presenter/rd_sap/report.rb +208 -3
  12. data/lib/presenter/sap/report.rb +208 -2
  13. data/lib/presenter/sap/summary.rb +1 -1
  14. data/lib/view_model/domestic_epc_view_model.rb +4 -0
  15. data/lib/view_model/rd_sap_schema_170/common_schema.rb +16 -0
  16. data/lib/view_model/rd_sap_schema_171/common_schema.rb +16 -0
  17. data/lib/view_model/rd_sap_schema_180/common_schema.rb +16 -0
  18. data/lib/view_model/rd_sap_schema_190/common_schema.rb +16 -0
  19. data/lib/view_model/rd_sap_schema_200/common_schema.rb +16 -4
  20. data/lib/view_model/rd_sap_schema_ni_173/common_schema.rb +16 -0
  21. data/lib/view_model/rd_sap_schema_ni_174/common_schema.rb +16 -0
  22. data/lib/view_model/rd_sap_schema_ni_180/common_schema.rb +16 -0
  23. data/lib/view_model/rd_sap_schema_ni_190/common_schema.rb +16 -0
  24. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +16 -4
  25. data/lib/view_model/rd_sap_wrapper.rb +4 -0
  26. data/lib/view_model/sap_schema_102/common_schema.rb +33 -6
  27. data/lib/view_model/sap_schema_102/rdsap.rb +8 -0
  28. data/lib/view_model/sap_schema_110/common_schema.rb +1 -6
  29. data/lib/view_model/sap_schema_110/rdsap.rb +36 -0
  30. data/lib/view_model/sap_schema_110/sap.rb +36 -0
  31. data/lib/view_model/sap_schema_112/common_schema.rb +1 -6
  32. data/lib/view_model/sap_schema_112/rdsap.rb +36 -0
  33. data/lib/view_model/sap_schema_112/sap.rb +36 -0
  34. data/lib/view_model/sap_schema_120/common_schema.rb +0 -4
  35. data/lib/view_model/sap_schema_120/rdsap.rb +36 -0
  36. data/lib/view_model/sap_schema_120/sap.rb +36 -0
  37. data/lib/view_model/sap_schema_130/common_schema.rb +0 -4
  38. data/lib/view_model/sap_schema_130/rdsap.rb +36 -0
  39. data/lib/view_model/sap_schema_130/sap.rb +36 -0
  40. data/lib/view_model/sap_schema_140/common_schema.rb +0 -4
  41. data/lib/view_model/sap_schema_140/rdsap.rb +36 -0
  42. data/lib/view_model/sap_schema_140/sap.rb +36 -0
  43. data/lib/view_model/sap_schema_141/common_schema.rb +0 -4
  44. data/lib/view_model/sap_schema_141/rdsap.rb +36 -0
  45. data/lib/view_model/sap_schema_141/sap.rb +36 -0
  46. data/lib/view_model/sap_schema_142/common_schema.rb +0 -4
  47. data/lib/view_model/sap_schema_142/rdsap.rb +36 -0
  48. data/lib/view_model/sap_schema_142/sap.rb +36 -0
  49. data/lib/view_model/sap_schema_150/common_schema.rb +0 -4
  50. data/lib/view_model/sap_schema_150/rdsap.rb +36 -0
  51. data/lib/view_model/sap_schema_150/sap.rb +36 -0
  52. data/lib/view_model/sap_schema_160/common_schema.rb +0 -4
  53. data/lib/view_model/sap_schema_160/rdsap.rb +36 -0
  54. data/lib/view_model/sap_schema_160/sap.rb +36 -0
  55. data/lib/view_model/sap_schema_161/common_schema.rb +0 -4
  56. data/lib/view_model/sap_schema_161/rdsap.rb +36 -0
  57. data/lib/view_model/sap_schema_161/sap.rb +36 -0
  58. data/lib/view_model/sap_schema_162/common_schema.rb +0 -4
  59. data/lib/view_model/sap_schema_162/rdsap.rb +36 -0
  60. data/lib/view_model/sap_schema_162/sap.rb +36 -0
  61. data/lib/view_model/sap_schema_163/common_schema.rb +0 -4
  62. data/lib/view_model/sap_schema_163/rdsap.rb +36 -0
  63. data/lib/view_model/sap_schema_163/sap.rb +36 -0
  64. data/lib/view_model/sap_schema_170/common_schema.rb +32 -0
  65. data/lib/view_model/sap_schema_171/common_schema.rb +32 -0
  66. data/lib/view_model/sap_schema_1800/common_schema.rb +32 -4
  67. data/lib/view_model/sap_schema_ni_112/common_schema.rb +1 -5
  68. data/lib/view_model/sap_schema_ni_112/rdsap.rb +45 -4
  69. data/lib/view_model/sap_schema_ni_112/sap.rb +35 -0
  70. data/lib/view_model/sap_schema_ni_120/common_schema.rb +1 -5
  71. data/lib/view_model/sap_schema_ni_120/rdsap.rb +40 -0
  72. data/lib/view_model/sap_schema_ni_120/sap.rb +36 -0
  73. data/lib/view_model/sap_schema_ni_130/common_schema.rb +1 -5
  74. data/lib/view_model/sap_schema_ni_130/rdsap.rb +40 -0
  75. data/lib/view_model/sap_schema_ni_130/sap.rb +36 -0
  76. data/lib/view_model/sap_schema_ni_140/common_schema.rb +1 -5
  77. data/lib/view_model/sap_schema_ni_140/rdsap.rb +40 -0
  78. data/lib/view_model/sap_schema_ni_140/sap.rb +36 -0
  79. data/lib/view_model/sap_schema_ni_141/common_schema.rb +1 -5
  80. data/lib/view_model/sap_schema_ni_141/rdsap.rb +40 -0
  81. data/lib/view_model/sap_schema_ni_141/sap.rb +36 -0
  82. data/lib/view_model/sap_schema_ni_142/common_schema.rb +1 -5
  83. data/lib/view_model/sap_schema_ni_142/rdsap.rb +40 -0
  84. data/lib/view_model/sap_schema_ni_142/sap.rb +36 -0
  85. data/lib/view_model/sap_schema_ni_150/common_schema.rb +1 -5
  86. data/lib/view_model/sap_schema_ni_150/rdsap.rb +40 -0
  87. data/lib/view_model/sap_schema_ni_150/sap.rb +36 -0
  88. data/lib/view_model/sap_schema_ni_160/common_schema.rb +2 -6
  89. data/lib/view_model/sap_schema_ni_160/rdsap.rb +36 -0
  90. data/lib/view_model/sap_schema_ni_160/sap.rb +36 -0
  91. data/lib/view_model/sap_schema_ni_161/common_schema.rb +1 -5
  92. data/lib/view_model/sap_schema_ni_161/rdsap.rb +36 -0
  93. data/lib/view_model/sap_schema_ni_161/sap.rb +36 -0
  94. data/lib/view_model/sap_schema_ni_170/common_schema.rb +0 -4
  95. data/lib/view_model/sap_schema_ni_170/rdsap.rb +36 -0
  96. data/lib/view_model/sap_schema_ni_170/sap.rb +36 -0
  97. data/lib/view_model/sap_schema_ni_171/common_schema.rb +0 -4
  98. data/lib/view_model/sap_schema_ni_171/rdsap.rb +36 -0
  99. data/lib/view_model/sap_schema_ni_171/sap.rb +36 -0
  100. data/lib/view_model/sap_schema_ni_172/common_schema.rb +0 -4
  101. data/lib/view_model/sap_schema_ni_172/rdsap.rb +44 -0
  102. data/lib/view_model/sap_schema_ni_172/sap.rb +36 -0
  103. data/lib/view_model/sap_schema_ni_173/common_schema.rb +32 -0
  104. data/lib/view_model/sap_schema_ni_174/common_schema.rb +32 -0
  105. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +32 -4
  106. data/lib/view_model/sap_wrapper.rb +4 -0
  107. metadata +4 -2
@@ -15,6 +15,7 @@ module Helper
15
15
  "4" => "Mid-Terrace",
16
16
  "5" => "Enclosed End-Terrace",
17
17
  "6" => "Enclosed Mid-Terrace",
18
+ "7" => "Linked Detached",
18
19
  "NR" => "Not Recorded",
19
20
  }.freeze
20
21
  SAP_ENERGY_TARIFF = {
@@ -31,109 +32,6 @@ module Helper
31
32
  "4" => "dual (24 hour)",
32
33
  "5" => "off-peak 18 hour",
33
34
  }.freeze
34
- RDSAP_MAIN_FUEL = {
35
- "0" =>
36
- "To be used only when there is no heating/hot-water system or data is from a community network",
37
- "1" =>
38
- "mains gas - this is for backwards compatibility only and should not be used",
39
- "2" =>
40
- "LPG - this is for backwards compatibility only and should not be used",
41
- "3" => "bottled LPG",
42
- "4" =>
43
- "oil - this is for backwards compatibility only and should not be used",
44
- "5" => "anthracite",
45
- "6" => "wood logs",
46
- "7" => "bulk wood pellets",
47
- "8" => "wood chips",
48
- "9" => "dual fuel - mineral + wood",
49
- "10" =>
50
- "electricity - this is for backwards compatibility only and should not be used",
51
- "11" =>
52
- "waste combustion - this is for backwards compatibility only and should not be used",
53
- "12" =>
54
- "biomass - this is for backwards compatibility only and should not be used",
55
- "13" =>
56
- "biogas - landfill - this is for backwards compatibility only and should not be used",
57
- "14" =>
58
- "house coal - this is for backwards compatibility only and should not be used",
59
- "15" => "smokeless coal",
60
- "16" => "wood pellets in bags for secondary heating",
61
- "17" => "LPG special condition",
62
- "18" => "B30K (not community)",
63
- "19" => "bioethanol",
64
- "20" => "mains gas (community)",
65
- "21" => "LPG (community)",
66
- "22" => "oil (community)",
67
- "23" => "B30D (community)",
68
- "24" => "coal (community)",
69
- "25" => "electricity (community)",
70
- "26" => "mains gas (not community)",
71
- "27" => "LPG (not community)",
72
- "28" => "oil (not community)",
73
- "29" => "electricity (not community)",
74
- "30" => "waste combustion (community)",
75
- "31" => "biomass (community)",
76
- "32" => "biogas (community)",
77
- "33" => "house coal (not community)",
78
- "34" => "biodiesel from any biomass source",
79
- "35" => "biodiesel from used cooking oil only",
80
- "36" => "biodiesel from vegetable oil only (not community)",
81
- "37" => "appliances able to use mineral oil or liquid biofuel",
82
- "51" => "biogas (not community)",
83
- "56" =>
84
- "heat from boilers that can use mineral oil or biodiesel (community)",
85
- "57" =>
86
- "heat from boilers using biodiesel from any biomass source (community)",
87
- "58" => "biodiesel from vegetable oil only (community)",
88
- "99" => "from heat network data (community)",
89
- }.freeze
90
- SAP_MAIN_FUEL = {
91
- "1" => "Gas: mains gas",
92
- "2" => "Gas: bulk LPG",
93
- "3" => "Gas: bottled LPG",
94
- "4" => "Oil: heating oil",
95
- "7" => "Gas: biogas",
96
- "8" => "LNG",
97
- "9" => "LPG subject to Special Condition 18",
98
- "10" => "Solid fuel: dual fuel appliance (mineral and wood)",
99
- "11" => "Solid fuel: house coal",
100
- "12" => "Solid fuel: manufactured smokeless fuel",
101
- "15" => "Solid fuel: anthracite",
102
- "20" => "Solid fuel: wood logs",
103
- "21" => "Solid fuel: wood chips",
104
- "22" => "Solid fuel: wood pellets (in bags, for secondary heating)",
105
- "23" =>
106
- "Solid fuel: wood pellets (bulk supply in bags, for main heating)",
107
- "36" => "Electricity: electricity sold to grid",
108
- "37" => "Electricity: electricity displaced from grid",
109
- "39" => "Electricity: electricity, unspecified tariff",
110
- "41" => "Community heating schemes: heat from electric heat pump",
111
- "42" => "Community heating schemes: heat from boilers - waste combustion",
112
- "43" => "Community heating schemes: heat from boilers - biomass",
113
- "44" => "Community heating schemes: heat from boilers - biogas",
114
- "45" => "Community heating schemes: waste heat from power stations",
115
- "46" => "Community heating schemes: geothermal heat source",
116
- "48" => "Community heating schemes: heat from CHP",
117
- "49" => "Community heating schemes: electricity generated by CHP",
118
- "50" =>
119
- "Community heating schemes: electricity for pumping in distribution network",
120
- "51" => "Community heating schemes: heat from mains gas",
121
- "52" => "Community heating schemes: heat from LPG",
122
- "53" => "Community heating schemes: heat from oil",
123
- "54" => "Community heating schemes: heat from coal",
124
- "55" => "Community heating schemes: heat from B30D",
125
- "56" =>
126
- "Community heating schemes: heat from boilers that can use mineral oil or biodiesel",
127
- "57" =>
128
- "Community heating schemes: heat from boilers using biodiesel from any biomass source",
129
- "58" => "Community heating schemes: biodiesel from vegetable oil only",
130
- "72" => "biodiesel from used cooking oil only",
131
- "73" => "biodiesel from vegetable oil only",
132
- "74" => "appliances able to use mineral oil or liquid biofuel",
133
- "75" => "B30K",
134
- "76" => "bioethanol from any biomass source",
135
- "99" => "Community heating schemes: special fuel",
136
- }.freeze
137
35
  RDSAP_GLAZED_TYPE = {
138
36
  "1" => "double glazing installed before 2002",
139
37
  "2" => "double glazing installed during or after 2002",
@@ -168,6 +66,7 @@ module Helper
168
66
  "4" =>
169
67
  "rental (private) - this is for backwards compatibility only and should not be used",
170
68
  "5" => "not sale or rental",
69
+ "ni_5" => "None of the above",
171
70
  "6" => "new dwelling",
172
71
  "7" =>
173
72
  "not recorded - this is for backwards compatibility only and should not be used",
@@ -198,6 +97,34 @@ module Helper
198
97
  "0" => "Not applicable",
199
98
  "NR" => "Not recorded",
200
99
  }.freeze
100
+ CONSTRUCTION_AGE_BAND_NI = {
101
+ "A" => "Northern Ireland: before 1919",
102
+ "A-12.0" => "Pre-1900",
103
+ "B" => "Northern Ireland: 1919-1929",
104
+ "B-12.0" => "1900-1929",
105
+ "C" => "Northern Ireland: 1930-1949",
106
+ "C-12.0" => "1930-1949",
107
+ "D" => "Northern Ireland: 1950-1973",
108
+ "D-12.0" => "1950-1966",
109
+ "E" => "Northern Ireland: 1974-1977",
110
+ "E-12.0" => "1967-1975",
111
+ "F" => "Northern Ireland: 1978-1985",
112
+ "F-12.0" => "1976-1982",
113
+ "G" => "Northern Ireland: 1986-1991",
114
+ "G-12.0" => "1983-1990",
115
+ "H" => "Northern Ireland: 1992-1999",
116
+ "H-12.0" => "1991-1995",
117
+ "I" => "Northern Ireland: 2000-2006",
118
+ "I-12.0" => "1996-2002",
119
+ "J" => "Northern Ireland: not applicable",
120
+ "J-12.0" => "2003-2006",
121
+ "K-RdSAP-NI" => "Northern Ireland: 2007-2013",
122
+ "K-SAP-NI" => "Northern Ireland: 2007 onwards",
123
+ "K-12.0" => "Post-2006",
124
+ "L" => "Northern Ireland: 2014 onwards",
125
+ "0" => "Not applicable",
126
+ "NR" => "Not recorded",
127
+ }.freeze
201
128
  PROPERTY_TYPE = {
202
129
  "0" => "House",
203
130
  "1" => "Bungalow",
@@ -227,8 +154,128 @@ module Helper
227
154
  "6" => "Voluntary (No legal requirement for an EPC).",
228
155
  "7" => "Not recorded.",
229
156
  }.freeze
157
+ VENTILATION_TYPE = {
158
+ "1" => "natural with intermittent extract fans",
159
+ "2" => "natural with passive vents",
160
+ "3" => "positive input from loft",
161
+ "4" => "positive input from outside",
162
+ "5" => "mechanical extract, centralised (MEV c)",
163
+ "6" => "mechanical extract, decentralised (MEV dc)",
164
+ "7" => "balanced without heat recovery (MV)",
165
+ "8" => "balanced with heat recovery (MVHR)",
166
+ "9" => "natural with intermittent extract fans and/or passive vents. For backwards compatibility only, do not use.",
167
+ "10" => "natural with intermittent extract fans and passive vents",
168
+ }.freeze
169
+ CYLINDER_INSULATION_THICKNESS = {
170
+ "12" => "12 mm",
171
+ "25" => "25 mm",
172
+ "38" => "38 mm",
173
+ "50" => "50 mm",
174
+ "80" => "80 mm",
175
+ "120" => "120 mm",
176
+ "160" => "160 mm",
177
+ }.freeze
178
+ RDSAP_FUEL_TYPE = {
179
+ "0" => "To be used only when there is no heating/hot-water system or data is from a community network",
180
+ "1" => "mains gas - this is for backwards compatibility only and should not be used",
181
+ "2" => "LPG - this is for backwards compatibility only and should not be used",
182
+ "3" => "bottled LPG",
183
+ "4" => "oil - this is for backwards compatibility only and should not be used",
184
+ "5" => "anthracite",
185
+ "6" => "wood logs",
186
+ "7" => "bulk wood pellets",
187
+ "8" => "wood chips",
188
+ "9" => "dual fuel - mineral + wood",
189
+ "10" => "electricity - this is for backwards compatibility only and should not be used",
190
+ "11" => "waste combustion - this is for backwards compatibility only and should not be used",
191
+ "12" => "biomass - this is for backwards compatibility only and should not be used",
192
+ "13" => "biogas - landfill - this is for backwards compatibility only and should not be used",
193
+ "14" => "house coal - this is for backwards compatibility only and should not be used",
194
+ "15" => "smokeless coal",
195
+ "16" => "wood pellets in bags for secondary heating",
196
+ "17" => "LPG special condition",
197
+ "18" => "B30K (not community)",
198
+ "19" => "bioethanol",
199
+ "20" => "mains gas (community)",
200
+ "21" => "LPG (community)",
201
+ "22" => "oil (community)",
202
+ "23" => "B30D (community)",
203
+ "24" => "coal (community)",
204
+ "25" => "electricity (community)",
205
+ "26" => "mains gas (not community)",
206
+ "27" => "LPG (not community)",
207
+ "28" => "oil (not community)",
208
+ "29" => "electricity (not community)",
209
+ "30" => "waste combustion (community)",
210
+ "31" => "biomass (community)",
211
+ "32" => "biogas (community)",
212
+ "33" => "house coal (not community)",
213
+ "34" => "biodiesel from any biomass source",
214
+ "35" => "biodiesel from used cooking oil only",
215
+ "36" => "biodiesel from vegetable oil only (not community)",
216
+ "36-rapeseed-oil" => "rapeseed oil",
217
+ "37" => "appliances able to use mineral oil or liquid biofuel",
218
+ "51" => "biogas (not community)",
219
+ "56" => "heat from boilers that can use mineral oil or biodiesel (community)",
220
+ "57" => "heat from boilers using biodiesel from any biomass source (community)",
221
+ "58" => "biodiesel from vegetable oil only (community)",
222
+ "99" => "from heat network data (community)",
223
+ }.freeze
224
+ RDSAP_FUEL_TYPE_PRE_143 = {
225
+ "1-pre14.3-sap" => "mains gas",
226
+ "4-pre14.3-sap" => "oil",
227
+ "10-pre14.3-sap" => "electricity",
228
+ "11-pre14.3-sap" => "waste combustion",
229
+ "12-pre14.3-sap" => "biomass",
230
+ "13-pre14.3-sap" => "biogas - landfill",
231
+ "14-pre14.3-sap" => "house coal",
232
+ }.freeze
233
+ SAP_FUEL_TYPE = {
234
+ "1" => "Gas: mains gas",
235
+ "2" => "Gas: bulk LPG",
236
+ "3" => "Gas: bottled LPG",
237
+ "4" => "Oil: heating oil",
238
+ "7" => "Gas: biogas",
239
+ "8" => "LNG",
240
+ "9" => "LPG subject to Special Condition 18",
241
+ "10" => "Solid fuel: dual fuel appliance (mineral and wood)",
242
+ "11" => "Solid fuel: house coal",
243
+ "12" => "Solid fuel: manufactured smokeless fuel",
244
+ "15" => "Solid fuel: anthracite",
245
+ "20" => "Solid fuel: wood logs",
246
+ "21" => "Solid fuel: wood chips",
247
+ "22" => "Solid fuel: wood pellets (in bags, for secondary heating)",
248
+ "23" => "Solid fuel: wood pellets (bulk supply in bags, for main heating)",
249
+ "36" => "Electricity: electricity sold to grid",
250
+ "37" => "Electricity: electricity displaced from grid",
251
+ "39" => "Electricity: electricity, unspecified tariff",
252
+ "41" => "Community heating schemes: heat from electric heat pump",
253
+ "42" => "Community heating schemes: heat from boilers - waste combustion",
254
+ "43" => "Community heating schemes: heat from boilers - biomass",
255
+ "44" => "Community heating schemes: heat from boilers - biogas",
256
+ "45" => "Community heating schemes: waste heat from power stations",
257
+ "46" => "Community heating schemes: geothermal heat source",
258
+ "48" => "Community heating schemes: heat from CHP",
259
+ "49" => "Community heating schemes: electricity generated by CHP",
260
+ "50" => "Community heating schemes: electricity for pumping in distribution network",
261
+ "51" => "Community heating schemes: heat from mains gas",
262
+ "52" => "Community heating schemes: heat from LPG",
263
+ "53" => "Community heating schemes: heat from oil",
264
+ "54" => "Community heating schemes: heat from coal",
265
+ "55" => "Community heating schemes: heat from B30D",
266
+ "56" => "Community heating schemes: heat from boilers that can use mineral oil or biodiesel",
267
+ "57" => "Community heating schemes: heat from boilers using biodiesel from any biomass source",
268
+ "58" => "Community heating schemes: biodiesel from vegetable oil only",
269
+ "71" => "biodiesel from any biomass source",
270
+ "72" => "biodiesel from used cooking oil only",
271
+ "73" => "biodiesel from vegetable oil only",
272
+ "74" => "appliances able to use mineral oil or liquid biofuel",
273
+ "75" => "B30K",
274
+ "76" => "bioethanol from any biomass source",
275
+ "99" => "Community heating schemes: special fuel",
276
+ }.freeze
230
277
 
231
- def self.xml_value_to_string(number)
278
+ def self.built_form_string(number)
232
279
  BUILT_FORM[number]
233
280
  end
234
281
 
@@ -236,23 +283,16 @@ module Helper
236
283
  RATINGS[value]
237
284
  end
238
285
 
239
- def self.energy_tariff(value, report_type = "2")
240
- case report_type.to_s
241
- when "3"
286
+ def self.energy_tariff(value, report_type)
287
+ if is_sap(report_type)
242
288
  SAP_ENERGY_TARIFF[value] || value
243
- when "2"
289
+ elsif is_rdsap(report_type)
244
290
  RDSAP_ENERGY_TARIFF[value] || value
291
+ else
292
+ value
245
293
  end
246
294
  end
247
295
 
248
- def self.main_fuel_rdsap(value)
249
- RDSAP_MAIN_FUEL[value]
250
- end
251
-
252
- def self.main_fuel_sap(value)
253
- SAP_MAIN_FUEL[value]
254
- end
255
-
256
296
  def self.glazed_area_rdsap(value)
257
297
  RDSAP_GLAZED_AREA[value]
258
298
  end
@@ -265,15 +305,32 @@ module Helper
265
305
  TENURE[value] || value
266
306
  end
267
307
 
268
- def self.transaction_type(value, report_type = "2")
269
- if report_type.to_s == "2" && value.to_i >= 12
308
+ def self.transaction_type(value, report_type = "2", schema_type = "")
309
+ types_of_ni = %w[
310
+ RdSAP-Schema-NI-20.0.0
311
+ RdSAP-Schema-NI-19.0
312
+ RdSAP-Schema-NI-18.0
313
+ RdSAP-Schema-NI-17.4
314
+ RdSAP-Schema-NI-17.3
315
+ SAP-Schema-NI-16.1
316
+ SAP-Schema-NI-17.0
317
+ SAP-Schema-NI-17.1
318
+ SAP-Schema-NI-17.2
319
+ SAP-Schema-NI-17.3
320
+ SAP-Schema-NI-17.4
321
+ SAP-Schema-NI-18.0.0
322
+ ]
323
+
324
+ if is_rdsap(report_type) && value.to_i >= 12
270
325
  TRANSACTION_TYPE["#{value}RdSAP"]
326
+ elsif types_of_ni.include?(schema_type) && value.to_i == 5
327
+ TRANSACTION_TYPE["ni_5"]
271
328
  else
272
329
  TRANSACTION_TYPE[value] || value
273
330
  end
274
331
  end
275
332
 
276
- def self.construction_age_band_lookup(value, schema_type, report_type = 0)
333
+ def self.construction_age_band_lookup(value, schema_type, report_type)
277
334
  types_of_sap_pre17 = %w[
278
335
  SAP-Schema-16.3
279
336
  SAP-Schema-16.2
@@ -298,11 +355,6 @@ module Helper
298
355
  RdSAP-Schema-18.0
299
356
  RdSAP-Schema-17.1
300
357
  RdSAP-Schema-17.0
301
- RdSAP-Schema-NI-20.0.0
302
- RdSAP-Schema-NI-19.0
303
- RdSAP-Schema-NI-18.0
304
- RdSAP-Schema-NI-17.4
305
- RdSAP-Schema-NI-17.3
306
358
  ]
307
359
 
308
360
  schemes_that_use_l = %w[
@@ -314,11 +366,6 @@ module Helper
314
366
  RdSAP-Schema-18.0
315
367
  RdSAP-Schema-17.1
316
368
  RdSAP-Schema-17.0
317
- RdSAP-Schema-NI-20.0.0
318
- RdSAP-Schema-NI-19.0
319
- RdSAP-Schema-NI-18.0
320
- RdSAP-Schema-NI-17.4
321
- RdSAP-Schema-NI-17.3
322
369
  ]
323
370
 
324
371
  schemes_that_use_0 = %w[
@@ -337,6 +384,25 @@ module Helper
337
384
  RdSAP-Schema-18.0
338
385
  RdSAP-Schema-17.1
339
386
  RdSAP-Schema-17.0
387
+ ]
388
+
389
+ sap_schemas_ni = %w[
390
+ SAP-Schema-NI-18.0.0
391
+ SAP-Schema-NI-17.4
392
+ SAP-Schema-NI-17.3
393
+ SAP-Schema-NI-17.2
394
+ SAP-Schema-NI-17.1
395
+ SAP-Schema-NI-17.0
396
+ SAP-Schema-NI-16.1
397
+ SAP-Schema-NI-16.0
398
+ SAP-Schema-NI-15.0
399
+ SAP-Schema-NI-14.2
400
+ SAP-Schema-NI-14.1
401
+ SAP-Schema-NI-14.0
402
+ SAP-Schema-NI-13.0
403
+ ]
404
+
405
+ rdsap_schemas_ni = %w[
340
406
  RdSAP-Schema-NI-20.0.0
341
407
  RdSAP-Schema-NI-19.0
342
408
  RdSAP-Schema-NI-18.0
@@ -344,7 +410,29 @@ module Helper
344
410
  RdSAP-Schema-NI-17.3
345
411
  ]
346
412
 
347
- if value == "K" && schema_type == "SAP-Schema-12.0" && report_type == 2
413
+ ni_schemas_pre_12 = %w[
414
+ SAP-Schema-NI-12.0
415
+ SAP-Schema-NI-11.2
416
+ ]
417
+
418
+ if value == "K" && rdsap_schemas_ni.include?(schema_type)
419
+ return CONSTRUCTION_AGE_BAND_NI["K-RdSAP-NI"]
420
+ end
421
+
422
+ if value == "K" && sap_schemas_ni.include?(schema_type)
423
+ return CONSTRUCTION_AGE_BAND_NI["K-SAP-NI"]
424
+ end
425
+
426
+ if ni_schemas_pre_12.include?(schema_type)
427
+ key = (value == "0" ? value : "#{value}-12.0")
428
+ return CONSTRUCTION_AGE_BAND_NI[key]
429
+ end
430
+
431
+ if sap_schemas_ni.include?(schema_type) || rdsap_schemas_ni.include?(schema_type)
432
+ return CONSTRUCTION_AGE_BAND_NI[value]
433
+ end
434
+
435
+ if value == "K" && schema_type == "SAP-Schema-12.0" && is_rdsap(report_type)
348
436
  return CONSTRUCTION_AGE_BAND["K-12.0"]
349
437
  end
350
438
 
@@ -353,15 +441,14 @@ module Helper
353
441
  end
354
442
 
355
443
  if value == "NR" &&
356
- !schemes_that_use_not_recorded.include?(schema_type) ||
357
- report_type == 3
444
+ (!schemes_that_use_not_recorded.include?(schema_type) || is_sap(report_type))
358
445
  return value
359
446
  end
360
447
 
361
448
  return value if value == "L" && !schemes_that_use_l.include?(schema_type)
362
449
 
363
- if value == "0" && !schemes_that_use_0.include?(schema_type) ||
364
- report_type == 3
450
+ if value == "0" &&
451
+ (!schemes_that_use_0.include?(schema_type) || is_sap(report_type))
365
452
  return value
366
453
  end
367
454
 
@@ -376,14 +463,15 @@ module Helper
376
463
  HEAT_LOSS_CORRIDOR[value] || value
377
464
  end
378
465
 
379
- def self.mechanical_ventilation(value, schema_type, report_type = 0)
466
+ def self.mechanical_ventilation(value, schema_type, report_type)
380
467
  types_of_sap_pre12 = %w[
381
468
  SAP-Schema-11.2
382
469
  SAP-Schema-11.0
383
470
  SAP-Schema-10.2
471
+ SAP-Schema-NI-11.2
384
472
  ].freeze
385
473
 
386
- if types_of_sap_pre12.include?(schema_type) && report_type == 2
474
+ if types_of_sap_pre12.include?(schema_type.to_s) && is_rdsap(report_type)
387
475
  return MECHANICAL_VENTILATION["#{value}-pre12.0"]
388
476
  end
389
477
 
@@ -393,5 +481,137 @@ module Helper
393
481
  def self.cepc_transaction_type(value)
394
482
  CEPC_TRANSACTION_TYPE[value] || value
395
483
  end
484
+
485
+ def self.cylinder_insulation_thickness(value, report_type = "2")
486
+ if is_rdsap(report_type)
487
+ CYLINDER_INSULATION_THICKNESS[value]
488
+ else
489
+ value
490
+ end
491
+ end
492
+
493
+ def self.is_rdsap(report_type)
494
+ report_type == "2"
495
+ end
496
+
497
+ def self.is_sap(report_type)
498
+ report_type == "3"
499
+ end
500
+
501
+ def self.ventilation_type(value, schema_type = "")
502
+ ni_sap = %w[
503
+ SAP-Schema-NI-16.1
504
+ SAP-Schema-NI-16.0
505
+ SAP-Schema-NI-15.0
506
+ SAP-Schema-NI-14.2
507
+ SAP-Schema-NI-14.1
508
+ SAP-Schema-NI-14.0
509
+ SAP-Schema-NI-13.0
510
+ ].freeze
511
+
512
+ if ni_sap.include?(schema_type) && value == "9"
513
+ VENTILATION_TYPE[value].split(".").first
514
+ else
515
+ VENTILATION_TYPE[value]
516
+ end
517
+ end
518
+
519
+ def self.fuel_type(value, schema_type = "", report_type = "2")
520
+ rdsap = %i[
521
+ RdSAP-Schema-20.0.0
522
+ RdSAP-Schema-19.0
523
+ RdSAP-Schema-18.0
524
+ RdSAP-Schema-17.1
525
+ RdSAP-Schema-17.0
526
+ RdSAP-Schema-NI-20.0.0
527
+ RdSAP-Schema-NI-19.0
528
+ RdSAP-Schema-NI-18.0
529
+ RdSAP-Schema-NI-17.4
530
+ RdSAP-Schema-NI-17.3
531
+ ]
532
+
533
+ pre143_sap = %i[
534
+ SAP-Schema-14.2
535
+ SAP-Schema-14.1
536
+ SAP-Schema-14.0
537
+ SAP-Schema-13.0
538
+ SAP-Schema-12.0
539
+ SAP-Schema-11.2
540
+ SAP-Schema-11.0
541
+ SAP-Schema-10.2
542
+ SAP-Schema-NI-14.2
543
+ SAP-Schema-NI-14.1
544
+ SAP-Schema-NI-14.0
545
+ SAP-Schema-NI-13.0
546
+ SAP-Schema-NI-12.0
547
+ SAP-Schema-NI-11.2
548
+ ]
549
+
550
+ includes_rapeseed_oil = %i[
551
+ SAP-Schema-16.3
552
+ SAP-Schema-16.2
553
+ SAP-Schema-16.1
554
+ SAP-Schema-16.0
555
+ SAP-Schema-15.0
556
+ SAP-Schema-NI-17.2
557
+ SAP-Schema-NI-17.1
558
+ SAP-Schema-NI-17.0
559
+ SAP-Schema-NI-16.1
560
+ SAP-Schema-NI-16.0
561
+ SAP-Schema-NI-15.0
562
+ ]
563
+
564
+ sap = %i[
565
+ SAP-Schema-18.0.0
566
+ SAP-Schema-17.1
567
+ SAP-Schema-17.0
568
+ SAP-Schema-16.3
569
+ SAP-Schema-16.2
570
+ SAP-Schema-16.1
571
+ SAP-Schema-16.0
572
+ SAP-Schema-15.0
573
+ SAP-Schema-14.2
574
+ SAP-Schema-14.1
575
+ SAP-Schema-14.0
576
+ SAP-Schema-13.0
577
+ SAP-Schema-12.0
578
+ SAP-Schema-11.2
579
+ SAP-Schema-11.0
580
+ SAP-Schema-10.2
581
+ SAP-Schema-NI-18.0.0
582
+ SAP-Schema-NI-17.4
583
+ SAP-Schema-NI-17.3
584
+ SAP-Schema-NI-17.2
585
+ SAP-Schema-NI-17.1
586
+ SAP-Schema-NI-17.0
587
+ SAP-Schema-NI-16.1
588
+ SAP-Schema-NI-16.0
589
+ SAP-Schema-NI-15.0
590
+ SAP-Schema-NI-14.2
591
+ SAP-Schema-NI-14.1
592
+ SAP-Schema-NI-14.0
593
+ SAP-Schema-NI-13.0
594
+ SAP-Schema-NI-12.0
595
+ SAP-Schema-NI-11.2
596
+ ]
597
+
598
+ if rdsap.include?(schema_type)
599
+ RDSAP_FUEL_TYPE[value]
600
+ elsif sap.include?(schema_type) && is_sap(report_type)
601
+ SAP_FUEL_TYPE[value]
602
+ elsif sap.include?(schema_type) && is_rdsap(report_type)
603
+ if includes_rapeseed_oil.include?(schema_type) && value == "36"
604
+ return RDSAP_FUEL_TYPE["#{value}-rapeseed-oil"]
605
+ end
606
+
607
+ if pre143_sap.include?(schema_type)
608
+ RDSAP_FUEL_TYPE_PRE_143["#{value}-pre14.3-sap"] || RDSAP_FUEL_TYPE[value]
609
+ else
610
+ RDSAP_FUEL_TYPE[value]
611
+ end
612
+ end
613
+ end
614
+
615
+ private_class_method :is_rdsap, :is_sap
396
616
  end
397
617
  end
@@ -7,7 +7,7 @@ module Presenter::Export
7
7
  view[:assessment_id] = @view_model.assessment_id
8
8
  view[:assessor] = assessor
9
9
  view[:built_form] =
10
- enum_value(:xml_value_to_string, @view_model.built_form)
10
+ enum_value(:built_form_string, @view_model.built_form)
11
11
  view[:co2_emissions_current_per_floor_area] =
12
12
  @view_model.co2_emissions_current_per_floor_area.to_i
13
13
  view[:construction_age_band] =