Commit 7cc14b7
Add multi-step conversion funnel support (#119)
* Add multi-step conversion funnel support
Extends type: conversion metrics to support N-step funnels via a steps
list field, generating per-entity BOOL_OR aggregation for each step.
Backwards compatible with existing base_event/conversion_event usage.
* Auto-update JSON schema
* Fix: monotonic funnel counts, entrant-only totals, validate conversion_window
* Fix: enforce chronological funnel order, normalize qualified filters
* Fix: derive step timestamps sequentially from prior-step completion
* Fix: alias timestamp expressions in step CTEs, parenthesize step predicates
* Fix: normalize timestamp expression in step source subqueries
* Fix: normalize step predicates to CTE source alias
* Fix: resolve {model} in filters, add metric-named output column
_strip_model_prefixes now replaces {model} with the actual model name
before sqlglot parsing, so placeholder-based filters no longer leak
literal {model} tokens into WHERE clauses.
Multistep funnel output now includes the last-step count aliased to
the metric name, so ORDER BY metric_name works without runtime errors.
* Fix: use sqlglot for model prefix stripping to preserve string literals
* Fix: parenthesize filters, always qualify step N with 's' alias
* Fix: resolve entity through model dimension sql_expr, normalize for each CTE alias
* Fix: qualify entity_sql_s with qualify_bare=True for step N
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 765ae8a commit 7cc14b7
5 files changed
Lines changed: 1385 additions & 20 deletions
File tree
- sidemantic
- adapters
- core
- sql
- tests/metrics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
632 | 648 | | |
633 | 649 | | |
634 | 650 | | |
| |||
1620 | 1636 | | |
1621 | 1637 | | |
1622 | 1638 | | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1623 | 1655 | | |
1624 | 1656 | | |
1625 | 1657 | | |
| |||
2361 | 2393 | | |
2362 | 2394 | | |
2363 | 2395 | | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
2364 | 2412 | | |
2365 | 2413 | | |
2366 | 2414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| |||
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
| 423 | + | |
422 | 424 | | |
423 | 425 | | |
424 | 426 | | |
| |||
585 | 587 | | |
586 | 588 | | |
587 | 589 | | |
| 590 | + | |
| 591 | + | |
588 | 592 | | |
589 | 593 | | |
590 | 594 | | |
| |||
675 | 679 | | |
676 | 680 | | |
677 | 681 | | |
| 682 | + | |
| 683 | + | |
678 | 684 | | |
679 | 685 | | |
680 | 686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
| |||
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
259 | 268 | | |
260 | 269 | | |
261 | 270 | | |
| |||
0 commit comments