mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
added excluded uprns
This commit is contained in:
parent
9436bfe7d6
commit
9938dea190
3 changed files with 19 additions and 4 deletions
|
|
@ -60,6 +60,7 @@ class Ownership:
|
||||||
average_property_value: float,
|
average_property_value: float,
|
||||||
portfolio_value: float,
|
portfolio_value: float,
|
||||||
excluded_owners: List[str] = None,
|
excluded_owners: List[str] = None,
|
||||||
|
excluded_uprns: List[int] = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -85,6 +86,7 @@ class Ownership:
|
||||||
self.land_registry_path = land_registry_path
|
self.land_registry_path = land_registry_path
|
||||||
|
|
||||||
self.excluded_owners = [] if excluded_owners is None else excluded_owners
|
self.excluded_owners = [] if excluded_owners is None else excluded_owners
|
||||||
|
self.excluded_uprns = [] if excluded_uprns is None else excluded_uprns
|
||||||
|
|
||||||
self.run_timestamp = str(datetime.now())
|
self.run_timestamp = str(datetime.now())
|
||||||
self.project_name = project_name
|
self.project_name = project_name
|
||||||
|
|
@ -204,6 +206,10 @@ class Ownership:
|
||||||
data.append(epc_data)
|
data.append(epc_data)
|
||||||
|
|
||||||
self.epc_data = pd.concat(data, ignore_index=True)
|
self.epc_data = pd.concat(data, ignore_index=True)
|
||||||
|
|
||||||
|
if self.excluded_uprns:
|
||||||
|
self.epc_data = self.epc_data[~self.epc_data["UPRN"].astype(float).isin(self.excluded_uprns)]
|
||||||
|
|
||||||
# We now store the data in s3
|
# We now store the data in s3
|
||||||
save_excel_to_s3(
|
save_excel_to_s3(
|
||||||
df=self.epc_data,
|
df=self.epc_data,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
# These are the registration numbers for companies we've heard a reponse from, and cannot sell
|
# These are the registration numbers for companies we've heard a reponse from, and cannot sell
|
||||||
OWNERS_WHO_CANT_SELL = [
|
OWNERS_WHO_CANT_SELL = [
|
||||||
# Al Rayan
|
# Al Rayan - they're the senior lender, not able to sell
|
||||||
"4483430"
|
"4483430",
|
||||||
|
# Ultrabarn - they're unwilling to sell and will sort any retrofits themselves
|
||||||
|
"2794851"
|
||||||
|
]
|
||||||
|
|
||||||
|
EXCLUDED_UPRNS = [
|
||||||
|
# This property no longer exists
|
||||||
|
200003827624
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
|
import pandas as pd
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from backend.app.db.connection import db_engine
|
from backend.app.db.connection import db_engine
|
||||||
from backend.app.db.models.portfolio import Portfolio, PortfolioUsers
|
from backend.app.db.models.portfolio import Portfolio, PortfolioUsers
|
||||||
from etl.ownership.Ownership import Ownership
|
from etl.ownership.Ownership import Ownership
|
||||||
from etl.ownership.config import OWNERS_WHO_CANT_SELL as EXCLUDED_OWNERS
|
from etl.ownership.config import OWNERS_WHO_CANT_SELL as EXCLUDED_OWNERS, EXCLUDED_UPRNS
|
||||||
from utils.s3 import save_csv_to_s3
|
from utils.s3 import save_csv_to_s3
|
||||||
|
|
||||||
# Set up the project configuration
|
# Set up the project configuration
|
||||||
|
|
@ -122,7 +123,8 @@ def app():
|
||||||
bucket=DATA_BUCKET,
|
bucket=DATA_BUCKET,
|
||||||
average_property_value=PROPERTY_VALUE_ESTIMATE,
|
average_property_value=PROPERTY_VALUE_ESTIMATE,
|
||||||
portfolio_value=PORTFOLIO_VALUE,
|
portfolio_value=PORTFOLIO_VALUE,
|
||||||
excluded_owners=EXCLUDED_OWNERS
|
excluded_owners=EXCLUDED_OWNERS,
|
||||||
|
excluded_uprns=EXCLUDED_UPRNS
|
||||||
)
|
)
|
||||||
ownership_instance.pipeline(column_filters=epc_column_filters)
|
ownership_instance.pipeline(column_filters=epc_column_filters)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue