From 786e310f7cabdd3239836c49fed2127ffa6095c4 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Tue, 20 Jan 2026 20:12:37 +0000 Subject: [PATCH] need to download grade pydantic --- .devcontainer/post-install.sh | 30 ------------------------------ backend/address2UPRN/README.md | 20 ++++++++++++++++++++ backend/address2UPRN/__init__.py | 0 backend/address2UPRN/main.py | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 backend/address2UPRN/README.md create mode 100644 backend/address2UPRN/__init__.py create mode 100644 backend/address2UPRN/main.py diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh index 5c8f2324..48fbfde1 100644 --- a/.devcontainer/post-install.sh +++ b/.devcontainer/post-install.sh @@ -1,32 +1,3 @@ -<<<<<<< HEAD -# #!/bin/bash -# poetry install; - -# # Get the Poetry virtual environment path -# VENV_PATH=$(poetry env info --path 2>/dev/null) - -# if [ -z "$VENV_PATH" ]; then -# echo "No Poetry environment found. Did you run 'poetry install'?" -# exit 1 -# fi - -# # Ensure VS Code settings directory exists -# SETTINGS_DIR="/home/vscode/.vscode-server/data/Machine" -# SETTINGS_FILE="$SETTINGS_DIR/settings.json" - -# mkdir -p "$SETTINGS_DIR" - -# # If settings.json doesn't exist, create a default one -# if [ ! -f "$SETTINGS_FILE" ]; then -# echo "{}" > "$SETTINGS_FILE" -# fi - -# # Update VS Code settings to use the Poetry virtual environment -# jq --arg venv "$VENV_PATH/bin/python" '.["python.defaultInterpreterPath"] = $venv' \ -# "$SETTINGS_FILE" > "$SETTINGS_FILE.tmp" && mv "$SETTINGS_FILE.tmp" "$SETTINGS_FILE" - -# echo "✅ Updated VS Code to use Poetry environment: $VENV_PATH" -======= mkdir -p ~/.ipython/profile_default/startup cat << 'EOF' > ~/.ipython/profile_default/startup/00-load-env.py @@ -41,4 +12,3 @@ if os.path.exists(env_path): else: print("⚠ No .env file found to load") EOF ->>>>>>> 11b482838efcf46f376fd3ecbf2c1bb0be6d097d diff --git a/backend/address2UPRN/README.md b/backend/address2UPRN/README.md new file mode 100644 index 00000000..b4876340 --- /dev/null +++ b/backend/address2UPRN/README.md @@ -0,0 +1,20 @@ +We have list of address as input. + +It'll come in batches of the same post code and from then we want to somehow convert that into UPRN + +if this lambda/function can do that we'll be speeding ahead + + +Energy Performance Information: https://epc.opendatacommunities.org/ + +guidance page: https://epc.opendatacommunities.org/docs/guidance#field_domestic_LMK_KEY + +Example of past khalims code that he wrote some tests for: https://github.com/Hestia-Homes/Model/blob/941be42b83a590e838fd3ee475bfd1ff31438789/backend/tests/test_search_epc.py#L11 + + +Example of EPC search: https://github.com/Hestia-Homes/Model/blob/941be42b83a590e838fd3ee475bfd1ff31438789/backend/SearchEpc.py#L118 + + + +Khalim has made a python package to help scrape data: https://github.com/KhalimCK/epc-api-python + diff --git a/backend/address2UPRN/__init__.py b/backend/address2UPRN/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/address2UPRN/main.py b/backend/address2UPRN/main.py new file mode 100644 index 00000000..fc081fab --- /dev/null +++ b/backend/address2UPRN/main.py @@ -0,0 +1,18 @@ +from epc_api.client import EpcClient +import os +EPC_AUTH_TOKEN = os.getenv("EPC_AUTH_TOKEN", "") + +client = EpcClient(auth_token=EPC_AUTH_TOKEN) + + +search_resp = client.domestic.search( + params={ + "postcode": "b938sy" + } +) + +print(search_resp) + + + +