epb_view_models 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/api/schemas/xml/RdSAP-Schema-NI-19.0/RdSAP/Templates/EPC-CollectedData.xsd +13 -12
  4. data/lib/epb_view_models.rb +1 -1
  5. data/lib/helper/energy_band_calculator.rb +1 -1
  6. data/lib/helper/xml_enums_to_output.rb +264 -114
  7. data/lib/presenter/export/domestic.rb +1 -1
  8. data/lib/presenter/rd_sap/report.rb +21 -11
  9. data/lib/presenter/sap/report.rb +19 -7
  10. data/lib/presenter/sap/summary.rb +1 -1
  11. data/lib/view_model/domestic_epc_view_model.rb +4 -0
  12. data/lib/view_model/rd_sap_schema_200/common_schema.rb +0 -4
  13. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +0 -4
  14. data/lib/view_model/sap_schema_102/common_schema.rb +5 -6
  15. data/lib/view_model/sap_schema_102/rdsap.rb +4 -0
  16. data/lib/view_model/sap_schema_110/common_schema.rb +0 -4
  17. data/lib/view_model/sap_schema_110/rdsap.rb +8 -0
  18. data/lib/view_model/sap_schema_110/sap.rb +8 -0
  19. data/lib/view_model/sap_schema_112/common_schema.rb +0 -4
  20. data/lib/view_model/sap_schema_112/rdsap.rb +8 -0
  21. data/lib/view_model/sap_schema_112/sap.rb +8 -0
  22. data/lib/view_model/sap_schema_120/common_schema.rb +0 -4
  23. data/lib/view_model/sap_schema_120/rdsap.rb +8 -0
  24. data/lib/view_model/sap_schema_120/sap.rb +8 -0
  25. data/lib/view_model/sap_schema_130/common_schema.rb +0 -4
  26. data/lib/view_model/sap_schema_130/rdsap.rb +8 -0
  27. data/lib/view_model/sap_schema_130/sap.rb +8 -0
  28. data/lib/view_model/sap_schema_140/common_schema.rb +0 -4
  29. data/lib/view_model/sap_schema_140/rdsap.rb +8 -0
  30. data/lib/view_model/sap_schema_140/sap.rb +8 -0
  31. data/lib/view_model/sap_schema_141/common_schema.rb +0 -4
  32. data/lib/view_model/sap_schema_141/rdsap.rb +8 -0
  33. data/lib/view_model/sap_schema_141/sap.rb +8 -0
  34. data/lib/view_model/sap_schema_142/common_schema.rb +0 -4
  35. data/lib/view_model/sap_schema_142/rdsap.rb +8 -0
  36. data/lib/view_model/sap_schema_142/sap.rb +8 -0
  37. data/lib/view_model/sap_schema_150/common_schema.rb +0 -4
  38. data/lib/view_model/sap_schema_150/rdsap.rb +8 -0
  39. data/lib/view_model/sap_schema_150/sap.rb +8 -0
  40. data/lib/view_model/sap_schema_160/common_schema.rb +0 -4
  41. data/lib/view_model/sap_schema_160/rdsap.rb +8 -0
  42. data/lib/view_model/sap_schema_160/sap.rb +8 -0
  43. data/lib/view_model/sap_schema_161/common_schema.rb +0 -4
  44. data/lib/view_model/sap_schema_161/rdsap.rb +8 -0
  45. data/lib/view_model/sap_schema_161/sap.rb +8 -0
  46. data/lib/view_model/sap_schema_162/common_schema.rb +0 -4
  47. data/lib/view_model/sap_schema_162/rdsap.rb +8 -0
  48. data/lib/view_model/sap_schema_162/sap.rb +8 -0
  49. data/lib/view_model/sap_schema_163/common_schema.rb +0 -4
  50. data/lib/view_model/sap_schema_163/rdsap.rb +8 -0
  51. data/lib/view_model/sap_schema_163/sap.rb +8 -0
  52. data/lib/view_model/sap_schema_170/common_schema.rb +4 -0
  53. data/lib/view_model/sap_schema_171/common_schema.rb +4 -0
  54. data/lib/view_model/sap_schema_1800/common_schema.rb +4 -4
  55. data/lib/view_model/sap_schema_ni_112/common_schema.rb +1 -5
  56. data/lib/view_model/sap_schema_ni_112/rdsap.rb +13 -0
  57. data/lib/view_model/sap_schema_ni_112/sap.rb +8 -0
  58. data/lib/view_model/sap_schema_ni_120/common_schema.rb +1 -5
  59. data/lib/view_model/sap_schema_ni_120/rdsap.rb +8 -0
  60. data/lib/view_model/sap_schema_ni_120/sap.rb +8 -0
  61. data/lib/view_model/sap_schema_ni_130/common_schema.rb +1 -5
  62. data/lib/view_model/sap_schema_ni_130/rdsap.rb +8 -0
  63. data/lib/view_model/sap_schema_ni_130/sap.rb +8 -0
  64. data/lib/view_model/sap_schema_ni_140/common_schema.rb +1 -5
  65. data/lib/view_model/sap_schema_ni_140/rdsap.rb +8 -0
  66. data/lib/view_model/sap_schema_ni_140/sap.rb +8 -0
  67. data/lib/view_model/sap_schema_ni_141/common_schema.rb +1 -5
  68. data/lib/view_model/sap_schema_ni_141/rdsap.rb +8 -0
  69. data/lib/view_model/sap_schema_ni_141/sap.rb +8 -0
  70. data/lib/view_model/sap_schema_ni_142/common_schema.rb +1 -5
  71. data/lib/view_model/sap_schema_ni_142/rdsap.rb +8 -0
  72. data/lib/view_model/sap_schema_ni_142/sap.rb +8 -0
  73. data/lib/view_model/sap_schema_ni_150/common_schema.rb +1 -5
  74. data/lib/view_model/sap_schema_ni_150/rdsap.rb +8 -0
  75. data/lib/view_model/sap_schema_ni_150/sap.rb +8 -0
  76. data/lib/view_model/sap_schema_ni_160/common_schema.rb +0 -4
  77. data/lib/view_model/sap_schema_ni_160/rdsap.rb +8 -0
  78. data/lib/view_model/sap_schema_ni_160/sap.rb +8 -0
  79. data/lib/view_model/sap_schema_ni_161/common_schema.rb +0 -4
  80. data/lib/view_model/sap_schema_ni_161/rdsap.rb +8 -0
  81. data/lib/view_model/sap_schema_ni_161/sap.rb +8 -0
  82. data/lib/view_model/sap_schema_ni_170/common_schema.rb +0 -4
  83. data/lib/view_model/sap_schema_ni_170/rdsap.rb +8 -0
  84. data/lib/view_model/sap_schema_ni_170/sap.rb +8 -0
  85. data/lib/view_model/sap_schema_ni_171/common_schema.rb +0 -4
  86. data/lib/view_model/sap_schema_ni_171/rdsap.rb +8 -0
  87. data/lib/view_model/sap_schema_ni_171/sap.rb +8 -0
  88. data/lib/view_model/sap_schema_ni_172/common_schema.rb +0 -4
  89. data/lib/view_model/sap_schema_ni_172/rdsap.rb +8 -0
  90. data/lib/view_model/sap_schema_ni_172/sap.rb +8 -0
  91. data/lib/view_model/sap_schema_ni_173/common_schema.rb +4 -0
  92. data/lib/view_model/sap_schema_ni_174/common_schema.rb +4 -0
  93. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +4 -4
  94. metadata +2 -3
  95. data/.DS_Store +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80efe4147a186423dd6099c2c495e7f694580511670d9ee054257ddce5e887b8
