This commit is contained in:
Khalim Conn-Kowlessar 2024-03-14 19:02:33 +00:00
parent 3b65a71793
commit 479a2b08c3
2 changed files with 23 additions and 2 deletions

View file

@ -5119,7 +5119,9 @@ def forecast_remaining_sales(loader):
def fml_data_pull(loader):
has_bruh = ["HA7", "HA14", "HA25", "HA39", "HA16"]
has_bruh = ["HA7", "HA14", "HA25", "HA39", "HA16",
# Do these
"HA1", "HA13", "HA50", "HA24"]
# DO
from backend.SearchEpc import SearchEpc
epc_api_key = "a2Nvbm5rb3dsZXNzYXJAZ21haWwuY29tOjY5MGJiMWM0NmIyOGI5ZDUxYzAxMzQzYzNiZGNlZGJjZDNmODQwMzA="
@ -5197,9 +5199,19 @@ def fml_analysis(loader):
no_ciga_cavity_descriptions = [
"Cavity wall, as built, insulated (assumed)",
"Cavity wall, as built, no insulation (assumed)",
"Cavity wall, as built, partial insulation (assumed)"
"Cavity wall, as built, partial insulation (assumed)",
"Cavity wall, no insulation (assumed)",
"Cavity wall, partial insulation (assumed)",
"Cavity wall,",
"Cavity wall, insulated (assumed)",
"Cavity wall, no insulation (assumed)",
"Cavity wall, as built, insulated (assumed)",
"Cavity wall, partial insulation (assumed)",
]
# TODO: There will be some properties that are subject to CIGA that do not look like they ned a CIGA check! pass
# them!
codes = [
"HA39", "HA14", "HA24", "HA15", "HA32", "HA28", "HA6", "HA1", "HA7",
"HA16", "HA107", "HA25", "HA50", "HA41", "HA48", "HA2", "HA63", "HA12",
@ -5217,6 +5229,7 @@ def fml_analysis(loader):
remaining_eligible_mapping = dict(zip(codes, values))
results = []
wall_descriptions = []
for ha_name in has_bruh:
original_figures = loader.december_figures[
@ -5236,6 +5249,7 @@ def fml_analysis(loader):
# We make sure we don't have duplicated. We do a super basic drop duplicates because it shouldn't be a huge
# issue at this point
epc_data = epc_data.drop_duplicates("uprn")
wall_descriptions.extend(epc_data["walls-description"].unique().tolist())
# time from the inspection to now
epc_data["epc_age"] = (datetime.now() - pd.to_datetime(epc_data["inspection-date"])).dt.days
@ -5464,6 +5478,10 @@ def fml_analysis(loader):
results_df = pd.DataFrame(results)
wall_descriptions = list(set(wall_descriptions))
from pprint import pprint
pprint(wall_descriptions)
# results_df["Delta vs November"] = 100 * (
# results_df["Of which ECO4 Eligible - Remaining"] - results_df["Original ECO4 Estimate - Remaining"]
# ) / results_df["Original ECO4 Estimate - Remaining"]

View file

@ -36,8 +36,11 @@ def app():
cleaned_data = {}
epc_directories = [entry for entry in EPC_DIRECTORY.iterdir() if entry.is_dir()]
WALLS = []
for directory in tqdm(epc_directories):
data = pd.read_csv(directory / "certificates.csv", low_memory=False)
z = data["WALLS_DESCRIPTION"].unique().tolist()
WALLS.extend(z)
# Rename the columns to the same format as the api returns
data.columns = [c.replace("_", "-").lower() for c in data.columns]
# Take just date before the date threshold