diff --git a/etl/customers/aiha/epc_data_pull.py b/etl/customers/aiha/epc_data_pull.py index f7f4631c..8259578d 100644 --- a/etl/customers/aiha/epc_data_pull.py +++ b/etl/customers/aiha/epc_data_pull.py @@ -676,6 +676,24 @@ def app(): "Manchester", archetyping_data["Location"] ) + # We fix the location for B 80 Bethune Road + archetyping_data["Location"] = np.where( + ( + archetyping_data["row_id"].isin( + data[ + data["Street address"] == "80 Bethune Road" + ]["row_id"].values.tolist() + ) + ) & ( + archetyping_data["row_id"].isin( + data[ + data["Address letter or number"] == "B" + ]["row_id"].values.tolist() + ) + ), + "London", + archetyping_data["Location"] + ) # Hackney 73 - London # Southend-on-Sea 6 - Southend @@ -691,7 +709,7 @@ def app(): 'Current heating system type', 'Wall type', 'Roof type', - "Location", + # "Location", # 'current-energy-rating', 'property-type-reduced', 'built-form-reduced', 'is_cavity_wall', # 'is_solid_brick_wall', 'is_system_built_wall', 'is_timber_frame_wall', 'is_as_built', # 'is_solid', 'is_roof_room', diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index 5f632567..64a2e285 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -20,13 +20,6 @@ class HeatingRecommender: high_heat_retention_contols_desc = "Controls for high heat retention storage heaters" - # These are descriptions for boilers that are not gas boilers - NON_GAS_BOILERS = [ - "Boiler and radiators, oil", - "Boiler and radiators, lpg", - "Boiler and radiators, electric" - ] - def __init__(self, property_instance: Property): self.property = property_instance self.costs = Costs(self.property) @@ -59,7 +52,8 @@ class HeatingRecommender: """ # 1) if the property has mains heating with boiler and radiators, we recommend optimal heating controls - has_boiler = self.property.main_heating["clean_description"] in ["Boiler and radiators, mains gas"] + # If it's NOT a gas boiler, we'll potentially recommend a boiler + has_gas_boiler = self.property.main_heating["has_boiler"] and self.property.main_heating["has_mains_gas"] # 2) If the property doesn't have a heating system, but it has access to the mains gas no_heating_has_mains = self.property.main_heating["clean_description"] in [ @@ -81,15 +75,16 @@ class HeatingRecommender: self.property.data["mains-gas-flag"] ) - # The next condition is if the home has a non-gas boiler, such as an oil boiler + # The next condition is if the home has a non-gas boiler, such as an oil boiler, with a mains gas connection non_gas_boiler = ( - self.property.main_heating["clean_description"] in self.NON_GAS_BOILERS and + self.property.main_heating["has_boiler"] and + not self.property.main_heating["has_mains_gas"] and self.property.data["mains-gas-flag"] ) is_valid = ( ( - has_boiler or + has_gas_boiler or no_heating_has_mains or electic_heating_has_mains or has_room_heaters or diff --git a/recommendations/tests/test_data/heating_recommendations_data.py b/recommendations/tests/test_data/heating_recommendations_data.py index bebbfec9..2fc47e13 100644 --- a/recommendations/tests/test_data/heating_recommendations_data.py +++ b/recommendations/tests/test_data/heating_recommendations_data.py @@ -777,6 +777,105 @@ testing_examples = [ "heating_controls_recommendation_descriptions": [], "notes": "This property has electric boilers in place, but does not have a mains connection so we don't " "recommend a boiler upgrade. We recommend HHR and ASHP" + }, + { + "epc": { + 'lmk-key': '683441359142011092814474999092088', 'address1': '20, Haybridge Avenue', 'address2': 'Hadley', + 'address3': None, 'postcode': 'TF1 5JR', 'building-reference-number': 3100250968, + 'current-energy-rating': 'F', 'potential-energy-rating': 'E', 'current-energy-efficiency': 34, + 'potential-energy-efficiency': 41, 'property-type': 'House', 'built-form': 'Semi-Detached', + 'inspection-date': '2011-09-28', 'local-authority': 'E06000020', 'constituency': 'E14000992', + 'county': None, + 'lodgement-date': '2011-09-28', 'transaction-type': 'rental (social)', 'environment-impact-current': 29, + 'environment-impact-potential': 34, 'energy-consumption-current': 495, 'energy-consumption-potential': 435, + 'co2-emissions-current': 8.3, 'co2-emiss-curr-per-floor-area': 97, 'co2-emissions-potential': 7.3, + 'lighting-cost-current': 61, 'lighting-cost-potential': 45, 'heating-cost-current': 1273, + 'heating-cost-potential': 1101, 'hot-water-cost-current': 214, 'hot-water-cost-potential': 214, + 'total-floor-area': 85.1, 'energy-tariff': 'Single', 'mains-gas-flag': 'N', 'floor-level': 'NODATA!', + 'flat-top-storey': None, 'flat-storey-count': None, 'main-heating-controls': 2101.0, + 'multi-glaze-proportion': 0.0, 'glazed-type': 'not defined', 'glazed-area': 'Normal', 'extension-count': 1, + 'number-habitable-rooms': 5, 'number-heated-rooms': 5, 'low-energy-lighting': 64, + 'number-open-fireplaces': 1, 'hotwater-description': 'From main system, no cylinder thermostat', + 'hot-water-energy-eff': 'Poor', 'hot-water-env-eff': 'Poor', + 'floor-description': 'Solid, no insulation (assumed)', 'floor-energy-eff': None, + 'windows-description': 'Single glazed', 'windows-energy-eff': 'Very Poor', 'windows-env-eff': 'Very Poor', + 'walls-description': 'Solid brick, as built, no insulation (assumed)', 'walls-energy-eff': 'Very Poor', + 'walls-env-eff': 'Very Poor', 'secondheat-description': 'Room heaters, dual fuel (mineral and wood)', + 'roof-description': 'Pitched, 250mm loft insulation', 'roof-energy-eff': 'Good', 'roof-env-eff': 'Good', + 'mainheat-description': 'Boiler and radiators, dual fuel (mineral and wood)', + 'mainheat-energy-eff': 'Average', 'mainheat-env-eff': 'Average', + 'mainheatcont-description': 'No time or thermostatic control of room temperature', + 'mainheatc-energy-eff': 'Very Poor', 'mainheatc-env-eff': 'Very Poor', + 'lighting-description': 'Low energy lighting in 64% of fixed outlets', 'lighting-energy-eff': 'Good', + 'lighting-env-eff': 'Good', 'main-fuel': 'dual fuel - mineral + wood', 'wind-turbine-count': 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': '20, Haybridge Avenue, Hadley', 'local-authority-label': 'Telford and Wrekin', + 'constituency-label': 'The Wrekin', 'posttown': 'TELFORD', + 'construction-age-band': 'England and Wales: 1900-1929', + 'lodgement-datetime': '2011-09-28 14:47:49', 'tenure': 'rental (social)', + 'fixed-lighting-outlets-count': 11.0, 'low-energy-fixed-light-count': 7.0, 'uprn': 452047507, + 'uprn-source': 'Address Matched', 'sheating-energy-eff': None, 'sheating-env-eff': None + }, + "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', + 'Install high heat retention electric storage heaters. Upgrade heating controls to High Heat Retention ' + 'Storage Heater Controls' + ], + "heating_controls_recommendation_descriptions": [], + "notes": "This property has a dual fuel boiler and no mains gas connection. We recommend ASHP and HHR, but" + "no gas condensing boiler" + }, + { + "epc": { + 'lmk-key': 'ba1de1b99f30546d7c6654af44c74fa4511611f9283502b77efb825d8566023c', + 'address1': '19 DORSET STREET', 'address2': 'DERBY', 'address3': None, 'postcode': 'DE21 6BE', + 'building-reference-number': 10000116666, 'current-energy-rating': 'F', 'potential-energy-rating': 'C', + 'current-energy-efficiency': 29, 'potential-energy-efficiency': 78, 'property-type': 'House', + 'built-form': 'Semi-Detached', 'inspection-date': '2021-01-09', 'local-authority': 'E06000015', + 'constituency': 'E14000662', 'county': None, 'lodgement-date': '2021-01-11', + 'transaction-type': 'ECO assessment', 'environment-impact-current': 1, 'environment-impact-potential': 40, + 'energy-consumption-current': 532, 'energy-consumption-potential': 153, 'co2-emissions-current': 14.0, + 'co2-emiss-curr-per-floor-area': 198, 'co2-emissions-potential': 5.1, 'lighting-cost-current': 105, + 'lighting-cost-potential': 60, 'heating-cost-current': 1361, 'heating-cost-potential': 545, + 'hot-water-cost-current': 242, 'hot-water-cost-potential': 132, 'total-floor-area': 72.0, + 'energy-tariff': 'off-peak 7 hour', 'mains-gas-flag': 'N', 'floor-level': None, 'flat-top-storey': None, + 'flat-storey-count': None, 'main-heating-controls': None, 'multi-glaze-proportion': 100.0, + 'glazed-type': 'double glazing, unknown install date', 'glazed-area': 'Normal', 'extension-count': 0, + 'number-habitable-rooms': 4, 'number-heated-rooms': 4, 'low-energy-lighting': 25, + 'number-open-fireplaces': 1, 'hotwater-description': 'From main system', 'hot-water-energy-eff': 'Average', + 'hot-water-env-eff': 'Very Poor', 'floor-description': 'Solid, no insulation (assumed)', + 'floor-energy-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': 'None', + 'roof-description': 'Pitched, 200 mm loft insulation', 'roof-energy-eff': 'Good', 'roof-env-eff': 'Good', + 'mainheat-description': 'Boiler and radiators, coal', 'mainheat-energy-eff': 'Poor', + 'mainheat-env-eff': 'Very Poor', + 'mainheatcont-description': 'No time or thermostatic control of room temperature', + 'mainheatc-energy-eff': 'Very Poor', 'mainheatc-env-eff': 'Very Poor', + 'lighting-description': 'Low energy lighting in 25% of fixed outlets', 'lighting-energy-eff': 'Average', + 'lighting-env-eff': 'Average', 'main-fuel': 'house coal (not community)', 'wind-turbine-count': 0, + 'heat-loss-corridor': None, 'unheated-corridor-length': None, 'floor-height': 2.37, 'photo-supply': 0.0, + 'solar-water-heating-flag': 'N', 'mechanical-ventilation': 'natural', 'address': '19 DORSET STREET, DERBY', + 'local-authority-label': 'Derby', 'constituency-label': 'Derby North', 'posttown': 'DERBY', + 'construction-age-band': 'England and Wales: 1950-1966', + 'lodgement-datetime': '2021-01-11 00:00:00', 'tenure': 'Owner-occupied', + 'fixed-lighting-outlets-count': 16.0, 'low-energy-fixed-light-count': 4.0, 'uprn': 100030309413, + 'uprn-source': 'Energy Assessor', 'sheating-energy-eff': None, 'sheating-env-eff': None + }, + "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', + 'Install high heat retention electric storage heaters. Upgrade heating controls to High Heat Retention ' + 'Storage Heater Controls' + ], + "heating_controls_recommendation_descriptions": [], + "notes": "This property has a coal boiler and no mains gas connection. We recommend ASHP and HHR, but" + "no gas condensing boiler" } ] @@ -830,6 +929,8 @@ completed_descriptions = [ "Room heaters, electric", "Electric storage heaters", "Boiler and radiators, LPG", + "Boiler and radiators, electric", + "Boiler and radiators, dual fuel (mineral and wood)" ] portfolio = pd.read_excel( @@ -837,9 +938,10 @@ portfolio = pd.read_excel( ) portfolio.columns = [c.replace("_", "-").lower() for c in portfolio.columns] portfolio = portfolio[~portfolio["mainheat-description"].isin(completed_descriptions)] -portfolio["mainheat-description"].value_counts() +print(portfolio["mainheat-description"].value_counts()) eg = portfolio[ - (portfolio["mainheat-description"] == "Boiler and radiators, electric") + (portfolio["mainheat-description"] == "Boiler and radiators, coal") ].sample(1) eg = eg.squeeze().to_dict() +print(eg)