4
- data.tar.gz: 51c6e4233b76f4a3959e73b9e8a2b01dd8d2ede3a363c1e292df66b2ee8c18eb
3
+ metadata.gz: feafa754037d1b8749e1e9b5a7308641da5870f851529cf3377078e51da48687
4
+ data.tar.gz: bd830849348a8cee04b84c565458211c28a50c31caf420b0cd407d6655a17602
5
5
  SHA512:
6
- metadata.gz: 88e7eb835ea70699291c21118ef0cab44da3e4423dff5032f1d9804b1d55f1014b90afc01ace5ba5bb4681bee1fd0e94e49c3b7095edef5eed2bc2940029a5e2
7
- data.tar.gz: a1accb23c50fab70d6404edf6f01e2ee8fb544b276b825f949df758471dd270b8887f90ff4e10fd9593373a2d0e14e0da4e719bb832e4be4550c877520db610c
6
+ metadata.gz: 0f1210802f8694ba26463bc14b321b4e97b242af4ea69dc8b4a1d6409568cec9383f12b36104c572d760cdf1c6f1ab3aed00e6fb89e5e7efda142fe1e9322a06
7
+ data.tar.gz: 51d788026927bbab0d9ad3def044e8f56b0a986fae552f2c550810ea2649f49638b144621743353daf8cf56f4a713bd23b8071c2487fbb8edc035b33c49f8db3
data/.gitignore CHANGED
@@ -6,7 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- .DS_Store
9
+ **/.DS_Store
10
10
  dump.rdb
