Model/applications/SAL/handler.py
2026-05-22 14:51:28 +00:00

59 lines
1.8 KiB
Python

from typing import Any
import boto3
from orchestration.sal_orchestrator import (
SALOrchestrator,
)
from infrastructure.s3.csv_s3_client import CsvS3Client
from repositories.unstandardised_address.unstandardised_address_list_csv_s3_repository import (
UnstandardisedAddressListCsvS3Repository,
)
from domain.addresses.unstandardised_address import AddressList
def handler(
body: dict[str, Any],
context: Any,
) -> dict[str, list[str]]:
s3_uri = "s3://retrofit-data-dev/bulk_onboarding_inputs/hyde2 (1).csv"
bucket = "retrofit-data-dev"
# boto3.client is overloaded per-service in the installed stubs; cast
# to Any so the strict-mode checker treats it as opaque.
boto3_client: Any = boto3.client # noqa
boto_s3: Any = boto3_client("s3")
csv_client = CsvS3Client(boto_s3, bucket)
unstandardised_address_repo = UnstandardisedAddressListCsvS3Repository(
csv_client, bucket
)
sal = SALOrchestrator(
unstandardised_address_repo=unstandardised_address_repo,
)
addressList: AddressList = sal.get_unstandardised_addresses(input_s3_uri=s3_uri)
column_mapping = {
# "Wall Description": "Walls",
"Property Type": "Property Type",
}
col_to_desc_map = sal.get_col_to_description_mappings(
list_of_unstandardised_address=addressList
)
"""
----
# TODO Property Type:
# 1) Make a small enum with all property types (5 enum)
# 2) Make an interface with ChatGPTAi to get wall field description and map it to enum
# 3) Stroe in landlord overrides
# TODO Wall Type:
# 1) Make a small enum with all property types (5 enum)
# 2) Make an interface with ChatGPTAi to get wall field description and map it to enum
# 3) Stroe in landlord overrides
---
"""
return {"hello": ["200"]}