Commit graph

12 commits

Author SHA1 Message Date
Khalim Conn-Kowlessar
689b0a5618 Fix the condition Lambda Dockerfile for the DDD layout
The lift-and-shift moved the handler to applications/condition/handler.py and
split the module across domain/infrastructure/repositories/applications, but the
Dockerfile still COPYed backend/condition/ and ran the old CMD path. Update the
COPYs to the handler's real import closure (the DDD dirs + the legacy backend
Base/db_session/settings bridges) and the CMD to applications/condition/handler.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 17:03:49 +00:00
Khalim Conn-Kowlessar
37745939b3 Resolve Calico UPRNs from the address-matched S3 CSV lookup
Calico Asset References don't match our landlord_property_id, so the runner now
resolves UPRNs from the address-matched CSV (UprnLookupS3) uploaded to S3, not
the property-table PropertyUprnLookup. run_calico_load accepts any UprnLookup
(null_uprn count applies only to the property-table lookup). Adds a dry_run
option to reconcile without writing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 16:22:53 +00:00
Khalim Conn-Kowlessar
f1cf7babad Record the confirmed Calico UPRN-join mismatch and S3 source
Confirmed against the DB: Calico Asset References have zero overlap with
portfolio 824's landlord_property_id (addresses match; all 824 UPRNs non-null),
so the property-table lookup cannot resolve Calico. Documents the open
resolution (Calico-supplied ref->UPRN table or address matching) in ADR-0064,
the runner, and the README, and pins the confirmed S3 source location.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:34:23 +00:00
Khalim Conn-Kowlessar
0588ae233a Document null_uprn as a portfolio-wide canary, not a partitioning drop count
Records the agreed reconciliation semantics: null_uprn reports portfolio
properties missing a UPRN (expected zero) and may overlap unmatched_to_portfolio,
rather than strictly partitioning the Calico rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:23:46 +00:00
Khalim Conn-Kowlessar
3a77a1a811 Wire the one-off Calico S3 load runner
run_calico_s3_load reads the Calico export from S3 and runs it through
run_calico_load against portfolio 824, resolving references to UPRNs via the
property table and persisting with ConditionPostgres. S3 + Postgres wiring
around the unit-tested load; run where a database and S3 are available.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:15:38 +00:00
Khalim Conn-Kowlessar
773869ada4 Run a Calico load end to end and return its reconciliation 🟩
run_calico_load ties parse -> map -> persist together: it resolves references to
UPRNs, drops blank/unmatched rows, persists the roof-covering surveys with
export-year-anchored renewal years, and returns the four-count LoadReport.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:13:33 +00:00
Khalim Conn-Kowlessar
a6a48dd337 Run a Calico load end to end and return its reconciliation 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:13:06 +00:00
Khalim Conn-Kowlessar
188176d81e Select the Calico parser and mapper by file type 🟩
Registers ConditionFileType.Calico in the parser/mapper factory; the Calico
parser requires a UPRN lookup (like Peabody) since references resolve to UPRNs
via the property table.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:11:56 +00:00
Khalim Conn-Kowlessar
a6b782d5b3 Select the Calico parser and mapper by file type 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:11:17 +00:00
Khalim Conn-Kowlessar
75c561e9db Summarise a Calico load as a four-count reconciliation report 🟩
LoadReport.from_calico_load reports loaded observations alongside the three drop
reasons (unmatched-to-portfolio, null-uprn, blank-placeholder) so every Calico
row is accounted for.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:10:08 +00:00
Khalim Conn-Kowlessar
87eecc6400 Summarise a Calico load as a four-count reconciliation report 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 15:09:39 +00:00
Khalim Conn-Kowlessar
735e83cef2 Relocate condition-data ingestion into the DDD layout 🟪
Behaviour-preserving lift-and-shift of the condition module out of legacy
backend/condition/ into domain/condition, infrastructure/condition,
infrastructure/postgres/condition_tables.py, repositories/condition,
applications/condition, and tests/condition. Imports rewritten to the DDD
paths; ConditionPostgres and the ORM models keep the legacy backend.app.db
Base/db_session bridges so the existing suite proves behaviour is unchanged
(SQLModel + session-DI conversion tracked as a follow-up in ADR-0064).

16 condition tests pass at the new location.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 14:51:25 +00:00