11
11
 
12
12
  # rspec failure tracking
@@ -1,5 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <xs:schema xmlns="http://www.epbniregister.com/xsd/rdsap" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.epbniregister.com/xsd/rdsap" elementFormDefault="qualified" attributeFormDefault="unqualified" version="LIG-NI-19.0">
2
+ <xs:schema xmlns="http://www.epbniregister.com/xsd/rdsap" xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
+ targetNamespace="http://www.epbniregister.com/xsd/rdsap" elementFormDefault="qualified" attributeFormDefault="unqualified" version="LIG-NI-19.0">
3
4
  <xs:include schemaLocation="../UDT/SAP-Domains.xsd"/>
4
5
  <xs:element name="SAP-Data" type="SAP-Data"/>
5
6
  <xs:complexType name="SAP-Data">
@@ -17,7 +18,7 @@
17
18
  <xs:annotation>
18
19
  <xs:documentation>The building type of the Property e.g. Detached, Semi-Detached, Terrace etc.
19
20
 
20
- Together with the Property Type, the Build Form produces a structured description of the property.</xs:documentation>
21
+ Together with the Property Type, the Build Form produces a structured description of the property.</xs:documentation>
21
22
  </xs:annotation>
22
23
  </xs:element>
23
24
  <xs:element name="Multiple-Glazed-Proportion" type="Percentage" minOccurs="0">
@@ -48,9 +49,9 @@ Together with the Property Type, the Build Form produces a structured descriptio
48
49
  </xs:element>
49
50
  <xs:element name="Habitable-Room-Count" type="Count">
50
51
  <xs:annotation>
51
- <xs:documentation>Count of the number of habitable rooms within the property.
52
+ <xs:documentation>Count of the number of habitable rooms within the property.
52
53
 
53
- This is the number of Reception Rooms (including Living Rooms, Sitting Rooms, Dining Rooms), Bedrooms, Study and similar rooms but excludes hall, stairs, kitchen, utility rooms, bathrooms, cloakrooms, en-suites and similar rooms.</xs:documentation>
54
+ This is the number of Reception Rooms (including Living Rooms, Sitting Rooms, Dining Rooms), Bedrooms, Study and similar rooms but excludes hall, stairs, kitchen, utility rooms, bathrooms, cloakrooms, en-suites and similar rooms.</xs:documentation>
54
55
  </xs:annotation>
55
56
  </xs:element>
56
57
  <xs:element name="Heated-Room-Count" type="Count">
