diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt index 3ffebf3e..300b86b0 100644 --- a/.devcontainer/requirements.txt +++ b/.devcontainer/requirements.txt @@ -16,4 +16,5 @@ uvicorn[standard] sqlmodel # Testing pytest==9.0.2 -pytest-cov==7.0.0 \ No newline at end of file +pytest-cov==7.0.0 +ipykernel>=6.25,<7 \ No newline at end of file diff --git a/.gitignore b/.gitignore index a6538116..625277a5 100644 --- a/.gitignore +++ b/.gitignore @@ -242,6 +242,8 @@ fabric.properties local_data/* /local_data/* etl/epc/local_data/* +/backend/condition/sample_data/lbwf/* +/backend/condition/sample_data/peadody/* *.DS_Store infrastructure/terraform/.terraform* diff --git a/backend/condition/__init__.py b/backend/condition/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/condition/handler.py b/backend/condition/handler.py new file mode 100644 index 00000000..9d26902b --- /dev/null +++ b/backend/condition/handler.py @@ -0,0 +1,16 @@ +from typing import Mapping, Any +from io import BytesIO + +from utils.logger import setup_logger +from ingestion.processor import process_file + + +logger = setup_logger() + +def handler(event: Mapping[str, Any], context: Any) -> None: + # Temporary stub for PoC wiring + dummy_stream = BytesIO(b"") + + source_key = event.get("source_key", "unknown-source") + + process_file(dummy_stream, source_key) \ No newline at end of file diff --git a/backend/condition/ingestion/processor.py b/backend/condition/ingestion/processor.py new file mode 100644 index 00000000..1653f310 --- /dev/null +++ b/backend/condition/ingestion/processor.py @@ -0,0 +1,6 @@ +from typing import BinaryIO, List + +from utils.logger import setup_logger + +def process_file(file_stream: BinaryIO, source_key: str) -> None: + print(f"[processor] Received file: {source_key}") \ No newline at end of file diff --git a/backend/condition/local_runner.py b/backend/condition/local_runner.py new file mode 100644 index 00000000..f27e04dc --- /dev/null +++ b/backend/condition/local_runner.py @@ -0,0 +1,25 @@ +from pathlib import Path + +from ingestion.processor import process_file + +def main() -> None: + try: + # Works in scripts / debugger / pytest + ROOT_DIR = Path(__file__).resolve().parents[1] + except NameError: + # __file__ is not defined in notebooks + ROOT_DIR = Path.cwd() + + path: Path = ROOT_DIR / "condition" / "sample_data" + + lbwf_path: Path = path / "lbwf" / "LBWF - Example Asset Data September 2025.xlsx" # TODO: get this from s3 as part of devcontainer init + + with lbwf_path.open("rb") as f: + process_file( + file_stream=f, + source_key=lbwf_path.as_posix(), + ) + +if __name__ == "__main__": + main() +