epb_view_models 2.7.1 → 2.8.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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +19 -2
  3. data/api/schemas/xml/CEPC-S-7.0/Reports/BaseDataTypes.xsd +296 -296
  4. data/api/schemas/xml/CEPC-S-7.0/Reports/CEPC-Reports.xsd +63 -63
  5. data/api/schemas/xml/CEPC-S-7.0/Reports/Input-Data.xsd +34 -34
  6. data/api/schemas/xml/CEPC-S-7.0/Reports/Performance-Summary.xsd +120 -120
  7. data/api/schemas/xml/CEPC-S-7.0/Reports/Property.xsd +67 -67
  8. data/api/schemas/xml/CEPC-S-7.0/Reports/Report-Header.xsd +178 -178
  9. data/api/schemas/xml/CEPC-S-7.0/Reports/Reported-Data.xsd +391 -391
  10. data/api/schemas/xml/CEPC-S-7.0/Reports/UserManagement.xsd +171 -171
  11. data/api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd +300 -300
  12. data/api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd +66 -66
  13. data/api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd +34 -34
  14. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd +125 -125
  15. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd.bak +123 -123
  16. data/api/schemas/xml/CEPC-S-7.1/Reports/Property.xsd +67 -67
  17. data/api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd +178 -178
  18. data/api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd +406 -406
  19. data/api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd +174 -174
  20. data/api/schemas/xml/CEPC-S-8.0.0/Reports/BaseDataTypes.xsd +302 -0
  21. data/api/schemas/xml/CEPC-S-8.0.0/Reports/CEPC-Reports.xsd +69 -0
  22. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Input-Data.xsd +39 -0
  23. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Performance-Summary.xsd +130 -0
  24. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Property.xsd +72 -0
  25. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Report-Header.xsd +182 -0
  26. data/api/schemas/xml/CEPC-S-8.0.0/Reports/Reported-Data.xsd +411 -0
  27. data/api/schemas/xml/CEPC-S-8.0.0/Reports/UserManagement.xsd +175 -0
  28. data/api/schemas/xml/CS63-S-8.0.0/ActionPlan.xsd +822 -0
  29. data/api/schemas/xml/DECAR-S-8.0.0/DEC-Summary.xsd +399 -0
  30. data/api/schemas/xml/DECAR-S-8.0.0/Reports/BaseDataTypes.xsd +187 -0
  31. data/api/schemas/xml/DECAR-S-8.0.0/Reports/CEPC-Reports.xsd +78 -0
  32. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Input-Data.xsd +313 -0
  33. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Performance-Summary.xsd +111 -0
  34. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Report-Header.xsd +455 -0
  35. data/api/schemas/xml/DECAR-S-8.0.0/Reports/Reported-Data.xsd +408 -0
  36. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xml +1456 -1456
  37. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/ExternalDefinitions.xsd +236 -236
  38. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/AssessorManagement.xsd +16 -16
  39. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-Certificate.xsd +388 -388
  40. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/EPC-CollectedData.xsd +784 -784
  41. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesExternal.xsd +283 -283
  42. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesGrounds.xsd +222 -222
  43. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesInternal.xsd +205 -205
  44. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-FeaturesServices.xsd +311 -311
  45. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-PropertyDetails.xsd +380 -380
  46. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/HCR-RiskAssessment.xsd +298 -298
  47. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/Property.xsd +67 -67
  48. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/SAP-Reports.xsd +201 -201
  49. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/Templates/UserManagement.xsd +259 -259
  50. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/BaseDataTypes.xsd +176 -176
  51. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/EPC-Domains.xsd +881 -881
  52. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/HCR-Domains.xsd +1779 -1779
  53. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SAP-Domains.xsd +1650 -1650
  54. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/SharedDomains.xsd +768 -768
  55. data/api/schemas/xml/RdSAP-Schema-S-16.1/RdSAP/UDT/TypeDefinitions.xsd +19 -19
  56. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xml +1456 -1456
  57. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/ExternalDefinitions.xsd +236 -236
  58. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/AssessorManagement.xsd +208 -208
  59. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  60. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/EPC-CollectedData.xsd +957 -957
  61. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ExceptionList.xsd +18 -18
  62. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/Property.xsd +66 -66
  63. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/RdSAP-Report.xsd +180 -180
  64. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/Templates/ReportList.xsd +26 -26
  65. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/EPC-Domains.xsd +843 -843
  66. data/api/schemas/xml/RdSAP-Schema-S-17.00/RdSAP/UDT/SAP-Domains.xsd +2541 -2541
  67. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xml +1456 -1456
  68. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/ExternalDefinitions.xsd +236 -236
  69. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  70. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  71. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/EPC-CollectedData.xsd +966 -966
  72. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ExceptionList.xsd +18 -18
  73. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/Property.xsd +66 -66
  74. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/RdSAP-Report.xsd +175 -175
  75. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/Templates/ReportList.xsd +26 -26
  76. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/EPC-Domains.xsd +853 -853
  77. data/api/schemas/xml/RdSAP-Schema-S-18.0/RdSAP/UDT/SAP-Domains.xsd +2551 -2551
  78. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  79. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  80. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  81. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  82. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  83. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  84. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  85. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  86. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  87. data/api/schemas/xml/RdSAP-Schema-S-21.0/RdSAP/Templates/RdSAP-Report.cs +11846 -11846
  88. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/ExternalDefinitions.xml +1832 -0
  89. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/ExternalDefinitions.xsd +267 -0
  90. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/AssessorManagement.xsd +212 -0
  91. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/EPC-Certificate.xsd +399 -0
  92. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/EPC-CollectedData.xsd +1453 -0
  93. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/Property.xsd +67 -0
  94. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/Templates/RdSAP-Report.xsd +179 -0
  95. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/UDT/EPC-Domains.xsd +943 -0
  96. data/api/schemas/xml/RdSAP-Schema-S-22.0.0/RdSAP/UDT/SAP-Domains.xsd +3557 -0
  97. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/ExternalDefinitions.txt +236 -236
  98. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/ExternalDefinitions.xml +1456 -1456
  99. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/EPC-Certificate.xsd +433 -433
  100. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/Property.xsd +69 -69
  101. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/SAP09-CollectedData.xsd +1326 -1326
  102. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/SAP09-Report.xsd +196 -196
  103. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/Templates/UserManagement.xsd +217 -217
  104. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/BaseDataTypes.xsd +175 -175
  105. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/EPC-Domains.xsd +813 -813
  106. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/SAP09-Domains.xsd +3457 -3457
  107. data/api/schemas/xml/SAP-Schema-S-16.1/SAP/UDT/SharedDomains.xsd +317 -317
  108. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/ExternalDefinitions.xml +1456 -1456
  109. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/ExternalDefinitions.xsd +236 -236
  110. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/AssessorManagement.xsd +216 -216
  111. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/EPC-Certificate.xsd +457 -457
  112. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/ExceptionList.xsd +18 -18
  113. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/Property.xsd +62 -62
  114. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/ReportList.xsd +26 -26
  115. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/SAP-CollectedData.xsd +1444 -1444
  116. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/Templates/SAP-Report.xsd +193 -193
  117. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/UDT/EPC-Domains.xsd +558 -558
  118. data/api/schemas/xml/SAP-Schema-S-17.0/SAP/UDT/SAP-Domains.xsd +2975 -2975
  119. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/ExternalDefinitions.xml +1352 -0
  120. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/ExternalDefinitions.xsd +242 -0
  121. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/AssessorManagement.xsd +210 -0
  122. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/EPC-Certificate.xsd +495 -0
  123. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/ExceptionList.xsd +23 -0
  124. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/Property.xsd +77 -0
  125. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/ReportList.xsd +30 -0
  126. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-CollectedData.xsd +1800 -0
  127. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-Compliance-Report.xsd +40 -0
  128. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/Templates/SAP-Report.xsd +206 -0
  129. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/UDT/EPC-Domains.xsd +564 -0
  130. data/api/schemas/xml/SAP-Schema-S-20.0.0/SAP/UDT/SAP-Domains.xsd +3140 -0
  131. data/lib/epb_view_models/version.rb +1 -1
  132. data/lib/view_model/cepc800/common_schema.rb +7 -7
  133. data/lib/view_model/cepc_s_800/cepc.rb +184 -0
  134. data/lib/view_model/cepc_wrapper.rb +2 -0
  135. data/lib/view_model/{cs63 → cs63_70}/common_schema.rb +1 -1
  136. data/lib/view_model/cs63_800/common_schema.rb +211 -0
  137. data/lib/view_model/cs63_wrapper.rb +15 -3
  138. data/lib/view_model/dec_rr_wrapper.rb +2 -0
  139. data/lib/view_model/dec_summary_wrapper.rb +2 -0
  140. data/lib/view_model/dec_wrapper.rb +2 -0
  141. data/lib/view_model/decar_s_800/common_schema.rb +109 -0
  142. data/lib/view_model/decar_s_800/dec.rb +235 -0
  143. data/lib/view_model/decar_s_800/dec_rr.rb +102 -0
  144. data/lib/view_model/factory.rb +6 -1
  145. data/lib/view_model/rd_sap_schema_s_2200/common_schema.rb +685 -0
  146. data/lib/view_model/rd_sap_wrapper.rb +4 -2
  147. data/lib/view_model/sap_schema_s_2000/common_schema.rb +619 -0
  148. data/lib/view_model/sap_wrapper.rb +2 -0
  149. metadata +46 -2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EpbViewModels