@@ -82,14 +83,14 @@ This is the number of Reception Rooms (including Living Rooms, Sitting Rooms, Di
82
83
  <xs:annotation>
83
84
  <xs:documentation>The number of Open Fireplaces in the Property.
84
85
 
85
- An Open Fireplace is a fireplace that still allows air to pass between the inside of the Property and the outside.</xs:documentation>
86
+ An Open Fireplace is a fireplace that still allows air to pass between the inside of the Property and the outside.</xs:documentation>
86
87
  </xs:annotation>
87
88
  </xs:element>
88
89
  <xs:element name="Property-Type" type="PropertyTypeCode">
89
90
  <xs:annotation>
90
91
  <xs:documentation>Describes the type of property such as House, Flat, Mansion, Maisonette etc.
91
92
 
92
- This is actually the type differentiator for Property but only a limited number of property types, notably Apartment and Apartment Block, have any specific characteristics and warrant their own definition.</xs:documentation>
93
+ This is actually the type differentiator for Property but only a limited number of property types, notably Apartment and Apartment Block, have any specific characteristics and warrant their own definition.</xs:documentation>
93
94
  </xs:annotation>
94
95
  </xs:element>
95
96
  <xs:element name="Solar-Water-Heating" type="Flag">
@@ -191,8 +192,8 @@ This is actually the type differentiator for Property but only a limited number
191
192
  <xs:annotation>
192
193
  <xs:documentation>Details of the significant building parts that comprise the main habitable building in the property. The main habitable area generally consists of a single main building but can over time be extended to include extensions such as new wings and additional storeys.
193
194
 
194
- For the purpose of calculating the overall Energy Assessment for the property details of each distinct Building Part, such as its construction, have to be gathered because different materials have different insulation ratings (obviously) which affects the overall rating.
195
- </xs:documentation>
195
+ For the purpose of calculating the overall Energy Assessment for the property details of each distinct Building Part, such as its construction, have to be gathered because different materials have different insulation ratings (obviously) which affects the overall rating.
196
+ </xs:documentation>
196
197
  </xs:annotation>
197
198
  <xs:sequence>
198
199
  <xs:element name="SAP-Integral-Conservatory" type="SAP-Integral-Conservatory" minOccurs="0"/>
@@ -564,7 +565,7 @@ For the purpose of calculating the overall Energy Assessment for the property de
564
565
  <xs:complexType name="SAP-Deselected-Improvements">
565
566
  <xs:annotation>
566
567
  <xs:documentation>There are 22 possible improvement measures, designated from A to V. This must record measures deselected by DEA
567
- (A to V is the full set, only E, N, U and V are considered at the moment for new build).</xs:documentation>
568
+ (A to V is the full set, only E, N, U and V are considered at the moment for new build).</xs:documentation>
568
569
  </xs:annotation>
569
570
  <xs:sequence>
570
571
  <xs:element name="Deselected-Improvement-Measure" type="SAP-ImprovementMeasureCode" maxOccurs="unbounded"/>
@@ -674,7 +675,7 @@ For the purpose of calculating the overall Energy Assessment for the property de
674
675
  <xs:element name="Emitter-Temperature" type="EmitterTemperatureCode" minOccurs="0">
675
676
  <xs:annotation>
676
677
  <xs:documentation>0, 1, 3 or 4 applicable to condensing boilers and heat pumps.
677
- Other systems NA.</xs:documentation>
678
+ Other systems NA.</xs:documentation>
678
679
  </xs:annotation>
679
680
  </xs:element>
680
681
  <xs:element name="MCS-Installed-Heat-Pump" type="xs:boolean" minOccurs="0">
@@ -716,7 +717,7 @@ Other systems NA.</xs:documentation>
716
717
  <xs:element name="Peak-Power" type="Measurement">
717
718
  <xs:annotation>
718
719
  <xs:documentation>Peak kW of photovoltaics (PVs) (kWp).
719
- If the total peak power has been apportioned between different dwellings within the same building, this is the kWp ascribed to the dwelling being assessed.</xs:documentation>
720
+ If the total peak power has been apportioned between different dwellings within the same building, this is the kWp ascribed to the dwelling being assessed.</xs:documentation>
720
721
  </xs:annotation>
721
722
  </xs:element>
722
723
  <xs:element name="Orientation" type="SAP-CompassDirectionCode">
@@ -1032,4 +1033,4 @@ If the total peak power has been apportioned between different dwellings within
1032
1033
  </xs:element>
1033
1034
  </xs:sequence>
1034
1035
  </xs:complexType>
1035
- </xs:schema>
1036
+ </xs:schema>
@@ -5,7 +5,7 @@ loader = Zeitwerk::Loader.for_gem
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "1.0.3"
8
+ VERSION = "1.0.4"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -21,7 +21,7 @@ module Helper
21
21
 
22
22
  def self.commercial(number)
23
23
  case number
24
- when proc { |n| n <= 0 }
24
+ when proc { |n| n <= -1 }
25
25
  "a+"
26
26
  when 0..25
27
27
  "a"
@@ -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",
@@ -227,8 +126,128 @@ module Helper
227
126
  "6" => "Voluntary (No legal requirement for an EPC).",
228
127
  "7" => "Not recorded.",
229
128
  }.freeze
