mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
updating the code to do eligibility
This commit is contained in:
parent
c18740eebd
commit
807ce14790
1 changed files with 29 additions and 13 deletions
|
|
@ -1164,15 +1164,33 @@ def get_epc_data(
|
||||||
|
|
||||||
# condition 1 - identified for gbis and not eligible
|
# condition 1 - identified for gbis and not eligible
|
||||||
condition_1 = (
|
condition_1 = (
|
||||||
identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront["eligible"]
|
identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront[
|
||||||
) & consider_penultimate_epc
|
"eligible"]
|
||||||
|
) & consider_penultimate_epc
|
||||||
|
|
||||||
# condition 2 - identified for eco4 and not eligible
|
# condition 2 - identified for eco4 and not eligible
|
||||||
condition_2 = (
|
condition_2 = (identified_for_eco4 and not eligibility.eco4_warmfront[
|
||||||
identified_for_eco4 and not eligibility.eco4_warmfront["eligible"]
|
"eligible"]) & consider_penultimate_epc
|
||||||
) & consider_penultimate_epc
|
|
||||||
|
|
||||||
if identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront["eligible"]:
|
# successfully identigied gbis
|
||||||
|
condition_3 = (
|
||||||
|
identified_for_gbis and (eligibility.gbis_warmfront or eligibility.eco4_warmfront["eligible"])
|
||||||
|
)
|
||||||
|
|
||||||
|
# Nothing identified
|
||||||
|
condition_4 = (
|
||||||
|
not identified_for_gbis and not identified_for_eco4 and not eligibility.gbis_warmfront and not
|
||||||
|
eligibility.eco4_warmfront["eligible"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Not identified but seemingly eligible for eco4 or gbis
|
||||||
|
condition_5 = (
|
||||||
|
not identified_for_gbis and not identified_for_eco4 and (
|
||||||
|
eligibility.eco4_warmfront["eligible"] or eligibility.gbis_warmfront
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if condition_1 or condition_2:
|
||||||
# We check the penultimate epc
|
# We check the penultimate epc
|
||||||
eligibility = Eligibility(epc=penultimate_epc, cleaned=cleaned)
|
eligibility = Eligibility(epc=penultimate_epc, cleaned=cleaned)
|
||||||
eligibility.check_gbis_warmfront()
|
eligibility.check_gbis_warmfront()
|
||||||
|
|
@ -1181,10 +1199,11 @@ def get_epc_data(
|
||||||
# We don't update just to make data cleaning easier
|
# We don't update just to make data cleaning easier
|
||||||
if penultimate_epc.get("estimated") is None:
|
if penultimate_epc.get("estimated") is None:
|
||||||
older_epcs = [x for x in searcher.data["rows"] if x["lmk-key"] != penultimate_epc["lmk-key"]]
|
older_epcs = [x for x in searcher.data["rows"] if x["lmk-key"] != penultimate_epc["lmk-key"]]
|
||||||
elif identified_for_eco4 and not eligibility.eco4_warmfront["eligible"]:
|
elif condition_3 or condition_4 or condition_5:
|
||||||
|
# If we have successfully identified for gbis, we don't need to check the penultimate epc
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
blah
|
NotImplementedError("Implement me")
|
||||||
|
|
||||||
# If the property is a cavity wall and it's filled, we produce an estimate for the age of the cavity
|
# If the property is a cavity wall and it's filled, we produce an estimate for the age of the cavity
|
||||||
# Loft MUST be suitable
|
# Loft MUST be suitable
|
||||||
|
|
@ -1229,10 +1248,7 @@ def get_epc_data(
|
||||||
"eco4_eligible": eligibility.eco4_warmfront["eligible"],
|
"eco4_eligible": eligibility.eco4_warmfront["eligible"],
|
||||||
"eco4_message": eligibility.eco4_warmfront["message"],
|
"eco4_message": eligibility.eco4_warmfront["message"],
|
||||||
"sap": float(eligibility.epc["current-energy-efficiency"]),
|
"sap": float(eligibility.epc["current-energy-efficiency"]),
|
||||||
"gbis_eligible_future": eligibility.gbis["eligible"],
|
|
||||||
"gbis_eligible_future_message": eligibility.gbis["message"],
|
|
||||||
"eco4_eligible_future": eligibility.eco4["eligible"],
|
|
||||||
"eco4_eligible_future_message": eligibility.eco4["message"],
|
|
||||||
# Property components
|
# Property components
|
||||||
"roof": eligibility.roof["clean_description"],
|
"roof": eligibility.roof["clean_description"],
|
||||||
"walls": eligibility.walls["clean_description"],
|
"walls": eligibility.walls["clean_description"],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue