New table asking_to_sold_ratios (rooms_bucket × district reserved) holding ratio = median(SOLD ppm²)/median(ASKING ppm²) per rooms bucket, derived from rosreestr ДКП deals (trailing 12mo) vs current active listings. Global -1 fallback row always written; per-rooms rows only at n_deals>=30 AND n_listings>=30 (estimator falls back to -1 when a bucket row is absent). Dry-run (prod, rollback): seeds 6 rows — global 0.79 + студия 0.72 / 1к 0.74 / 2к 0.80 / 3к 0.84 / 4+ 0.93 (sold is 72-93% of asking by rooms; студия biggest discount, matching the harness finding). Idempotent (ON CONFLICT DO UPDATE); derivation CTE structured for Stage-4 refresh reuse. district reserved for #647. |
||
|---|---|---|
| .. | ||
| sql | ||