epb_view_models 1.0.2 → 1.0.3

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.buildspec.yml +13 -0
  4. data/.gitignore +5 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile.lock +22 -17
  7. data/lib/epb_view_models.rb +1 -1
  8. data/lib/helper/xml_enums_to_output.rb +23 -13
  9. data/lib/presenter/rd_sap/report.rb +196 -1
  10. data/lib/presenter/sap/report.rb +194 -0
  11. data/lib/view_model/rd_sap_schema_170/common_schema.rb +16 -0
  12. data/lib/view_model/rd_sap_schema_171/common_schema.rb +16 -0
  13. data/lib/view_model/rd_sap_schema_180/common_schema.rb +16 -0
  14. data/lib/view_model/rd_sap_schema_190/common_schema.rb +16 -0
  15. data/lib/view_model/rd_sap_schema_200/common_schema.rb +16 -0
  16. data/lib/view_model/rd_sap_schema_ni_173/common_schema.rb +16 -0
  17. data/lib/view_model/rd_sap_schema_ni_174/common_schema.rb +16 -0
  18. data/lib/view_model/rd_sap_schema_ni_180/common_schema.rb +16 -0
  19. data/lib/view_model/rd_sap_schema_ni_190/common_schema.rb +16 -0
  20. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +16 -0
  21. data/lib/view_model/rd_sap_wrapper.rb +4 -0
  22. data/lib/view_model/sap_schema_102/common_schema.rb +28 -0
  23. data/lib/view_model/sap_schema_102/rdsap.rb +4 -0
  24. data/lib/view_model/sap_schema_110/common_schema.rb +1 -2
  25. data/lib/view_model/sap_schema_110/rdsap.rb +28 -0
  26. data/lib/view_model/sap_schema_110/sap.rb +28 -0
  27. data/lib/view_model/sap_schema_112/common_schema.rb +1 -2
  28. data/lib/view_model/sap_schema_112/rdsap.rb +28 -0
  29. data/lib/view_model/sap_schema_112/sap.rb +28 -0
  30. data/lib/view_model/sap_schema_120/rdsap.rb +28 -0
  31. data/lib/view_model/sap_schema_120/sap.rb +28 -0
  32. data/lib/view_model/sap_schema_130/rdsap.rb +28 -0
  33. data/lib/view_model/sap_schema_130/sap.rb +28 -0
  34. data/lib/view_model/sap_schema_140/rdsap.rb +28 -0
  35. data/lib/view_model/sap_schema_140/sap.rb +28 -0
  36. data/lib/view_model/sap_schema_141/rdsap.rb +28 -0
  37. data/lib/view_model/sap_schema_141/sap.rb +28 -0
  38. data/lib/view_model/sap_schema_142/rdsap.rb +28 -0
  39. data/lib/view_model/sap_schema_142/sap.rb +28 -0
  40. data/lib/view_model/sap_schema_150/rdsap.rb +28 -0
  41. data/lib/view_model/sap_schema_150/sap.rb +28 -0
  42. data/lib/view_model/sap_schema_160/rdsap.rb +28 -0
  43. data/lib/view_model/sap_schema_160/sap.rb +28 -0
  44. data/lib/view_model/sap_schema_161/rdsap.rb +28 -0
  45. data/lib/view_model/sap_schema_161/sap.rb +28 -0
  46. data/lib/view_model/sap_schema_162/rdsap.rb +28 -0
  47. data/lib/view_model/sap_schema_162/sap.rb +28 -0
  48. data/lib/view_model/sap_schema_163/rdsap.rb +28 -0
  49. data/lib/view_model/sap_schema_163/sap.rb +28 -0
  50. data/lib/view_model/sap_schema_170/common_schema.rb +28 -0
  51. data/lib/view_model/sap_schema_171/common_schema.rb +28 -0
  52. data/lib/view_model/sap_schema_1800/common_schema.rb +28 -0
  53. data/lib/view_model/sap_schema_ni_112/rdsap.rb +32 -4
  54. data/lib/view_model/sap_schema_ni_112/sap.rb +27 -0
  55. data/lib/view_model/sap_schema_ni_120/rdsap.rb +32 -0
  56. data/lib/view_model/sap_schema_ni_120/sap.rb +28 -0
  57. data/lib/view_model/sap_schema_ni_130/rdsap.rb +32 -0
  58. data/lib/view_model/sap_schema_ni_130/sap.rb +28 -0
  59. data/lib/view_model/sap_schema_ni_140/rdsap.rb +32 -0
  60. data/lib/view_model/sap_schema_ni_140/sap.rb +28 -0
  61. data/lib/view_model/sap_schema_ni_141/rdsap.rb +32 -0
  62. data/lib/view_model/sap_schema_ni_141/sap.rb +28 -0
  63. data/lib/view_model/sap_schema_ni_142/rdsap.rb +32 -0
  64. data/lib/view_model/sap_schema_ni_142/sap.rb +28 -0
  65. data/lib/view_model/sap_schema_ni_150/rdsap.rb +32 -0
  66. data/lib/view_model/sap_schema_ni_150/sap.rb +28 -0
  67. data/lib/view_model/sap_schema_ni_160/common_schema.rb +2 -2
  68. data/lib/view_model/sap_schema_ni_160/rdsap.rb +28 -0
  69. data/lib/view_model/sap_schema_ni_160/sap.rb +28 -0
  70. data/lib/view_model/sap_schema_ni_161/common_schema.rb +1 -1
  71. data/lib/view_model/sap_schema_ni_161/rdsap.rb +28 -0
  72. data/lib/view_model/sap_schema_ni_161/sap.rb +28 -0
  73. data/lib/view_model/sap_schema_ni_170/rdsap.rb +28 -0
  74. data/lib/view_model/sap_schema_ni_170/sap.rb +28 -0
  75. data/lib/view_model/sap_schema_ni_171/rdsap.rb +28 -0
  76. data/lib/view_model/sap_schema_ni_171/sap.rb +28 -0
  77. data/lib/view_model/sap_schema_ni_172/rdsap.rb +36 -0
  78. data/lib/view_model/sap_schema_ni_172/sap.rb +28 -0
  79. data/lib/view_model/sap_schema_ni_173/common_schema.rb +28 -0
  80. data/lib/view_model/sap_schema_ni_174/common_schema.rb +28 -0
  81. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +28 -0
  82. data/lib/view_model/sap_wrapper.rb +4 -0
  83. metadata +5 -2
