Skip to content

Commit 4718ee3

Browse files
author
Test User
committed
Day 19 (20:00): update spec progress
1 parent 9376602 commit 4718ee3

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

BACKLOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Living document for coordinating between bot instances and tracking ideation.
55

66
## Currently Working On
77

8-
## Day 19 (20:00) — In Progress
8+
## Day 19 (20:00) — Done
99
Group trend analysis via chat — `_GROUP_TREND_PATTERNS` (7 NL variants: "which X are growing", "fastest growing X", "which regions are trending up", "growth rate by X", "which products are declining") + `_detect_group_trend_request()` (auto-detects date_col via detect_time_columns, group_col from categorical column mentions, value_col from numeric column mentions) + `compute_group_trends(df, date_col, group_col, value_col)` in `core/analyzer.py` (OLS slope per group, % change first→last, direction up/down/flat, rank by slope, plain-English summary); `GET /api/data/{id}/group-trends?date_col=&group_col=&value_col=` REST endpoint; `{type:"group_trends"}` SSE event; `GroupTrendCard` (orange border, ranked rows with up/down arrows, growth badges, summary). Directly implements vision's "Which products are trending up?" question.
1010

1111
## Day 19 (12:00) — Done

JOURNAL.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Journal
22

3+
## Day 19 — 20:00 — Group Trend Analysis via Chat (2108 backend + 941 frontend = 3049 tests)
4+
5+
AutoModeler now answers "which regions are growing?", "fastest growing products?", "which segments are trending up?", "compare growth by product category", or "how are my regions trending over time?" with an inline `GroupTrendCard` — an orange-bordered card ranking all groups by growth rate. Each row shows the group name, first value, last value, a color-coded % change badge (+green/−rose/→muted), and a direction arrow (▲▼→). Rising/falling/flat count badges appear in the header. The footer contains a plain-English summary naming the fastest grower and steepest decliner.
6+
7+
`compute_group_trends(df, date_col, group_col, value_col)` in `core/analyzer.py` converts the date column to a numeric day-index (days since min), then for each group fits OLS slope via `cov(x,y)/var(x)` and computes % change first→last. Groups are sorted by slope descending (fastest growers ranked 1st). High-cardinality guard: rejects if group_col has >50 unique values. `GET /api/data/{id}/group-trends?date_col=&group_col=&value_col=` REST endpoint; `_GROUP_TREND_PATTERNS` (7 NL variants) + `_detect_group_trend_request()` auto-detects date column via `detect_time_columns()` and scans message for categorical/numeric column names (longest-match first); `{type:"group_trends"}` SSE event.
8+
9+
**One lint fix:** `x_mean` and `y_mean` were computed but not used (ruff F841) — removed. **One test fix:** endpoint tests used `session.add()` which fails on repeated runs in the shared SQLite DB; changed to `session.merge()` (idempotent upsert). Directly implements the vision's "Which products are trending up?" question — distinct from scatter/correlation (static relationship), time-window comparison (two specific periods), and line chart (single series raw trend).
10+
11+
**17 backend + 13 frontend = 30 new tests. Total: 2108 backend + 941 frontend = 3049, all passing. Backend lint: clean. Frontend build + lint: clean.**
12+
313
## Day 19 — 12:00 — Pair Correlation Analysis + Quick Stat Query via Chat (2091 backend + 928 frontend = 3019 tests)
414

