Skip to content

feat(iter-12): collapsible schema panel, funnel analysis & ROW_NUMBER dedup levels - #26

Merged
martinl5 merged 1 commit into
mainfrom
lcb-evolution/collapsible-schema-funnel-dedup
Jun 30, 2026
Merged

feat(iter-12): collapsible schema panel, funnel analysis & ROW_NUMBER dedup levels#26
martinl5 merged 1 commit into
mainfrom
lcb-evolution/collapsible-schema-funnel-dedup

Conversation

@martinl5

Copy link
Copy Markdown
Owner

Summary

  • Collapsible schema panel — right panel collapses to 40 px rail via chevron; SQL editor expands to fill freed space; + vertical "SCHEMA" label restore it. Mobile unaffected.
  • Level 72 — Loan Product Acquisition Funnel: UNION ALL multi-stage aggregation + CROSS JOIN scalar CTE yields 20→15→12→5 customers (100%→75%→60%→25%). Standard product-analytics funnel pattern.
  • Level 73 — First Salary Credit Per Account: ROW_NUMBER() OVER (PARTITION BY account_id ORDER BY transaction_date ASC) + WHERE rn = 1 dedup. 4 rows. Universal ETL/SCD dedup pattern.

[UI/UX Improvements]

Collapsible schema panel (GameProvider.tsx): The right-hand Schema/Results column now collapses to a 40 px desktop rail by clicking the chevron appended to the tab bar's right edge. When collapsed:

  • Panel width transitions from lg:w-[420px]lg:w-10 with transition-all duration-200 ease-in-out
  • Collapsed rail shows a expand button (gold, bordered) and a vertical "SCHEMA" text label so the affordance is always visible
  • SQL editor column changes from lg:w-[460px] flex-shrink-0lg:flex-1 min-w-0, growing to fill freed horizontal space — more room for long CTEs and window-function queries
  • State is session-local (useState), not persisted — panel always opens on reload
  • Both toggle buttons have aria-label + title; mobile stacked layout is unaffected

Directly implements the "collapsible schema panel" item from the UI/UX rotation.

[Game Design Tweaks]

Level 72 (Expert, difficulty 4) — "Loan Product Acquisition Funnel": Teaches the canonical SQL product-analytics funnel using UNION ALL of four scalar aggregate queries (tagged with ord) and a CROSS JOIN scalar CTE for the conversion-rate denominator. Four stages: All Customers (20, 100%), Loan Applicants (15, 75%), Active Loan Holders (12, 60%), Active Home Loan Holders (5, 25%). ORDER BY customer_count DESC gives natural funnel order (all counts distinct). Reinforces the CROSS JOIN scalar CTE idiom from Level 70 in a new product-analytics context. This exact UNION ALL + CROSS JOIN pattern is used in BigQuery/Redshift/Snowflake at FAANG and digital banks. No new data required.

Level 73 (Expert, difficulty 4) — "First Salary Credit Per Account (ROW_NUMBER Dedup)": Teaches the universal SQL deduplication pattern: ROW_NUMBER() OVER (PARTITION BY account_id ORDER BY transaction_date ASC) in a CTE, then WHERE rn = 1. Compliance framing (MAS Notice 632 income-verification) makes the business case concrete. Returns 4 rows — accounts 5/15/25/35 (customers Aisha Binte Yusof, Chen Mei Ling, Nur Hidayah, Fiona Tan) with their first Salary Credit amounts ($3 750–$8 250) and dates in Jan–Feb 2024. Pattern is identical across BigQuery, Redshift, Snowflake, Spark SQL, and PostgreSQL. No new data required.

[Database & Code Optimizations]

  • LevelUpModal.tsx EPOCH_NEXT_HINT extended with entries for levels 72 (funnel) and 73 (ROW_NUMBER dedup); nextHintKey sentinel array extended to […, 71, 72, 73]; fallback updated ?? 71?? 73
  • MAX_LEVEL in progression.ts auto-derives from the last level array entry (now 73) — zero touch points
  • Left panel layout: lg:w-[460px] flex-shrink-0lg:flex-1 min-w-0 so the editor grows when the panel collapses
  • No new DB tables, seed rows, or indexes — both levels use existing loans, transactions, accounts, customers tables

Test results

Test Files  5 passed (5)
     Tests  405 passed (up from 395 in iter-11)
  Duration  786 ms
TypeScript  clean (tsc --noEmit)

🤖 Generated with Claude Code

https://claude.ai/code/session_011AFkb4EU6i5RTHn6sVFhGs


Generated by Claude Code

… dedup levels

UI/UX: Right panel (Schema/Results) now collapses to a 40px rail on
desktop via a › chevron in the tab bar. The SQL editor column changes
from fixed-460px to flex-1 so it fills the freed space. A ‹ expand
button + vertical "SCHEMA" label keep the affordance clear. Mobile
layouts are unaffected. Implements the "collapsible schema panel" item
from the UI/UX rotation.

Game: Level 72 — Loan Product Acquisition Funnel: UNION ALL + CROSS
JOIN scalar CTE funnel showing 20→15→12→5 customer conversion
(100%→75%→60%→25%), ORDER BY customer_count DESC. The canonical
product-analytics funnel pattern used at FAANG and digital banks.

Level 73 — First Salary Credit Per Account: ROW_NUMBER() OVER
(PARTITION BY account_id ORDER BY transaction_date ASC), WHERE rn = 1
dedup. Returns 4 rows (accounts 5,15,25,35). The universal dedup /
latest-record-per-entity pattern for ETL, SCD, and data-quality work.

Tests: 405 pass (up from 395 in iter-11). TypeScript clean.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sqlwak Ready Ready Preview, Comment Jun 29, 2026 8:57pm

@martinl5
martinl5 marked this pull request as ready for review June 30, 2026 18:09
@martinl5
martinl5 merged commit a225cdb into main Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants