gendesign/tradein-mvp/scripts
lekss361 4f26720dc8 feat(tradein): bulk sweep CLI for Yandex valuation house-history (EKB)
- New tradein-mvp/scripts/sweep-yandex-valuation-ekb.py
- Iterates DISTINCT addresses from listings (source='yandex' AND region_code=66)
- Calls existing estimator helpers (_get_or_fetch_yandex_valuation_cached +
  _save_yandex_history_items) — page=1 uses 24h cache; pages 2..N go direct
- Idempotent — skips addresses with external_valuations.fetched_at < N days
- CLI: --limit / --max-pages / --delay / --address-delay / --skip-recent-days /
  --address (single-address mode)
- Backfills the 160 orphan rows now that PR #526 (parser) + #531 (house_id link)
  are wired
2026-05-24 17:32:44 +03:00
..
backfill_001_address_fingerprints.py feat(tradein): Phase 1.3 backfill scripts — fingerprints + house/listing_sources (#475) 2026-05-23 14:29:39 +00:00
backfill_002_house_sources.sql feat(tradein): Phase 1.3 backfill scripts — fingerprints + house/listing_sources (#475) 2026-05-23 14:29:39 +00:00
backfill_003_listing_sources.sql feat(tradein): Phase 1.3 backfill scripts — fingerprints + house/listing_sources (#475) 2026-05-23 14:29:39 +00:00
probe-confidence-distribution.py feat(tradein-estimator): unique-address-based confidence threshold (#513) 2026-05-24 11:52:00 +00:00
probe-imv-by-address.py feat(tradein-imv): retry with cleaned address + categorize errors (#505) 2026-05-24 11:04:24 +00:00
README.md feat(tradein): Phase 1.3 backfill scripts — fingerprints + house/listing_sources (#475) 2026-05-23 14:29:39 +00:00
sweep-yandex-valuation-ekb.py feat(tradein): bulk sweep CLI for Yandex valuation house-history (EKB) 2026-05-24 17:32:44 +03:00
upload-cian-cookies.sh fix(tradein): убрать require_admin полностью — Caddy basic_auth достаточен (#474) 2026-05-23 14:21:01 +00:00

tradein-mvp scripts -- backfill

One-shot manual operator scripts. NOT auto-applied by deploy.yml (which only runs tradein-mvp/backend/data/sql/NN_*.sql).

Order

Run in numbered sequence after PR #470 (matching module) merged:

cd tradein-mvp/backend
export DATABASE_URL="postgresql+psycopg://user:pass@host:5432/tradein"

# 001 -- backfill houses.address_fingerprint (Python, idempotent)
uv run python ../scripts/backfill_001_address_fingerprints.py

# 002 -- backfill house_sources link rows (SQL, idempotent)
psql "${DATABASE_URL/postgresql+psycopg/postgresql}" -f ../scripts/backfill_002_house_sources.sql

# 003 -- backfill listing_sources link rows (SQL, idempotent)
psql "${DATABASE_URL/postgresql+psycopg/postgresql}" -f ../scripts/backfill_003_listing_sources.sql

All scripts idempotent -- re-running is safe (ON CONFLICT DO NOTHING on the SQL; row-level UPDATE WHERE NULL on the Python).

Other scripts

  • upload-cian-cookies.sh -- one-shot Cian session cookie upload (see inline docs)