← back to La Socrata Ingester
yoloforever c8 FIX (Cody): status brief market = permit volume + median (not outlier-inflated sum)
804a15e67da74e9f1a97eb5c4faf9c08ac6327da · 2026-08-12 07:55:00 -0700 · steve
Cody c8: the Market section re-imported the sum(valuation) outlier problem killed in
c2/c7 ($493M incl. the $375M unverified permit, unflagged). Now ranks hottest district
by permit VOLUME (outlier-immune) + shows MEDIAN value. Consistent with the digest.
Files touched
M scripts/status-brief.js
Diff
commit 804a15e67da74e9f1a97eb5c4faf9c08ac6327da
Author: steve <steve@designerwallcoverings.com>
Date: Wed Aug 12 07:55:00 2026 -0700
yoloforever c8 FIX (Cody): status brief market = permit volume + median (not outlier-inflated sum)
Cody c8: the Market section re-imported the sum(valuation) outlier problem killed in
c2/c7 ($493M incl. the $375M unverified permit, unflagged). Now ranks hottest district
by permit VOLUME (outlier-immune) + shows MEDIAN value. Consistent with the digest.
---
scripts/status-brief.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/status-brief.js b/scripts/status-brief.js
index 82d1288..97b372e 100644
--- a/scripts/status-brief.js
+++ b/scripts/status-brief.js
@@ -65,15 +65,18 @@ async function main() {
L.push('');
// 4. Top market (rollup) + contractor supply
+ // Rank hottest district by permit VOLUME (outlier-immune) + show MEDIAN value, not a raw
+ // sum a single unverified mega-permit dominates (Cody c8: don't re-import the killed metric).
const topCd = (await q(`
- SELECT p.council_district cd, count(*) permits, round(sum(p.valuation)) val
+ SELECT p.council_district cd, count(*) permits,
+ percentile_cont(0.5) WITHIN GROUP (ORDER BY p.valuation)::bigint AS median_val
FROM la_building_permits_raw p WHERE p.dataset_id='pi9x-tg5x' AND p.status_desc='Issued'
AND p.issue_date > now()-interval '90 days' AND p.council_district IS NOT NULL
- GROUP BY 1 ORDER BY val DESC LIMIT 1`)).rows[0];
+ GROUP BY 1 ORDER BY count(*) DESC LIMIT 1`)).rows[0];
const cdName = topCd ? (await q(`SELECT name FROM la_gis_features WHERE layer='council_district' AND name LIKE $1 LIMIT 1`, [topCd.cd + ' -%'])).rows[0]?.name : null;
const bTrade = Number((await q(`SELECT count(*) c FROM cslb_raw, unnest(string_to_array("Classifications(s)",'|')) x WHERE "County"='Los Angeles' AND "PrimaryStatus"='CLEAR' AND trim(x)='B'`)).rows[0].c);
L.push('## Market');
- if (topCd) L.push(`- Hottest district (90d, issued): **${cdName || 'CD ' + topCd.cd}** — ${Number(topCd.permits).toLocaleString()} permits, ${money(topCd.val)}`);
+ if (topCd) L.push(`- Hottest district (90d, by permit volume): **${cdName || 'CD ' + topCd.cd}** — ${Number(topCd.permits).toLocaleString()} permits, ${money(topCd.median_val)} median/permit`);
L.push(`- General-building contractor supply (active, LA County): ${bTrade.toLocaleString()}`);
L.push('');
← e1a34c1 yoloforever c8: consolidated platform status brief (scripts/
·
back to La Socrata Ingester
·
Contractor web-enrichment — $0 local (free DDG search + loca c5f4234 →