diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0240-0200-5706-2365-8010.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0240-0200-5706-2365-8010.json new file mode 100644 index 00000000..579d48df --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0240-0200-5706-2365-8010.json @@ -0,0 +1,536 @@ +{ + "uprn": 10008625005, + "roofs": [ + { + "description": "Pitched, 400+ mm loft insulation", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + { + "description": "Pitched, insulated (assumed)", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + { + "description": "Roof room(s), insulated (assumed)", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "walls": [ + { + "description": "Sandstone, as built, insulated (assumed)", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "floors": [ + { + "description": "Solid, insulated (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "lighting": { + "description": "Excellent lighting efficiency", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + "postcode": "LE15 9LB", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "post_town": "OAKHAM", + "psv_count": 0, + "built_form": 1, + "created_at": "2026-04-27 19:21:35", + "door_count": 2, + "region_code": 6, + "report_type": 2, + "sap_heating": { + "number_baths": 1, + "cylinder_size": 1, + "shower_outlets": [ + { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + }, + { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + }, + { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + } + ], + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 28, + "cylinder_thermostat": "N", + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 28, + "boiler_flue_type": 2, + "fan_flue_present": "N", + "heat_emitter_type": 1, + "emitter_temperature": 1, + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 51, + "sap_main_heating_code": 130, + "central_heating_pump_age": 0, + "main_heating_data_source": 2 + }, + { + "has_fghrs": "N", + "main_fuel_type": 28, + "boiler_flue_type": 2, + "fan_flue_present": "N", + "heat_emitter_type": 2, + "emitter_temperature": 4, + "main_heating_number": 2, + "main_heating_control": 2110, + "main_heating_category": 2, + "main_heating_fraction": 49, + "sap_main_heating_code": 130, + "central_heating_pump_age": 0, + "main_heating_data_source": 2 + } + ], + "immersion_heating_type": "NA", + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": { + "value": 1.4, + "quantity": "m" + }, + "window_height": { + "value": 1.3, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": { + "value": 1.2, + "quantity": "m" + }, + "window_height": { + "value": 1.3, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": { + "value": 1.6, + "quantity": "m" + }, + "window_height": { + "value": 1.3, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": { + "value": 2.5, + "quantity": "m" + }, + "window_height": { + "value": 2, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": { + "value": 1.4, + "quantity": "m" + }, + "window_height": { + "value": 1.3, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 2, + "glazing_type": 2, + "window_width": { + "value": 1, + "quantity": "m" + }, + "window_height": { + "value": 1, + "quantity": "m" + }, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, oil", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + { + "description": "Boiler and underfloor heating, oil", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Detached house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "36a Main Street", + "address_line_2": "Belton In Rutland", + "assessment_type": "RdSAP", + "completion_date": "2026-04-27", + "inspection_date": "2026-04-27", + "extensions_count": 1, + "measurement_type": 1, + "open_flues_count": 0, + "total_floor_area": 202, + "transaction_type": 1, + "conservatory_type": 2, + "heated_room_count": 7, + "other_flues_count": 0, + "registration_date": "2026-04-27", + "sap_energy_source": { + "mains_gas": "N", + "meter_type": 3, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "true" + }, + "secondary_heating": { + "description": "None", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "closed_flues_count": 0, + "extract_fans_count": 0, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "floor_heat_loss": 7, + "sap_room_in_roof": { + "floor_area": 83.2, + "room_in_roof_type_1": { + "gable_wall_type_1": 0, + "gable_wall_type_2": 0, + "gable_wall_length_1": 6.4, + "gable_wall_length_2": 6.4 + }, + "construction_age_band": "J" + }, + "roof_construction": 4, + "wall_construction": 2, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": 2.28, + "floor_insulation": 1, + "total_floor_area": 97.72, + "party_wall_length": 0, + "floor_construction": 1, + "heat_loss_perimeter": 36.45 + } + ], + "wall_insulation_type": 4, + "construction_age_band": "J", + "party_wall_construction": "NA", + "wall_thickness_measured": "N", + "roof_insulation_location": 2, + "roof_insulation_thickness": "400mm+", + "wall_insulation_thickness": "NI" + }, + { + "identifier": "Extension 1", + "wall_dry_lined": "N", + "floor_heat_loss": 7, + "roof_construction": 5, + "wall_construction": 2, + "building_part_number": 2, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": 2.28, + "floor_insulation": 1, + "total_floor_area": 20.61, + "party_wall_length": 0, + "floor_construction": 1, + "heat_loss_perimeter": 13.45 + } + ], + "wall_insulation_type": 4, + "construction_age_band": "J", + "party_wall_construction": "NA", + "wall_thickness_measured": "N", + "roof_insulation_location": 4, + "roof_insulation_thickness": "NI", + "wall_insulation_thickness": "NI" + } + ], + "boilers_flues_count": 0, + "open_chimneys_count": 0, + "solar_water_heating": "N", + "habitable_room_count": 7, + "heating_cost_current": { + "value": 1376, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 6.0, + "energy_rating_average": 60, + "energy_rating_current": 73, + "lighting_cost_current": { + "value": 127, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + { + "description": "Time and temperature zone control", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + } + ], + "blocked_chimneys_count": 0, + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 1376, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 288, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 85, + "schema_version_current": "LIG-21.0", + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": 317, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 78, + "environmental_impact_rating": 70 + } + ], + "co2_emissions_potential": 5.7, + "energy_rating_potential": 78, + "lighting_cost_potential": { + "value": 127, + "currency": "GBP" + }, + "schema_version_original": "LIG-21.0", + "hot_water_cost_potential": { + "value": 288, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2842.82, + "space_heating_existing_dwelling": 13254.52 + }, + "draughtproofed_door_count": 0, + "energy_consumption_current": 122, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "10.2.2.0", + "energy_consumption_potential": 113, + "environmental_impact_current": 69, + "cfl_fixed_lighting_bulbs_count": 0, + "current_energy_efficiency_band": "C", + "environmental_impact_potential": 70, + "led_fixed_lighting_bulbs_count": 8, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 30, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0300-2747-7640-2526-2135.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0300-2747-7640-2526-2135.json new file mode 100644 index 00000000..df63f14d --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0300-2747-7640-2526-2135.json @@ -0,0 +1,480 @@ +{ + "uprn": 44097668, + "roofs": [ + { + "description": "Pitched, 270 mm loft insulation", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + } + ], + "walls": [ + { + "description": "Cavity wall, filled cavity", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "floors": [ + { + "description": "Solid, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 2, + "environmental_efficiency_rating": 2 + }, + "addendum": { + "addendum_numbers": [ + 15 + ] + }, + "lighting": { + "description": "Excellent lighting efficiency", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + "postcode": "ME8 6SU", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + "post_town": "GILLINGHAM", + "built_form": 2, + "created_at": "2026-04-23 15:22:04", + "door_count": 1, + "region_code": 14, + "report_type": 2, + "sap_heating": { + "number_baths": 1, + "cylinder_size": 1, + "shower_outlets": [ + { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + }, + { + "shower_wwhrs": 1, + "shower_outlet_type": 2 + } + ], + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 26, + "secondary_fuel_type": 26, + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 26, + "boiler_flue_type": 2, + "fan_flue_present": "Y", + "heat_emitter_type": 1, + "emitter_temperature": 0, + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 1, + "central_heating_pump_age": 0, + "main_heating_data_source": 1, + "main_heating_index_number": 17992 + } + ], + "immersion_heating_type": "NA", + "secondary_heating_type": 605, + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "orientation": 4, + "window_type": 1, + "glazing_type": 2, + "window_width": 2.45, + "window_height": 1.32, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 2.05, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.11, + "window_height": 2.05, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.04, + "window_height": 2.05, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.45, + "window_height": 1.32, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 2, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.45, + "window_height": 0.6, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 4, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.3, + "window_height": 1.32, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 4, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.58, + "window_height": 1.32, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.28, + "window_height": 0.6, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 8, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.19, + "window_height": 0.6, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, mains gas", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Semi-detached house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "36 Milsted Road", + "assessment_type": "RdSAP", + "completion_date": "2026-04-23", + "inspection_date": "2026-04-23", + "extensions_count": 1, + "measurement_type": 1, + "open_flues_count": 1, + "total_floor_area": 526, + "transaction_type": 1, + "conservatory_type": 1, + "has_draught_lobby": "true", + "heated_room_count": 5, + "registration_date": "2026-04-23", + "sap_energy_source": { + "mains_gas": "Y", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "false" + }, + "secondary_heating": { + "description": "Room heaters, mains gas", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "extract_fans_count": 1, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "wall_thickness": 280, + "floor_heat_loss": 7, + "roof_construction": 4, + "wall_construction": 4, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.36, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 456.97, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 6.29, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 13.49, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.44, + "quantity": "metres" + }, + "total_floor_area": { + "value": 43.83, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 6.24, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 20.29, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "D", + "party_wall_construction": 0, + "wall_thickness_measured": "Y", + "roof_insulation_location": 2, + "roof_insulation_thickness": "270mm", + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI" + }, + { + "identifier": "Extension 1", + "wall_dry_lined": "N", + "wall_thickness": 280, + "floor_heat_loss": 7, + "roof_construction": 1, + "wall_construction": 4, + "building_part_number": 2, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.36, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 25.21, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 5.71, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 12.74, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "D", + "party_wall_construction": 0, + "wall_thickness_measured": "Y", + "roof_insulation_location": 6, + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI", + "flat_roof_insulation_thickness": "AB" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 7, + "heating_cost_current": { + "value": 3418, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 10, + "energy_rating_average": 60, + "energy_rating_current": 78, + "lighting_cost_current": { + "value": 250, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 3177, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 303, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 100, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 241, + "currency": "GBP" + }, + "indicative_cost": "\u00a3900 - \u00a31,200", + "improvement_type": "A2", + "improvement_details": { + "improvement_number": 45 + }, + "improvement_category": 5, + "energy_performance_rating": 79, + "environmental_impact_rating": 75 + }, + { + "sequence": 2, + "typical_saving": { + "value": 314, + "currency": "GBP" + }, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 81, + "environmental_impact_rating": 76 + } + ], + "co2_emissions_potential": 9.3, + "energy_rating_potential": 81, + "lighting_cost_potential": { + "value": 250, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "hot_water_cost_potential": { + "value": 303, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2791.63, + "space_heating_existing_dwelling": 35376.05 + }, + "draughtproofed_door_count": 1, + "energy_consumption_current": 106, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "5.02r0342", + "energy_consumption_potential": 96, + "environmental_impact_current": 74, + "current_energy_efficiency_band": "C", + "environmental_impact_potential": 76, + "led_fixed_lighting_bulbs_count": 15, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "B", + "co2_emissions_current_per_floor_area": 19, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0390-2954-3640-2196-4175.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0390-2954-3640-2196-4175.json new file mode 100644 index 00000000..a13ac6ed --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/0390-2954-3640-2196-4175.json @@ -0,0 +1,619 @@ +{ + "uprn": 10022970979, + "roofs": [ + { + "description": "Pitched, insulated (assumed)", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "walls": [ + { + "description": "Cavity wall, as built, partial insulation (assumed)", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "floors": [ + { + "description": "Solid, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "addendum": { + "addendum_numbers": [ + 15 + ], + "cavity_fill_recommended": "true" + }, + "lighting": { + "description": "Excellent lighting efficiency", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + "postcode": "BB7 3JG", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "post_town": "CLITHEROE", + "built_form": 1, + "created_at": "2026-05-06 08:21:43", + "door_count": 3, + "region_code": 19, + "report_type": 2, + "sap_heating": { + "number_baths": 2, + "cylinder_size": 3, + "shower_outlets": [ + { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + } + ], + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 28, + "cylinder_thermostat": "Y", + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 28, + "boiler_flue_type": 2, + "fan_flue_present": "N", + "heat_emitter_type": 1, + "emitter_temperature": "NA", + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 1, + "central_heating_pump_age": 0, + "main_heating_data_source": 1, + "main_heating_index_number": 9005 + } + ], + "immersion_heating_type": "NA", + "cylinder_insulation_type": 1, + "has_fixed_air_conditioning": "false", + "cylinder_insulation_thickness": 50 + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.8, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.7, + "window_height": 1.9, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 7, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.4, + "window_height": 1.3, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.4, + "window_height": 1.3, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.3, + "window_height": 1.7, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.8, + "window_height": 1.1, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.8, + "window_height": 1.1, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.8, + "window_height": 1.1, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.8, + "window_height": 1.1, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, oil", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Detached house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "Easington House", + "address_line_2": "Eaves Hall Lane", + "address_line_3": "West Bradford", + "assessment_type": "RdSAP", + "completion_date": "2026-05-06", + "inspection_date": "2026-04-14", + "extensions_count": 0, + "measurement_type": 1, + "total_floor_area": 360, + "transaction_type": 1, + "conservatory_type": 1, + "has_draught_lobby": "true", + "heated_room_count": 8, + "registration_date": "2026-05-06", + "sap_energy_source": { + "mains_gas": "N", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "false" + }, + "secondary_heating": { + "description": "None", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "wall_thickness": 580, + "floor_heat_loss": 7, + "roof_construction": 5, + "wall_construction": 4, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.6, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 180.22, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 55.83, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.7, + "quantity": "metres" + }, + "total_floor_area": { + "value": 180.22, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 55.83, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 4, + "construction_age_band": "F", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 4, + "roof_insulation_thickness": "ND", + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 8, + "heating_cost_current": { + "value": 3165, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 15, + "energy_rating_average": 60, + "energy_rating_current": 60, + "lighting_cost_current": { + "value": 152, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "has_hot_water_cylinder": "true", + "heating_cost_potential": { + "value": 2427, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 274, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 100, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 446, + "currency": "GBP" + }, + "indicative_cost": "\u00a3900 - \u00a31,500", + "improvement_type": "B", + "improvement_details": { + "improvement_number": 6 + }, + "improvement_category": 5, + "energy_performance_rating": 65, + "environmental_impact_rating": 58 + }, + { + "sequence": 2, + "typical_saving": { + "value": 138, + "currency": "GBP" + }, + "indicative_cost": "\u00a35,000 - \u00a310,000", + "improvement_type": "W2", + "improvement_details": { + "improvement_number": 58 + }, + "improvement_category": 5, + "energy_performance_rating": 67, + "environmental_impact_rating": 60 + }, + { + "sequence": 3, + "typical_saving": { + "value": 171, + "currency": "GBP" + }, + "indicative_cost": "\u00a32,200 - \u00a33,500", + "improvement_type": "I", + "improvement_details": { + "improvement_number": 20 + }, + "improvement_category": 5, + "energy_performance_rating": 69, + "environmental_impact_rating": 62 + }, + { + "sequence": 4, + "typical_saving": { + "value": 259, + "currency": "GBP" + }, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 71, + "environmental_impact_rating": 63 + } + ], + "co2_emissions_potential": 11, + "energy_rating_potential": 71, + "lighting_cost_potential": { + "value": 152, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "alternative_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 262, + "currency": "GBP" + }, + "improvement_type": "Q2", + "improvement_details": { + "improvement_number": 55 + }, + "improvement_category": 6, + "energy_performance_rating": 68, + "environmental_impact_rating": 62 + }, + { + "sequence": 2, + "typical_saving": { + "value": 88, + "currency": "GBP" + }, + "improvement_type": "J2", + "improvement_details": { + "improvement_number": 54 + }, + "improvement_category": 6, + "energy_performance_rating": 72, + "environmental_impact_rating": 96 + } + ], + "hot_water_cost_potential": { + "value": 257, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 3292.08, + "space_heating_existing_dwelling": 39282.1 + }, + "draughtproofed_door_count": 3, + "energy_consumption_current": 165, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "5.02r0344", + "energy_consumption_potential": 125, + "environmental_impact_current": 52, + "current_energy_efficiency_band": "D", + "environmental_impact_potential": 63, + "led_fixed_lighting_bulbs_count": 25, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 41, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/6035-7729-2309-0879-2296.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/6035-7729-2309-0879-2296.json new file mode 100644 index 00000000..e45b7553 --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/6035-7729-2309-0879-2296.json @@ -0,0 +1,495 @@ +{ + "uprn": 100050911226, + "roofs": [ + { + "description": "Pitched, 300 mm loft insulation", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + { + "description": "Roof room(s), limited insulation (assumed)", + "energy_efficiency_rating": 2, + "environmental_efficiency_rating": 2 + } + ], + "walls": [ + { + "description": "Solid brick, with internal insulation", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + { + "description": "Solid brick, as built, no insulation (assumed)", + "energy_efficiency_rating": 1, + "environmental_efficiency_rating": 1 + } + ], + "floors": [ + { + "description": "Suspended, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + { + "description": "Solid, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 2, + "environmental_efficiency_rating": 2 + }, + "lighting": { + "description": "Below average lighting efficiency", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "postcode": "S10 1EA", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + "post_town": "SHEFFIELD", + "built_form": 4, + "created_at": "2025-11-11 13:03:41", + "door_count": 2, + "region_code": 3, + "report_type": 2, + "sap_heating": { + "number_baths": 2, + "cylinder_size": 1, + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 26, + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 26, + "boiler_flue_type": 2, + "fan_flue_present": "Y", + "heat_emitter_type": 1, + "emitter_temperature": 1, + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 1, + "sap_main_heating_code": 104, + "central_heating_pump_age": 2, + "main_heating_data_source": 2 + } + ], + "immersion_heating_type": "NA", + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.6, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.3, + "window_height": 1.8, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 1.19, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.6, + "window_height": 1.4, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.8, + "window_height": 0.6, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 0.8, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 0.8, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 4, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.12, + "window_height": 1.8, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, mains gas", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Mid-terrace house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "43 Barber Road", + "assessment_type": "RdSAP", + "completion_date": "2025-11-11", + "inspection_date": "2025-11-11", + "extensions_count": 1, + "measurement_type": 1, + "total_floor_area": 128, + "transaction_type": 1, + "conservatory_type": 1, + "heated_room_count": 6, + "registration_date": "2025-11-11", + "sap_energy_source": { + "mains_gas": "Y", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "false" + }, + "secondary_heating": { + "description": "None", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "wall_thickness": 340, + "floor_heat_loss": 7, + "sap_room_in_roof": { + "floor_area": 29.75, + "room_in_roof_type_1": { + "gable_wall_type_1": 1, + "gable_wall_type_2": 0, + "gable_wall_length_1": 4.65, + "gable_wall_length_2": 4.65 + }, + "construction_age_band": "A" + }, + "roof_construction": 4, + "wall_construction": 3, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.78, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 41.73, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 7.92, + "quantity": "metres" + }, + "floor_construction": 2, + "heat_loss_perimeter": { + "value": 15.99, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.78, + "quantity": "metres" + }, + "total_floor_area": { + "value": 41.73, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 15.84, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 8.32, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 3, + "construction_age_band": "A", + "party_wall_construction": 1, + "wall_thickness_measured": "Y", + "roof_insulation_location": 2, + "roof_insulation_thickness": "300mm", + "wall_insulation_thickness": "100mm", + "floor_insulation_thickness": "NI" + }, + { + "identifier": "Extension 1", + "wall_dry_lined": "N", + "wall_thickness": 240, + "floor_heat_loss": 7, + "roof_construction": 4, + "wall_construction": 3, + "building_part_number": 2, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.82, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 7.21, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 8.31, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.86, + "quantity": "metres" + }, + "total_floor_area": { + "value": 7.21, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 8.31, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 4, + "construction_age_band": "A", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 2, + "roof_insulation_thickness": "300mm", + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 6, + "heating_cost_current": { + "value": 1285, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 4.5, + "energy_rating_average": 60, + "energy_rating_current": 70, + "lighting_cost_current": { + "value": 103, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 1031, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 217, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 100, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 174, + "currency": "GBP" + }, + "indicative_cost": "\u00a37,500 - \u00a311,000", + "improvement_type": "Q", + "improvement_details": { + "improvement_number": 7 + }, + "improvement_category": 5, + "energy_performance_rating": 73, + "environmental_impact_rating": 71 + }, + { + "sequence": 2, + "typical_saving": { + "value": 79, + "currency": "GBP" + }, + "indicative_cost": "\u00a35,000 - \u00a310,000", + "improvement_type": "W1", + "improvement_details": { + "improvement_number": 57 + }, + "improvement_category": 5, + "energy_performance_rating": 75, + "environmental_impact_rating": 73 + }, + { + "sequence": 3, + "typical_saving": { + "value": 227, + "currency": "GBP" + }, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 78, + "environmental_impact_rating": 74 + } + ], + "co2_emissions_potential": 3.5, + "energy_rating_potential": 78, + "lighting_cost_potential": { + "value": 103, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "hot_water_cost_potential": { + "value": 217, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2660.85, + "space_heating_existing_dwelling": 14828.94 + }, + "draughtproofed_door_count": 2, + "energy_consumption_current": 191, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "sap_deselected_improvements": [ + "X" + ], + "calculation_software_version": "5.02r0328", + "energy_consumption_potential": 147, + "environmental_impact_current": 67, + "current_energy_efficiency_band": "C", + "environmental_impact_potential": 74, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 35, + "low_energy_fixed_lighting_bulbs_count": 9, + "incandescent_fixed_lighting_bulbs_count": 2 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/7536-3827-0600-0600-0276.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/7536-3827-0600-0600-0276.json new file mode 100644 index 00000000..b81ad40f --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/7536-3827-0600-0600-0276.json @@ -0,0 +1,761 @@ +{ + "uprn": 200002992553, + "roofs": [ + { + "description": "Pitched, 100 mm loft insulation", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + { + "description": "Pitched, insulated", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "walls": [ + { + "description": "Cavity wall, filled cavity", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + { + "description": "Cavity wall, as built, insulated (assumed)", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "floors": [ + { + "description": "To unheated space, insulated", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + { + "description": "Solid, insulated (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "lighting": { + "description": "Excellent lighting efficiency", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + "postcode": "S10 5PT", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + "post_town": "SHEFFIELD", + "built_form": 1, + "created_at": "2026-04-04 16:58:11", + "door_count": 2, + "region_code": 3, + "report_type": 2, + "sap_heating": { + "number_baths": 1, + "cylinder_size": 1, + "shower_outlets": [ + { + "shower_outlet": { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + } + } + ], + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 26, + "secondary_fuel_type": 29, + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 26, + "boiler_flue_type": 2, + "fan_flue_present": "Y", + "heat_emitter_type": 1, + "emitter_temperature": 0, + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 1, + "central_heating_pump_age": 0, + "main_heating_data_source": 1, + "main_heating_index_number": 17679 + } + ], + "immersion_heating_type": "NA", + "secondary_heating_type": 691, + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 1.05, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.9, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.9, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.9, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 2, + "glazing_type": 2, + "window_width": 0.9, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.6, + "window_height": 2.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.5, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.5, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.4, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 7, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.9, + "window_height": 1.05, + "draught_proofed": "true", + "window_location": 2, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 7, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.9, + "window_height": 1.05, + "draught_proofed": "true", + "window_location": 2, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 7, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 1.05, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 7, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.4, + "window_height": 0.9, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 1.05, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 1, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.1, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.5, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.5, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.4, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.4, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.4, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": "16+", + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, mains gas", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Detached house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "588 Manchester Road", + "assessment_type": "RdSAP", + "completion_date": "2026-04-04", + "inspection_date": "2026-03-30", + "extensions_count": 2, + "measurement_type": 1, + "total_floor_area": 152, + "transaction_type": 1, + "conservatory_type": 1, + "heated_room_count": 6, + "registration_date": "2026-04-04", + "sap_energy_source": { + "mains_gas": "Y", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "true", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "true" + }, + "secondary_heating": { + "description": "Room heaters, electric", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "extract_fans_count": 1, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "wall_thickness": 250, + "floor_heat_loss": 2, + "roof_construction": 4, + "wall_construction": 4, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.24, + "quantity": "metres" + }, + "floor_insulation": 2, + "total_floor_area": { + "value": 17.28, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "floor_construction": 2, + "heat_loss_perimeter": { + "value": 16.8, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.4, + "quantity": "metres" + }, + "total_floor_area": { + "value": 50.98, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 15.47, + "quantity": "metres" + } + }, + { + "floor": 2, + "room_height": { + "value": 2.31, + "quantity": "metres" + }, + "total_floor_area": { + "value": 50.98, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 23.4, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "D", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 2, + "roof_insulation_thickness": "100mm", + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI" + }, + { + "identifier": "Extension 1", + "wall_dry_lined": "N", + "wall_thickness": 300, + "floor_heat_loss": 7, + "roof_construction": 8, + "wall_construction": 4, + "building_part_number": 2, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.4, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 7.44, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 8.6, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.74, + "quantity": "metres" + }, + "total_floor_area": { + "value": 19.37, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 12.45, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 4, + "construction_age_band": "L", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 7, + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI", + "sloping_ceiling_insulation_thickness": "AB" + }, + { + "identifier": "Extension 2", + "wall_dry_lined": "N", + "wall_thickness": 250, + "floor_heat_loss": 3, + "roof_construction": 8, + "wall_construction": 4, + "building_part_number": 3, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.15, + "quantity": "metres" + }, + "total_floor_area": { + "value": 6.05, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 9.17, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "F", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 7, + "wall_insulation_thickness": "NI", + "sloping_ceiling_insulation_thickness": "AB" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 6, + "heating_cost_current": { + "value": 1949, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 4.7, + "energy_rating_average": 60, + "energy_rating_current": 68, + "lighting_cost_current": { + "value": 71, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 1949, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 214, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 100, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 241, + "currency": "GBP" + }, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 71, + "environmental_impact_rating": 71 + } + ], + "co2_emissions_potential": 4.6, + "energy_rating_potential": 71, + "lighting_cost_potential": { + "value": 71, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "hot_water_cost_potential": { + "value": 214, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2569.77, + "space_heating_existing_dwelling": 17628.58 + }, + "draughtproofed_door_count": 2, + "energy_consumption_current": 177, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "5.02r0335", + "energy_consumption_potential": 168, + "environmental_impact_current": 70, + "cfl_fixed_lighting_bulbs_count": 1, + "current_energy_efficiency_band": "D", + "environmental_impact_potential": 71, + "led_fixed_lighting_bulbs_count": 51, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 31, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/8135-1728-8500-0511-3296.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/8135-1728-8500-0511-3296.json new file mode 100644 index 00000000..d4d1f172 --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/8135-1728-8500-0511-3296.json @@ -0,0 +1,535 @@ +{ + "uprn": 45004128, + "roofs": [ + { + "description": "Pitched, 300 mm loft insulation", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + { + "description": "Flat, insulated", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "walls": [ + { + "description": "Cavity wall, filled cavity", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "floors": [ + { + "description": "Suspended, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + { + "description": "Solid, no insulation (assumed)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 3, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 2, + "environmental_efficiency_rating": 2 + }, + "lighting": { + "description": "Good lighting efficiency", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + "postcode": "SR2 9DP", + "hot_water": { + "description": "From main system", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + }, + "post_town": "SUNDERLAND", + "built_form": 2, + "created_at": "2025-08-22 10:51:20", + "door_count": 2, + "region_code": 1, + "report_type": 2, + "sap_heating": { + "number_baths": 1, + "cylinder_size": 1, + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 26, + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 26, + "boiler_flue_type": 2, + "fan_flue_present": "Y", + "heat_emitter_type": 1, + "emitter_temperature": 0, + "main_heating_number": 1, + "main_heating_control": 2106, + "main_heating_category": 2, + "main_heating_fraction": 1, + "central_heating_pump_age": 0, + "main_heating_data_source": 1, + "main_heating_index_number": 17702 + } + ], + "immersion_heating_type": "NA", + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "glazing_gap": 6, + "orientation": 6, + "window_type": 1, + "glazing_type": 3, + "window_width": 0.2, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": 6, + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.5, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": 6, + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 2.8, + "window_height": 1.5, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": 6, + "orientation": 5, + "window_type": 1, + "glazing_type": 3, + "window_width": 1.2, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.8, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "glazing_gap": 6, + "orientation": 6, + "window_type": 1, + "glazing_type": 3, + "window_width": 2, + "window_height": 1.8, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 6, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.2, + "window_height": 0.3, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.8, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.3, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.3, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.8, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.2, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.3, + "window_height": 1.2, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.3, + "window_height": 1.1, + "draught_proofed": "true", + "window_location": 1, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Boiler and radiators, mains gas", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Semi-detached house", + "language_code": 1, + "pressure_test": 4, + "property_type": 0, + "address_line_1": "338 Leechmere Road", + "assessment_type": "RdSAP", + "completion_date": "2025-08-22", + "inspection_date": "2025-08-19", + "extensions_count": 1, + "measurement_type": 1, + "total_floor_area": 102, + "transaction_type": 8, + "conservatory_type": 1, + "heated_room_count": 6, + "registration_date": "2025-08-22", + "sap_energy_source": { + "mains_gas": "Y", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "false" + }, + "secondary_heating": { + "description": "None", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "extract_fans_count": 3, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "N", + "wall_thickness": 300, + "floor_heat_loss": 7, + "roof_construction": 4, + "wall_construction": 4, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.39, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 37.8, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 7, + "quantity": "metres" + }, + "floor_construction": 2, + "heat_loss_perimeter": { + "value": 10.8, + "quantity": "metres" + } + }, + { + "floor": 1, + "room_height": { + "value": 2.39, + "quantity": "metres" + }, + "total_floor_area": { + "value": 37.8, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 7, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 17.8, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "C", + "party_wall_construction": 0, + "wall_thickness_measured": "Y", + "roof_insulation_location": 2, + "roof_insulation_thickness": "300mm", + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI" + }, + { + "identifier": "Extension 1", + "wall_dry_lined": "N", + "wall_thickness": 300, + "floor_heat_loss": 7, + "roof_construction": 1, + "wall_construction": 4, + "building_part_number": 2, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.1, + "quantity": "metres" + }, + "floor_insulation": 1, + "total_floor_area": { + "value": 26.16, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "floor_construction": 1, + "heat_loss_perimeter": { + "value": 17.2, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 2, + "construction_age_band": "G", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": 6, + "wall_insulation_thickness": "NI", + "floor_insulation_thickness": "NI", + "flat_roof_insulation_thickness": "AB" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 6, + "heating_cost_current": { + "value": 1023, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 3.4, + "energy_rating_average": 60, + "energy_rating_current": 72, + "lighting_cost_current": { + "value": 62, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Programmer, room thermostat and TRVs", + "energy_efficiency_rating": 4, + "environmental_efficiency_rating": 4 + } + ], + "blocked_chimneys_count": 1, + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 913, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 178, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 88, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 62, + "currency": "GBP" + }, + "indicative_cost": "\u00a35,000 - \u00a310,000", + "improvement_type": "W1", + "improvement_details": { + "improvement_number": 57 + }, + "improvement_category": 5, + "energy_performance_rating": 73, + "environmental_impact_rating": 71 + }, + { + "sequence": 2, + "typical_saving": { + "value": 47, + "currency": "GBP" + }, + "indicative_cost": "\u00a35,000 - \u00a310,000", + "improvement_type": "W2", + "improvement_details": { + "improvement_number": 58 + }, + "improvement_category": 5, + "energy_performance_rating": 74, + "environmental_impact_rating": 73 + }, + { + "sequence": 3, + "typical_saving": { + "value": 225, + "currency": "GBP" + }, + "indicative_cost": "\u00a38,000 - \u00a310,000", + "improvement_type": "U", + "improvement_details": { + "improvement_number": 34 + }, + "improvement_category": 5, + "energy_performance_rating": 78, + "environmental_impact_rating": 74 + } + ], + "co2_emissions_potential": 3.0, + "energy_rating_potential": 78, + "lighting_cost_potential": { + "value": 62, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "hot_water_cost_potential": { + "value": 178, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2380.15, + "space_heating_existing_dwelling": 11731.4 + }, + "draughtproofed_door_count": 0, + "energy_consumption_current": 184, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "5.02r0304", + "energy_consumption_potential": 154, + "environmental_impact_current": 70, + "current_energy_efficiency_band": "C", + "environmental_impact_potential": 74, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 34, + "low_energy_fixed_lighting_bulbs_count": 22, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/9390-2722-3520-2105-8715.json b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/9390-2722-3520-2105-8715.json new file mode 100644 index 00000000..7fe1a0e7 --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/fixtures/golden/9390-2722-3520-2105-8715.json @@ -0,0 +1,373 @@ +{ + "uprn": 100040554202, + "roofs": [ + { + "description": "(another dwelling above)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "walls": [ + { + "description": "Cavity wall, as built, no insulation (assumed)", + "energy_efficiency_rating": 2, + "environmental_efficiency_rating": 2 + } + ], + "floors": [ + { + "description": "(another dwelling below)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + } + ], + "status": "entered", + "tenure": 1, + "window": { + "description": "Fully double glazed", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "addendum": { + "high_exposure": "true", + "cavity_fill_recommended": "true" + }, + "lighting": { + "description": "Excellent lighting efficiency", + "energy_efficiency_rating": 5, + "environmental_efficiency_rating": 5 + }, + "postcode": "TQ1 2ND", + "hot_water": { + "description": "Community scheme", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + }, + "post_town": "TORQUAY", + "built_form": "NR", + "created_at": "2025-12-02 19:41:06", + "door_count": 1, + "region_code": 15, + "report_type": 2, + "sap_heating": { + "number_baths": 1, + "cylinder_size": 1, + "shower_outlets": [ + { + "shower_outlet": { + "shower_wwhrs": 1, + "shower_outlet_type": 1 + } + } + ], + "number_baths_wwhrs": 0, + "water_heating_code": 901, + "water_heating_fuel": 20, + "main_heating_details": [ + { + "has_fghrs": "N", + "main_fuel_type": 20, + "heat_emitter_type": 0, + "emitter_temperature": "NA", + "main_heating_number": 1, + "main_heating_control": 2307, + "main_heating_category": 6, + "main_heating_fraction": 1, + "sap_main_heating_code": 301, + "main_heating_data_source": 2, + "community_heat_distribution_type": 6 + } + ], + "immersion_heating_type": "NA", + "has_fixed_air_conditioning": "false" + }, + "sap_version": 10.2, + "sap_windows": [ + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.88, + "window_height": 1.27, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.85, + "window_height": 2.05, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.26, + "window_height": 1.27, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 3, + "window_type": 1, + "glazing_type": 2, + "window_width": 2.18, + "window_height": 2.07, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 5, + "window_type": 1, + "glazing_type": 2, + "window_width": 0.81, + "window_height": 2.07, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.26, + "window_height": 0.96, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + }, + { + "pvc_frame": "true", + "orientation": 1, + "window_type": 1, + "glazing_type": 2, + "window_width": 1.87, + "window_height": 0.96, + "draught_proofed": "true", + "window_location": 0, + "window_wall_type": 1, + "permanent_shutters_present": "N", + "permanent_shutters_insulated": "N" + } + ], + "schema_type": "RdSAP-Schema-21.0.1", + "uprn_source": "Energy Assessor", + "country_code": "ENG", + "main_heating": [ + { + "description": "Community scheme", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "air_tightness": { + "description": "(not tested)", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "dwelling_type": "Mid-floor flat", + "language_code": 1, + "pressure_test": 4, + "property_type": 2, + "address_line_1": "39 Ridgeway Heights", + "address_line_2": "Ridgeway Road", + "assessment_type": "RdSAP", + "completion_date": "2025-12-02", + "inspection_date": "2025-12-02", + "extensions_count": 0, + "measurement_type": 1, + "sap_flat_details": { + "level": 2, + "top_storey": "N", + "storey_count": 7, + "flat_location": 2, + "heat_loss_corridor": 0 + }, + "total_floor_area": 75, + "transaction_type": 1, + "conservatory_type": 1, + "has_draught_lobby": "true", + "heated_room_count": 3, + "registration_date": "2025-12-02", + "sap_energy_source": { + "mains_gas": "Y", + "meter_type": 2, + "pv_connection": 0, + "photovoltaic_supply": { + "none_or_no_details": { + "percent_roof_area": 0 + } + }, + "wind_turbines_count": 0, + "gas_smart_meter_present": "false", + "is_dwelling_export_capable": "false", + "wind_turbines_terrain_type": 2, + "electricity_smart_meter_present": "false" + }, + "secondary_heating": { + "description": "None", + "energy_efficiency_rating": 0, + "environmental_efficiency_rating": 0 + }, + "sap_building_parts": [ + { + "identifier": "Main Dwelling", + "wall_dry_lined": "Y", + "wall_thickness": 310, + "floor_heat_loss": 6, + "roof_construction": 3, + "wall_construction": 4, + "building_part_number": 1, + "sap_floor_dimensions": [ + { + "floor": 0, + "room_height": { + "value": 2.35, + "quantity": "metres" + }, + "total_floor_area": { + "value": 75.17, + "quantity": "square metres" + }, + "party_wall_length": { + "value": 0, + "quantity": "metres" + }, + "heat_loss_perimeter": { + "value": 38.22, + "quantity": "metres" + } + } + ], + "wall_insulation_type": 4, + "construction_age_band": "D", + "party_wall_construction": "NA", + "wall_thickness_measured": "Y", + "roof_insulation_location": "ND", + "roof_insulation_thickness": "ND", + "wall_insulation_thickness": "NI" + } + ], + "solar_water_heating": "N", + "habitable_room_count": 3, + "heating_cost_current": { + "value": 557, + "currency": "GBP" + }, + "insulated_door_count": 0, + "co2_emissions_current": 2.8, + "energy_rating_average": 60, + "energy_rating_current": 67, + "lighting_cost_current": { + "value": 48, + "currency": "GBP" + }, + "main_heating_controls": [ + { + "description": "Flat rate charging, TRVs", + "energy_efficiency_rating": 3, + "environmental_efficiency_rating": 3 + } + ], + "has_hot_water_cylinder": "false", + "heating_cost_potential": { + "value": 373, + "currency": "GBP" + }, + "hot_water_cost_current": { + "value": 242, + "currency": "GBP" + }, + "mechanical_ventilation": 0, + "percent_draughtproofed": 100, + "suggested_improvements": [ + { + "sequence": 1, + "typical_saving": { + "value": 184, + "currency": "GBP" + }, + "indicative_cost": "\u00a3900 - \u00a31,500", + "improvement_type": "B", + "improvement_details": { + "improvement_number": 6 + }, + "improvement_category": 5, + "energy_performance_rating": 74, + "environmental_impact_rating": 73 + } + ], + "co2_emissions_potential": 2.1, + "energy_rating_potential": 74, + "lighting_cost_potential": { + "value": 48, + "currency": "GBP" + }, + "schema_version_original": "21.0.1", + "alternative_improvements": [ + { + "improvement": { + "sequence": 1, + "typical_saving": { + "value": 74, + "currency": "GBP" + }, + "improvement_type": "Q2", + "improvement_details": { + "improvement_number": 55 + }, + "improvement_category": 6, + "energy_performance_rating": 77, + "environmental_impact_rating": 77 + } + } + ], + "hot_water_cost_potential": { + "value": 242, + "currency": "GBP" + }, + "renewable_heat_incentive": { + "water_heating": 2571.36, + "space_heating_existing_dwelling": 4808.84 + }, + "draughtproofed_door_count": 1, + "energy_consumption_current": 205, + "has_fixed_air_conditioning": "false", + "multiple_glazed_proportion": 100, + "calculation_software_version": "5.02r0328", + "energy_consumption_potential": 152, + "environmental_impact_current": 63, + "cfl_fixed_lighting_bulbs_count": 1, + "current_energy_efficiency_band": "D", + "environmental_impact_potential": 73, + "led_fixed_lighting_bulbs_count": 10, + "has_heated_separate_conservatory": "false", + "potential_energy_efficiency_band": "C", + "co2_emissions_current_per_floor_area": 38, + "incandescent_fixed_lighting_bulbs_count": 0 +} \ No newline at end of file diff --git a/packages/domain/src/domain/sap/rdsap/tests/test_golden_fixtures.py b/packages/domain/src/domain/sap/rdsap/tests/test_golden_fixtures.py new file mode 100644 index 00000000..defcd43e --- /dev/null +++ b/packages/domain/src/domain/sap/rdsap/tests/test_golden_fixtures.py @@ -0,0 +1,149 @@ +"""Regression-anchor tests for a small set of corpus certs whose +SAP rating and primary-energy values our calculator currently produces +within tolerance of what Elmhurst lodged. + +Purpose: catch regressions silently introduced by future slices. If a +slice that's meant to improve aggregate MAE accidentally pushes a +previously-correct cert outside the tolerance, this suite fails and we +can decide consciously whether the trade-off is worth it. + +Tolerance rationale: +- SAP rounded-integer residual ≤ 1 — the score the cert lodges; integer + rounding means an exact "0" check would over-fit to integer flips. +- PE residual ≤ 10 kWh/m² — looser than ideal but reflects current + calculator capability; tightens as we close the PE bias. + +Selection criteria (see docs/sap-spec/PARITY_FINDINGS.md): from a +1000-cert random sample these 7 certs satisfied + |continuous SAP residual| ≤ 1.0 AND |PE residual| ≤ 10 + AND (main_heating_category != 4 OR main_heating_data_source != 1) +i.e. non-PCDB-heat-pump, lowest combined-residual quartile of the sample. + +Each cert is a stored JSON document under +`fixtures/golden/.json` — frozen at extraction time +so test results are reproducible without bulk-zip access. +""" + +from __future__ import annotations + +import json +from dataclasses import dataclass +from pathlib import Path +from typing import Any + +import pytest + +from datatypes.epc.domain.mapper import EpcPropertyDataMapper +from domain.sap.calculator import calculate_sap_from_inputs +from domain.sap.rdsap.cert_to_inputs import cert_to_inputs +from domain.sap.tables.table_12_cert_calibration import cert_calibration_prices + +_FIXTURES_DIR = Path(__file__).parent / "fixtures" / "golden" +_SAP_TOLERANCE = 1 +_PE_TOLERANCE_KWH_PER_M2 = 10.0 + + +@dataclass(frozen=True) +class _GoldenExpectation: + """Recorded SAP / PE residuals at the time of fixture capture, plus + short cert-shape notes so anyone debugging a regression knows what + kind of cert this is without re-reading the JSON.""" + + cert_number: str + actual_sap: int + expected_sap_resid: int + expected_pe_resid_kwh_per_m2: float + notes: str + + +_EXPECTATIONS: tuple[_GoldenExpectation, ...] = ( + _GoldenExpectation( + cert_number="0240-0200-5706-2365-8010", + actual_sap=73, + expected_sap_resid=0, + expected_pe_resid_kwh_per_m2=-8.07, + notes="Detached house, TFA 202, age J, oil boiler, Table 4b code 130.", + ), + _GoldenExpectation( + cert_number="0300-2747-7640-2526-2135", + actual_sap=78, + expected_sap_resid=1, + expected_pe_resid_kwh_per_m2=+9.75, + notes="Large semi-detached, TFA 526, age D, gas boiler PCDB-listed (no Table 4b code).", + ), + _GoldenExpectation( + cert_number="0390-2954-3640-2196-4175", + actual_sap=60, + expected_sap_resid=1, + expected_pe_resid_kwh_per_m2=-8.04, + notes="Large detached, TFA 360, age F, oil PCDB-listed.", + ), + _GoldenExpectation( + cert_number="6035-7729-2309-0879-2296", + actual_sap=70, + expected_sap_resid=0, + expected_pe_resid_kwh_per_m2=+8.95, + notes="Mid-terrace, TFA 128, age A, gas combi Table 4b code 104.", + ), + _GoldenExpectation( + cert_number="7536-3827-0600-0600-0276", + actual_sap=68, + expected_sap_resid=1, + expected_pe_resid_kwh_per_m2=-0.29, + notes="Detached + 2 extensions, TFA 152, age D, gas PCDB. Cleanest PE match in set.", + ), + _GoldenExpectation( + cert_number="8135-1728-8500-0511-3296", + actual_sap=72, + expected_sap_resid=0, + expected_pe_resid_kwh_per_m2=+8.18, + notes="Semi-detached, TFA 102, age C, gas PCDB-listed.", + ), + _GoldenExpectation( + cert_number="9390-2722-3520-2105-8715", + actual_sap=67, + expected_sap_resid=0, + expected_pe_resid_kwh_per_m2=+7.90, + notes="Mid-floor flat, TFA 75, age D, heat network (cat 6, sap_code 301).", + ), +) + + +def _load_cert(cert_number: str) -> dict[str, Any]: + """Load one frozen cert document from the fixtures directory.""" + path = _FIXTURES_DIR / f"{cert_number}.json" + with open(path) as f: + return json.load(f) # type: ignore[no-any-return] + + +@pytest.mark.parametrize( + "expectation", + _EXPECTATIONS, + ids=lambda e: e.cert_number, +) +def test_golden_cert_stays_within_tolerance(expectation: _GoldenExpectation) -> None: + # Arrange — load the frozen cert JSON, map to EpcPropertyData, run the + # calculator end-to-end with cert-calibration prices (the parity- + # validation mode the existing probe uses). + doc = _load_cert(expectation.cert_number) + epc = EpcPropertyDataMapper.from_api_response(doc) + inputs = cert_to_inputs(epc, prices=cert_calibration_prices()) + + # Act + result = calculate_sap_from_inputs(inputs) + + # Assert — both rounded SAP and PEUI must stay within tolerance of + # the residuals recorded at fixture capture time. The expected + # residual value is informational (helps future debuggers see the + # baseline); the test only enforces |residual| ≤ tolerance. + sap_resid = result.sap_score - expectation.actual_sap + pe_resid = result.primary_energy_kwh_per_m2 - doc["energy_consumption_current"] + assert abs(sap_resid) <= _SAP_TOLERANCE, ( + f"SAP residual {sap_resid:+d} out of tolerance ±{_SAP_TOLERANCE} " + f"(expected ≈{expectation.expected_sap_resid:+d}). Notes: {expectation.notes}" + ) + assert abs(pe_resid) <= _PE_TOLERANCE_KWH_PER_M2, ( + f"PE residual {pe_resid:+.2f} kWh/m² out of tolerance " + f"±{_PE_TOLERANCE_KWH_PER_M2} (expected ≈{expectation.expected_pe_resid_kwh_per_m2:+.2f}). " + f"Notes: {expectation.notes}" + )