4
- VERSION = "2.7.1"
4
+ VERSION = "2.8.0"
5
5
  end
@@ -14,31 +14,31 @@ module ViewModel
14
14
  end
15
15
 
16
16
  def address_line1
17
- xpath(%w[Property-Address Address-Line-1])
17
+ xpath(%w[Property-Address Address-Line-1]) or xpath(%w[Property Address-Line-1])
18
18
  end
19
19
 
20
20
  def address_line2
21
- xpath(%w[Property-Address Address-Line-2])
21
+ xpath(%w[Property-Address Address-Line-2]) or xpath(%w[Property Address-Line-2])
22
22
  end
23
23
 
24
24
  def address_line3
25
- xpath(%w[Property-Address Address-Line-3])
25
+ xpath(%w[Property-Address Address-Line-3]) or xpath(%w[Property Address-Line-3])
26
26
  end
27
27
 
28
28
  def address_line4
29
- xpath(%w[Property-Address Address-Line-4])
29
+ xpath(%w[Property-Address Address-Line-4]) or xpath(%w[Property Address-Line-4])
30
30
  end
31
31
 
32
32
  def town
33
- xpath(%w[Property-Address Post-Town])
33
+ xpath(%w[Property-Address Post-Town]) or xpath(%w[Property Post-Town])
34
34
  end
