mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
debugging matching for HA28
This commit is contained in:
parent
811f141c45
commit
cb39590f61
1 changed files with 23 additions and 0 deletions
|
|
@ -214,6 +214,13 @@ class DataLoader:
|
|||
asset_list["Postcode"].astype(str).str.lower().str.strip()
|
||||
)
|
||||
asset_list["matching_postcode"] = asset_list["Postcode"].astype(str).str.lower().str.strip()
|
||||
elif ha_name == "HA28":
|
||||
asset_list["matching_address"] = (
|
||||
asset_list["House Number"].astype(str).str.lower().str.strip() + ", " +
|
||||
asset_list["Street 1"].astype(str).str.lower().str.strip() + ", " +
|
||||
asset_list["Postcode"].astype(str).str.lower().str.strip()
|
||||
)
|
||||
asset_list["matching_postcode"] = asset_list["Postcode"].astype(str).str.lower().str.strip()
|
||||
elif ha_name == "HA32":
|
||||
asset_list["matching_address"] = (
|
||||
asset_list["Dwelling num"].astype(str).str.lower().str.strip() + ", " +
|
||||
|
|
@ -323,6 +330,8 @@ class DataLoader:
|
|||
asset_list["HouseNo"] = asset_list["House No"].copy()
|
||||
elif ha_name == "HA32":
|
||||
asset_list["HouseNo"] = asset_list["Dwelling num"].copy()
|
||||
elif ha_name == "HA28":
|
||||
asset_list["HouseNo"] = asset_list["House Number"].copy()
|
||||
else:
|
||||
split_addresses = asset_list['matching_address'].str.split(',', expand=True)
|
||||
house_numbers = split_addresses[0].str.split(' ', expand=True)
|
||||
|
|
@ -371,6 +380,8 @@ class DataLoader:
|
|||
def get_asset_sheetname(workbook):
|
||||
if "Asset List" in workbook.sheetnames:
|
||||
return "Asset List"
|
||||
elif "Asset list" in workbook.sheetnames:
|
||||
return "Asset list"
|
||||
elif "Asset" in workbook.sheetnames and "Assets" not in workbook.sheetnames:
|
||||
return "Asset"
|
||||
elif "Decent Homes Stock" in workbook.sheetnames:
|
||||
|
|
@ -394,6 +405,8 @@ class DataLoader:
|
|||
def get_survey_sheetname(workbook):
|
||||
if "ECO Surveys" in workbook.sheetnames:
|
||||
return "ECO Surveys"
|
||||
elif "ECO Survey" in workbook.sheetnames:
|
||||
return "ECO Survey"
|
||||
else:
|
||||
return "ECO surveys"
|
||||
|
||||
|
|
@ -870,6 +883,12 @@ class DataLoader:
|
|||
|
||||
return survey_list
|
||||
|
||||
@staticmethod
|
||||
def correct_ha28_survey_list(survey_list):
|
||||
# Rename the "No" column to "No." to align with the other survey sheets
|
||||
survey_list = survey_list.rename(columns={"NO ": "NO."})
|
||||
return survey_list
|
||||
|
||||
@staticmethod
|
||||
def correct_ha32_survey_list(survey_list):
|
||||
survey_list["Street / Block Name"] = np.where(
|
||||
|
|
@ -1027,6 +1046,10 @@ class DataLoader:
|
|||
asset_list["matching_address"].str.contains(row["Street / Block Name"].lower().strip())
|
||||
].copy()
|
||||
|
||||
if str(house_number) not in df["matching_address"].values:
|
||||
if "flat" in str(house_number):
|
||||
house_number = house_number.split("flat")[1].strip()
|
||||
|
||||
df = df[df["matching_address"].str.contains(str(house_number))]
|
||||
|
||||
if df.empty:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue