Commit Graph
100 Commits
Author SHA1 Message Date
Christian Vidal WolfandClaude Sonnet 4.6 777a01e417 fix: use all-country ads for MKT tab to match Excel file total
filteredAdsData applies PAN_EU default when no marketplace is selected,
cutting UK/other spend and showing 118k instead of the full 151k.
mktAdsData skips the PAN_EU restriction: no customer filter = all
countries, still respects explicit customer/year/week selections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 16:52:06 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 910e6d2a4d fix: include empty-ASIN ad records so MKT total matches ADs Weekly
Removed the `if (asin)` guard so records without a product ASIN
(e.g. campaign-level rows) accumulate in adsSpendMap and appear as
an 'Unassigned Ad Spend' row, ensuring the total PPC spend is the
same as in the ADs Weekly tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 16:44:36 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 36fa63b6c1 fix: zero out deals/promos/chargebacks when 2025 is not in filtered scope
These Excel files only contain 2025 data. When the top filter excludes
2025 (e.g. year=2024), the maps are ignored so columns show 0 instead
of stale 2025 figures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 16:26:52 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 0eda5551d8 fix: include all ad-spend ASINs in MKT tab to match ADs Weekly total
Two bugs fixed:
1. Removed hardcoded year===2025 filter (data is already pre-filtered)
2. ASINs with ad spend but no sales records were silently dropped —
   now appended as extra rows so the total PPC spend matches ADs Weekly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 16:18:46 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 657009a7ba feat: wire MKT tab to top-level filters and remove internal category filter
MktDataView now receives filteredData/filteredAdsData so the global
FilterBar controls the tab's data. Removed the local "All Categories"
dropdown that previously sat next to the Include COGS toggle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 14:35:37 +01:00
Christian Vidal WolfandQwen-Coder 12fb15cae3 style: rename MKT tab from 'MKT (preview)' to 'MKT'
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-11 13:20:05 +01:00
Christian Vidal Wolf 9c55d132dd feat(mkt): filter sales and ads to 2025 only and show full product catalog 2026-03-11 13:06:06 +01:00
Christian Vidal Wolf 7240c9998c style: fix mkt tab columns visibility by wrapping product names 2026-03-11 13:00:19 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 6a1cb0e8dd refactor: consolidate 3 MKT fetch routes into fetch-mkt-data to stay within Vercel 12-function limit
Replace fetch-deals, fetch-promos, fetch-chargebacks with a single
/api/fetch-mkt-data?file=deals|promos|chargebacks endpoint.
Update MktDataView fetch calls accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 12:36:45 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 49498c5c51 feat: wire MKT tab to real data sources
Replace all mock data in the Profitability Dashboard with live data:
- Add 3 new API routes (fetch-deals, fetch-promos, fetch-chargebacks) proxying Dropbox Excel files
- MktDataView now accepts rawData/adsData props and fetches+parses the 3 new files on mount
- SELL OUT and units aggregated globally across all marketplaces from rawData
- PPC Spend aggregated globally from adsData; ACoS calculated as spend/sales
- Deals (col A→C), Promos (col E→K), Chargebacks (col AN→B) parsed and summed per ASIN
- Category filter populated from product line metadata
- Loading skeleton shown while files are fetching

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 12:34:07 +01:00
Christian Vidal WolfandQwen-Coder 5d0edfba5f ui: rename Gross Sales to SELL OUT in MKT table
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-11 10:34:17 +01:00
Christian Vidal WolfandQwen-Coder ba69375dbe ui: rename MKT tab to MKT (preview)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-11 10:25:57 +01:00
Christian Vidal Wolf f323e2a96e feat: split Incentives into Deals and Promos in MKT tab 2026-03-11 09:31:39 +01:00
Christian Vidal Wolf 455cd8ed08 feat: add MKT tab and integrate profitability dashboard 2026-03-11 09:27:57 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 0e1457bd3d fix: BSR rank line now shows in BSR vs Units Sold chart
BSRRecord.market is stored as short codes ('DE', 'IT', etc.) from the
Excel file, but the chart was comparing against full names ('Amazon DE',
'Amazon IT', etc.) — causing bsrRecordsForMarket to always be empty and
the BSR line to never render. Added normalizeBsrMarket() to map short
codes to full names before filtering. Also removed the debug strip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 09:08:30 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 dcf77cad2d perf: make filter dropdowns feel instant with useDeferredValue
Use React's useDeferredValue to decouple UI responsiveness from
expensive data reprocessing. Checkboxes now update immediately on
click; filterData/filterAdsData/filterBsrData and all downstream
useMemos run as a low-priority background pass. Added local optimistic
state in MultiSelectDropdown as a belt-and-suspenders layer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 09:02:24 +01:00
Christian Vidal WolfandQwen-Coder 8e907f1dff refactor: remove Movers tab (table now integrated in Dashboard)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-10 14:09:39 +01:00
Christian Vidal Wolf cefbc18433 fix: simplify green/red logic for inverted metrics in experiments 2026-03-10 14:07:43 +01:00
Christian Vidal Wolf 74d92b83b5 fix: logic to show BSR improvements (rank drops) in green 2026-03-10 14:04:20 +01:00
Christian Vidal Wolf c15642d62d feat: add Detail Level BSR metric to experiments analysis 2026-03-10 13:58:44 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 2363982144 feat: simplify verdict to winner/unsuccessful with >50% threshold
- winner if posterior probability > 50%, unsuccessful otherwise
- Removes inconclusive — binary outcome based on Bayesian signal
- Label "Loser" renamed to "Unsuccessful"
- Updated all stored experiment verdicts in DB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 13:47:01 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 127fa9c279 fix: show 1-decimal probability and conditional confidence badge
- Display probability with 1 decimal (89.8% instead of 90%) so users
  understand why it's below the 90% winner threshold