129
+ VENTILATION_TYPE = {
130
+ "1" => "natural with intermittent extract fans",
131
+ "2" => "natural with passive vents",
132
+ "3" => "positive input from loft",
133
+ "4" => "positive input from outside",
134
+ "5" => "mechanical extract, centralised (MEV c)",
135
+ "6" => "mechanical extract, decentralised (MEV dc)",
136
+ "7" => "balanced without heat recovery (MV)",
137
+ "8" => "balanced with heat recovery (MVHR)",
138
+ "9" => "natural with intermittent extract fans and/or passive vents. For backwards compatibility only, do not use.",
139
+ "10" => "natural with intermittent extract fans and passive vents",
140
+ }.freeze
141
+ CYLINDER_INSULATION_THICKNESS = {
142
+ "12" => "12 mm",
143
+ "25" => "25 mm",
144
+ "38" => "38 mm",
145
+ "50" => "50 mm",
146
+ "80" => "80 mm",
147
+ "120" => "120 mm",
148
+ "160" => "160 mm",
149
+ }.freeze
150
+ RDSAP_FUEL_TYPE = {
151
+ "0" => "To be used only when there is no heating/hot-water system or data is from a community network",
152
+ "1" => "mains gas - this is for backwards compatibility only and should not be used",
153
+ "2" => "LPG - this is for backwards compatibility only and should not be used",
154
+ "3" => "bottled LPG",
155
+ "4" => "oil - this is for backwards compatibility only and should not be used",
156
+ "5" => "anthracite",
157
+ "6" => "wood logs",
158
+ "7" => "bulk wood pellets",
159
+ "8" => "wood chips",
160
+ "9" => "dual fuel - mineral + wood",
161
+ "10" => "electricity - this is for backwards compatibility only and should not be used",
162
+ "11" => "waste combustion - this is for backwards compatibility only and should not be used",
163
+ "12" => "biomass - this is for backwards compatibility only and should not be used",
164
+ "13" => "biogas - landfill - this is for backwards compatibility only and should not be used",
165
+ "14" => "house coal - this is for backwards compatibility only and should not be used",
166
+ "15" => "smokeless coal",
167
+ "16" => "wood pellets in bags for secondary heating",
168
+ "17" => "LPG special condition",
169
+ "18" => "B30K (not community)",
170
+ "19" => "bioethanol",
171
+ "20" => "mains gas (community)",
172
+ "21" => "LPG (community)",
173
+ "22" => "oil (community)",
174
+ "23" => "B30D (community)",
175
+ "24" => "coal (community)",
176
+ "25" => "electricity (community)",
177
+ "26" => "mains gas (not community)",
178
+ "27" => "LPG (not community)",
179
+ "28" => "oil (not community)",
180
+ "29" => "electricity (not community)",
181
+ "30" => "waste combustion (community)",
182
+ "31" => "biomass (community)",
183
+ "32" => "biogas (community)",
184
+ "33" => "house coal (not community)",
185
+ "34" => "biodiesel from any biomass source",
186
+ "35" => "biodiesel from used cooking oil only",
187
+ "36" => "biodiesel from vegetable oil only (not community)",
188
+ "36-rapeseed-oil" => "rapeseed oil",
189
+ "37" => "appliances able to use mineral oil or liquid biofuel",
190
+ "51" => "biogas (not community)",
191
+ "56" => "heat from boilers that can use mineral oil or biodiesel (community)",
192
+ "57" => "heat from boilers using biodiesel from any biomass source (community)",
193
+ "58" => "biodiesel from vegetable oil only (community)",
194
+ "99" => "from heat network data (community)",
195
+ }.freeze
196
+ RDSAP_FUEL_TYPE_PRE_143 = {
197
+ "1-pre14.3-sap" => "mains gas",
198
+ "4-pre14.3-sap" => "oil",
199
+ "10-pre14.3-sap" => "electricity",
200
+ "11-pre14.3-sap" => "waste combustion",
201
+ "12-pre14.3-sap" => "biomass",
202
+ "13-pre14.3-sap" => "biogas - landfill",
203
+ "14-pre14.3-sap" => "house coal",
204
+ }.freeze
205
+ SAP_FUEL_TYPE = {
206
+ "1" => "Gas: mains gas",
207
+ "2" => "Gas: bulk LPG",
208
+ "3" => "Gas: bottled LPG",
209
+ "4" => "Oil: heating oil",
210
+ "7" => "Gas: biogas",
211
+ "8" => "LNG",
212
+ "9" => "LPG subject to Special Condition 18",
213
+ "10" => "Solid fuel: dual fuel appliance (mineral and wood)",
214
+ "11" => "Solid fuel: house coal",
215
+ "12" => "Solid fuel: manufactured smokeless fuel",
216
+ "15" => "Solid fuel: anthracite",
217
+ "20" => "Solid fuel: wood logs",
218
+ "21" => "Solid fuel: wood chips",
219
+ "22" => "Solid fuel: wood pellets (in bags, for secondary heating)",
220
+ "23" => "Solid fuel: wood pellets (bulk supply in bags, for main heating)",
221
+ "36" => "Electricity: electricity sold to grid",
222
+ "37" => "Electricity: electricity displaced from grid",
223
+ "39" => "Electricity: electricity, unspecified tariff",
224
+ "41" => "Community heating schemes: heat from electric heat pump",
225
+ "42" => "Community heating schemes: heat from boilers - waste combustion",
226
+ "43" => "Community heating schemes: heat from boilers - biomass",
227
+ "44" => "Community heating schemes: heat from boilers - biogas",
228
+ "45" => "Community heating schemes: waste heat from power stations",
229
+ "46" => "Community heating schemes: geothermal heat source",
230
+ "48" => "Community heating schemes: heat from CHP",
231
+ "49" => "Community heating schemes: electricity generated by CHP",
232
+ "50" => "Community heating schemes: electricity for pumping in distribution network",
233
+ "51" => "Community heating schemes: heat from mains gas",
234
+ "52" => "Community heating schemes: heat from LPG",
235
+ "53" => "Community heating schemes: heat from oil",
236
+ "54" => "Community heating schemes: heat from coal",
237
+ "55" => "Community heating schemes: heat from B30D",
238
+ "56" => "Community heating schemes: heat from boilers that can use mineral oil or biodiesel",
239
+ "57" => "Community heating schemes: heat from boilers using biodiesel from any biomass source",
240
+ "58" => "Community heating schemes: biodiesel from vegetable oil only",
241
+ "71" => "biodiesel from any biomass source",
242
+ "72" => "biodiesel from used cooking oil only",
243
+ "73" => "biodiesel from vegetable oil only",
244
+ "74" => "appliances able to use mineral oil or liquid biofuel",
245
+ "75" => "B30K",
246
+ "76" => "bioethanol from any biomass source",
247
+ "99" => "Community heating schemes: special fuel",
248
+ }.freeze
230
249
 