35
35
 
36
36
  def postcode
37
- xpath(%w[Property-Address Postcode])
37
+ xpath(%w[Property-Address Postcode]) or xpath(%w[Property Postcode])
38
38
  end
39
39
 
40
40
  def scheme_assessor_id
41
- xpath(%w[Certificate-Number])
41
+ xpath(%w[Certificate-Number]) or xpath(%w[Membership-Number])
42
42
  end
43
43
 
44
44
  def assessor_name
@@ -0,0 +1,184 @@
1
+ module ViewModel
2
+ module CepcS800
3
+ class Cepc < ViewModel::Cepc800::CommonSchema
4
+ def date_of_expiry
5
+ expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
6
+
7
+ expires_at.to_s
8
+ end
9
+
10
+ def building_environment
11
+ xpath(%w[Building-Environment])
12
+ end
13
+
14
+ def energy_efficiency_rating
15
+ xpath(%w[Asset-Rating])&.to_i
16
+ end
17
+
18
+ def current_energy_efficiency_band
19
+ xpath(%w[Energy-Band])
20
+ end
21
+
22
+ def potential_energy_rating
23
+ xpath(%w[Potential-Rating])&.to_i
24
+ end
25
+
26
+ def potential_energy_band
27
+ xpath(%w[Potential-Band])
28
+ end
29
+
30
+ def new_build_benchmark_band
31
+ xpath(%w[New-Build-Benchmark-Band])
32
+ end
33
+
34
+ def comparative_asset_rating
35
+ xpath(%w[Comparative-Asset-Rating])&.to_i
36
+ end
37
+
38
+ def comparative_asset_band
39
+ xpath(%w[Comparative-Energy-Band])
40
+ end
41
+
42
+ def epc_rating_ber
43
+ xpath(%w[BER])&.to_f
44
+ end
45
+
46
+ def approximate_energy_use
47
+ xpath(%w[Approximate-Energy-Use])&.to_i
48
+ end
49
+
50
+ def floor_area
51
+ xpath(%w[Technical-Information Floor-Area])&.to_i
52
+ end
53
+
54
+ def main_heating_fuel
55
+ xpath(%w[Main-Heating-Fuel])
56
+ end
57
+
58
+ def property_type
59
+ xpath(%w[Property-Type Long-Description])
60
+ end
61
+
62
+ def property_long_description
63
+ xpath(%w[Property-Type Long-Description])
64
+ end
65
+
66
+ def property_short_description
67
+ xpath(%w[Property-Type Short-Description])
68
+ end
69
+
70
+ def compliant_2002
71
+ xpath(%w[Compliant-2002])
72
+ end
73
+
74
+ def renewable_energy_sources
75
+ @xml_doc.search("Renewable-Energy-Sources").children.search("Renewable-Energy-Source").map(&:content)
76
+ end
77
+
78
+ def electricity_sources
79
+ @xml_doc.search("Electricity-Sources").children.search("Electricity-Source").map(&:content)
80
+ end
81
+
82
+ def primary_energy_indicator
83
+ xpath(%w[Primary-Energy-Indicator])&.to_i
84
+ end
85
+
86
+ def calculation_tool
87
+ xpath(%w[Calculation-Tool])
88
+ end
89
+
90
+ def ter_2002
91
+ xpath(%w[TER-2002])&.to_f
92
+ end
93
+
94
+ def ter
95
+ xpath(%w[TER])&.to_f
96
+ end
97
+
98
+ def recommendations(payback = "")
99
+ if payback.empty?
100
+ # return an enumerable of all nodes
101
+ @xml_doc.xpath "Recommendations-Report RR-Recommendations"
102
+ else
103
+ @xml_doc
104
+ .search("Recommendations-Report RR-Recommendations/#{payback}")
105
+ .map do |node|
106
+ {
107
+ code: node.at("Recommendation-Code").content,
108
+ text: node.at("Recommendation").content,
109
+ cO2Impact: node.at("CO2-Impact").content,
110
+ }
111
+ end
112
+ end
113
+ end
114
+
115
+ def short_payback_recommendations
116
+ recommendations("Short-Payback")
117
+ end
118
+
119
+ def medium_payback_recommendations
120
+ recommendations("Medium-Payback")
121
+ end
122
+
123
+ def long_payback_recommendations
124
+ recommendations("Long-Payback")
125
+ end
126
+
127
+ def other_payback_recommendations
128
+ recommendations("Other-Payback")
129
+ end
130
+
131
+ def related_rrn
132
+ xpath(%w[Related-RRN])
133
+ end
134
+
135
+ def new_build_rating
136
+ xpath(%w[New-Build-Benchmark])&.to_i
137
+ end
138
+
139
+ def existing_build_rating
140
+ xpath(%w[Existing-Stock-Benchmark])&.to_i
141
+ end
142
+
143
+ def epc_related_party_disclosure
144
+ xpath(%w[EPC-Related-Party-Disclosure])
145
+ end
146
+
147
+ def trading_address
148
+ xpath(%w[Trading-Address])
149
+ end
150
+
151
+ def company_name
152
+ xpath(%w[Company-Name])
153
+ end
154
+
155
+ def insurer
156
+ xpath(%w[Insurer])
157
+ end
158
+
159
+ def policy_no
160
+ xpath(%w[Policy-No])
161
+ end
162
+
163
+ def insurer_effective_date
164
+ xpath(%w[Effective-Date])
165
+ end
166
+
167
+ def insurer_expiry_date
168
+ xpath(%w[Expiry-Date])
169
+ end
170
+
171
+ def insurer_pi_limit
172
+ xpath(%w[PI-Limit])
173
+ end
174
+
175
+ def inspection_date
176
+ xpath(%w[Inspection-Date])
177
+ end
178
+
179
+ def completion_date
180
+ xpath(%w[Completion-Date])
181
+ end
182
+ end
183
+ end
184
+ end
@@ -65,6 +65,8 @@ module ViewModel
65
65
  ViewModel::CepcS70::Cepc.new xml_doc
