feat(scanner): cross-country analytics views (#932)#945
Merged
ericsocrat merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds cross-country analytics surfaces in the database to support the country-aware scanner/submission epic (#920), by introducing 3 new read-only views and extending the QA view-consistency suite to validate their presence/shape.
Changes:
- Add
v_cross_country_scan_analyticsfor per-country scan hit/miss metrics. - Add
v_cross_country_ean_candidatesto identify EANs scanned in multiple countries (linking candidates). - Add
v_submission_country_analyticsfor per-country submission status breakdown and acceptance rate, plus QA column-count checks for all 3 views.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
supabase/migrations/20260321000700_cross_country_analytics_views.sql |
Creates 3 new public analytics views over scan_history and product_submissions. |
db/qa/QA__view_consistency.sql |
Adds QA checks to assert the new views exist and have expected column counts. |
Comment on lines
+50
to
+54
| CREATE OR REPLACE VIEW public.v_submission_country_analytics AS | ||
| SELECT | ||
| suggested_country, | ||
| count(*) AS total_submissions, | ||
| count(*) FILTER (WHERE status = 'pending') AS pending, |
Comment on lines
+9
to
+13
| CREATE OR REPLACE VIEW public.v_cross_country_scan_analytics AS | ||
| SELECT | ||
| scan_country, | ||
| count(*) AS total_scans, | ||
| count(*) FILTER (WHERE found = true) AS found_scans, |
Comment on lines
+29
to
+33
| CREATE OR REPLACE VIEW public.v_cross_country_ean_candidates AS | ||
| SELECT | ||
| ean, | ||
| array_agg(DISTINCT scan_country ORDER BY scan_country) AS scanned_in_countries, | ||
| count(DISTINCT scan_country) AS country_count, |
This was referenced Mar 17, 2026
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.
Summary
Adds 3 read-only analytics views for cross-country scan and submission data, closing the final issue in epic #920.
Views Created
v_cross_country_scan_analyticsv_cross_country_ean_candidatesproduct_linksv_submission_country_analyticsKey Design Decisions
CREATE OR REPLACE VIEWfor idempotencyscan_country/suggested_countryrows excluded via WHERE clauseFiles Changed
supabase/migrations/20260321000700_cross_country_analytics_views.sql— 3 new viewsdb/qa/QA__view_consistency.sql— 3 new checks (13 → 16)Verification
Closes #932
Part of epic #920