- Replace hardcoded "Significant Confidence Reached" badge with
  verdict-aware badge: winner=green, loser=red, inconclusive=amber

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 13:36:23 +01:00
Christian Vidal WolfandQwen-Coder e118d43b3d rename Vendor tab to BSR
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-10 13:36:21 +01:00
Christian Vidal Wolf fdf217c8e6 Implement dynamic annual impact projection in Experiment view 2026-03-10 13:20:20 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 af77a3f5d4 fix: parseAsins splits LINE: names with spaces correctly
Split by comma/semicolon/newline first; only split by spaces for
non-LINE: tokens so "LINE:MAGIC DOUGH" isn't broken into two parts.
Also fix placeholder and repair stored experiment data via API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 13:14:23 +01:00
Christian Vidal Wolf b8c3a6ff49 Remove redundant info cards from Experiment detail view 2026-03-10 13:13:23 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 9bdb7a5c4a debug: add diagnostic strip to BSR chart to identify data mismatch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:33:47 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 31d1755122 fix: use detailLevelBSR in BSR vs Units chart with topLevel fallback
Detail category BSR is more granular and relevant per ASIN. Falls back
to topLevelBSR if detailLevelBSR is null for a record.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:07:54 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 f1e11ca79a fix: replace Math.max(...spread) with loop to prevent call stack overflow
Math.max(...largeArray) crashes when combinedAdsData has thousands of
records. Replaced with a simple for-loop to find the max year safely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:03:56 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 3e3975cd2b feat: add BSR vs Units correlation chart to Vendor tab
New BSRUnitsCorrelationChart component added to the Vendor tab showing:
- Per-marketplace tabs (DE, ES, FR, IT, UK) with market accent colors
- Dual-axis combo chart: bars (units sold, right axis) + line (BSR rank, left axis)
- Inverted BSR axis by default (lower rank = top) with toggle to flip
- Pearson r correlation calculated and displayed with strength interpretation
- Wired to existing combinedAdsData (filtered) and filteredBsrData

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 10:58:01 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 507af94e1a fix: move BuyBoxWarningBadge inside stockMap block to prevent duplication
The badge was rendered outside the stockMap conditional, causing it to
appear independently of the Amazon stock badge. Now it's grouped inside
the block, always appearing immediately next to VendorStockBadge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 10:23:28 +01:00
Christian Vidal WolfandQwen-Coder 826688a3f6 fix: prevent BuyBox badge visual duplication
- Wrap component with memo() to prevent unnecessary re-renders
- Restructure DOM hierarchy to avoid nested inline-flex containers
- Center hover popup with left-1/2 -translate-x-1/2
- Add pointer-events-none to popup to prevent hover flickering
- Improve popup spacing and sizing

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-09 10:10:32 +01:00
Christian Vidal WolfandQwen-Coder c58b246c41 fix: remove duplicate buybox lost badge from SKU column in GRID
The BuyBoxWarningBadge was appearing twice - once next to the SKU and once next to Amazon stock. Now it only appears next to Amazon stock as requested.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-09 09:52:33 +01:00
Christian Vidal Wolf 1c23053e57 feat: replace old detail view entirely with premium dashboard and add safe metric fallbacks 2026-03-04 10:05:39 +01:00
Christian Vidal Wolf be49b0a7af fix: show dashboard when didResults exist even if verdict is missing 2026-03-04 09:57:55 +01:00
Christian Vidal Wolf 7748e869b7 feat: redesign experiment results dashboard to match premium dark theme 2026-03-04 09:53:57 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 07461031b8 fix(VendorDataView): assign distinct color per market in all three charts
Each market line (DE/ES/FR/IT/UK) now renders with its own color across
Top Level BSR, Detail Level BSR, and Average Rating charts, along with
per-market legend entries. Removes hardcoded single-color approach.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 09:06:05 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 1d0ea2f485 fix(vendor): abbreviate large BSR numbers on Y-axis (500000 → 500K, 1.2M)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 08:57:49 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 c49b331e82 fix(vendor): remove duplicate 'Altro' key in category translation map
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 08:52:00 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 110ec13ac4 feat(vendor): translate BSR category names to English
Add translateCategory() with a full DE/FR/IT/ES → EN map covering
all top-level and detail categories found in the BSR data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 08:50:15 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 9af2296a9b fix(vendor): remove gradient fill from BSR and rating charts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 08:42:20 +01:00
Christian Vidal Wolf 8d849dfb63 feat: show category names next to BSR chart headers when single ASIN selected 2026-03-04 08:40:46 +01:00
Christian Vidal Wolf 5eb42f5e33 feat: show X and Y axis values on Vendor charts 2026-03-04 08:35:00 +01:00
Christian Vidal Wolf bdd65d16d1 fix: perfectly match Vendor tab UI to reference screenshot 2026-03-04 08:29:20 +01:00
Christian Vidal Wolf 8ad1f908b1 feat: redesign Vendor tab with premium AreaCharts and updated UI 2026-03-03 17:15:02 +01:00
Christian Vidal WolfandQwen-Coder 0a2b15615d feat(vendor): update to modern bar charts
- Use BarChart with rounded corners for modern look
- Remove vertical grid lines for cleaner appearance
- Add hover cursor effect on tooltip
- Y-axis reversed for BSR charts (lower = better)
- Normal Y-axis for Rating chart (higher = better)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-03 16:21:08 +01:00
Christian Vidal WolfandQwen-Coder 4fa8b0f45e feat(vendor): use modern area charts with gradient fills
Replace bar charts with area charts featuring:
- Gradient fill effects for modern look
- Smooth monotone curves
- Proper Y-axis orientation (reversed for BSR where lower is better)
- Color-coded by market with transparency

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-03 16:16:52 +01:00
Christian Vidal WolfandQwen-Coder 4025cb69a3 feat(vendor): change charts from lines to bars for weekly data
Convert Top Level BSR, Detail Level BSR, and Average Rating charts
from LineChart to BarChart for better week-over-week comparison.
Each market now displays as colored bars per week instead of lines.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-03 16:12:56 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 1fb9956a15 fix(buybox): hardcode reason column for FR/UK/DE, remove STATUS keyword
FR/UK/DE sheets have a 'Status' column that appears before 'Reason',
causing the dynamic detector to pick the wrong column.
Use confirmed indices: FR=col S(18), UK=col J(9), DE=col N(13).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 15:47:56 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 916c349126 fix(buybox): restrict sheet detection to BB_* sheets only
Inventory sheets like 'INV ITALY' were being incorrectly matched as
buybox sheets, adding all their ASINs as false BB lost entries.
Now only sheets starting with 'BB' are processed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 15:38:39 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 d1510bb76a fix(buybox): update Dropbox URL (previous token expired)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 15:21:19 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 249fba5390 fix(buybox): rewrite processBuyBoxExcel with ASIN regex detection
Replace fragile header/column-index approach with pattern-based ASIN detection:
- Scan all cells for Amazon ASIN pattern (B[0-9A-Z]{9}) to auto-detect the ASIN column regardless of headers or position
- Detect country from sheet name with flexible matching (no hardcoded sheet name list)
- Detect reason column from header keywords, no hardcoded column indices
- Remove all hardcoded fallback indices (col 13, 18, 9, etc.) that caused empty results

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 15:08:24 +01:00
Christian Vidal Wolf 036e7b9a0a fix: prioritize ASIN column detection over SKU in processBuyBoxExcel 2026-03-03 14:23:08 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 93c2a699ea fix(buybox): show BB Lost badge for ES ASINs with missing or empty reason
- Force reasonIdx to column N (13) for BB_ES sheet, same as DE/FR/UK, so dynamic header detection can't override to a wrong column
- Fall back to 'BB Lost' when reason cell is empty instead of skipping the ASIN entirely
- Add B095K8948Z to debug logging alongside B0D3874WSD

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 13:39:04 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 4afae59de9 fix(DataGrid): show BuyBoxWarningBadge in title dimension
The badge was only rendered for dim==='asin'|'sku'. When pivoting by
title (the default view) the BuyBox warning was silently absent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 13:29:41 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 37f9ffac2f fix(dataProcessor): parse DD/M/YY correctly when day <= 12
The previous fix only handled the unambiguous case (day > 12). Dates like
"5/1/26" or "12/1/26" (Jan 5 / Jan 12, 2026) were falling through to
JS's new Date() which parsed them as US format MM/DD/YY, assigning them
to May and December instead of January.

