gendesign/tradein-mvp/backend/app/services
bot-backend f25fa57141 fix(scrapers): stable dedup_hash — drop price_rub + strip URL query (Refs #753)
compute_dedup_hash включал price_rub и волатильный source_url (?context=) в
ключ → смена цены / ре-скрейп того же объявления давали новый hash → INSERT
дубля вместо ON CONFLICT DO UPDATE → дубли активных listings → искажение
asking_to_sold_ratio / sales-vs-listings / активного инвентаря.

Фикс (base.py.compute_dedup_hash):
- price_rub убран из ключа (смена цены = UPDATE строки, не новый объект);
- source_url-fallback стрипает query-string (?...) перед хешированием.

Avito source_id (DoD п.1): УЖЕ выставляется avito.py:404
(source_id=data-item-id, добавлено #726) — премиса issue про '0 совпадений
source_id' устарела. avito.py НЕ менялся, конфликт зафиксирован в PR/комменте.

Разовый эффект: существующие строки получат новый hash → следующий скрейп
upsert'нет их по новому ключу (всплеск дублей разовый, как и оговорено в issue).

Tests (test_base_save_listings.py): same item разная цена+context→один hash;
no-source_id query-strip; разные source_id→разный hash; source в ключе.
2026-05-30 19:06:03 +03:00
..
exporters chore(tradein): close pre-commit ruff gap + add CI pytest gate (#666) (#675) 2026-05-29 19:18:48 +00:00
matching feat(tradein): same-building матчинг аналогов по house_id (#6) 2026-05-28 13:55:51 +05:00
scrapers fix(scrapers): stable dedup_hash — drop price_rub + strip URL query (Refs #753) 2026-05-30 19:06:03 +03:00
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
account_quota.py fix(tradein): atomic conditional quota increment — close TOCTOU (#747) (#749) 2026-05-30 15:52:34 +00:00
brand.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
cache.py feat(tradein): Phase 3.2 — /api/v1/search endpoint + Redis cache (#479) 2026-05-23 14:44:22 +00:00
cian_session.py fix(tradein): CIAN_REQUIRED_COOKIES — add real auth cookies (DMIR_AUTH + Cian session) (#480) 2026-05-23 14:52:24 +00:00
dadata.py feat(tradein): DaData /suggest tier в /suggest endpoint (PR Q2) 2026-05-27 19:08:58 +05:00
estimator.py fix(tradein): sync n_analogs to anchor count when anchor drives headline (#695) (#739) 2026-05-30 15:25:35 +00:00
geocoder.py feat(tradein): DaData /suggest tier в /suggest endpoint (PR Q2) 2026-05-27 19:08:58 +05:00
house_metadata.py feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00
image_sanitizer.py fix(tradein-photos): sanitize uploaded images via Pillow re-encode (#511) 2026-05-24 11:32:04 +00:00
scheduler.py feat(scrapers): wire N1.ru city sweep — pipeline + scheduler + admin endpoint (#575) (#745) 2026-05-30 15:43:38 +00:00
scrape_pipeline.py feat(scrapers): wire N1.ru city sweep — pipeline + scheduler + admin endpoint (#575) (#745) 2026-05-30 15:43:38 +00:00
scrape_runs.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session (#487) 2026-05-23 20:08:40 +00:00
scraper_settings.py feat(tradein): global scraper delay setting (applies across all scrapers) (#485) 2026-05-23 15:43:28 +00:00
search_query.py feat(tradein): Phase 3.2 — /api/v1/search endpoint + Redis cache (#479) 2026-05-23 14:44:22 +00:00