Repository navigation
chore(seed): populate raw prompt_results.shopping_cards for the demo Shopping page - #232
Merged
Merged
Conversation
The Shopping page's card-rate KPI and the per-platform card-rate bar chart read prompt_results.shopping_cards, which the seed left at the default '[]' for every row — so both showed 0% on the demo dashboard. (#176 already seeded the normalized prompt_result_shopping_cards table, which drives the other KPIs and the trend chart.) Set shopping_cards to provider-shape JSON on the exact prompt_results rows the normalized cards reference (prompt 801: Perplexity US/GB, Google AI Mode US, Copilot US), so the raw and normalized layers agree: - Perplexity -> snake_case (image_url, review_count, ...) - Google AI Mode / Copilot -> camelCase (imageUrl, reviewCount, ...) Same products/prices/merchants as the normalized rows; everything else stays '[]'. Reuses the existing Acme/Demo/Fixture/Sample fixture brands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #153
Context
Most of #153 was already delivered by #176, which seeded the normalized
prompt_result_shopping_cardstable — so the demo Shopping page's Products surfaced, Shopping SoV, Top merchant KPIs and the 30-day trend chart already populate.What was still missing is the issue's Part 1: the raw
prompt_results.shopping_cardscolumn. The seed left it at the default'[]'for every row, and two surfaces read that column directly (verified inweb/src/lib/actions/shopping.ts):cardBearingResults / totalResults, filteringshopping_cards != '[]'shopping_cardsis a non-empty arrayBoth showed 0% on the demo because no seeded row had a non-empty
shopping_cards.Change
Add
shopping_cardsto theprompt_resultsinsert and set it via aCASEto provider-shape JSON on exactly the rows the normalized cards reference (prompt…801), so the raw and normalized layers stay consistent:image_url,review_count)imageUrl,reviewCount)Every other row stays
'[]'. Same product titles / prices / merchant domains as the normalized rows #176 seeded; reuses the existingAcme Coffee/Demo Coffee Co/Fixture Roasters/Sample Beansfixture brands (no real names).shopping.tsonly checks these for non-emptiness — the analytics read the normalized table — so the raw shape is for fidelity, but it's kept provider-accurate on purpose.Verification
CASEexpression's syntax and per-combo card counts with a read-only query (no tables written): Perplexity US → 3, GB → 2, Google AI Mode US → 1, Copilot US → 1, everything else → 0 — matching feat(shopping): My Products / Competitors tabs with brand matching #176's normalized rows exactly.Reviewer note: I couldn't run
npx supabase db resethere (no local Postgres). Please confirm the reset reloads cleanly and that, signed in as[email protected], the Shopping card rate KPI and the platform bar chart now show non-zero values.Scope note
Currencies are kept
USDto match the already-seeded normalized rows (the issue's "vary currencies" suggestion predates #176; diverging here would desync the two layers). No production code, no migration — fixture only.