[object Object]

← back to Commercialrealestate

residential: rental-leak floor — drop sub-$25k 'sale' prices from the for-sale SFR feed (yoloforever c7)

f97798f3ec2bb1fe48d1aa450864e4a9e1cbe679 · 2026-08-01 20:13:04 -0700 · Steve

8 monthly rentals ($3k-$16.5k, e.g. a $9,500 Beverly Hills 'sale') were
mis-scraped into the for-sale SFR feed and shown as real listings. /api/residential
now floors at price>=$25k on both the DB and snapshot paths. Safe: verified gap —
leaks top out ~$16.5k, cheapest genuine sale is $99.9k, so the floor hides no real
listing. Verified live (throwaway): 17925->17917, 0 sub-$25k remaining.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit f97798f3ec2bb1fe48d1aa450864e4a9e1cbe679
Author: Steve <steve@designerwallcoverings.com>
Date:   Sat Aug 1 20:13:04 2026 -0700

    residential: rental-leak floor — drop sub-$25k 'sale' prices from the for-sale SFR feed (yoloforever c7)
    
    8 monthly rentals ($3k-$16.5k, e.g. a $9,500 Beverly Hills 'sale') were
    mis-scraped into the for-sale SFR feed and shown as real listings. /api/residential
    now floors at price>=$25k on both the DB and snapshot paths. Safe: verified gap —
    leaks top out ~$16.5k, cheapest genuine sale is $99.9k, so the floor hides no real
    listing. Verified live (throwaway): 17925->17917, 0 sub-$25k remaining.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 scripts/serve.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/serve.js b/scripts/serve.js
index cb83a47..effdd79 100644
--- a/scripts/serve.js
+++ b/scripts/serve.js
@@ -703,7 +703,10 @@ app.get('/api/residential', async (req, res) => {
                 firm_name, broker_name, source, lat, lng,
                 status, off_market_at, disposition, sold_price, sold_date, created_at,
                 days_on_market, listed_date, market_status, prev_market_status, prev_price, price_changed_at
-           FROM sfr WHERE price > 0 AND (status='active' OR off_market_at > now() - interval '180 days')
+           FROM sfr WHERE price >= 25000 AND (status='active' OR off_market_at > now() - interval '180 days')
+           -- rental-leak floor: nothing sells for <$25k in LA County; sub-$25k 'sale' prices are
+           -- monthly RENTALS mis-scraped into the for-sale feed (data gap: leaks top out ~$16.5k,
+           -- cheapest genuine sale is $99.9k — the floor sits safely in that gap)
           ORDER BY (status='active') DESC, created_at DESC, price DESC LIMIT $1`, [limit]);
       if (r.rows.length) return res.json({ sfr: r.rows, label: SFR_LABEL, source: 'db' });
     } catch (_) { /* fall through to snapshot */ }
@@ -712,7 +715,9 @@ app.get('/api/residential', async (req, res) => {
   try {
     const file = path.join(ROOT, 'data', 'sfr-redfin.json');
     const { sfr = [] } = JSON.parse(fs.readFileSync(file, 'utf8'));
-    return res.json({ sfr: sfr.slice(0, limit), label: SFR_LABEL, source: 'snapshot' });
+    // mirror the DB rental-leak floor (see above): drop sub-$25k 'sale' prices (mis-scraped rentals)
+    const rows = sfr.filter(r => +r.price >= 25000).slice(0, limit);
+    return res.json({ sfr: rows, label: SFR_LABEL, source: 'snapshot' });
   } catch (e) {
     return res.json({ sfr: [], note: 'no sfr data', error: String(e.message).split('\n')[0] });
   }

← 9951d44 auto-save: 2026-08-01T20:09:07 (1 files) — public/deals-flow  ·  back to Commercialrealestate  ·  crcp: M&M firm-direct DEAD-END — API caps at 100 results ser 5413425 →