515
AutoModeler now answers "how correlated are revenue and cost?", "correlation between X and Y?", "does price correlate with demand?", or "Pearson r for units and sales?" with an inline `PairCorrelationCard` — a violet-bordered card showing Pearson r in large colored text, strength badge (very strong/strong/moderate/weak/negligible), direction badge (positive/negative/no correlation), p-value with significance classification (highly significant p<0.001, significant p<0.01, marginally significant p<0.05, not significant), a one-sentence interpretation, and a summary footer. It also now answers "what's the average revenue?", "total sales?", "maximum cost?", "count the rows?" with an inline `StatQueryCard` — a color-coded card (cyan=mean, blue=sum, teal=median, emerald=max, orange=min, purple=std, amber=count) with an agg icon (x̄/Σ/m/↑/↓/σ/#), a large formatted value with k/M suffixes, and an optional row-info paragraph when some values are null.

spec.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ guides them forward through the natural flow.
688688
- [x] **Quick stat query via chat** — Business analysts can ask "what's the average revenue?", "total sales?", "maximum cost?", "median units?", "standard deviation of price?", or "count the rows?" and receive an inline `StatQueryCard` showing a single large aggregate value. `compute_stat_query(df, agg, col)` in `core/analyzer.py` supports count/sum/mean/median/max/min/std, formats values with k/M suffixes, infers a plain-English label (average/total/median/maximum/minimum/std dev/count), and returns `n_rows`, `n_valid`, `formatted_value`, `label`, and `summary`. `GET /api/data/{id}/stat-query?agg=&col=` REST endpoint (400 on unknown agg or column). `_STAT_QUERY_PATTERNS` (7 NL variants) + `_detect_stat_query()` in `chat.py` detect intent; `_AGG_WORD_MAP` maps "average/mean/total/sum/max/min/median/std" to internal agg keys; count intent checked before the `_AGG_WORD_MAP` loop to prevent "how many rows?" matching "total" → "sum". `{type:"stat_query"}` SSE event; `attachStatQueryToLastMessage()` Zustand store action. `StatQueryCard` renders: color-coded border by agg type (cyan=mean, blue=sum, teal=median, emerald=max, orange=min, purple=std, amber=count), agg icon (x̄/Σ/m/↑/↓/σ/#), label + column header, agg badge, large formatted value, optional row-info paragraph when n_valid < n_rows, summary footer. Distinct from `_GROUP_PATTERNS` (requires "by" grouping clause). `StatQueryResult` TypeScript type; `api.data.getStatQuery()` client method.
689689
*Day 19 (12:00): 928 frontend tests passing, build clean. Total: 2091 backend + 928 frontend = 3019.*
690690

691+
- [x] **Group trend analysis via chat** — Business analysts can ask "which regions are growing?", "fastest growing products?", "which segments are trending up?", "compare growth by product category", or "how are my regions trending over time?" and receive an inline `GroupTrendCard` ranking all groups by growth rate. `compute_group_trends(df, date_col, group_col, value_col)` in `core/analyzer.py` converts dates to a numeric day-index, fits OLS slope per group (b = cov(x,y)/var(x)), computes % change (first→last), classifies direction (up/down/flat), ranks by slope descending, and builds a plain-English summary naming the fastest grower and worst decliner. Guards: rejects if group_col has >50 unique values (high cardinality). `GET /api/data/{id}/group-trends?date_col=&group_col=&value_col=` REST endpoint (400 on missing columns or high-cardinality group_col). `_GROUP_TREND_PATTERNS` (7 NL variants: "which X are growing/trending/increasing/declining/rising", "fastest growing/declining X", "growth/trend rate by/per X", "which X have the most growth/decline", "how are X trending over time", "compare growth by X") + `_detect_group_trend_request()` in `chat.py` — auto-detects date column via `detect_time_columns()`, scans message for mentioned categorical col (longest-match, fallback first cat col) and numeric col (longest-match, fallback first numeric). Handler computes `_compute_gt()`, injects rising/falling counts + summary into system prompt. `{type:"group_trends"}` SSE event; `attachGroupTrendsToLastMessage()` Zustand store action. `GroupTrendCard` renders: orange border, 📈 icon, rising/falling/flat count badges, table with rank/#/group/first/last/change badge (color-coded +green/-rose/→muted) / direction arrow (▲▼→), summary footer. `GroupTrendRow` + `GroupTrendResult` TypeScript types; `api.data.getGroupTrends()` client method. Directly implements the vision's "Which products are trending up?" question — distinct from scatter (static relationship), correlation (strength/direction), time-window comparison (two specific periods), and line chart (single series raw trend line).
692+
*Day 19 (20:00): 17 backend + 13 frontend = 30 new tests. Total: 2108 backend + 941 frontend = 3049.*
693+
691694
#### Track C — Coordination
692695

693696
- [x] **Update BACKLOG.md** — Before starting work, check BACKLOG.md for what the other

0 commit comments

Comments
 (0)