66
66
  when :"CEPC-S-7.1"
67
67
  ViewModel::CepcS71::Cepc.new xml_doc
68
+ when :"CEPC-S-8.0.0"
69
+ ViewModel::CepcS800::Cepc.new xml_doc
68
70
  else
69
71
  raise ArgumentError, "Unsupported schema type"
70
72
  end
@@ -1,7 +1,7 @@
1
1
  require "date"
2
2
 
3
3
  module ViewModel
4
- module Cs63
4
+ module Cs6370
5
5
  class CommonSchema < ViewModel::DomesticEpcViewModel
6
6
  THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY = 65
7
7
 
@@ -0,0 +1,211 @@
1
+ require "date"
2
+
3
+ module ViewModel
4
+ module Cs63800
5
+ class CommonSchema < ViewModel::DomesticEpcViewModel
6
+ THRESHOLD_LOW_ENERGY_LIGHTING_EFFICACY = 65
7
+
8
+ def assessment_id
9
+ xpath(%w[Report-Header RRN])
10
+ end
11
+
12
+ def epc_assessment_id
13
+ xpath(%w[Report-Header EPC-RRN])
14
+ end
15
+
16
+ def sale_lease_date
17
+ xpath(%w[Report-Header Sale-Lease-Date])
18
+ end
19
+
20
+ def assessment_date
21
+ xpath(%w[Report-Header Assessment-Date])
22
+ end
23
+
24
+ def plan_report_date
25
+ xpath(%w[Report-Header Plan-Report-Date])
26
+ end
27
+
28
+ def delegated_protocol_date
29
+ xpath(%w[Delegated-Protocol-Date])
30
+ end
31
+
32
+ def delegated_protocol_set_up
33
+ xpath(%w[Delegated-Protocol-Set-Up])
34
+ end
35
+
36
+ def report_type
37
+ xpath(%w[Report-Header Report-Type])
38
+ end
39
+
40
+ def address_line1
41
+ xpath(%w[Report-Header Property Address Address-Line-1])
42
+ end
43
+
44
+ def address_line2
45
+ xpath(%w[Report-Header Property Address Address-Line-2])
46
+ end
47
+
48
+ def address_line3
49
+ xpath(%w[Report-Header Property Address Address-Line-3])
50
+ end
51
+
52
+ def address_line4
53
+ xpath(%w[Report-Header Property Address Address-Line-4])
54
+ end
55
+
56
+ def town
57
+ xpath(%w[Report-Header Property Address Post-Town])
58
+ end
59
+
60
+ def postcode
61
+ xpath(%w[Report-Header Property Address Postcode])
62
+ end
63
+
64
+ def scheme_assessor_id
65
+ xpath(%w[Energy-Assessor Membership-Number]) or xpath(%w[Energy-Assessor Certificate-Number])
66
+ end
67
+
68
+ def assessor_name
69
+ xpath(%w[Energy-Assessor Name])
70
+ end
71
+
72
+ # def approved_organisation_name
73
+ # xpath(%w[Energy-Assessor Approved-Organisation-Name])
74
+ # end
75
+ #
76
+ # def approved_organisation_web_address
77
+ # xpath(%w[Energy-Assessor Approved-Organisation-Name])
78
+ # end
79
+
80
+ def trading_address
81
+ xpath(%w[Energy-Assessor Trading-Address])
82
+ end
83
+
84
+ def company_name
85
+ xpath(%w[Energy-Assessor Company-Name])
86
+ end
87
+
88
+ def status
89
+ xpath(%w[Energy-Assessor Status])
90
+ end
91
+
92
+ def assessor_email
93
+ xpath(%w[Energy-Assessor/E-Mail])
94
+ end
95
+
96
+ def assessor_telephone
97
+ xpath(%w[Energy-Assessor/Telephone-Number])
98
+ end
99
+
100
+ def address_id
101
+ xpath(%w[UPRN])
102
+ end
103
+
104
+ # def type_of_assessment
105
+ # "CS63"
106
+ # end
107
+
108
+ def owner_commission_report
109
+ xpath(%w[Owner-Commission-Report])
110
+ end
111
+
112
+ def delegated_person_commission_report
113
+ xpath(%w[Delegated-Person-Commission-Report])
114
+ end
115
+
116
+ def property_type_short_description
117
+ xpath(%w[Property-Type Short-Description])
118
+ end
119
+
120
+ def property_type_long_description
121
+ xpath(%w[Property-Type Long-Description])
122
+ end
123
+
124
+ def building_improvements
125
+ xpath(%w[Improvement-Type Building-Improvements])
126
+ end
127
+
128
+ def operational_ratings
129
+ xpath(%w[Improvement-Type Operational-Rating])
130
+ end
131
+
132
+ def dec
133
+ xpath(%w[Operational-Rating-System Display-Energy-Certificate])
134
+ end
135
+
136
+ def planned_completion_date
137
+ xpath(%w[Improvements-Completion Planned-Completion-Date])
138
+ end
139
+
140
+ def actual_completion_date
141
+ xpath(%w[Improvements-Completion Actual-Completion-Date])
142
+ end
143
+
144
+ def target_emission_savings
145
+ xpath(%w[Target-Savings Target-Emission-Savings])&.to_f
146
+ end
147
+
148
+ def target_energy_savings
149
+ xpath(%w[Target-Savings Target-Energy-Savings])&.to_f
150
+ end
151
+
152
+ def accept_prescriptive_improvements
153
+ xpath(%w[Prescriptive-Improvements Accept-Prescriptive-Improvements])
154
+ end
155
+
156
+ def prescriptive_improvements
157
+ @xml_doc
158
+ .search("Prescriptive-Improvements Prescriptive-Scenario")
159
+ .map do |node|
160
+ {
161
+ measure_description_short:
162
+ xpath(%w[Measure-Description-Short], node),
163
+ measure_description_long:
164
+ xpath(%w[Measure-Description-Long], node),
165
+ measure_valid: xpath(%w[Measure-Valid], node),
166
+ measure_type: xpath(%w[Measure-Type], node),
167
+ }
168
+ end
169
+ end
170
+
171
+ def alternative_improvements
172
+ @xml_doc
173
+ .search("Alternative-Improvements Alternative-Scenario")
174
+ .map do |node|
175
+ {
176
+ measure_description_short:
177
+ xpath(%w[Measure-Description-Short], node),
178
+ measure_description_long:
179
+ xpath(%w[Measure-Description-Long], node),
180
+ measure_valid: xpath(%w[Measure-Valid], node),
181
+ measure_type: xpath(%w[Measure-Type], node),
182
+ }
183
+ end
184
+ end
185
+
186
+ def date_of_registration
187
+ xpath(%w[Report-Header Plan-Report-Date])
188
+ end
189
+
190
+ def date_of_expiry
191
+ Date.parse(date_of_registration).next_month(42).to_s
192
+ end
193
+
194
+ def date_of_assessment
195
+ xpath(%w[Report-Header Assessment-Date])
196
+ end
197
+
198
+ def related_rrn
199
+ nil
200
+ end
201
+
202
+ def total_emission_savings
203
+ xpath(%w[Total-Emission-Savings])
204
+ end
205
+
206
+ def total_energy_savings
207
+ xpath(%w[Total-Energy-Savings])
208
+ end
209
+ end
210
+ end
211
+ end
@@ -2,9 +2,8 @@ module ViewModel
2
2
  class Cs63Wrapper