231
- def self.xml_value_to_string(number)
250
+ def self.built_form_string(number)
232
251
  BUILT_FORM[number]
233
252
  end
234
253
 
@@ -246,14 +265,6 @@ module Helper
246
265
  end
247
266
  end
248
267
 
249
- def self.main_fuel_rdsap(value)
250
- RDSAP_MAIN_FUEL[value]
251
- end
252
-
253
- def self.main_fuel_sap(value)
254
- SAP_MAIN_FUEL[value]
255
- end
256
-
257
268
  def self.glazed_area_rdsap(value)
258
269
  RDSAP_GLAZED_AREA[value]
259
270
  end
@@ -266,9 +277,26 @@ module Helper
266
277
  TENURE[value] || value
267
278
  end
268
279
 
269
- def self.transaction_type(value, report_type = "2")
280
+ def self.transaction_type(value, report_type = "2", schema_type = "")
281
+ types_of_ni = %w[
282
+ RdSAP-Schema-NI-20.0.0
283
+ RdSAP-Schema-NI-19.0
284
+ RdSAP-Schema-NI-18.0
285
+ RdSAP-Schema-NI-17.4
286
+ RdSAP-Schema-NI-17.3
287
+ SAP-Schema-NI-16.1
288
+ SAP-Schema-NI-17.0
289
+ SAP-Schema-NI-17.1
290
+ SAP-Schema-NI-17.2
291
+ SAP-Schema-NI-17.3
292
+ SAP-Schema-NI-17.4
293
+ SAP-Schema-NI-18.0.0
294
+ ]
295
+
270
296
  if is_rdsap(report_type) && value.to_i >= 12