Now any 3-part slash date with a 2-digit year in position 3 and a valid
month in position 2 is treated as DD/M/YY (Spanish/EU convention),
fixing weeks 2-3 of January (days 5-18) showing zero sell-out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 13:14:30 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 2eed94b94b fix(dataProcessor): parse DD/M/YY dates from column C in sell-out CSV
Add support for European day-first date format (e.g. "23/2/26" = 23 Feb 2026)
in the sell-out CSV pipeline so months and years are correctly extracted from
column C of Amazon Sell Out 2023-2025.csv.

- normalizeMonth: detect DD/MM/YY when first part > 12, return "Mon-YY"
- mapRowToRecord: add 'C', 'Date', 'Fecha', 'DATA' to month column aliases
- validateSellOutHeaders: accept date columns as substitute for YEAR + MONTH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 13:07:59 +01:00
Christian Vidal Wolf ad1695d360 fix(ui): make Sync button smaller and more subtle in header 2026-03-03 11:50:07 +01:00
Christian Vidal Wolf 56d07ca459 fix: remove Upload button from header and clean unused imports
All data sources are linked via Dropbox, manual upload not needed.
2026-03-03 11:33:27 +01:00
Christian Vidal WolfandQwen-Coder 2814d68716 feat: mostrar detalles del producto en Vendor tab cuando hay un solo ASIN
- Agregar tarjeta con SKU, ASIN y título al inicio de los gráficos
- Incluir Buy Box Warning Badge si el producto tiene issues
- Solo se muestra cuando hay un único ASIN seleccionado

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-03 11:21:14 +01:00
Christian Vidal WolfandClaude Sonnet 4.6 32a7de8aea feat: remove vendor CSV upload button from data modal
All vendor files are linked via Dropbox, making manual upload unnecessary.
Removes the Upload Vendor CSV button, handleVendorUpload handler, and processVendorCSV import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:19:05 +01:00
Christian Vidal Wolf 98ba0d1708 feat: sync vendor tab filters with global header filters 2026-03-03 10:52:35 +01:00
christian.vidalandClaude Sonnet 4.6 a6b7503c82 fix(vendor): replace ASIN text input with MultiSelectDropdown for proper filtering
The free-text ASIN search was unclear and not working as expected.
Replace it with a proper MultiSelectDropdown (same as Market/Category
filters) — selecting an ASIN now strictly filters chart data to that
ASIN only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 20:16:27 +01:00
christian.vidalandClaude Sonnet 4.6 7f5aa1b812 feat(vendor): switch BSR charts to daily resolution for smoother trend lines
- Add date? field to BSRRecord (ISO string YYYY-MM-DD)
- processBSRExcel now extracts and stores the Date column as an ISO date
  (handles both Excel serial numbers and string dates)