3
3
  attr_reader :view_model
4
4
 
5
- def initialize(xml_doc, _schema_type, _additional_data = {})
6
- @view_model = ViewModel::Cs63::CommonSchema.new xml_doc
7
- # @view_model = build_view_model(xml_doc, schema_type)
5
+ def initialize(xml_doc, schema_type, _additional_data = {})
6
+ @view_model = build_view_model(xml_doc, schema_type)
8
7
  @summary = Presenter::Cs63::Summary.new(view_model)
9
8
  @certificate_summary = Presenter::Cs63::CertificateSummary.new(view_model)
10
9
  end
@@ -24,5 +23,18 @@ module ViewModel
24
23
  def get_view_model
25
24
  view_model
26
25
  end
26
+
27
+ private
28
+
29
+ def build_view_model(xml_doc, schema_type)
30
+ case schema_type
31
+ when :"CS63-S-7.0"
32
+ ViewModel::Cs6370::CommonSchema.new xml_doc
33
+ when :"CS63-S-8.0.0"
34
+ ViewModel::Cs63800::CommonSchema.new xml_doc
35
+ else
36
+ raise ArgumentError, "Unsupported schema type"
37
+ end
38
+ end
27
39
  end
28
40
  end
@@ -34,6 +34,8 @@ module ViewModel
34
34
 
