Added coverage for oil boiler

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-16 14:08:28 +01:00
parent 342f926415
commit 7e11584407
2 changed files with 68 additions and 2 deletions

View file

@ -27,6 +27,11 @@ 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",
]
def __init__(self, property_instance: Property):
self.property = property_instance
self.costs = Costs(self.property)
@ -84,13 +89,20 @@ 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
non_gas_boiler = (
self.property.main_heating["clean_description"] in self.NON_GAS_BOILERS and
self.property.data["mains-gas-flag"]
)
is_valid = (
(
has_boiler or
no_heating_has_mains or
electic_heating_has_mains or
has_room_heaters or
portable_heaters_has_mains
portable_heaters_has_mains or
non_gas_boiler
) and
(not ashp_only_heating_recommendation) and
("boiler_upgrade" in measures)

View file

@ -417,6 +417,53 @@ testing_examples = [
"heating_controls_recommendation_descriptions": [],
"notes": "This property has assumed electric heating and is mid-terrace house. It has a mains gas connection."
"We can recommend a boiler upgrade and high heat retention storage heaters"
},
{
"epc": {
'lmk-key': '1162853989402014062718391220442948', 'address1': '145, Darley Green Road', 'address2': 'Knowle',
'address3': None, 'postcode': 'B93 8PU', 'building-reference-number': 4475684278,
'current-energy-rating': 'F', 'potential-energy-rating': 'D', 'current-energy-efficiency': 23,
'potential-energy-efficiency': 58, 'property-type': 'House', 'built-form': 'Semi-Detached',
'inspection-date': '2014-06-24', 'local-authority': 'E08000029', 'constituency': 'E14000812',
'county': None,
'lodgement-date': '2014-06-27', 'transaction-type': 'none of the above', 'environment-impact-current': 17,
'environment-impact-potential': 45, 'energy-consumption-current': 382, 'energy-consumption-potential': 194,
'co2-emissions-current': 27.0, 'co2-emiss-curr-per-floor-area': 94, 'co2-emissions-potential': 14.0,
'lighting-cost-current': 175, 'lighting-cost-potential': 106, 'heating-cost-current': 5477,
'heating-cost-potential': 3001, 'hot-water-cost-current': 267, 'hot-water-cost-potential': 120,
'total-floor-area': 293.0, 'energy-tariff': 'Single', 'mains-gas-flag': 'N', 'floor-level': 'NODATA!',
'flat-top-storey': None, 'flat-storey-count': None, 'main-heating-controls': 2106.0,
'multi-glaze-proportion': 0.0, 'glazed-type': 'not defined', 'glazed-area': 'Normal', 'extension-count': 2,
'number-habitable-rooms': 12, 'number-heated-rooms': 12, 'low-energy-lighting': 31,
'number-open-fireplaces': 2, 'hotwater-description': 'From main system', 'hot-water-energy-eff': 'Average',
'hot-water-env-eff': 'Poor', 'floor-description': 'Suspended, 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, no insulation (assumed)', 'roof-energy-eff': 'Very Poor',
'roof-env-eff': 'Very Poor', 'mainheat-description': 'Boiler and radiators, oil',
'mainheat-energy-eff': 'Average', 'mainheat-env-eff': 'Average',
'mainheatcont-description': 'Programmer, room thermostat and TRVs', 'mainheatc-energy-eff': 'Good',
'mainheatc-env-eff': 'Good', 'lighting-description': 'Low energy lighting in 31% of fixed outlets',
'lighting-energy-eff': 'Average', 'lighting-env-eff': 'Average', 'main-fuel': 'oil (not community)',
'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': '145, Darley Green Road, Knowle',
'local-authority-label': 'Solihull', 'constituency-label': 'Meriden', 'posttown': 'SOLIHULL',
'construction-age-band': 'England and Wales: before 1900',
'lodgement-datetime': '2014-06-27 18:39:12', 'tenure': 'owner-occupied',
'fixed-lighting-outlets-count': 42.0, 'low-energy-fixed-light-count': 13.0, 'uprn': 100070985545,
'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'
],
"heating_controls_recommendation_descriptions": [],
"notes": "This property has an oil boiler and doesn't have a mains gas connection so we can only recommend"
"an air source heat pump"
}
]
@ -460,11 +507,18 @@ print(eg["built-form"])
print(eg["mainheatcont-description"])
### We also use the Midlands EPC F/G portfolio to get examples to create tests
completed_descriptions = [
"Portable electric heaters assumed for most rooms"
]
portfolio = pd.read_excel(
"/Users/khalimconn-kowlessar/Documents/hestia/Customers/sfr/20240820 portfolio_epc_data.xlsx"
)
portfolio.columns = [c.replace("_", "-").lower() for c in portfolio.columns]
portfolio = portfolio[~portfolio["mainheat-description"].isin(completed_descriptions)]
eg = portfolio[
(portfolio["mainheat-description"] == "Portable electric heaters assumed for most rooms")
(portfolio["mainheat-description"] == "Boiler and radiators, oil")
].sample(1)
eg = eg.squeeze().to_dict()