epb_view_models 2.2.0 → 2.2.2

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/api/schemas/data/orchestrate.json +3 -0
  3. data/api/schemas/xml/CEPC-S-7.1/Reports/BaseDataTypes.xsd +300 -300
  4. data/api/schemas/xml/CEPC-S-7.1/Reports/CEPC-Reports.xsd +66 -66
  5. data/api/schemas/xml/CEPC-S-7.1/Reports/Input-Data.xsd +34 -34
  6. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd +125 -125
  7. data/api/schemas/xml/CEPC-S-7.1/Reports/Performance-Summary.xsd.bak +123 -123
  8. data/api/schemas/xml/CEPC-S-7.1/Reports/Property.xsd +67 -67
  9. data/api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd +178 -178
  10. data/api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd +406 -406
  11. data/api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd +174 -174
  12. data/api/schemas/xml/CS63-S-7.0/ActionPlan.xsd +818 -0
  13. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/ExternalDefinitions.xsd +261 -261
  14. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/AssessorManagement.xsd +213 -213
  15. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-Certificate.xsd +400 -400
  16. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/EPC-CollectedData.xsd +1051 -1051
  17. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/Property.xsd +66 -66
  18. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/RdSAP-Report.xsd +176 -176
  19. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/Templates/ReportList.xsd +26 -26
  20. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/EPC-Domains.xsd +858 -858
  21. data/api/schemas/xml/RdSAP-Schema-S-19.0/RdSAP/UDT/SAP-Domains.xsd +2684 -2684
  22. data/lib/epb_view_models.rb +1 -1
  23. data/lib/presenter/cepc/certificate_summary.rb +148 -0
  24. data/lib/presenter/cs63/certificate_summary.rb +56 -0
  25. data/lib/presenter/cs63/export_configuration.rb +7 -0
  26. data/lib/presenter/cs63/summary.rb +44 -0
  27. data/lib/view_model/base_view_model.rb +2 -0
  28. data/lib/view_model/cepc_s_71/cepc.rb +115 -42
  29. data/lib/view_model/cepc_wrapper.rb +9 -0
  30. data/lib/view_model/cs63/common_schema.rb +195 -0
  31. data/lib/view_model/cs63_wrapper.rb +28 -0
  32. data/lib/view_model/factory.rb +5 -0
  33. data/lib/view_model_gateway/xsd_files_gateway.rb +7 -0
  34. metadata +10 -7