271
297
  TRANSACTION_TYPE["#{value}RdSAP"]
298
+ elsif types_of_ni.include?(schema_type) && value.to_i == 5
299
+ TRANSACTION_TYPE["ni_5"]
272
300
  else
273
301
  TRANSACTION_TYPE[value] || value
274
302
  end
@@ -381,9 +409,10 @@ module Helper
381
409
  SAP-Schema-11.2
382
410
  SAP-Schema-11.0
383
411
  SAP-Schema-10.2
412
+ SAP-Schema-NI-11.2
384
413
  ].freeze
385
414
 
386
- if types_of_sap_pre12.include?(schema_type) && is_rdsap(report_type)
415
+ if types_of_sap_pre12.include?(schema_type.to_s) && is_rdsap(report_type)
387
416
  return MECHANICAL_VENTILATION["#{value}-pre12.0"]
388
417
  end
389
418
 
@@ -394,6 +423,14 @@ module Helper
394
423
  CEPC_TRANSACTION_TYPE[value] || value
395
424
  end
396
425
 
426
+ def self.cylinder_insulation_thickness(value, report_type = "2")
427
+ if is_rdsap(report_type)
428
+ CYLINDER_INSULATION_THICKNESS[value]
429
+ else
430
+ value
431
+ end
432
+ end
433
+
397
434
  def self.is_rdsap(report_type)
398
435
  report_type == "2"
399
436
  end
@@ -402,6 +439,119 @@ module Helper
402
439
  report_type == "3"
403
440
  end
404
441
 
