mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added excluded owners
This commit is contained in:
parent
0db2f59230
commit
36b18876d6
3 changed files with 18 additions and 2 deletions
|
|
@ -58,7 +58,8 @@ class Ownership:
|
|||
project_name: str,
|
||||
bucket: str,
|
||||
average_property_value: float,
|
||||
portfolio_value: float
|
||||
portfolio_value: float,
|
||||
excluded_owners: List[str] = None,
|
||||
):
|
||||
"""
|
||||
|
||||
|
|
@ -83,6 +84,8 @@ class Ownership:
|
|||
self.overseas_ownership_path = overseas_ownership_path
|
||||
self.land_registry_path = land_registry_path
|
||||
|
||||
self.excluded_owners = [] if excluded_owners is None else excluded_owners
|
||||
|
||||
self.run_timestamp = str(datetime.now())
|
||||
self.project_name = project_name
|
||||
self.bucket = bucket
|
||||
|
|
@ -221,6 +224,12 @@ class Ownership:
|
|||
self.ownership_data["Postcode"].str.lower().isin(self.epc_data["POSTCODE"].str.lower().unique())
|
||||
]
|
||||
|
||||
logger.info("Removing excluded owners")
|
||||
# Use the company registration number to filter out excluded owners
|
||||
self.ownership_data = self.ownership_data[
|
||||
~self.ownership_data["Company Registration No. (1)"].astype(str).isin(self.excluded_owners)
|
||||
]
|
||||
|
||||
def prepare_for_matching(self):
|
||||
"""
|
||||
Given the epc properties and the ownership data, this function performs a number of operations on both datasets
|
||||
|
|
|
|||
5
etl/ownership/config.py
Normal file
5
etl/ownership/config.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# These are the registration numbers for companies we've heard a reponse from, and cannot sell
|
||||
OWNERS_WHO_CANT_SELL = [
|
||||
# Al Rayan
|
||||
"4483430"
|
||||
]
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
from etl.ownership.Ownership import Ownership
|
||||
from etl.ownership.config import OWNERS_WHO_CANT_SELL as EXCLUDED_OWNERS
|
||||
|
||||
# Set up the project configuration
|
||||
USER_IDS = [
|
||||
|
|
@ -70,7 +71,8 @@ def app():
|
|||
project_name=PROJECT_NAME,
|
||||
bucket=DATA_BUCKET,
|
||||
average_property_value=PROPERTY_VALUE_ESTIMATE,
|
||||
portfolio_value=PORTFOLIO_VALUE
|
||||
portfolio_value=PORTFOLIO_VALUE,
|
||||
EXCLUDED_OWNERS=EXCLUDED_OWNERS
|
||||
)
|
||||
ownership_instance.pipeline(column_filters=epc_column_filters)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue