mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
moved year built
This commit is contained in:
parent
9f36efb2a1
commit
4a89b1f409
1 changed files with 6 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ class Property(BaseUtility):
|
|||
self.data = data
|
||||
self.full_sap_epc = None
|
||||
self.in_conservation_area = None
|
||||
self.year_built = None
|
||||
|
||||
if epc_client:
|
||||
self.epc_client = epc_client
|
||||
|
|
@ -145,14 +146,16 @@ class Property(BaseUtility):
|
|||
"""
|
||||
|
||||
if self.full_sap_epc:
|
||||
return pd.to_datetime(self.full_sap_epc["lodgement-date"]).year
|
||||
self.year_built = pd.to_datetime(self.full_sap_epc["lodgement-date"]).year
|
||||
return
|
||||
|
||||
if self.data["construction-age-band"] not in self.DATA_ANOMALY_MATCHES:
|
||||
# Take the lower limit. If we're pessimistic about the age of the property, that at least means we have
|
||||
# more options for recommendations if that age falls before the year that insulation in walls became
|
||||
# common practice
|
||||
band = [int(x) for x in re.findall(r'\b\d{4}\b', self.data["construction-age-band"])]
|
||||
return band[0]
|
||||
self.year_built = band[0]
|
||||
return
|
||||
|
||||
# We don't know when the property was built
|
||||
return None
|
||||
self.year_built = None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue