App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-25] [Insights polish] [R3] Improve AI insight cards as a stat chip, a title, and a short summary

Open JmillsExpensify opened this issue 4 weeks ago • 22 comments

Background

The Spend dashboard shows up to 4 AI insight cards above Spend over time. Rules detect each signal, and Concierge writes the card as one sentence, e.g. Hubspot Inc. spend in Oct 1–31, 2026 was 26,440% above its Sep 1–30, 2026 historical average.

In testing, the cards read flat and long:

  • Dates repeat the Date filter, e.g. across Aug 1–31, Sep 1–30, and Oct 1–31, 2026, and make up most of the sentence.
  • Percentages get huge, e.g. 65,060%, when an item had almost no spend before. They're accurate but meaningless.
  • In-progress periods read as drops. On Nov 3, Nov 2026 was 98% below the Oct 2026 historical average compares 3 days against a full month.
  • The same item shows on more than one card, and the wording changes from card to card.

This issue gives every card the same layout: a colored chip with the stat, the item's name in bold, and one short summary line, with Explain for anything more. It also tightens which signals qualify and how cards are picked. It covers the Spend dashboard, and the rules here are the framework the other dashboards' cards follow when they're updated. Detection thresholds and materiality ranking don't change, except where this issue says so.

Product and design details

Spend dashboard card row, desktop

Image Image

Card layout

Each card has four parts, top to bottom:

  1. Chip: the stat.
  2. Title: the item that changed, in bold, e.g. IT Site Hosting, Cole Eason, or Total spend. It wraps to 2 lines, then truncates with an ellipsis.
  3. Summary: one short line in the secondary text style.
  4. Explain: opens Concierge in the RHP (full-screen on mobile) with a question already filled in.

Cards sit in one row, divided by vertical lines, with no card background. On mobile, the row is the same and scrolls horizontally, as today: the next card peeks in from the right, and people swipe left to see the rest.

On desktop breakpoints, we want the cards to squish and wrap so that they show fully in the PNG exported via the Export button. Examples:

Viewport around 1120px: Image

Viewport around 900px: Image

Viewport around 600px: Image

Fully mobile viewport: Image

The above are just examples—let's use the breakpoints we already have to determine when to wrap/scroll.

Chip

There are two kinds of chip:

  • Change: an arrow and the size of the change, e.g. ↑ 65%. The color says whether the change is good or bad, not which way it went, using the colors from #102814. On Spend, an increase is red and a decrease is green.
  • Neutral: a count, share, or amount, with no arrow, on a gray background, e.g. 42%. Used for signals that don't have a direction.

Formatting:

  • Percentages are whole numbers, e.g. ↑ 65%.
  • From 1,000% up, the chip shows the change in the Group currency instead, rounded to whole units, e.g. ↑ $24,000.

Summary

Concierge writes the summary from the detected signal. It follows these rules:

  • At most 50 characters, so it fits on one line on desktop. It ends with a period.
  • No dates. The period word comes from the period rules in #105196, e.g. this month or this week.
  • No numbers or names that are already in the chip or title.
  • It may name one driver when the data shows one, e.g. Above its average, mostly from Vercel.
  • Plain words, e.g. its average, not its historical average. Members use their, e.g. Below their average this month.

If Concierge's summary breaks a rule, or hasn't arrived after 3 seconds, the card shows the signal's default summary from Signals.

Signals

Signal Chip Default summary Explain question
Spike, above its average Change, red, e.g. ↑ 65% Above its average this month. Why is <item> spend above its average this month?
Spike, below its average Change, green, e.g. ↓ 19% Below its average this month. Why is <item> spend below its average this month?
Trend Change, from the first period in the run to the last, e.g. ↑ 28% Up 3 weeks in a row. Why has <item> spend gone up 3 weeks in a row?
Record, highest or lowest Change, against the previous record, e.g. ↑ 12% Highest month on record. Why was this <item>'s highest month on record?
Threshold crossed Neutral, the threshold, e.g. $100,000 First month above this amount. What pushed <item> past $100,000 this month?
Concentration Neutral, the item's share of all spend, e.g. 42% Share of all spend this month. Why is so much of our spend going to <item>?
  • A spike's average is the item's own average, calculated the same way as the Details panel (#105196).
  • <item> is the card's title, and the period word follows the card's period.

Which items qualify

  • An item needs at least 3 complete periods of history, the same minimum as #105196.
  • For a spike or record, the item's average must be at least 1% of total spend in the period. For a trend, the first period in the run must be at least 1% of total spend in that period. This keeps a near-zero baseline from producing a huge percentage.
  • Members only appear for people who can see Top spenders.

In-progress periods

When the card's period is still in progress, e.g. This month on Nov 16:

  • A spike compares spend so far against the item's average to date: the average of what it spent by the same day of each earlier complete period, the same matched-days rule as #.
  • Spikes only show after that issue's thresholds: day 3 of a week, day 8 of a month, day 15 of a quarter, and day 31 of a year. A day never compares while it's in progress.
  • A trend only counts complete periods.
  • An in-progress period can set a highest record, but never a lowest one.
  • Concentration compares shares within the same days, so it works as is.

Picking the cards

  • We show up to 4 cards, ranked by materiality, as today.
  • Each item appears on one card at most. When an item qualifies for more than one signal, we keep the most material one.
  • Each signal appears on 2 cards at most.
  • When nothing qualifies, the row of cards is hidden.

Loading

  • Cards show the existing skeleton loader until the chip, title, and summary are all ready, so a card never changes after it appears.
Issue OwnerCurrent Issue Owner: @mallenexpensify
Issue OwnerCurrent Issue Owner: @luacmartins

JmillsExpensify avatar Nov 02 '26 23:11 JmillsExpensify

@JmillsExpensify left a comment in Figma for you to check out regarding these

dannymcclain avatar Nov 03 '26 13:11 dannymcclain

Awesome, I'll update the mocks. I think we've aligned at this point.

JmillsExpensify avatar Nov 03 '26 19:11 JmillsExpensify

We may also want to handle the wrapping for these in this issue. @JmillsExpensify what do you think?

dannymcclain avatar Nov 03 '26 19:11 dannymcclain

Yeah, let's do that. I can update the OP

JmillsExpensify avatar Nov 03 '26 19:11 JmillsExpensify

Added some notes about these squishing and wrapping to the description.

dannymcclain avatar Nov 05 '26 15:11 dannymcclain

awesome, thanks

mhawryluk avatar Nov 05 '26 15:11 mhawryluk

Self assigned since I worked on R3's issues

truph01 avatar Nov 06 '26 09:11 truph01

@truph01 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Nov 09 '26 22:11 melvin-bot[bot]

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar Nov 10 '26 17:11 melvin-bot[bot]

Deploy Blocker https://github.com/Expensify/App/issues/106591 was identified to be related to the PR https://github.com/Expensify/App/pull/106133 that attempted to fix this issue.

Chandkia24 avatar Nov 11 '26 02:11 Chandkia24

@truph01

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.36-0 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/106133

If no regressions arise, payment will be issued on 2026-11-19. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

melvin-bot[bot] avatar Nov 12 '26 08:11 melvin-bot[bot]

@truph01

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.40-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/106709

If no regressions arise, payment will be issued on 2026-11-25. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

melvin-bot[bot] avatar Nov 18 '26 00:11 melvin-bot[bot]

Waiting on regression period.

JmillsExpensify avatar Nov 18 '26 08:11 JmillsExpensify

@truph01 Eep! 4 days overdue now. Issues have feelings too...

Deploy Blocker #106591 was identified to be related to the PR #106133 that attempted to fix this issue.

It is BE issue https://github.com/Expensify/App/issues/106591#issuecomment-6806879201

truph01 avatar Nov 24 '26 04:11 truph01

Agreed.

JmillsExpensify avatar Nov 24 '26 08:11 JmillsExpensify

Triggered auto assignment to @mallenexpensify (Awaiting Payment)

Payment Summary

Resolving PRs:

  • https://github.com/Expensify/App/pull/106133

  • https://github.com/Expensify/App/pull/106709

  • Contributor: @mhawryluk does not require payment (Contractor)

  • Reviewer: @truph01 owed $175 via NewDot

BugZero Checklist (@mallenexpensify)

  • [ ] I have confirmed assignees, roles, and Upwork contracts look correct
  • [ ] I have paid out Upwork contracts / manual NewDot requests
  • [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon

@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Contributor+ Checklist:

  • [x] [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to the comment on the PR: N/A. It is an improvement issue Link to the comment on the Issue:

  • [x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion:

  • [x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

Precondition:

Test:

  1. Log in to an account that has the insightsAI beta enabled on the backend. Go to Insights > Spend.
  2. Verify each card shows the chip, the title in bold, the summary and Explain, and it looks correct.
  3. Verify the increase chips are tangerine with an up arrow, the decrease chips are green with a down arrow, and the neutral chips are blue with a coins icon.
  4. Verify long titles wrap to 2 lines and the Explain buttons line up across cards.
  5. Press Explain on a card and verify Concierge opens with that card's prompt.
  6. Change a filter and verify the skeleton matches the card layout while the insights load.
  7. Pick a date range with no insights and verify the card row is hidden.
  8. On a wide window, verify the 4 cards sit in one row. Narrow the window to a medium width and verify they wrap into 2 rows of 2, with dividers only between columns.
  9. Narrow the window until the filters don't fit next to the tabs and verify they move below the tabs, aligned left.
  10. Press Export (on wide and medium desktop layout) and verify the PNG shows all the cards and filters.
  11. On mobile, verify the cards scroll sideways as before.

Do we agree 👍 or 👎

truph01 avatar Nov 30 '26 04:11 truph01