mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Define simple local runner
This commit is contained in:
parent
b808f132a8
commit
b1aca16be0
6 changed files with 51 additions and 1 deletions
|
|
@ -16,4 +16,5 @@ uvicorn[standard]
|
|||
sqlmodel
|
||||
# Testing
|
||||
pytest==9.0.2
|
||||
pytest-cov==7.0.0
|
||||
pytest-cov==7.0.0
|
||||
ipykernel>=6.25,<7
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -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*
|
||||
|
|
|
|||
0
backend/condition/__init__.py
Normal file
0
backend/condition/__init__.py
Normal file
16
backend/condition/handler.py
Normal file
16
backend/condition/handler.py
Normal file
|
|
@ -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)
|
||||
6
backend/condition/ingestion/processor.py
Normal file
6
backend/condition/ingestion/processor.py
Normal file
|
|
@ -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}")
|
||||
25
backend/condition/local_runner.py
Normal file
25
backend/condition/local_runner.py
Normal file
|
|
@ -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()
|
||||
|
||||
Loading…
Add table
Reference in a new issue