feat(site-finder): X1 score breakdown + verbal explain (#47) #87
1 changed files with 5 additions and 2 deletions
|
|
@ -802,7 +802,7 @@ def analyze_parcel(
|
||||||
by_category: dict[str, list[dict[str, Any]]] = {}
|
by_category: dict[str, list[dict[str, Any]]] = {}
|
||||||
# X1 (#47): per-POI breakdown с verbal explain для UI
|
# X1 (#47): per-POI breakdown с verbal explain для UI
|
||||||
factors_detailed: list[dict[str, Any]] = []
|
factors_detailed: list[dict[str, Any]] = []
|
||||||
for p in poi_rows:
|
for idx, p in enumerate(poi_rows):
|
||||||
cat: str = p["category"]
|
cat: str = p["category"]
|
||||||
w = _POI_WEIGHTS.get(cat, 0.0)
|
w = _POI_WEIGHTS.get(cat, 0.0)
|
||||||
# distance decay: 1.0 на 0м, 0.5 на ~500м, ~0 на 1000м
|
# distance decay: 1.0 на 0м, 0.5 на ~500м, ~0 на 1000м
|
||||||
|
|
@ -826,7 +826,10 @@ def analyze_parcel(
|
||||||
continue
|
continue
|
||||||
factors_detailed.append(
|
factors_detailed.append(
|
||||||
{
|
{
|
||||||
"factor": f"{cat}_{round(distance_m)}m",
|
# Include idx чтобы избежать React key collision: два POI одной
|
||||||
|
# категории на одинаково округлённом расстоянии иначе дали бы
|
||||||
|
# дубль (например, two аптеки 450м в плотном районе).
|
||||||
|
"factor": f"{cat}_{round(distance_m)}m_{idx}",
|
||||||
"category": cat,
|
"category": cat,
|
||||||
"category_ru": _POI_CATEGORY_RU.get(cat, cat),
|
"category_ru": _POI_CATEGORY_RU.get(cat, cat),
|
||||||
"group": _POI_GROUP.get(cat, "Прочее"),
|
"group": _POI_GROUP.get(cat, "Прочее"),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue