From c5d7867ff4edda01c9c4d86793180c6806b7280f Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Sat, 31 Aug 2024 20:59:13 +0100 Subject: [PATCH] added more heating tests --- .../test_data/heating_recommendations_data.py | 110 +++++++++++++++++- 1 file changed, 105 insertions(+), 5 deletions(-) diff --git a/recommendations/tests/test_data/heating_recommendations_data.py b/recommendations/tests/test_data/heating_recommendations_data.py index b5e7c42f..cbc8ca65 100644 --- a/recommendations/tests/test_data/heating_recommendations_data.py +++ b/recommendations/tests/test_data/heating_recommendations_data.py @@ -91,7 +91,7 @@ testing_examples = [ 'posttown': 'ORMSKIRK', 'construction-age-band': 'England and Wales: 2003-2006', 'lodgement-datetime': '2008-10-07 17:31:09', 'tenure': 'owner-occupied', 'fixed-lighting-outlets-count': None, 'low-energy-fixed-light-count': None, 'uprn': 10012342725.0, - 'uprn-source': 'Address Matched', 'used': None + 'uprn-source': 'Address Matched', }, "heating_recommendation_descriptions": [ "Install high heat retention electric storage heaters and upgrade heating controls to High Heat Retention " @@ -143,7 +143,6 @@ testing_examples = [ 'construction-age-band': 'England and Wales: 1983-1990', 'lodgement-datetime': '2012-02-20 10:20:54', 'tenure': 'owner-occupied', 'fixed-lighting-outlets-count': 6.0, 'low-energy-fixed-light-count': 4.0, 'uprn': 100090311351.0, 'uprn-source': 'Address Matched', 'property-type_y': None, 'built-form_y': None, - 'used': None }, "heating_recommendation_descriptions": [], "heating_controls_recommendation_descriptions": [], @@ -181,13 +180,112 @@ testing_examples = [ 'mainheatc-energy-eff': 'Average', 'mainheatc-env-eff': 'Average', 'lighting-description': 'Low energy lighting in 50% of fixed outlets', 'lighting-energy-eff': 'Good', 'lighting-env-eff': 'Good', 'main-fuel': 'mains gas (not community)', 'wind-turbine-count': 0.0, - 'heat-loss-corridor': 'no corridor', 'unheated-corridor-length': None, 'floor-height': None, + 'heat-loss-corridor': 'no corridor', 'unheated-corridor-length': None, 'floor-height': 2.5, 'photo-supply': None, 'solar-water-heating-flag': 'N', 'mechanical-ventilation': 'natural', 'address': '19a, St. Stephens Road', 'local-authority-label': 'Hounslow', 'constituency-label': 'Brentford and Isleworth', 'posttown': 'HOUNSLOW', 'construction-age-band': 'England and Wales: 1930-1949', 'lodgement-datetime': '2015-08-21 16:51:56', 'tenure': 'owner-occupied', 'fixed-lighting-outlets-count': None, 'low-energy-fixed-light-count': None, - 'uprn': 100021560521.0, 'uprn-source': 'Address Matched', 'used': None + 'uprn': 100021560521.0, 'uprn-source': 'Address Matched', + }, + "heating_recommendation_descriptions": [], + "heating_controls_recommendation_descriptions": [], + "notes": "" + }, + { + "epc": { + 'lmk-key': '1164410099442014062611405027442168', 'address1': '31, Brightside Road', 'address2': None, + 'address3': None, 'postcode': 'SE13 6EP', 'building-reference-number': 5481394278, + 'current-energy-rating': 'E', 'potential-energy-rating': 'C', 'current-energy-efficiency': 48, + 'potential-energy-efficiency': 79, 'property-type': 'House', 'built-form': 'Mid-Terrace', + 'inspection-date': '2014-06-26', 'local-authority': 'E09000023', 'constituency': 'E14000789', + 'county': 'Greater London Authority', 'lodgement-date': '2014-06-26', + 'transaction-type': 'assessment for green deal', 'environment-impact-current': 44, + 'environment-impact-potential': 77, 'energy-consumption-current': 334, + 'energy-consumption-potential': 121.0, 'co2-emissions-current': 5.1, 'co2-emiss-curr-per-floor-area': 64, + 'co2-emissions-potential': 1.9, 'lighting-cost-current': 70.0, 'lighting-cost-potential': 49.0, + 'heating-cost-current': 964.0, 'heating-cost-potential': 571.0, 'hot-water-cost-current': 107.0, + 'hot-water-cost-potential': 72.0, 'total-floor-area': 80.0, 'energy-tariff': 'Single', + 'mains-gas-flag': 'Y', 'floor-level': 'NODATA!', 'flat-top-storey': None, 'flat-storey-count': None, + 'main-heating-controls': '2102', 'multi-glaze-proportion': 100.0, + 'glazed-type': 'double glazing installed before 2002', 'glazed-area': 'Normal', 'extension-count': 1.0, + 'number-habitable-rooms': 3.0, 'number-heated-rooms': 3.0, 'low-energy-lighting': 56.0, + 'number-open-fireplaces': 0.0, 'hotwater-description': 'From main system', 'hot-water-energy-eff': 'Good', + 'hot-water-env-eff': 'Good', 'floor-description': 'Suspended, no insulation (assumed)', + 'floor-energy-eff': None, 'floor-env-eff': None, 'windows-description': 'Fully double glazed', + 'windows-energy-eff': 'Average', 'windows-env-eff': 'Average', + 'walls-description': 'Solid brick, as built, no insulation (assumed)', 'walls-energy-eff': 'Very Poor', + 'walls-env-eff': 'Very Poor', 'secondheat-description': 'Room heaters, mains gas', + 'sheating-energy-eff': None, 'sheating-env-eff': None, + 'roof-description': 'Pitched, no insulation (assumed)', + 'roof-energy-eff': 'Very Poor', 'roof-env-eff': 'Very Poor', + 'mainheat-description': 'Boiler and radiators, mains gas', 'mainheat-energy-eff': 'Good', + 'mainheat-env-eff': 'Good', 'mainheatcont-description': 'Programmer, no room thermostat', + 'mainheatc-energy-eff': 'Very Poor', 'mainheatc-env-eff': 'Very Poor', + 'lighting-description': 'Low energy lighting in 56% of fixed outlets', 'lighting-energy-eff': 'Good', + 'lighting-env-eff': 'Good', 'main-fuel': 'mains gas (not community)', 'wind-turbine-count': 0.0, + 'heat-loss-corridor': 'NO DATA!', 'unheated-corridor-length': None, 'floor-height': 2.5, + 'photo-supply': 0.0, + 'solar-water-heating-flag': None, 'mechanical-ventilation': 'natural', 'address': '31, Brightside Road', + 'local-authority-label': 'Lewisham', 'constituency-label': 'Lewisham, Deptford', 'posttown': 'LONDON', + 'construction-age-band': 'England and Wales: before 1900', 'lodgement-datetime': '2014-06-26 11:40:50', + 'tenure': 'owner-occupied', 'fixed-lighting-outlets-count': 9.0, 'low-energy-fixed-light-count': 5.0, + 'uprn': 100021936225.0, 'uprn-source': 'Address Matched', + }, + "heating_recommendation_descriptions": [ + 'Install an air source heat pump, and upgrade heating controls to Smart Thermostats, room sensors and ' + 'smart radiator valves (time & temperature zone control). The cost includes the £7500 boiler upgrade ' + 'scheme grant', + ], + "heating_controls_recommendation_descriptions": [ + 'upgrade heating controls to Room thermostat, programmer and TRVs', + 'Upgrade heating controls to Smart Thermostats, room sensors and smart radiator valves (time & ' + 'temperature zone control)' + ], + "notes": "Because this property already has a boiler, we don't recommend HHR. We only have a " + "heating recommendation for an air source heat pump. Because the heating controls are " + "Programmer, no room thermostat, we have a programmer, room thermostat and trvs recommendation" + "for heating controls and for TTZC." + }, + { + "epc": { + 'lmk-key': '1139584119102014052116014126342698', 'address1': '13, Starbuck Street', 'address2': 'Rudry', + 'address3': None, 'postcode': 'CF83 3DP', 'building-reference-number': 2187913278, + 'current-energy-rating': 'E', 'potential-energy-rating': 'D', 'current-energy-efficiency': 44, + 'potential-energy-efficiency': 61, 'property-type': 'Flat', 'built-form': 'Semi-Detached', + 'inspection-date': '2014-05-21', 'local-authority': 'W06000018', 'constituency': 'W07000076', + 'county': None, + 'lodgement-date': '2014-05-21', 'transaction-type': 'rental (private)', 'environment-impact-current': 49, + 'environment-impact-potential': 64, 'energy-consumption-current': 343, + 'energy-consumption-potential': 240.0, 'co2-emissions-current': 4.0, 'co2-emiss-curr-per-floor-area': 61, + 'co2-emissions-potential': 2.8, 'lighting-cost-current': 49.0, 'lighting-cost-potential': 49.0, + 'heating-cost-current': 752.0, 'heating-cost-potential': 429.0, 'hot-water-cost-current': 281.0, + 'hot-water-cost-potential': 281.0, 'total-floor-area': 66.0, 'energy-tariff': 'Single', + 'mains-gas-flag': 'N', 'floor-level': '1st', 'flat-top-storey': 'Y', 'flat-storey-count': None, + 'main-heating-controls': 2602.0, 'multi-glaze-proportion': 100.0, + 'glazed-type': 'double glazing installed during or after 2002', 'glazed-area': 'Normal', + 'extension-count': 0.0, 'number-habitable-rooms': 4.0, 'number-heated-rooms': 4.0, + 'low-energy-lighting': 86.0, 'number-open-fireplaces': 0.0, + 'hotwater-description': 'Electric immersion, standard tariff', 'hot-water-energy-eff': 'Very Poor', + 'hot-water-env-eff': 'Very Poor', 'floor-description': '(other premises below)', 'floor-energy-eff': None, + 'floor-env-eff': None, 'windows-description': 'Fully double glazed', 'windows-energy-eff': 'Good', + 'windows-env-eff': 'Good', 'walls-description': 'Cavity wall, as built, no insulation (assumed)', + 'walls-energy-eff': 'Poor', 'walls-env-eff': 'Poor', 'secondheat-description': 'None', + 'sheating-energy-eff': None, 'sheating-env-eff': None, + 'roof-description': 'Pitched, 200 mm loft insulation', + 'roof-energy-eff': 'Good', 'roof-env-eff': 'Good', 'mainheat-description': 'Room heaters, electric', + 'mainheat-energy-eff': 'Very Poor', 'mainheat-env-eff': 'Very Poor', + 'mainheatcont-description': 'Appliance thermostats', 'mainheatc-energy-eff': 'Good', + 'mainheatc-env-eff': 'Good', 'lighting-description': 'Low energy lighting in 86% of fixed outlets', + 'lighting-energy-eff': 'Very Good', 'lighting-env-eff': 'Very Good', + 'main-fuel': 'electricity (not community)', 'wind-turbine-count': 0.0, 'heat-loss-corridor': 'no corridor', + 'unheated-corridor-length': None, 'floor-height': None, 'photo-supply': 0.0, + 'solar-water-heating-flag': None, + 'mechanical-ventilation': 'natural', 'address': '13, Starbuck Street, Rudry', + 'local-authority-label': 'Caerphilly', 'constituency-label': 'Caerphilly', 'posttown': 'CAERPHILLY', + 'construction-age-band': 'England and Wales: 1950-1966', 'lodgement-datetime': '2014-05-21 16:01:41', + 'tenure': 'rental (private)', 'fixed-lighting-outlets-count': 7.0, 'low-energy-fixed-light-count': 6.0, + 'uprn': 43088770.0, 'uprn-source': 'Address Matched', }, "heating_recommendation_descriptions": [], "heating_controls_recommendation_descriptions": [], @@ -224,6 +322,8 @@ used_examples = pd.DataFrame( data = data.merge( used_examples, how="left", on=["mainheat-description", "mainheat-energy-eff", "built-form", "property-type"] ) -data = data[pd.isnull(data["used"])] +data = data[pd.isnull(data["used"])].drop(columns=["used"]) eg = data.sample(1).to_dict("records")[0] +print(eg["mainheat-description"]) +print(eg["mainheat-energy-eff"])