@@ -12,8 +12,202 @@ module Presenter
12
12
  .merge(report_from_additional_data)
13
13
  end
14
14
 
15
+ def to_hash_ni
16
+ report_from_ni_assessment_xml
17
+ end
18
+
15
19
  private
16
20
 
21
+ def report_from_ni_assessment_xml
22
+ {
23
+ address1: @view_model.address_line1,
24
+ address2: @view_model.address_line2,
25
+ address3: @view_model.address_line3,
26
+ built_form:
27
+ Helper::XmlEnumsToOutput.xml_value_to_string(@view_model.built_form),
28
+ co2_emiss_curr_perfloor_area:
29
+ @view_model.co2_emissions_current_per_floor_area,
30
+ co2_emissions_current: @view_model.current_carbon_emission,
31
+ co2_emissions_potential: @view_model.potential_carbon_emission,
32
+ construction_age_band:
33
+ Helper::XmlEnumsToOutput.construction_age_band_lookup(
34
+ @view_model.main_dwelling_construction_age_band_or_year,
35
+ @schema_type,
36
+ @view_model.report_type,
37
+ ),
38
+ current_energy_efficiency: @view_model.current_energy_rating.to_s.chomp,
39
+ current_energy_rating:
40
+ Helper::EnergyBandCalculator.domestic(
41
+ @view_model.current_energy_rating,
42
+ ),
43
+ cylinder_insul_thickness: @view_model.cylinder_insul_thickness,
44
+ cylinder_insulation_type: @view_model.cylinder_insulation_type,
45
+ cylinder_size: @view_model.cylinder_size,
46
+ has_cylinder_thermostat: @view_model.has_cylinder_thermostat,
47
+ energy_consumption_current: @view_model.primary_energy_use,
48
+ energy_consumption_potential: @view_model.energy_consumption_potential,
49
+ energy_tariff:
50
+ Helper::XmlEnumsToOutput.energy_tariff(
51
+ @view_model.energy_tariff,
52
+ @view_model.report_type,
53
+ ),
54
+ environment_impact_current: @view_model.environmental_impact_current,
55
+ environment_impact_potential:
56
+ @view_model.environmental_impact_potential,
57
+ extension_count: @view_model.extensions_count,
58
+ fixed_lighting_outlets_count: @view_model.fixed_lighting_outlets_count,
59
+ flat_storey_count: @view_model.storey_count,
60
+ flat_top_storey: @view_model.top_storey,
61
+ floor_description: @view_model.all_floor_descriptions.first,
62
+ floor_energy_eff:
63
+ Helper::XmlEnumsToOutput.energy_rating_string(
64
+ @view_model.all_floor_energy_efficiency_rating.first,
65
+ ),
66
+ floor_env_eff:
67
+ Helper::XmlEnumsToOutput.energy_rating_string(
68
+ @view_model.all_floor_env_energy_efficiency_rating.first,
69
+ ),
70
+ floor_height:
71
+ if @view_model.respond_to?(:floor_height)
72
+ @view_model.floor_height.first
73
+ end,
74
+ floor_level: @view_model.floor_level,
75
+ glazed_area:
76
+ Helper::XmlEnumsToOutput.glazed_area_rdsap(@view_model.glazed_area),
77
+ glazed_type:
78
+ Helper::XmlEnumsToOutput.glazed_type_rdsap(
79
+ @view_model.multi_glazing_type,
80
+ ),
81
+ heat_loss_corridor:
82
+ Helper::XmlEnumsToOutput.heat_loss_corridor(
83
+ @view_model.heat_loss_corridor,
84
+ ),
85
+ heating_cost_current: @view_model.heating_cost_current,
86
+ heating_cost_potential: @view_model.heating_cost_potential,
87
+ hot_water_cost_current: @view_model.hot_water_cost_current,
88
+ hot_water_cost_potential: @view_model.hot_water_cost_potential,
89
+ hot_water_energy_eff:
90
+ Helper::XmlEnumsToOutput.energy_rating_string(
91
+ @view_model.hot_water_energy_efficiency_rating,
92
+ ),
93
+ hot_water_env_eff:
94
+ Helper::XmlEnumsToOutput.energy_rating_string(
95
+ @view_model.hot_water_environmental_efficiency_rating,
96
+ ),
97
+ hotwater_description: @view_model.hot_water_description,
98
+ inspection_date: @view_model.date_of_assessment,
99
+ lighting_cost_current: @view_model.lighting_cost_current,
100
+ lighting_cost_potential: @view_model.lighting_cost_potential,
101
+ lighting_description: @view_model.lighting_description,
102
+ lighting_energy_eff:
103
+ Helper::XmlEnumsToOutput.energy_rating_string(
104
+ @view_model.lighting_energy_efficiency_rating,
105
+ ),
106
+ lighting_env_eff:
107
+ Helper::XmlEnumsToOutput.energy_rating_string(
108
+ @view_model.lighting_environmental_efficiency_rating,
109
+ ),
110
+ low_energy_lighting: @view_model.low_energy_lighting,
111
+ low_energy_fixed_light_count:
112
+ @view_model.low_energy_fixed_lighting_outlets_count,
113
+ main_fuel:
114
+ Helper::XmlEnumsToOutput.main_fuel_sap(@view_model.main_fuel_type),
115
+ mainheat_description:
116
+ @view_model.all_main_heating_descriptions.join(", "),
117
+ mainheat_energy_eff:
118
+ Helper::XmlEnumsToOutput.energy_rating_string(
119
+ @view_model.all_main_heating_energy_efficiency.first,
120
+ ),
121
+ mainheat_env_eff:
122
+ Helper::XmlEnumsToOutput.energy_rating_string(
123
+ @view_model.all_main_heating_environmental_efficiency.first,
124
+ ),
125
+ mainheatc_energy_eff:
126
+ Helper::XmlEnumsToOutput.energy_rating_string(
127
+ @view_model.all_main_heating_controls_energy_efficiency.first,
128
+ ),
129
+ mainheatc_env_eff:
130
+ Helper::XmlEnumsToOutput.energy_rating_string(
131
+ @view_model.all_main_heating_controls_environmental_efficiency.first,
132
+ ),
133
+ mainheatcont_description:
134
+ @view_model.all_main_heating_controls_descriptions.first,
135
+ mains_gas_flag:
136
+ @view_model.respond_to?(:mains_gas) ? @view_model.mains_gas : nil,
137
+ mechanical_ventilation:
138
+ Helper::XmlEnumsToOutput.mechanical_ventilation(
139
+ @view_model.mechanical_ventilation,
140
+ @schema_type,
141
+ @view_model.report_type,
142
+ ),
143
+ mech_vent_sys_index_number: @view_model.mech_vent_sys_index_number,
144
+ mechanical_vent_data_source: @view_model.mechanical_vent_data_source,
145
+ multi_glaze_proportion: @view_model.multiple_glazed_proportion,
146
+ number_habitable_rooms: @view_model.habitable_room_count,
147
+ number_heated_rooms: @view_model.heated_room_count,
148
+ number_open_fireplaces: @view_model.open_fireplaces_count,
149
+ photo_supply: @view_model.photovoltaic_roof_area_percent,
150
+ postcode: @view_model.postcode,
151
+ posttown: @view_model.town,
152
+ potential_energy_efficiency:
153
+ @view_model.potential_energy_rating.to_s.chomp,
154
+ potential_energy_rating:
155
+ Helper::EnergyBandCalculator.domestic(
156
+ @view_model.potential_energy_rating,
157
+ ),
158
+ property_type:
159
+ Helper::XmlEnumsToOutput.property_type(@view_model.property_type),
160
+ report_type: @view_model.report_type,
161
+ roof_description: @view_model.all_roof_descriptions.first,
162
+ roof_energy_eff:
163
+ Helper::XmlEnumsToOutput.energy_rating_string(
164
+ @view_model.all_roof_energy_efficiency_rating.first,
165
+ ),
166
+ roof_env_eff:
167
+ Helper::XmlEnumsToOutput.energy_rating_string(
168
+ @view_model.all_roof_env_energy_efficiency_rating.first,
169
+ ),
170
+ secondheat_description: @view_model.secondary_heating_description,
171
+ sheating_energy_eff:
172
+ Helper::XmlEnumsToOutput.energy_rating_string(
173
+ @view_model.secondary_heating_energy_efficiency_rating,
174
+ ),
175
+ sheating_env_eff:
176
+ Helper::XmlEnumsToOutput.energy_rating_string(
177
+ @view_model.secondary_heating_environmental_efficiency_rating,
178
+ ),
179
+ solar_water_heating_flag: @view_model.solar_water_heating_flag,
180
+ thermal_store: @view_model.thermal_store,
181
+ tenure: Helper::XmlEnumsToOutput.tenure(@view_model.tenure),
182
+ total_floor_area: @view_model.total_floor_area,
183
+ transaction_type:
184
+ Helper::XmlEnumsToOutput.transaction_type(
185
+ @view_model.transaction_type,
186
+ @view_model.report_type,
187
+ ),
188
+ unheated_corridor_length: @view_model.unheated_corridor_length,
189
+ walls_description: @view_model.all_wall_descriptions.first,
190
+ walls_energy_eff:
191
+ Helper::XmlEnumsToOutput.energy_rating_string(
192
+ @view_model.all_wall_energy_efficiency_rating.first,
193
+ ),
194
+ walls_env_eff:
195
+ Helper::XmlEnumsToOutput.energy_rating_string(
196
+ @view_model.all_wall_env_energy_efficiency_rating.first,
197
+ ),
198
+ wind_turbine_count: @view_model.wind_turbine_count,
199
+ windows_description: @view_model.window_description,
200
+ windows_energy_eff:
201
+ Helper::XmlEnumsToOutput.energy_rating_string(
202
+ @view_model.window_energy_efficiency_rating,
203
+ ),
204
+ windows_env_eff:
205
+ Helper::XmlEnumsToOutput.energy_rating_string(
206
+ @view_model.window_environmental_efficiency_rating,
207
+ ),
208
+ }
209
+ end
210
+
17
211
  def report_from_assessment_xml