@@ -0,0 +1,195 @@
1
+ require "date"
2
+
3
+ module ViewModel
4
+ module Cs63
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 report_type
29
+ xpath(%w[Report-Header Report-Type])
30
+ end
31
+
32
+ def address_line1
33
+ xpath(%w[Report-Header Property Address Address-Line-1])
34
+ end
35
+
36
+ def address_line2
37
+ xpath(%w[Report-Header Property Address Address-Line-2])
38
+ end
39
+
40
+ def address_line3
41
+ xpath(%w[Report-Header Property Address Address-Line-3])
42
+ end
43
+
44
+ def address_line4
45
+ xpath(%w[Report-Header Property Address Address-Line-4])
46
+ end
47
+
48
+ def town
49
+ xpath(%w[Report-Header Property Address Post-Town])
50
+ end
51
+
52
+ def postcode
53
+ xpath(%w[Report-Header Property Address Postcode])
54
+ end
55
+
56
+ def scheme_assessor_id
57
+ xpath(%w[Energy-Assessor Membership-Number]) or xpath(%w[Energy-Assessor Certificate-Number])
58
+ end
59
+
60
+ def assessor_name
61
+ xpath(%w[Energy-Assessor Name])
62
+ end
63
+
64
+ # def approved_organisation_name
65
+ # xpath(%w[Energy-Assessor Approved-Organisation-Name])
66
+ # end
67
+ #
68
+ # def approved_organisation_web_address
69
+ # xpath(%w[Energy-Assessor Approved-Organisation-Name])
70
+ # end
71
+
72
+ def trading_address
73
+ xpath(%w[Energy-Assessor Trading-Address])
74
+ end
75
+
76
+ def company_name
77
+ xpath(%w[Energy-Assessor Company-Name])
78
+ end
79
+
80
+ def status
81
+ xpath(%w[Energy-Assessor Status])
82
+ end
83
+
84
+ def assessor_email
85
+ xpath(%w[Energy-Assessor/E-Mail])
86
+ end
87
+
88
+ def assessor_telephone
89
+ xpath(%w[Energy-Assessor/Telephone-Number])
90
+ end
91
+
92
+ def address_id
93
+ xpath(%w[UPRN])
94
+ end
95
+
96
+ # def type_of_assessment
97
+ # "CS63"
98
+ # end
99
+
100
+ def owner_commission_report
101
+ xpath(%w[Owner-Commission-Report])
102
+ end
103
+
104
+ def delegated_person_commission_report
105
+ xpath(%w[Delegated-Person-Commission-Report])
106
+ end
107
+
108
+ def property_type_short_description
109
+ xpath(%w[Property-Type Short-Description])
110
+ end
111
+
112
+ def property_type_long_description
113
+ xpath(%w[Property-Type Long-Description])
114
+ end
115
+
116
+ def building_improvements
117
+ xpath(%w[Improvement-Type Building-Improvements])
118
+ end
119
+
120
+ def operational_ratings
121
+ xpath(%w[Improvement-Type Operational-Rating])
122
+ end
123
+
124
+ def dec
125
+ xpath(%w[Operational-Rating-System Display-Energy-Certificate])
126
+ end
127
+
128
+ def planned_completion_date
129
+ xpath(%w[Improvements-Completion Planned-Completion-Date])
130
+ end
131
+
132
+ def actual_completion_date
133
+ xpath(%w[Improvements-Completion Actual-Completion-Date])
134
+ end
135
+
136
+ def target_emission_savings
137
+ xpath(%w[Target-Savings Target-Emission-Savings])
138
+ end
139
+
140
+ def target_energy_savings
141
+ xpath(%w[Target-Savings Target-Energy-Savings])
142
+ end
143
+
144
+ def accept_prescriptive_improvements
145
+ xpath(%w[Prescriptive-Improvements Accept-Prescriptive-Improvements])
146
+ end
147
+
148
+ def prescriptive_improvements
149
+ @xml_doc
150
+ .search("Prescriptive-Improvements Prescriptive-Scenario")
151
+ .map do |node|
152
+ {
153
+ measure_description_short:
154
+ xpath(%w[Measure-Description-Short], node),
155
+ measure_description_long:
156
+ xpath(%w[Measure-Description-Long], node),
157
+ measure_valid: xpath(%w[Measure-Valid], node),
158
+ measure_type: xpath(%w[Measure-Type], node),
159
+ }
160
+ end
161
+ end
162
+
163
+ def alternative_improvements
164
+ @xml_doc
165
+ .search("Alternative-Improvements Alternative-Scenario")
166
+ .map do |node|
167
+ {
168
+ measure_description_short:
169
+ xpath(%w[Measure-Description-Short], node),
170
+ measure_description_long:
171
+ xpath(%w[Measure-Description-Long], node),
172
+ measure_valid: xpath(%w[Measure-Valid], node),
173
+ measure_type: xpath(%w[Measure-Type], node),
174
+ }
175
+ end
176
+ end
177
+
178
+ def date_of_registration
179
+ xpath(%w[Report-Header Plan-Report-Date])
180
+ end
181
+
182
+ def date_of_expiry
183
+ Date.parse(date_of_registration).next_month(42).to_s
184
+ end
185
+
186
+ def date_of_assessment
187
+ xpath(%w[Report-Header Assessment-Date])
188
+ end
189
+
190
+ def related_rrn
191
+ nil
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,28 @@
1
+ module ViewModel
2
+ class Cs63Wrapper
3
+ attr_reader :view_model
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)
8
+ @summary = Presenter::Cs63::Summary.new(view_model)
9
+ @certificate_summary = Presenter::Cs63::CertificateSummary.new(view_model)
10
+ end
11
+
12
+ def type
13
+ :CS63
14
+ end
15
+
16
+ def to_hash
17
+ @summary.to_hash
18
+ end
19
+
20
+ def to_certificate_summary
21
+ @certificate_summary.to_certificate_summary
22
+ end
23
+
24
+ def get_view_model
25
+ view_model
26
+ end
27
+ end
28
+ end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module ViewModel
4
4
  class Factory
