Infra I2: Per-class weight profile (эконом / комфорт / бизнес) #43

Closed
opened 2026-05-11 20:16:56 +00:00 by lekss361 · 1 comment
lekss361 commented 2026-05-11 20:16:56 +00:00 (Migrated from github.com)

Эшелон: 🟢 Infrastructure / Quality

Контекст / проблема

Текущие _POI_WEIGHTS хардкоднутые универсальные. Но для бизнес-класса парк и метро важнее supermarket, а для эконома наоборот. Один скоринг неприменим.

Что сделать

Backend

  1. Конфиг-driven weights — таблица или JSON в app/services/site_finder/weight_profiles.json:
    {
      "economy":  {"school": 1.8, "kindergarten": 1.8, "shop_supermarket": 1.3, ...},
      "comfort":  {"school": 1.5, "kindergarten": 1.5, "park": 1.6, ...},
      "business": {"park": 2.2, "metro_stop": 2.0, "shop_mall": 1.5, "shop_small": 0.2, ...}
    }
    
  2. analyze принимает ?class_profile=economy|comfort|business query param (default comfort)
  3. Возвращать в response applied_profile + profile_explanation

Frontend

  1. Radio buttons «Класс жилья» в /site-finder (3 варианта)
  2. Reactive recompute при изменении (mutate с новым profile)
  3. Сравнение «score @ economy: 12 / @ business: 8» — side comparison

Acceptance

  • Один тестовый участок даёт разный score при разных classes
  • UI radio переключается без перезагрузки
  • Default = comfort для backward compatibility

Owner

backend-engineer + frontend-engineer

Effort

1.5 дня

Dependencies

  • Опционально: D6 (per-obj_class данные в БД) — для inference дефолтного класса

Risks / open

  • Weight values субъективны — нужна валидация Максимом + 2-3 девелоперами на встречах
  • Reactive recompute может быть expensive (full re-analyze). Optimization: возвращать все 3 score в одном response
**Эшелон:** 🟢 Infrastructure / Quality ## Контекст / проблема Текущие `_POI_WEIGHTS` хардкоднутые универсальные. Но для бизнес-класса парк и метро важнее supermarket, а для эконома наоборот. Один скоринг неприменим. ## Что сделать ### Backend 1. Конфиг-driven weights — таблица или JSON в `app/services/site_finder/weight_profiles.json`: ```json { "economy": {"school": 1.8, "kindergarten": 1.8, "shop_supermarket": 1.3, ...}, "comfort": {"school": 1.5, "kindergarten": 1.5, "park": 1.6, ...}, "business": {"park": 2.2, "metro_stop": 2.0, "shop_mall": 1.5, "shop_small": 0.2, ...} } ``` 2. `analyze` принимает `?class_profile=economy|comfort|business` query param (default `comfort`) 3. Возвращать в response `applied_profile` + `profile_explanation` ### Frontend 1. Radio buttons «Класс жилья» в `/site-finder` (3 варианта) 2. Reactive recompute при изменении (mutate с новым profile) 3. Сравнение «score @ economy: 12 / @ business: 8» — side comparison ## Acceptance - [ ] Один тестовый участок даёт разный score при разных classes - [ ] UI radio переключается без перезагрузки - [ ] Default = comfort для backward compatibility ## Owner `backend-engineer` + `frontend-engineer` ## Effort 1.5 дня ## Dependencies - Опционально: D6 (per-obj_class данные в БД) — для inference дефолтного класса ## Risks / open - Weight values субъективны — нужна валидация Максимом + 2-3 девелоперами на встречах - Reactive recompute может быть expensive (full re-analyze). Optimization: возвращать все 3 score в одном response
Owner

Закрываю — реализовано через серию #114 sub-PR:

  • PR #136 — schema user_weight_profiles (#114 1/4)
  • PR #137 — weight profiles service Pydantic + CRUD (#114 2/4)
  • PR #138 — weight profiles endpoints + analyze integration (#114 3/4)
  • PR #139 — weight profile panel + analyze options (#114 4/4 FINAL, commit b42c9dd)

Плюс PR #206/#215 (#201 Phase 1+2) — inline POI weights pass-through в /analyze + debounce live preview.

Сейчас: backend/app/services/site_finder/weight_profiles.py + backend/app/api/v1/admin_weight_profiles.py живёт, frontend имеет panel для выбора profile, debounced re-analyze работает.

Базовые econom/comfort/business profiles можно seed'ить через admin UI — user-driven, не hardcoded JSON как в issue body.

Закрываю — реализовано через серию #114 sub-PR: - PR #136 — schema `user_weight_profiles` (#114 1/4) - PR #137 — weight profiles service Pydantic + CRUD (#114 2/4) - PR #138 — weight profiles endpoints + analyze integration (#114 3/4) - PR #139 — weight profile panel + analyze options (#114 4/4 FINAL, commit b42c9dd) Плюс PR #206/#215 (#201 Phase 1+2) — inline POI weights pass-through в /analyze + debounce live preview. Сейчас: `backend/app/services/site_finder/weight_profiles.py` + `backend/app/api/v1/admin_weight_profiles.py` живёт, frontend имеет panel для выбора profile, debounced re-analyze работает. Базовые econom/comfort/business profiles можно seed'ить через admin UI — user-driven, не hardcoded JSON как в issue body.
Sign in to join this conversation.
No project
No assignees
2 participants
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#43
No description provided.