Commit graph

4 commits

Author SHA1 Message Date
9183829d08 feat(site-finder): max-info popups — конкурент/§3-таблица/польз.точка/соседи (#2111)
All checks were successful
CI / changes (pull_request) Successful in 9s
CI / frontend-tests (pull_request) Successful in 1m33s
CI / openapi-codegen-check (pull_request) Successful in 2m30s
CI / backend-tests (pull_request) Successful in 14m52s
Audit #2111 (MEDIUM/LOW): попапы/карточки показывали данные, которые есть в
ответе, но недоливались до UI. Все поля едут через существующие loose
dict[str, Any] passthrough'ы (competitors, neighbors_summary) — без изменения
контракта/codegen.

- Конкурент (MarketLayers): «Застройщик» (dev_name) + «Ср. площадь кв.»
  (avg_area_pd — SQL уже считал, прокидываем явно в _competitor_with_coords).
- §3 «Инж. сооружения рядом» (NspdEngineeringNearbyBlock): вторичная строка
  Назначение/Характеристики/Адрес/№ ЕГРН (EngineeringStructure уже несёт эти поля).
- Польз. точка (CustomPoiLayer): scope-метка (глобальная/привязана к участку) +
  добавлена/изменена (formatDate с guard).
- Соседи (NeighborsBlock): Назначение + Статус (cad_buildings.purpose/status,
  добавлены в neighbors CTE SELECT + neighbor dict; прод-verified ~100% заполнено).
- Utility material → RU («сталь/металл/бетон», unknown → passthrough) — «человеческим
  языком» (ui-microcopy). Юнит-тесты material RU + avg_area_pd passthrough.

Примечание: neighbor purpose/status покрыты только DB-gated EXPLAIN-тестом
(integration), unit-покрытия нет by design.
2026-06-30 18:29:39 +05:00
74f1ffb500 perf(objective): request-path consumers dedup inline, not via whole-table view (#1964)
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m49s
CI / backend-tests (pull_request) Successful in 13m58s
deep-review #1964: v_objective_lots_latest has NO premise/district filter inside,
so a consumer's outer WHERE cannot push below DISTINCT ON → the view materializes
the WHOLE table (Parallel Seq Scan + external Sort 1.76M rows, ~55MB spill) on
every query. For REQUEST-PATH consumers inside analyze_parcel this is a ~19x latency
regression vs the pre-#1964 raw-table plan.

DISPROVEN remedy (NOT applied): a full index on the physflat-key does NOT help —
DISTINCT ON selects ol.* (51 cols, width≈945) so index-only-unique is impossible;
the planner ignores the index (seq-scan+sort still cheaper) and even forced it is
~3.9 s. A 142MB index for zero request-path benefit + slower bulk-INSERT during
objective-scrape is wrong. Honors original #1964 decision "no new index".

Prod EXPLAIN (Академический / 3km radius, 2026-06-28):
  consumer            via view      inline (this commit)
  concepts median     5854 ms       1640 ms   (bitmap district + sort)
  parcels district    5854 ms       1640 ms
  parcels geo-median  6443 ms        122 ms   (NestedLoop geo->complex bitmap)
  parcels obj_pricing 5721 ms        441 ms   (project bitmap per nearby ЖК)

FIX: keep v_objective_lots_latest ONLY for batch/background/cached consumers
(supply_layers L1, competitors._SOLD_COUNT_SQL, special_indices [/forecast bg task
30-180s], admin, landing). Revert the 4 request-path consumers inside analyze_parcel
to inline DISTINCT ON (physflat-key, latest snapshot) with the filter pushed INTO the
CTE so the district/spatial/project index applies:
- concepts._OBJECTIVE_MEDIAN_SQL
- parcels.py district price block
- parcels.py geo-radius median (complex_id-scoped)
- parcels.py obj_pricing CTE (project_name-scoped; aggregates over deduped set)

Migration 175 header CORRECTED: accurately states the partial mig-173 index does NOT
serve the view (qual can't push below DISTINCT ON), the full index is disproven/not
added, and which consumers use the view vs inline. No DDL change (still view-only).

Tests: +guards (concepts/obj_pricing dedup inline, not view; obj_pricing physflat
DISTINCT ON; perf-pushdown scope preserved). 965 passed.
2026-06-28 05:00:47 +05:00
cab19020a9 perf(site-finder): pushdown obj_pricing CTE to nearby competitors (#70/#307) (#1335)
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy / build-frontend (push) Has been skipped
Deploy / build-backend (push) Successful in 1m40s
Deploy / build-worker (push) Successful in 2m38s
Deploy / deploy (push) Successful in 1m12s
2026-06-14 16:58:43 +00:00
lekss361
1799e1fb30 fix(sf-02): добавить site_status/ready_dt в /analyze competitors + sort строящиеся first
SQL в /analyze не выбирал site_status, ready_dt из domrf_kn_objects;
ORDER BY flat_count DESC ставил сданные ЖК в топ.

Closes (epic part) #271 item 2
2026-05-17 13:29:59 +03:00