mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
start making changes to deploy handler
This commit is contained in:
parent
cd24804ca2
commit
da57392953
5 changed files with 9 additions and 19 deletions
0
backend/condition/Dockerfile
Normal file
0
backend/condition/Dockerfile
Normal file
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, Optional, Tuple
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from backend.condition.domain.aspect_condition import AspectCondition
|
from backend.condition.domain.aspect_condition import AspectCondition
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
from typing import Mapping, Any
|
from typing import Mapping, Any
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
from backend.condition.lookups.uprn_lookup_s3 import UprnLookupS3
|
||||||
from utils.logger import setup_logger
|
from utils.logger import setup_logger
|
||||||
from backend.condition.processor import process_file
|
from backend.condition.processor import process_file
|
||||||
|
|
||||||
|
|
||||||
logger = setup_logger()
|
logger = setup_logger()
|
||||||
|
|
||||||
|
|
||||||
def handler(event: Mapping[str, Any], context: Any) -> None:
|
def handler(event: Mapping[str, Any], context: Any) -> None:
|
||||||
# Temporary stub for PoC wiring
|
# Temporary stub for PoC wiring
|
||||||
|
uprn_lookup = UprnLookupS3(
|
||||||
|
bucket="", key=""
|
||||||
|
) # TODO: replace with postgres implementation
|
||||||
dummy_stream = BytesIO(b"")
|
dummy_stream = BytesIO(b"")
|
||||||
|
|
||||||
source_key = event.get("source_key", "unknown-source")
|
source_key = event.get("source_key", "unknown-source")
|
||||||
|
|
||||||
process_file(dummy_stream, source_key)
|
process_file(dummy_stream, source_key)
|
||||||
|
|
|
||||||
|
|
@ -33,23 +33,6 @@ class PeabodyParser(Parser):
|
||||||
location_ref_to_uprn_map=location_ref_to_uprn_map,
|
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
|
@staticmethod
|
||||||
def _parse_assets(wb: Workbook) -> List[PeabodyAssetCondition]:
|
def _parse_assets(wb: Workbook) -> List[PeabodyAssetCondition]:
|
||||||
assets_sheet = wb["Survey Records - D & Lower"]
|
assets_sheet = wb["Survey Records - D & Lower"]
|
||||||
|
|
|
||||||
2
backend/condition/requirements.txt
Normal file
2
backend/condition/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
openpyxl
|
||||||
|
sqlmodel
|
||||||
Loading…
Add table
Reference in a new issue