442
+ def self.ventilation_type(value, schema_type = "")
443
+ ni_sap = %w[
444
+ SAP-Schema-NI-16.1
445
+ SAP-Schema-NI-16.0
446
+ SAP-Schema-NI-15.0
447
+ SAP-Schema-NI-14.2
448
+ SAP-Schema-NI-14.1
449
+ SAP-Schema-NI-14.0
450
+ SAP-Schema-NI-13.0
451
+ ].freeze
452
+
453
+ if ni_sap.include?(schema_type) && value == "9"
454
+ VENTILATION_TYPE[value].split(".").first
455
+ else
456
+ VENTILATION_TYPE[value]
457
+ end
458
+ end
459
+
460
+ def self.fuel_type(value, schema_type = "", report_type = "2")
461
+ rdsap = %i[
462
+ RdSAP-Schema-20.0.0
463
+ RdSAP-Schema-19.0
464
+ RdSAP-Schema-18.0
465
+ RdSAP-Schema-17.1
466
+ RdSAP-Schema-17.0
467
+ RdSAP-Schema-NI-20.0.0
468
+ RdSAP-Schema-NI-19.0
469
+ RdSAP-Schema-NI-18.0
470
+ RdSAP-Schema-NI-17.4
471
+ RdSAP-Schema-NI-17.3
472
+ ]
473
+
474
+ pre143_sap = %i[
475
+ SAP-Schema-14.2
476
+ SAP-Schema-14.1
477
+ SAP-Schema-14.0
478
+ SAP-Schema-13.0
479
+ SAP-Schema-12.0
480
+ SAP-Schema-11.2
481
+ SAP-Schema-11.0
482
+ SAP-Schema-10.2
483
+ SAP-Schema-NI-14.2
484
+ SAP-Schema-NI-14.1
485
+ SAP-Schema-NI-14.0
486
+ SAP-Schema-NI-13.0
487
+ SAP-Schema-NI-12.0
488
+ SAP-Schema-NI-11.2
489
+ ]
490
+
491
+ includes_rapeseed_oil = %i[
492
+ SAP-Schema-16.3
493
+ SAP-Schema-16.2
494
+ SAP-Schema-16.1
495
+ SAP-Schema-16.0
496
+ SAP-Schema-15.0
497
+ SAP-Schema-NI-17.2
498
+ SAP-Schema-NI-17.1
499
+ SAP-Schema-NI-17.0
500
+ SAP-Schema-NI-16.1
501
+ SAP-Schema-NI-16.0
502
+ SAP-Schema-NI-15.0
503
+ ]
504
+
505
+ sap = %i[
506
+ SAP-Schema-18.0.0
507
+ SAP-Schema-17.1
508
+ SAP-Schema-17.0
509
+ SAP-Schema-16.3
510
+ SAP-Schema-16.2
511
+ SAP-Schema-16.1
512
+ SAP-Schema-16.0
513
+ SAP-Schema-15.0
514
+ SAP-Schema-14.2
515
+ SAP-Schema-14.1
516
+ SAP-Schema-14.0
517
+ SAP-Schema-13.0
518
+ SAP-Schema-12.0
519
+ SAP-Schema-11.2
520
+ SAP-Schema-11.0
521
+ SAP-Schema-10.2
522
+ SAP-Schema-NI-18.0.0
523
+ SAP-Schema-NI-17.4
524
+ SAP-Schema-NI-17.3
525
+ SAP-Schema-NI-17.2
526
+ SAP-Schema-NI-17.1
527
+ SAP-Schema-NI-17.0
528
+ SAP-Schema-NI-16.1
529
+ SAP-Schema-NI-16.0
530
+ SAP-Schema-NI-15.0
531
+ SAP-Schema-NI-14.2
532
+ SAP-Schema-NI-14.1
533
+ SAP-Schema-NI-14.0
534
+ SAP-Schema-NI-13.0
535
+ SAP-Schema-NI-12.0
536
+ SAP-Schema-NI-11.2
537
+ ]
538
+
539
+ if rdsap.include?(schema_type)
540
+ RDSAP_FUEL_TYPE[value]
541
+ elsif sap.include?(schema_type) && is_sap(report_type)
542
+ SAP_FUEL_TYPE[value]
543
+ elsif sap.include?(schema_type) && is_rdsap(report_type)
544
+ if includes_rapeseed_oil.include?(schema_type) && value == "36"
545
+ return RDSAP_FUEL_TYPE["#{value}-rapeseed-oil"]
546
+ end
547
+ if pre143_sap.include?(schema_type)
548
+ return RDSAP_FUEL_TYPE_PRE_143["#{value}-pre14.3-sap"] || RDSAP_FUEL_TYPE[value]
549
+ else
550
+ RDSAP_FUEL_TYPE[value]
551
+ end
552
+ end
553
+ end
554
+
405
555
  private_class_method :is_rdsap, :is_sap
406
556
  end
407
557
  end