5
+ TYPES_OF_CS63 = %i[
6
+ CS63-S-7.0
7
+ ].freeze
5
8
  TYPES_OF_CEPC = %i[
6
9
  CEPC-8.0.0
7
10
  CEPC-NI-8.0.0
@@ -105,6 +108,8 @@ module ViewModel
105
108
  elsif TYPES_OF_SAP.include?(schema_type)
106
109
  report_type = xml_doc.at("Report-Type")&.content
107
110
  ViewModel::SapWrapper.new(xml_doc, schema_type, report_type, additional_data)
111
+ elsif TYPES_OF_CS63.include?(schema_type)
112
+ ViewModel::Cs63Wrapper.new(xml_doc, schema_type, additional_data)
108
113
  end
109
114
  end
110
115
  end
@@ -27,6 +27,8 @@ module ViewModelGateway
27
27
  rdsap_xsd_files
28
28
  when "cepc"
29
29
  cepc_xsd_files
30
+ when "cs63"
31
+ cd63_xsd_files
30
32
  end
31
33
  else
32
34
  @glob_path = "#{@dir_path}#{@xsd_dir_path}"
@@ -58,5 +60,10 @@ module ViewModelGateway
58
60
  @glob_path = "#{@dir_path + XSD_DEFAULT_PATH}Reported-Data.xsd"
59
61
  Dir.glob(@glob_path)
60
62
  end
63
+
64
+ def cs63_xsd_files
65
+ @glob_path = "#{@dir_path + XSD_DEFAULT_PATH}ActionPlan.xsd"
66
+ Dir.glob(@glob_path)
67
+ end
61
68
  end
62
69
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epb_view_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-01-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
39
  version: '2.6'
41
- description:
42
40
  email:
43
41
  - mhclg.digital-services@levellingup.gov.uk
44
42
  executables: []
@@ -172,6 +170,7 @@ files:
172
170
  - api/schemas/xml/CEPC-S-7.1/Reports/Report-Header.xsd
173
171
  - api/schemas/xml/CEPC-S-7.1/Reports/Reported-Data.xsd
174
172
  - api/schemas/xml/CEPC-S-7.1/Reports/UserManagement.xsd
173
+ - api/schemas/xml/CS63-S-7.0/ActionPlan.xsd
175
174
  - api/schemas/xml/RdSAP-Schema-17.0/RdSAP/ExternalDefinitions.xml
176
175
  - api/schemas/xml/RdSAP-Schema-17.0/RdSAP/ExternalDefinitions.xsd
177
176
  - api/schemas/xml/RdSAP-Schema-17.0/RdSAP/Templates/AssessorManagement.xsd
@@ -1572,12 +1571,16 @@ files:
1572
1571
  - lib/presenter/ac_cert/summary.rb
1573
1572
  - lib/presenter/ac_report/export_configuration.rb
1574
1573
  - lib/presenter/ac_report/summary.rb
1574
+ - lib/presenter/cepc/certificate_summary.rb
1575
1575
  - lib/presenter/cepc/export_configuration.rb
1576
1576
  - lib/presenter/cepc/report.rb
1577
1577
  - lib/presenter/cepc/summary.rb
1578
1578
  - lib/presenter/cepc_rr/export_configuration.rb
1579
1579
  - lib/presenter/cepc_rr/recommendation_report.rb
1580
1580
  - lib/presenter/cepc_rr/summary.rb
1581
+ - lib/presenter/cs63/certificate_summary.rb
1582
+ - lib/presenter/cs63/export_configuration.rb
1583
+ - lib/presenter/cs63/summary.rb
1581
1584
  - lib/presenter/dec/export_configuration.rb
1582
1585
  - lib/presenter/dec/report.rb
1583
1586
  - lib/presenter/dec/summary.rb
@@ -1668,6 +1671,8 @@ files:
1668
1671
  - lib/view_model/cepc_rr_wrapper.rb
1669
1672
  - lib/view_model/cepc_s_71/cepc.rb
1670
1673
  - lib/view_model/cepc_wrapper.rb
1674
+ - lib/view_model/cs63/common_schema.rb
1675
+ - lib/view_model/cs63_wrapper.rb
1671
1676
  - lib/view_model/dec_rr_wrapper.rb
1672
1677
  - lib/view_model/dec_summary_wrapper.rb
1673
1678
  - lib/view_model/dec_wrapper.rb
@@ -1782,7 +1787,6 @@ homepage: https://github.com/communitiesuk/epb-view-models
1782
1787
  licenses:
1783
1788
  - MIT
1784
1789
  metadata: {}
1785
- post_install_message:
1786
1790
  rdoc_options: []
1787
1791
  require_paths:
1788
1792
  - lib
@@ -1797,8 +1801,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1797
1801
  - !ruby/object:Gem::Version
1798
1802
  version: '0'
1799
1803
  requirements: []
1800
- rubygems_version: 3.5.11
1801
- signing_key:
1804
+ rubygems_version: 3.6.9
1802
1805
  specification_version: 4
1803
1806
  summary: Library used to parse Energy Performance Certificates (EPC)
1804
1807
  test_files: []