- VendorDataView groups chart data by date (daily) when dates are available,
  falling back to weekly buckets — eliminates straight-line charts caused
  by only 2 weekly data points

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 18:53:45 +01:00
christian.vidalandClaude Sonnet 4.6 702bb021f8 fix(bsr): fix regex bug and expand column aliases in processBSRExcel
- Fix critical regex bug: /\\d+/ was matching literal '\d' instead of
  digits, causing all rows to be rejected (week always = 0)
- Add VendorCSV format support: 'Top Level Category (Rank)', 'Date', etc.
- Derive ISO week number from Date column when no Week column exists
- Process all sheets (not just first) to handle multi-tab workbooks
- Log column names on load to aid future debugging

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 18:44:12 +01:00
christian.vidalandClaude Sonnet 4.6 17a3df9fb3 feat(bsr): fetch BSR.xlsx from Dropbox instead of local file
- Rewrite api/fetch-bsr.ts to proxy BSR.xlsx from the Dropbox URL,
  matching the same pattern as fetch-buybox.ts and other data sources
- Add /api/fetch-bsr proxy in vite.config.ts for local dev

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 18:37:39 +01:00
christian.vidalandClaude Sonnet 4.6 ce13d17eda fix(vendor): pass bsrData prop to VendorDataView - resolves black screen
VendorDataView was refactored to receive BSR data as a prop but App.tsx
was not updated to pass it, causing the component to crash on undefined
and show a blank screen. Also fixes supabase.ts type errors and removes
dead code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 18:32:38 +01:00
Christian Vidal Wolf 243c44c7f7 feat: replace Vendor tab with BSR tracker 2026-03-02 15:22:12 +01:00
Christian Vidal WolfandQwen-Coder 918da227ee fix(experimentAnalysis): use ISO week start (Monday) consistently in aggregateWeeklyMetrics
- Change getWeekStartSunday to getISOWeekMonday for timestamp calculation
- Ensures week alignment between data aggregation and ISO week range calculation
- Fixes incorrect treatment_after average calculation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-26 15:21:21 +01:00
Christian Vidal WolfandQwen-Coder d5936f1301 fix(experimentAnalysis): use ISO calendar weeks for treatment/baseline periods
- Add ISO week calculation functions (getISOWeek, getISOWeekMonday, calculateISOWeekRange)
- Expand experiment dates to full ISO weeks (Monday-Sunday) instead of exact date ranges
- Use actual data.length for averaging metrics instead of theoretical durationWeeks
- Baseline now takes same number of complete weeks immediately before experiment

