mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Extending to HA 7
This commit is contained in:
parent
d573c4d8a0
commit
b26e44b465
1 changed files with 18 additions and 1 deletions
|
|
@ -48,6 +48,10 @@ PROPERTY_TYPE_LOOKUP = {
|
||||||
'EXTRACARE SCHEME': "Flat",
|
'EXTRACARE SCHEME': "Flat",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"HA7": {
|
||||||
|
"property_type": {},
|
||||||
|
"built_form": {}
|
||||||
|
},
|
||||||
"HA14": {
|
"HA14": {
|
||||||
"property_type": {
|
"property_type": {
|
||||||
"House": "House",
|
"House": "House",
|
||||||
|
|
@ -143,6 +147,13 @@ class DataLoader:
|
||||||
asset_list["matching_postcode"] = asset_list[
|
asset_list["matching_postcode"] = asset_list[
|
||||||
self.COLUMN_CONFIG[ha_name]["postcode"]
|
self.COLUMN_CONFIG[ha_name]["postcode"]
|
||||||
].str.lower().str.strip()
|
].str.lower().str.strip()
|
||||||
|
elif ha_name == "HA7":
|
||||||
|
# Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode
|
||||||
|
asset_list["matching_address"] = asset_list["Address"].str.lower().str.strip() + ", " + \
|
||||||
|
asset_list["Address2"].str.lower().str.strip() + ", " + \
|
||||||
|
asset_list["Address3"].str.lower().str.strip() + ", " + \
|
||||||
|
asset_list["Postcode"].str.lower().str.strip()
|
||||||
|
asset_list["matching_postcode"] = asset_list["Postcode"].str.lower().str.strip()
|
||||||
elif ha_name == "HA14":
|
elif ha_name == "HA14":
|
||||||
# Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode
|
# Create matching_address by concatenating Address 1, Address 2, Address 3, Address 4, Postcode
|
||||||
asset_list["matching_address"] = asset_list["Address 1"].str.lower().str.strip() + ", " + \
|
asset_list["matching_address"] = asset_list["Address 1"].str.lower().str.strip() + ", " + \
|
||||||
|
|
@ -241,6 +252,8 @@ class DataLoader:
|
||||||
def get_asset_sheetname(workbook):
|
def get_asset_sheetname(workbook):
|
||||||
if "Asset List" in workbook.sheetnames:
|
if "Asset List" in workbook.sheetnames:
|
||||||
return "Asset List"
|
return "Asset List"
|
||||||
|
elif "Asset" in workbook.sheetnames and "Assets" not in workbook.sheetnames:
|
||||||
|
return "Asset"
|
||||||
else:
|
else:
|
||||||
return "Assets"
|
return "Assets"
|
||||||
|
|
||||||
|
|
@ -311,6 +324,8 @@ class DataLoader:
|
||||||
survey_list = pd.DataFrame(survey_rows, columns=[cell.value for cell in survey_sheet[1]])
|
survey_list = pd.DataFrame(survey_rows, columns=[cell.value for cell in survey_sheet[1]])
|
||||||
# Remove columns that are None
|
# Remove columns that are None
|
||||||
survey_list = survey_list.loc[:, survey_list.columns.notnull()]
|
survey_list = survey_list.loc[:, survey_list.columns.notnull()]
|
||||||
|
# Remove rows that are completely empty
|
||||||
|
survey_list = survey_list.loc[survey_list.loc[:, survey_list.columns].notnull().any(axis=1)]
|
||||||
survey_list["survey_list_row_id"] = [ha_name + "_survey_" + str(i) for i in range(0, len(survey_list))]
|
survey_list["survey_list_row_id"] = [ha_name + "_survey_" + str(i) for i in range(0, len(survey_list))]
|
||||||
|
|
||||||
# Perform survey list merge
|
# Perform survey list merge
|
||||||
|
|
@ -328,6 +343,8 @@ class DataLoader:
|
||||||
ciga_list = pd.DataFrame(ciga_rows, columns=[cell.value for cell in ciga_sheet[1]])
|
ciga_list = pd.DataFrame(ciga_rows, columns=[cell.value for cell in ciga_sheet[1]])
|
||||||
# Remove columns that are None
|
# Remove columns that are None
|
||||||
ciga_list = ciga_list.loc[:, ciga_list.columns.notnull()]
|
ciga_list = ciga_list.loc[:, ciga_list.columns.notnull()]
|
||||||
|
# Remove rows that are completely None
|
||||||
|
ciga_list = ciga_list.loc[ciga_list.loc[:, ciga_list.columns].notnull().any(axis=1)]
|
||||||
# Perform ciga list merge
|
# Perform ciga list merge
|
||||||
if not ciga_list.empty:
|
if not ciga_list.empty:
|
||||||
# Remove rows with missing postcode which happens in a small number of cases
|
# Remove rows with missing postcode which happens in a small number of cases
|
||||||
|
|
@ -1880,7 +1897,7 @@ def app():
|
||||||
# Grab the December HA figures filepath
|
# Grab the December HA figures filepath
|
||||||
december_figures_filepath = "local_data/ha_data/HA_December_figures.csv"
|
december_figures_filepath = "local_data/ha_data/HA_December_figures.csv"
|
||||||
|
|
||||||
priority_has = ["HA1", "HA6", "HA14", "HA39", "HA107"]
|
priority_has = ["HA1", "HA6", "HA7", "HA14", "HA39", "HA107"]
|
||||||
# Filter down the directories to only the priority HAs
|
# Filter down the directories to only the priority HAs
|
||||||
directories = [d for d in directories if d.split("/")[2] in priority_has]
|
directories = [d for d in directories if d.split("/")[2] in priority_has]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue