feat(tradein): infer repair_state from listing description text (#622) #632

Merged
Light1YT merged 1 commit from feat/622-infer-repair-state-from-text into main 2026-05-28 15:37:35 +00:00
Owner

Summary

  • New infer_repair_state_from_text() (ordered regex → 4-enum, strongest-signal-first) in repair_state_normalizer.py.
  • avito_detail/cian/cian_detail/yandex_detail/yandex_realty fall back to description inference when the structured repair field is absent (structured stays priority).
  • Migration 075 backfills existing NULL rows from description (idempotent, BEGIN/COMMIT).
  • Yandex goes 0% → meaningful coverage (had no repair field before).
  • Unknown/no-signal → NULL (no fabrication).

Builds on #621 (normalizer). Prereq-adjacent to #7 repair coefficients.

Test plan

  • 42 normalizer tests + parser fallback tests pass
  • migration 075 applies; SELECT repair_state, count(*) FROM listings GROUP BY 1

Closes #622

## Summary - New infer_repair_state_from_text() (ordered regex → 4-enum, strongest-signal-first) in repair_state_normalizer.py. - avito_detail/cian/cian_detail/yandex_detail/yandex_realty fall back to description inference when the structured repair field is absent (structured stays priority). - Migration 075 backfills existing NULL rows from description (idempotent, BEGIN/COMMIT). - Yandex goes 0% → meaningful coverage (had no repair field before). - Unknown/no-signal → NULL (no fabrication). Builds on #621 (normalizer). Prereq-adjacent to #7 repair coefficients. ## Test plan - [x] 42 normalizer tests + parser fallback tests pass - [ ] migration 075 applies; SELECT repair_state, count(*) FROM listings GROUP BY 1 Closes #622
Light1YT added 1 commit 2026-05-28 15:36:25 +00:00
Structured repair coverage was too low for data-derived repair coefficients
(#7 v2): avito ~1% / cian ~5% / yandex 0%. When the structured field is absent
we now extract repair state from the listing description via Russian-phrase
regexes (евроремонт / без отделки / черновая / дизайнерский / косметический,
...), centralized in repair_state_normalizer.infer_repair_state_from_text().

Wired as a fallback into avito_detail, cian SERP + cian_detail, and both yandex
SERP and detail parsers — the structured field always wins; only NULLs fall back
to inference. Patterns are checked strongest-first (excellent > good >
needs_repair > standard) so mixed descriptions resolve to the latest state.
Migration 075 backfills existing rows with the same patterns; unknown stays NULL
(no fabrication).
Light1YT merged commit 312df8536a into main 2026-05-28 15:37:35 +00:00
Light1YT deleted branch feat/622-infer-repair-state-from-text 2026-05-28 15:37:35 +00:00
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#632
No description provided.