35
35
  def build_view_model(xml_doc, schema_type)
36
36
  case schema_type
37
+ when :"DECAR-S-8.0.0"
38
+ ViewModel::DecarS800::DecRr.new xml_doc
37
39
  when :"DECAR-S-7.0"
38
40
  ViewModel::DecarS70::DecRr.new xml_doc
39
41
  when :"CEPC-8.0.0"
@@ -29,6 +29,8 @@ module ViewModel
29
29
 
30
30
  def build_view_model(xml_doc, schema_type)
31
31
  case schema_type
32
+ when :"DECAR-S-8.0.0"
33
+ ViewModel::DecarS800::Dec.new xml_doc
32
34
  when :"DECAR-S-7.0"
33
35
  ViewModel::DecarS70::Dec.new xml_doc
34
36
  when :"CEPC-8.0.0"
@@ -35,6 +35,8 @@ module ViewModel
35
35
 
36
36
  def build_view_model(xml_doc, schema_type)
37
37
  case schema_type
38
+ when :"DECAR-S-8.0.0"
39
+ ViewModel::DecarS800::Dec.new xml_doc
38
40
  when :"DECAR-S-7.0"
39
41
  ViewModel::DecarS70::Dec.new xml_doc
40
42
  when :"CEPC-8.0.0"
