fix(pipeline): enrich obj_class via objective_lots (fix 'Не указан: 4075') #165

Merged
lekss361 merged 1 commit from fix/pipeline-class-enrichment-objective-v2 into main 2026-05-15 07:07:52 +00:00

View file

@ -375,8 +375,9 @@ def _aggregate_pipeline(rows: list[Any]) -> dict[str, Any]:
- top_objects: PIPELINE_TOP_OBJECTS_LIMIT крупнейших ЖК по flat_count
NB: `obj_class` в production часто NULL (см.
`fixes/Bug_Kn_API_Obj_Class_Always_Null_OPEN`) by_class dominated by
"unknown" пока не закрыт D6/#38.
`fixes/Bug_Kn_API_Obj_Class_Always_Null_OPEN`). Pipeline SQL обогащает
obj_class через objective_lots + objective_complex_mapping (COALESCE
fallback). Объекты без маппинга остаются "unknown".
Используется для UI pipeline-bar и severity badge.
"""
@ -1312,7 +1313,16 @@ def analyze_parcel(
SELECT obj_id,
comm_name,
dev_name,
obj_class,
COALESCE(
obj_class,
(SELECT DISTINCT ol.class
FROM objective_lots ol
JOIN objective_complex_mapping m
ON m.objective_complex_name = ol.project_name
WHERE m.domrf_obj_id = o.obj_id
AND ol.class IS NOT NULL
LIMIT 1)
) AS obj_class,
flat_count,
ready_dt,
ST_Distance(