made tests pass and redploy

This commit is contained in:
Jun-te Kim 2026-02-12 15:11:20 +00:00
parent 3bdd4a4a97
commit c2f29e86df
3 changed files with 12 additions and 10 deletions

View file

@ -204,3 +204,6 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.DEV_AWS_REGION }}

View file

@ -329,6 +329,7 @@ def get_uprn_candidates(
def get_uprn_with_epc_df(
user_inputed_address: str,
epc_df: pd.DataFrame,
verbose=False,
):
"""
Return uprn (str) using a pre-fetched EPC dataframe.
@ -377,15 +378,16 @@ def get_uprn_with_epc_df(
if found_uprn == "":
return None
return (found_uprn, address, score)
if verbose:
return (found_uprn, address, score)
else:
return found_uprn
def get_uprn(
user_inputed_address: str,
postcode: str,
return_address=False,
return_EPC=False,
return_score=True,
verbose=False,
):
"""
Return uprn (str)
@ -400,9 +402,7 @@ def get_uprn(
return get_uprn_with_epc_df(
user_inputed_address=user_inputed_address,
epc_df=df,
return_address=return_address,
return_EPC=return_EPC,
return_score=return_score,
verbose=verbose,
)
@ -727,8 +727,7 @@ def handler(event, context, local=False):
# Get UPRN using the pre-fetched EPC data with all return options
result = get_uprn_with_epc_df(
user_inputed_address=user_input,
epc_df=epc_df,
user_inputed_address=user_input, epc_df=epc_df, verbose=True
)
# Parse result tuple if successful

View file

@ -168,7 +168,7 @@ def handler(event, context, local=False):
# TODO: DELETE ME, if you see this in the PR.
# TODO: DELETE ME, if you see this in the PR.
# TODO: DELETE ME, if you see this in the PR.
df = df.head(5)
df = df.head(1983)
logger.info(f"CSV loaded: {len(df)} rows, {len(df.columns)} columns")