18
212
  {
19
213
  assessment_id: Helper::RrnHelper.hash_rrn(@view_model.assessment_id),
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -575,6 +575,22 @@ module ViewModel
575
575
  end
576
576
  nil
577
577
  end
578
+
579
+ def cylinder_insul_thickness
580
+ xpath(%w[Cylinder-Insulation-Thickness])
581
+ end
582
+
583
+ def cylinder_insulation_type
584
+ xpath(%w[Cylinder-Insulation-Type])
585
+ end
586
+
587
+ def cylinder_size
588
+ xpath(%w[Cylinder-Size])
589
+ end
590
+
591
+ def has_cylinder_thermostat
592
+ xpath(%w[Cylinder-Thermostat])
593
+ end
578
594
  end
579
595
  end
580
596
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end
@@ -566,6 +566,22 @@ module ViewModel
566
566
  end
567
567
  nil
568
568
  end
569
+
570
+ def cylinder_insulation_type
571
+ xpath(%w[Cylinder-Insulation-Type])
572
+ end
573
+
574
+ def cylinder_insul_thickness
575
+ xpath(%w[Cylinder-Insulation-Thickness])
576
+ end
577
+
578
+ def cylinder_size
579
+ xpath(%w[Cylinder-Size])
580
+ end
581
+
582
+ def has_cylinder_thermostat
583
+ xpath(%w[Cylinder-Thermostat])
584
+ end
569
585
  end
570
586
  end
571
587
  end
@@ -18,6 +18,10 @@ module ViewModel
18
18
  @summary.to_hash
19
19
  end
20
20
 
21
+ def to_hash_ni
22
+ @report.to_hash_ni
23
+ end
24
+
21
25
  def to_report
22
26
  @report.to_hash
23
27
  end