got main fuel working - needs tests

This commit is contained in:
Khalim Conn-Kowlessar 2023-06-14 19:15:26 +01:00
parent 6a48eea55c
commit 8e7c39a823
2 changed files with 9 additions and 2 deletions

View file

@ -58,7 +58,7 @@ def handler():
df = df.reset_index(drop=True)
import numpy as np
idx = 14
idx = 24
record = df[df.index == idx].to_dict("records")[0]
record = {k: v for k, v in record.items() if v not in [None, np.nan]}
from pprint import pprint

View file

@ -22,6 +22,10 @@ class MainFuelAttributes:
'house coal'
]
COMPLEX_FUEL_KEYWORDS = [
'heat from boilers using biodiesel from any biomass source'
]
TARIFF_KEYWORDS = [
'unspecified tariff'
# We may come across more later but this is all observed for now
@ -45,7 +49,8 @@ class MainFuelAttributes:
for keywords in [
self.FUEL_KEYWORDS,
self.NO_INDIVIDUAL_HEATING_OR_COMMUNITY_NETWORK,
self.TARIFF_KEYWORDS
self.TARIFF_KEYWORDS,
self.COMPLEX_FUEL_KEYWORDS
]
):
raise ValueError('Invalid description')
@ -61,6 +66,8 @@ class MainFuelAttributes:
"no_individual_heating_or_community_network": find_keyword(
self.description, self.NO_INDIVIDUAL_HEATING_OR_COMMUNITY_NETWORK
),
"complex_fuel_type": find_keyword(self.description, self.COMPLEX_FUEL_KEYWORDS),
}
# to make this field palettable, if no_individual_heating_or_community_network is populated, we'll