feat(site-finder): X1 score breakdown + verbal explain (#47) #87

Closed
lekss361 wants to merge 8 commits from feat/site-finder-score-breakdown into main
Showing only changes of commit ec681441e5 - Show all commits

View file

@ -802,7 +802,7 @@ def analyze_parcel(
by_category: dict[str, list[dict[str, Any]]] = {}
# X1 (#47): per-POI breakdown с verbal explain для UI
factors_detailed: list[dict[str, Any]] = []
for p in poi_rows:
for idx, p in enumerate(poi_rows):
cat: str = p["category"]
w = _POI_WEIGHTS.get(cat, 0.0)
# distance decay: 1.0 на 0м, 0.5 на ~500м, ~0 на 1000м
@ -826,7 +826,10 @@ def analyze_parcel(
continue
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_ru": _POI_CATEGORY_RU.get(cat, cat),
"group": _POI_GROUP.get(cat, "Прочее"),