Adding ha24 wip

This commit is contained in:
Khalim Conn-Kowlessar 2024-02-27 19:01:32 +00:00
parent 102600b196
commit a1c19b5b88

View file

@ -150,6 +150,10 @@ class DataLoader:
"HA16": {
"address": "Address",
"postcode": "Postcode"
},
"HA24": {
"address": "Address",
"postcode": "Postcode"
}
}
@ -174,7 +178,7 @@ class DataLoader:
def create_asset_list_matching_address(self, ha_name, asset_list):
if ha_name in ["HA1", "HA6", "HA16"]:
if ha_name in ["HA1", "HA6", "HA16", "HA24"]:
asset_list["matching_address"] = asset_list[
self.COLUMN_CONFIG[ha_name]["address"]
].str.lower().str.strip()
@ -289,6 +293,8 @@ class DataLoader:
return "Asset List"
elif "Asset" in workbook.sheetnames and "Assets" not in workbook.sheetnames:
return "Asset"
elif "Decent Homes Stock" in workbook.sheetnames:
return "Decent Homes Stock"
else:
return "Assets"
@ -703,6 +709,43 @@ class DataLoader:
return survey_list
@staticmethod
def correct_ha24_survey_list(survey_list):
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace("/", ", ")
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.lower()
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.strip()
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"council house, nidds lane", "nidds lane"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"wirral avenue", "wirrall avenue"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"st ives road", "st. ives crescent"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"sundringham road", "sandringham road"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"milton avenue", "milton road"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"st ives crescent", "st. ives crescent"
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"council house, waterbelly lane", "waterbelly lane"
)
# Generally remove "councile house, " from the start of the street name
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"council house, ", ""
)
survey_list["Street / Block Name"] = survey_list["Street / Block Name"].str.replace(
"st. leodegars close", "st leodegars close"
)
return survey_list
@staticmethod
def correct_ha107_survey_list(survey_list):
# Replace Front Street, East Stockham with Front Street, East Stockwith
@ -2061,7 +2104,7 @@ def app():
# Grab the December HA figures filepath
december_figures_filepath = "local_data/ha_data/HA_December_figures.csv"
priority_has = ["HA1", "HA6", "HA7", "HA14", "HA16", "HA39", "HA107"]
priority_has = ["HA1", "HA6", "HA7", "HA14", "HA16", "HA24", "HA39", "HA107"]
# Filter down the directories to only the priority HAs
directories = [d for d in directories if d.split("/")[2] in priority_has]