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

Closed
lekss361 wants to merge 1 commit from fix/pipeline-class-enrichment-objective into main
lekss361 commented 2026-05-15 07:01:01 +00:00 (Migrated from github.com)

Bug

Pipeline 24mo UI showed 'Не указан: 4075 квартир' because domrf_kn_objects.obj_class всегда NULL (Bug_Kn_API_Obj_Class_Always_Null_OPEN).

Fix

SQL COALESCE с correlated subquery в pipeline query (parcels.py:1313-1325):

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

Coverage impact (MCP-verified prod)

Before After
Total planned ЖК 1316 1316
With class 0 (0%) 339 (25.8%)

Breakdown post-fix: 249 комфорт · 45 стандарт · 42 бизнес.

Не-mapped (mostly не-Свердл или newer ЖК) остаются 'Не указан' до:

  • Mapping expansion (separate task)
  • Upstream kn-scraper class fix (Bug remains OPEN)

Closes #162

## Bug Pipeline 24mo UI showed **'Не указан: 4075 квартир'** because `domrf_kn_objects.obj_class` всегда NULL (`Bug_Kn_API_Obj_Class_Always_Null_OPEN`). ## Fix SQL COALESCE с correlated subquery в pipeline query (parcels.py:1313-1325): ```sql 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 ``` ## Coverage impact (MCP-verified prod) | | Before | After | |---|---|---| | Total planned ЖК | 1316 | 1316 | | With class | **0 (0%)** | **339 (25.8%)** | Breakdown post-fix: 249 комфорт · 45 стандарт · 42 бизнес. Не-mapped (mostly не-Свердл или newer ЖК) остаются 'Не указан' до: - Mapping expansion (separate task) - Upstream kn-scraper class fix (Bug remains OPEN) Closes #162
lekss361 commented 2026-05-15 07:02:13 +00:00 (Migrated from github.com)

Closing — branch had stale content (recreating clean)

Closing — branch had stale content (recreating clean)

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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#164
No description provided.