From f6a7621b2daacec0b84adec79b1ce13f7ec33fe5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Apr 2026 22:00:52 -0500 Subject: [PATCH] =?UTF-8?q?demo:=20profiler=20index=20=E2=80=94=20director?= =?UTF-8?q?y=20of=20every=20Chicago=20contractor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit J asked for "a profiler index that shows a history of everyone." This is a /profiler directory page (also reachable via /contractors) that ranks every contractor who's filed a Chicago permit, by total permit value. Rows are clickable into the full /contractor profile. Defaults: since 2025-06-01, min permit cost $250K, top 200 contractors by total_cost. Server pulls two Socrata GROUP BY queries (one keyed on contact_1_name, one on contact_2_name), merges them so contractors listed in either applicant or contractor slot appear once with combined counts/cost. ~300ms cold. UI: live search box, since-date selector, min-cost selector, sortable columns (name / permits / total_cost / last_filed). Live numbers as of this write: 200 contractors, 1,702 permits, $14.22B aggregate. Filter "Target" returns TARGET CORPORATION + CORPORATION TARGET (name variants from Socrata). Also fixes J's other complaint — "no new contracts, Target is gone": /intelligence/permit_contracts was hard-capped at $limit=6 + only the most recent 6 over $250K, so any day with 6 fresh permits would push older contractors (Target) off the panel entirely. Now defaults to 24 (caller can pass body.limit up to 100), so 2-3 days of permits stay on the panel. Added body.contractor — passes a name into the WHERE so the staffer can pin a specific contractor to the panel ("Target Corporation" → 3 of their permits over $250K). Server-side: - new POST /intelligence/profiler_index — paginated contractor index (since, min_cost, search, limit) with merged contact_1+contact_2 aggregations - /intelligence/permit_contracts — body.limit + body.contractor - /profiler and /contractors routes serve profiler.html Front-end: - new mcp-server/profiler.html — sortable table, live filter, deep links to /contractor?name=... (prefix-aware via P, so /lakehouse works on devop.live) - search.html + console.html nav: added "Profiler" link Verified end-to-end via playwright on the public URL. --- mcp-server/console.html | 1 + mcp-server/index.ts | 104 ++++++++++++++++++- mcp-server/profiler.html | 216 +++++++++++++++++++++++++++++++++++++++ mcp-server/search.html | 1 + 4 files changed, 319 insertions(+), 3 deletions(-) create mode 100644 mcp-server/profiler.html diff --git a/mcp-server/console.html b/mcp-server/console.html index d2316fd..41397fb 100644 --- a/mcp-server/console.html +++ b/mcp-server/console.html @@ -95,6 +95,7 @@ details .body{padding-top:10px;font-size:12px;color:#8b949e}