feat(tradein): houses.cian_zhk_url column + backfill (#568) #627

Merged
Light1YT merged 2 commits from fix/568-houses-cian-zhk-url into main 2026-05-28 13:57:44 +00:00

2 commits

Author SHA1 Message Date
cfa24c3bcf fix(tradein): SAVEPOINT-isolate houses backfill + ruff/shell fixes (#568) 2026-05-28 18:54:27 +05:00
c47a42c0a5 feat(tradein): houses.cian_zhk_url column + backfill (#568)
Add TEXT column cian_zhk_url to houses (migration 071) with partial index.
This unblocks fetch_newbuilding() which requires a ZHK slug URL — the
existing cian_internal_house_id (bigint) is not sufficient for the API call.

Activate the do_houses block in backfill_cian_history(): query houses with
cian_zhk_url set + no price_dynamics rows, then fetch + save per house.

Add resolve_cian_zhk_url() in cian_newbuilding.py: follows Cian redirect
from https://cian.ru/zhk/<id>/ to canonical slug URL, for use by the new
backfill script (scripts/backfill_cian_zhk_url.py).

Store cian_zhk_url into NewbuildingEnrichment and persist it via
save_newbuilding_enrichment UPDATE (COALESCE — never overwrites non-NULL).

Remove stale TODO comments referencing #525 from cian_history_backfill.py
and admin.py docstring. Enable DO_HOUSES=true by default in cian_backfill_all.sh.

Post-deploy required: apply 071 migration, then run
scripts/backfill_cian_zhk_url.py to populate existing rows.
2026-05-28 18:45:42 +05:00