From da573929532ecc1956c65ca22f766a0888cc5c5f Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 4 Feb 2026 12:16:47 +0000 Subject: [PATCH] start making changes to deploy handler --- backend/condition/Dockerfile | 0 .../domain/mapping/lbwf/lbwf_mapper.py | 2 +- backend/condition/handler.py | 7 ++++++- backend/condition/parsing/peabody_parser.py | 17 ----------------- backend/condition/requirements.txt | 2 ++ 5 files changed, 9 insertions(+), 19 deletions(-) create mode 100644 backend/condition/Dockerfile create mode 100644 backend/condition/requirements.txt diff --git a/backend/condition/Dockerfile b/backend/condition/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/backend/condition/domain/mapping/lbwf/lbwf_mapper.py b/backend/condition/domain/mapping/lbwf/lbwf_mapper.py index 60c8b1ac..9dbfcb17 100644 --- a/backend/condition/domain/mapping/lbwf/lbwf_mapper.py +++ b/backend/condition/domain/mapping/lbwf/lbwf_mapper.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional, Tuple +from typing import Any, Dict, Optional, Tuple from datetime import date from backend.condition.domain.aspect_condition import AspectCondition diff --git a/backend/condition/handler.py b/backend/condition/handler.py index 5279b029..21b7b1b8 100644 --- a/backend/condition/handler.py +++ b/backend/condition/handler.py @@ -1,16 +1,21 @@ from typing import Mapping, Any from io import BytesIO +from backend.condition.lookups.uprn_lookup_s3 import UprnLookupS3 from utils.logger import setup_logger from backend.condition.processor import process_file logger = setup_logger() + def handler(event: Mapping[str, Any], context: Any) -> None: # Temporary stub for PoC wiring + uprn_lookup = UprnLookupS3( + bucket="", key="" + ) # TODO: replace with postgres implementation dummy_stream = BytesIO(b"") source_key = event.get("source_key", "unknown-source") - process_file(dummy_stream, source_key) \ No newline at end of file + process_file(dummy_stream, source_key) diff --git a/backend/condition/parsing/peabody_parser.py b/backend/condition/parsing/peabody_parser.py index 9b5444b8..126bcfea 100644 --- a/backend/condition/parsing/peabody_parser.py +++ b/backend/condition/parsing/peabody_parser.py @@ -33,23 +33,6 @@ class PeabodyParser(Parser): location_ref_to_uprn_map=location_ref_to_uprn_map, ) - # @staticmethod - # def _build_location_ref_to_uprn_map() -> Dict[str, int]: - # location_ref_to_uprn_filepath: Path = ( - # Path(__file__).resolve().parents[1] - # / "sample_data" - # / "peabody" - # / "PeabodyPropertymatched_Dec25_propref_UPRN.csv" - # ) # TODO: get this to work with lambda - include file in docker image for now? - # location_ref_to_uprn_map: Dict[str, int] = {} - - # with location_ref_to_uprn_filepath.open(newline="") as f: - # reader: Any = csv.DictReader(f) - # for row in reader: - # location_ref_to_uprn_map[row["reference"]] = int(row["out_uprn"]) - - # return location_ref_to_uprn_map - @staticmethod def _parse_assets(wb: Workbook) -> List[PeabodyAssetCondition]: assets_sheet = wb["Survey Records - D & Lower"] diff --git a/backend/condition/requirements.txt b/backend/condition/requirements.txt new file mode 100644 index 00000000..74eb483b --- /dev/null +++ b/backend/condition/requirements.txt @@ -0,0 +1,2 @@ +openpyxl +sqlmodel \ No newline at end of file