trade-in/v2 [BE-1]: estimate +cv +source_counts +created_at; /history +sources_used; cache-KPI #2043

Closed
opened 2026-06-28 11:05:15 +00:00 by lekss361 · 0 comments
Owner

Под-issue #2036. После — FE снимает approximate-флаги (FE-1/FE-4/FE-5).

yes-data-no-endpoint — данные считаются, но не отдаются:

  • AggregatedEstimate.cv: float|None — estimator уже считает std/mean ₽/м² компов и выбрасывает; вернуть.
  • AggregatedEstimate.source_counts: dict[str,int] — заполнить из listings-запроса ДО top-N sampling (estimator строит by_source транзиентно).
  • AggregatedEstimate.created_at — колонка trade_in_estimates.created_at уже есть, прокинуть в схему ответа (POST+GET).
  • /history: добавить sources_used (или длину) в проекцию → разблокирует колонку ИСТОЧНИКОВ N/7 в CacheView.
  • cache-KPI: расширить /cache-stats (или новый endpoint) — avg median_price + % повторных адресов (чтобы CacheView KPI были точные, а не FE-аппрокс).

psycopg v3 (CAST(:x AS type)), без ::. backend/app/schemas/trade_in.py + api/v1/trade_in.py + services/.../estimator.py. npm run codegen на FE после.

Acceptance: GET /estimate/{id} возвращает cv/source_counts/created_at непустыми на реальной оценке; /history отдаёт sources_used.

Под-issue #2036. После — FE снимает approximate-флаги (FE-1/FE-4/FE-5). `yes-data-no-endpoint` — данные считаются, но не отдаются: - `AggregatedEstimate.cv: float|None` — estimator уже считает std/mean ₽/м² компов и выбрасывает; вернуть. - `AggregatedEstimate.source_counts: dict[str,int]` — заполнить из listings-запроса ДО top-N sampling (estimator строит `by_source` транзиентно). - `AggregatedEstimate.created_at` — колонка `trade_in_estimates.created_at` уже есть, прокинуть в схему ответа (POST+GET). - `/history`: добавить `sources_used` (или длину) в проекцию → разблокирует колонку `ИСТОЧНИКОВ N/7` в CacheView. - cache-KPI: расширить `/cache-stats` (или новый endpoint) — avg median_price + % повторных адресов (чтобы CacheView KPI были точные, а не FE-аппрокс). psycopg v3 (`CAST(:x AS type)`), без `::`. `backend/app/schemas/trade_in.py` + `api/v1/trade_in.py` + `services/.../estimator.py`. `npm run codegen` на FE после. Acceptance: `GET /estimate/{id}` возвращает cv/source_counts/created_at непустыми на реальной оценке; `/history` отдаёт sources_used.
lekss361 added the
enhancement
scope/backend
tradein
labels 2026-06-28 11:06:15 +00:00
Sign in to join this conversation.
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#2043
No description provided.