@@ -0,0 +1,109 @@
1
+ module ViewModel
2
+ module DecarS800
3
+ class CommonSchema < ViewModel::BaseViewModel
4
+ def assessment_id
5
+ xpath(%w[RRN])
6
+ end
7
+
8
+ def date_of_expiry
9
+ xpath(%w[Valid-Until])
10
+ end
11
+
12
+ def report_type
13
+ xpath(%w[Report-Type])
14
+ end
15
+
16
+ def address_line1
17
+ xpath(%w[Property-Address Address-Line-1])
18
+ end
19
+
20
+ def address_line2
21
+ xpath(%w[Property-Address Address-Line-2])
22
+ end
23
+
24
+ def address_line3
25
+ xpath(%w[Property-Address Address-Line-3])
26
+ end
27
+
28
+ def address_line4
29
+ xpath(%w[Property-Address Address-Line-4])
30
+ end
31
+
32
+ def town
33
+ xpath(%w[Property-Address Post-Town])
34
+ end
35
+
36
+ def postcode
37
+ xpath(%w[Property-Address Postcode])
38
+ end
39
+
40
+ def scheme_assessor_id
41
+ xpath(%w[Certificate-Number])
42
+ end
43
+
44
+ def assessor_name
45
+ xpath(%w[Energy-Assessor Name])
46
+ end
47
+
48
+ def assessor_email
49
+ xpath(%w[Energy-Assessor E-Mail])
50
+ end
51
+
52
+ def assessor_telephone
53
+ xpath(%w[Energy-Assessor Telephone-Number])
54
+ end
55
+
56
+ def company_name
57
+ xpath(%w[Energy-Assessor Company-Name])
58
+ end
59
+
60
+ def company_address
61
+ xpath(%w[Energy-Assessor Trading-Address])
62
+ end
63
+
64
+ def date_of_assessment
65
+ xpath(%w[Inspection-Date])
66
+ end
67
+
68
+ def date_of_registration
69
+ xpath(%w[Registration-Date])
70
+ end
71
+
72
+ def date_of_issue
73
+ xpath(%w[Issue-Date])
74
+ end
75
+
76
+ def address_id
77
+ xpath(%w[UPRN])
78
+ end
79
+
80
+ def all_start_dates
81
+ @xml_doc.search("Start-Date").map(&:content)
82
+ end
83
+
84
+ def all_energy_types
85
+ @xml_doc.search("Energy-Type").map(&:content)
86
+ end
87
+
88
+ def all_reason_types
89
+ @xml_doc.search("Reason-Type").map(&:content)
90
+ end
91
+
92
+ def or_assessment_end_date
93
+ xpath(%w[OR-Operational-Rating OR-Assessment-End-Date])
94
+ end
95
+
96
+ def calculation_tool
97
+ xpath(%w[Calculation-Details Calculation-Tool])
98
+ end
99
+
100
+ def inspection_type
101
+ xpath(%w[Calculation-Details Inspection-Type])
102
+ end
103
+
104
+ def building_level
105
+ xpath(%w[Building-Level])&.to_i
106
+ end
107
+ end
108
+ end
109
+ end