mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Stage-2 entry point for the First Run use case. Adds the `ara_first_run` Lambda package mirroring the `postcode_splitter` template, its typed trigger contract, and a stub `FirstRunPipeline`. - `AraFirstRunTriggerBody`: thin command of five fields — `task_id`, `sub_task_id` (UUID, lifecycle), `portfolio_id`, `property_ids`, `scenario_ids` (int business IDs). No `model_config` override, so Pydantic's default `extra="ignore"` lets the FastAPI backend add fields without breaking deployed lambdas. UPRNs / Scenario defs are deliberately off the event — read from source-of-truth tables. - Thin `handler.py`: validate-and-delegate only, via a named `dispatch_first_run` seam (testable without the Lambda runtime). Subtask status (in-progress/complete/failed) + CloudWatch log URL come for free from the existing `@subtask_handler()` decorator. - `FirstRunPipeline` (orchestration/) stub: `run(command)` receives the validated command. Declares a structural `FirstRunCommand` Protocol (the three business fields) that `AraFirstRunTriggerBody` satisfies, so orchestration needs no application-layer import — rhymes with the `EpcFetcher`/`SolarFetcher` Protocols on IngestionOrchestrator (ADR-0011). Full Ingestion→Baseline→Modelling composition lands in #1136. - Dockerfile / requirements.txt / local_handler/ mirror postcode_splitter. TDD: 7 new tests (trigger-body validation incl. forward-compat + id-types, pipeline seam, handler delegation). pyright strict clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
1.2 KiB
Text
28 lines
1.2 KiB
Text
# Local-test environment for the ara_first_run Lambda.
|
|
#
|
|
# cp .env.local.example .env.local then fill in the values below.
|
|
#
|
|
# .env.local is gitignored. The container hits a REAL Postgres (the SubTask
|
|
# lifecycle store), so every value here points at infrastructure that exists.
|
|
#
|
|
# NOTE: the DDD code uses different env var names than the repo root .env. The
|
|
# mapping (root .env name -> var here) is given per section. Keep comments on
|
|
# their own lines — docker-compose's env_file parser folds a trailing "# ..."
|
|
# into the value.
|
|
|
|
# --- Postgres (utilities/aws_lambda/default_orchestrator -> PostgresConfig.from_env) ---
|
|
# POSTGRES_HOST <- DB_HOST, PORT <- DB_PORT, USERNAME <- DB_USERNAME,
|
|
# PASSWORD <- DB_PASSWORD, DATABASE <- DB_NAME.
|
|
POSTGRES_HOST=
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_USERNAME=
|
|
POSTGRES_PASSWORD=
|
|
POSTGRES_DATABASE=
|
|
# POSTGRES_DRIVER=psycopg2 (optional; defaults to psycopg2)
|
|
|
|
# --- AWS credentials for boto3 (used by later slices; the SubTask lifecycle
|
|
# CloudWatch URL is read from the Lambda runtime's own AWS_* env in prod) ---
|
|
AWS_ACCESS_KEY_ID=
|
|
AWS_SECRET_ACCESS_KEY=
|
|
AWS_DEFAULT_REGION=eu-west-2
|
|
# AWS_SESSION_TOKEN= (only if using temporary/SSO credentials)
|