Commit Graph
122 Commits
Author SHA1 Message Date
Christian Vidal Wolf adda0cd58f fix(storage): enforce Ads cached schema invalidation to clear broken numeric mapped columns 2026-02-26 10:47:36 +01:00
Christian Vidal Wolf fa588a6444 fix(dataProcessor): improve regex parsing for week number in Ads and Traffic CSV/Excel import 2026-02-26 10:37:50 +01:00
Christian Vidal Wolf 21ec5b63ab fix(parser): align ad sales and units regexes to capture standard Amazon header 'Sales within X days' 2026-02-26 08:30:23 +01:00
Christian Vidal WolfandClaude Opus 4.6 5dfcdd71c0 fix(parser): prevent regex collision where /sale/i matched ACOS column instead of attributed sales
The generic regex /sale/i in ads column detection was matching "Advertising Cost
of Sales" (the ACOS % column) before reaching "7 day total sales" (the actual
attributed sales amount). This caused attributedSales30d to receive the ACOS
percentage instead of the real sales value, making experiment ACOS = 0 or 100%.

- Replace /sale/i with specific regexes: /\d+\s*day.*sale/i, /total\s+sale/i, etc.
- Replace /cost/i with regexes that exclude "cost of sales" columns
- Replace /unit/i with specific regexes for unit columns
- Add diagnostic logging for ads Excel column headers and first-row values
- Revert ACOS 100% fallback (root cause now fixed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:54:56 +01:00
Christian Vidal WolfandClaude Opus 4.6 8b774ae7ba fix(experiments): prevent NaN propagation and ACOS zero-value bug in experiment analysis
- Change ?? to || for salesAds/units/revenue in weekly aggregation to guard against NaN
- Add || 0 fallback to ads-only records in mergeSalesAndAdsData
- Fix parseCurrency to check isNaN on all EU-format return paths
- Handle ACOS edge case: cost > 0 with adRevenue = 0 now returns 100% instead of 0%
- Add diagnostic console logging to computeDiD for data flow tracing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:34:55 +01:00
Christian Vidal Wolf de1af7e0db fix(experiment): patch ASIN matching bug where trailing whitespaces from excel files dropped matching records from analysis leading to zeroed metrics 2026-02-25 16:16:47 +01:00
Christian Vidal Wolf 79641b793a fix(parser): implement regex matching for headers to catch prefixed metric titles like '7 day total sales' 2026-02-25 14:56:15 +01:00
Christian Vidal Wolf 13dd4b62c2 fix(parser): add alphanumeric sanitizer to excel header mapping to support characters like % and parenthesis 2026-02-25 14:22:58 +01:00
Christian Vidal WolfandClaude Opus 4.6 487b8e105e feat: bulk ASIN selection via space-separated paste in filters
Allow pasting multiple ASINs separated by spaces in any MultiSelectDropdown
search field and pressing Enter to auto-select all matching options.
Also switch ads CSV/Excel parsing to header-based column mapping for
robustness across different file formats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 14:01:11 +01:00
Christian Vidal Wolf 69eafe8335 fix(experiments): explicitly use ad revenue (salesAds) for true ACOS and ROAS calculations instead of total sales revenue 2026-02-25 13:52:57 +01:00
Christian Vidal Wolf 30466a94ff fix(experiments): mathematically correctly aggregate ratios like ACOS and ROAS before averaging 2026-02-25 13:44:59 +01:00
Christian Vidal Wolf b39831c417 fix(experiments): change weekly boundaries to start on Sunday instead of ISO Monday 2026-02-25 13:35:10 +01:00
Christian Vidal Wolf 0fb312d537 fix(experiments): resolve bug that included adjacent week when experiment ended on midnight boundary 2026-02-25 13:32:39 +01:00
Christian Vidal Wolf 719390a5d5 refactor(experiments): change metric average calculation to strict weekly dividing rather than day fractions 2026-02-25 13:15:44 +01:00
Christian Vidal Wolf 6e94a32a47 fix(experiments): include full 24h of end_date in DiD overlap bounds 2026-02-25 13:10:00 +01:00
Christian Vidal Wolf be829c938e fix(experiments): allow decimals in formatMetricValue to show exact weekly averages 2026-02-25 13:03:45 +01:00
Christian Vidal Wolf 8ed073ff6e fix(experiments): use exact fractional proportions for overlapping weeks in DiD calculation 2026-02-25 12:59:03 +01:00
Christian Vidal Wolf aa745b4d5e feat(data): map product line from column R 2026-02-25 12:38:58 +01:00
Christian Vidal Wolf ce2241a5ec feat(data): update sell-out parser mapping and validation for new structure 2026-02-25 11:46:02 +01:00
Christian Vidal Wolf 4de9fb5b89 fix(experiments): include overlapping weeks in date range logic and use exact ISO weeks 2026-02-25 08:39:13 +01:00
Christian Vidal Wolf 4935112a55 feat: enable custom baseline periods for Experiments to solve seasonality 2026-02-23 18:34:04 +01:00
Christian Vidal Wolf 69f4456942 feat: force ASIN and SKU columns in Grid exports 2026-02-23 18:18:02 +01:00
Christian Vidal WolfandClaude Opus 4.6 24df5935cc feat: rebuild Experiments tab with Difference-in-Differences analysis and Bayesian verdicts
Replace the basic CRUD experiment tracker with a scientifically rigorous A/B testing system:

- Add DiD analysis engine (services/experimentAnalysis.ts) that computes treatment vs control
  group comparisons across 7 metrics (units, sessions, CVR, CTR, ROAS, revenue, ACOS)
- Implement Bayesian verdict system (Winner/Loser/Inconclusive) using posterior probability
  with normal CDF approximation (Abramowitz & Stegun erf, no external deps)
- Build counterfactual time series for trend charts (actual vs estimated without change)
- Rewrite ExperimentsView as single component with 3 inline sub-views (list, detail, create)
  replacing the previous modal-based ExperimentDetail and ExperimentForm
- Add control group support, change annotations (before→after diffs), and SEO experiment type
- New types: ExperimentChangeAnnotation, DiDMetricResult, DifferenceInDifferencesResult,
  ExperimentVerdict
- Simplify App.tsx by removing experiment modal state (5 useState hooks eliminated)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:42:40 +01:00
Christian Vidal Wolf 99d524db12 fix: adapt experiment calculation engine to consume both CombinedKPIs and SalesRecord data structures 2026-02-21 22:51:38 +01:00
Christian Vidal Wolf 411448e4d2 fix: resolve NaN algorithm corruption causing empty experiment calculations on save 2026-02-21 22:31:28 +01:00
Christian Vidal Wolf 58cc863748 chore: enable verbose error logging on experiment calculations to reveal silent production errors 2026-02-21 21:56:35 +01:00
Christian Vidal Wolf 9259129f95 fix: add safe generic fallback to date parsers to prevent parse errors 2026-02-21 19:44:18 +01:00
Christian Vidal Wolf aa9a7845b7 fix: resolve UTC date matching and implement per-product ASIN breakdown table for Line experiments 2026-02-21 19:37:07 +01:00
Christian Vidal Wolf 249dc0c749 fix: resolve LINE level experiments to individual ASINs using salesData so calculation works for product lines 2026-02-21 19:26:45 +01:00
Christian Vidal Wolf d78a88afe1 feat: complete experiments tab analytics optimization with modular kpis and sparklines 2026-02-21 15:31:02 +01:00
Christian Vidal Wolf 67e93f6653 feat: implement experiment tracking in Weekly Sales Grid 2026-02-21 15:14:22 +01:00
Christian Vidal WolfandQwen-Coder 8d05173b40 Fix Supabase LockManager timeout error
- Disable auth persistence in Supabase client
- Set autoRefreshToken: false, persistSession: false
- Prevents 'Acquiring an exclusive Navigator LockManager lock' timeout
- Applied to both services/supabase.ts and api/experiments.ts

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-21 09:29:22 +01:00
Christian Vidal WolfandQwen-Coder edbde19f3a Fix Supabase credentials error - use API routes
- Create /api/experiments endpoint for server-side Supabase access
- Update experiments service to use fetch instead of direct Supabase client
- Fixes 'Supabase credentials not configured' error in browser

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-21 00:21:57 +01:00
Christian Vidal WolfandQwen-Coder a21c0d532c Fix TypeScript errors in experiments feature
- Add experimentMap/onOpenExperiment props to WeeklyRow component
- Export VendorDailyRow type from supabase.ts
- Fix type errors in experiments.ts (unknown[] to string[])
- Add type annotation for allAsins in App.tsx

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-20 19:39:56 +01:00
Christian Vidal WolfandQwen-Coder f93d92da0b Add complete Experiments tracking system
New Features:
- Experiments tab with full CRUD operations
- Create experiments by ASIN or product line groups
- Track pricing, advertising, content, and promotion experiments
- Performance analytics with baseline vs experiment comparison
- Visual experiment badges in Weekly Sales grid
- Experiment detail view with metrics and learnings

Technical Changes:
- Add Supabase experiments table migration
- New services/experiments.ts for CRUD + calculations
- New components: ExperimentsView, ExperimentDetail, ExperimentForm, ExperimentBadge
- Integrate experiment indicators in WeeklyGrid
- Add navigation tab (desktop + mobile)
- Type definitions in types.ts

Usage:
1. Run SQL migration in Supabase
2. Navigate to Experiments tab
3. Create experiments with ASINs, dates, hypothesis
4. View performance lift after completion
5. See active experiments marked in Weekly Sales

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-20 19:31:44 +01:00
Christian Vidal WolfandQwen-Coder a4919691b2 Fix Vendor filters: add year, date range, and ASIN search
- Add year filter with multi-select dropdown
- Add date range pickers (from/to)
- Fix tags filter using ilike for partial matching
- Add clear filters button
- Update supabase service with proper year filtering

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-20 14:01:05 +01:00
Christian Vidal Wolf 0b76e587d5 fix(types): resolve lint errors in Supabase filter options 2026-02-20 13:41:20 +01:00
Christian Vidal Wolf 85c789bf52 fix: resolve vendor data upload error by implementing client-side parsing and sequential batching 2026-02-20 13:32:26 +01:00
Christian Vidal WolfandClaude Opus 4.6 16f7af7df3 fix: lazy-init Supabase client to prevent crash when env vars missing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:23:29 +01:00
Christian Vidal WolfandClaude Opus 4.6 2bce0a839b feat: add Supabase vendor data integration (BSR, ratings, buy box)
- Create vendor_daily_data table schema and Supabase client service
- Add upload API route for Vendor Central CSV parsing and upsert
- Add VendorDataView with BSR trend, ratings, and buy box charts
- Integrate new Vendor tab into app navigation (desktop + mobile)
- Add vendor CSV upload card to FileUpload modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:19:25 +01:00
Christian Vidal Wolf 2b9399e7e0 fix: correct revenue metric mapping in Weekly Sales grid (pivot revenue vs ads cost) 2026-02-19 16:22:19 +01:00
Christian Vidal Wolf 079e4130f7 feat: add units/revenue toggle to Weekly Sales and improve traffic data parsing 2026-02-19 16:03:16 +01:00
Christian Vidal WolfandClaude Opus 4.6 31ad7fda21 fix: read all sheets in Traffic Weekly Excel for complete GV data
processTrafficExcel was only reading the first sheet, missing data from
year-based sheets (e.g., "2025", "2026"). Now iterates all sheets with
auto-detection of column layout, matching the processAdsExcel pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:34:00 +01:00
Christian Vidal Wolf 1bea36aa74 fix: move Gemini API calls server-side to fix API key issue on Vercel 2026-02-10 15:35:10 +01:00
Christian Vidal Wolf a259538ff4 fix: exhaustive API key lookup and injection for Vercel 2026-02-10 15:24:52 +01:00
Christian Vidal Wolf 3f6fdc8d72 feat: integrate Gemini Pro 1.5 with KAM persona for data analysis 2026-02-10 15:15:44 +01:00
Christian Vidal Wolf d5bcbeda1a Fix GRID tab empty table regression by correcting filter logic and prop passing 2026-02-09 12:05:03 +01:00
Christian Vidal Wolf ac791b5265 Implement Excel-style filters (SKU, ASIN, Title, Line) across GRID, WEEKLY SALES, and FC26 tabs 2026-02-09 12:00:39 +01:00
Christian Vidal Wolf 827135a517 fix: force ASIN column B and Reason column N for BB_DE 2026-02-06 10:57:03 +01:00
Christian Vidal Wolf bd8f86007c fix: force Column J for BB_UK reason column 2026-02-06 10:54:06 +01:00