fix(tradein): backfill kn obj_class (parser + 3-pass) (#572) #628

Merged
Light1YT merged 2 commits from fix/572-kn-obj-class-backfill into main 2026-05-28 15:04:32 +00:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 39f390ddb8 - Show all commits

View file

@ -143,6 +143,8 @@ _OBJ_CLASS_PATTERNS: list[tuple[str, str]] = [
# that use the word "типов*" to describe standard/economy housing. The canonical value
# "Типовой" matches what the catalog SSR scraper (domrf_catalog.py) extracts from pages.
# Bug #572: this pattern was absent → 131+ objects remained NULL despite matching aiDescription.
# Intentionally broad (r"типов" not r"типов[ыоа]й?\b"): DOM.RF aiDescription uses varied
# inflections; tightening risks dropping coverage below the 70% acceptance threshold.
(r"типов", "Типовой"),
]

View file

@ -1,4 +1,4 @@
-- 120_backfill_obj_class_kn_api.sql
-- 121_backfill_obj_class_kn_api.sql
--
-- Backfill obj_class for domrf_kn_objects rows that remain NULL after migration 106.
--
@ -75,7 +75,7 @@ WHERE o.obj_id = src.obj_id
UPDATE domrf_kn_objects AS o
SET obj_class = prev.obj_class
FROM (
SELECT DISTINCT ON (n.obj_id, n.snapshot_date)
SELECT
n.obj_id,
n.snapshot_date,
best.obj_class
@ -145,7 +145,7 @@ BEGIN
WHERE snapshot_date = v_latest_snap AND region_cd = 66;
RAISE NOTICE
'domrf_kn_objects after 120 backfill:'
'domrf_kn_objects after 121 backfill:'
' all-snapshots: total=% filled=% null=%'
' | latest snapshot (%): total=% filled=%',
v_total, v_filled, v_null,