Fixes incorrect units sold average calculation (was 6.5, now correctly shows 4.33 for 13 units over 3 weeks)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-26 15:00:24 +01:00
Christian Vidal Wolf b840050686 fix(fetch-ads): update Dropbox URL for Ads-Weekly.xlsx with complete INKEE DE data 2026-02-26 11:26:18 +01:00
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 Wolf bd85229def feat(ui): remove experimental Gap Report tab and component from navigation 2026-02-26 08:15:12 +01:00
Christian Vidal Wolf cbb6477200 chore: force trigger vercel deploy for previously patched experiment analysis 2026-02-26 08:10:12 +01:00
christian.vidal 583bc07dba feat: add Market Gap Report - top 5 DE products not sold in ES 2026-02-25 19:17:07 +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 1edfd97ed1 feat(ui): exclude #N/D and Unassigned from product line filter options 2026-02-25 12:47:07 +01:00
Christian Vidal Wolf dc4db269ee feat(ui): exclude N/D from product line filter options 2026-02-25 12:44:51 +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 27d4268aff feat(experiments): add edit experiment functionality 2026-02-25 09:26:58 +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 WolfandClaude Opus 4.6 eba6628325 fix: apply dark theme to all form inputs in Experiments create view
Replace undefined input-field CSS class with explicit Tailwind dark theme
classes (bg-slate-800, border-slate-700, text-slate-200) to prevent white
background on form fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 08:25:46 +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