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
2 changed files with 10 additions and 5 deletions
Showing only changes of commit 41f2402b25 - Show all commits

View file

@ -189,12 +189,15 @@ def _to_bigint(raw: Any) -> int | None:
def _predicted_prices(entity: dict[str, Any]) -> tuple[int | None, int | None, int | None]:
"""Extract (value, min, max) from entity.predictedPrice.predictedPrice.
"""Extract (value, min, max) from entity.predictions.predictedPrice.
Yandex's own per-offer valuation. Fields are strings (e.g. "7554000").
Returns (None, None, None) when the nested path is absent.
Yandex's own per-offer valuation. The gate-API nests it under
``predictions.predictedPrice`` (NOT ``predictedPrice.predictedPrice``
that key does not exist; verified live 2026-06-18 against the gate-API).
Fields are strings (e.g. "7554000"). Returns (None, None, None) when the
nested path is absent (e.g. novostroyki offers carry no valuation).
"""
outer = entity.get("predictedPrice") or {}
outer = entity.get("predictions") or {}
inner = outer.get("predictedPrice") or {}
if not isinstance(inner, dict):
return None, None, None

View file

@ -114,7 +114,9 @@ _ENTITY_RICH_OWNER: dict = {
"trend": "DECREASED",
"previous": 7500000,
},
"predictedPrice": {"predictedPrice": {"value": "7554000", "min": "7100000", "max": "8000000"}},
# Real gate-API nests valuation under predictions.predictedPrice (verified
# live 2026-06-18) — NOT predictedPrice.predictedPrice.
"predictions": {"predictedPrice": {"value": "7554000", "min": "7100000", "max": "8000000"}},
"area": {"value": 48.0},
"roomsTotal": 2,
"floorsOffered": [5],