fix(yandex): read predicted price from entity.predictions.predictedPrice (#1725) #1734

Merged
lekss361 merged 1 commit from fix/yandex-predicted-price-path-1725 into main 2026-06-18 05:12:26 +00:00
Owner

Problem

predicted_price_rub is 0/NULL for every Yandex listing in prod (pp=0 across all 6189 yandex rows in listings). #1725 added the rich-field plumbing (ScrapedLot field → INSERT → ON CONFLICT COALESCE → DB column — all correct), but the extraction read the wrong gate-API key.

Root cause (verified live against gate-API, 2026-06-18)

The Yandex gate-API nests the per-offer valuation under:

entity.predictions.predictedPrice = { value, min, max }   // strings, e.g. "7554000"

_predicted_prices() read entity["predictedPrice"]["predictedPrice"] — that outer key does not exist (the real key is predictions), so it returned (None, None, None) for every offer.

Live verification (home residential IP, rgid=559132 EKB, roomsTotal=2, newFlat=NO): 23 entities, 0 had predictedPrice, all 23 had predictions.predictedPrice with {value,min,max} strings.

Fix

  • _predicted_prices: entity.get("predictedPrice")entity.get("predictions") (inner predictedPrice key + _to_bigint string-cast already correct). Docstring updated with the live-verified path.
  • Test fixture _ENTITY_RICH_OWNER used the same wrong wrapper → the assertion passed vacuously. Updated to the real predictions.predictedPrice shape; with the old code the assertions now fail, confirming the test is non-vacuous.

Verification

  • pytest tests/test_yandex_realty_serp.py → 62 passed
  • Full gate (pytest -q with the 2 standard deselects) → 1906 passed, 2 deselected

Post-deploy expectation

After deploy + a yandex vtorichka sweep, predicted_price_rub should populate for vtorichka offers (novostroyki carry no valuation — expected NULL there).

## Problem `predicted_price_rub` is **0/NULL for every Yandex listing** in prod (pp=0 across all 6189 yandex rows in `listings`). #1725 added the rich-field plumbing (ScrapedLot field → INSERT → ON CONFLICT COALESCE → DB column — all correct), but the extraction read the **wrong gate-API key**. ## Root cause (verified live against gate-API, 2026-06-18) The Yandex gate-API nests the per-offer valuation under: ``` entity.predictions.predictedPrice = { value, min, max } // strings, e.g. "7554000" ``` `_predicted_prices()` read `entity["predictedPrice"]["predictedPrice"]` — that **outer key does not exist** (the real key is `predictions`), so it returned `(None, None, None)` for every offer. Live verification (home residential IP, `rgid=559132` EKB, `roomsTotal=2`, `newFlat=NO`): 23 entities, **0** had `predictedPrice`, **all 23** had `predictions.predictedPrice` with `{value,min,max}` strings. ## Fix - `_predicted_prices`: `entity.get("predictedPrice")` → `entity.get("predictions")` (inner `predictedPrice` key + `_to_bigint` string-cast already correct). Docstring updated with the live-verified path. - Test fixture `_ENTITY_RICH_OWNER` used the same wrong wrapper → the assertion passed **vacuously**. Updated to the real `predictions.predictedPrice` shape; with the old code the assertions now fail, confirming the test is non-vacuous. ## Verification - `pytest tests/test_yandex_realty_serp.py` → 62 passed - Full gate (`pytest -q` with the 2 standard deselects) → **1906 passed, 2 deselected** ## Post-deploy expectation After deploy + a yandex vtorichka sweep, `predicted_price_rub` should populate for vtorichka offers (novostroyki carry no valuation — expected NULL there).
lekss361 added 1 commit 2026-06-18 05:03:33 +00:00
fix(yandex): read predicted price from entity.predictions.predictedPrice (#1725)
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
41f2402b25
Gate-API nests Yandex's per-offer valuation under predictions.predictedPrice,
not predictedPrice.predictedPrice (that key does not exist). _predicted_prices
read the wrong outer key, so predicted_price_rub/_min/_max were None for every
offer (prod: pp=0 across all 6189 yandex rows). Verified live against the
gate-API 2026-06-18.

The rich-field test fixture used the same wrong wrapper, so the test passed
vacuously. Updated _ENTITY_RICH_OWNER to the real predictions.predictedPrice
shape — with the old code the assertions now fail, confirming non-vacuity.
lekss361 added the
bug
priority/p1
scope/backend
scrapers
status/review
labels 2026-06-18 05:08:00 +00:00
lekss361 merged commit 635851a71c into main 2026-06-18 05:12:26 +00:00
lekss361 deleted branch fix/yandex-predicted-price-path-1725 2026-06-18 05:12:26 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#1734
No description provided.