1.9.0
βοΈ Patch 1.9.0 β Analysis page update¶
π Summary¶
- Analysis (
/analysis) is the dedicated article analytics surface: Metabase Guest dashboard embed plus a KPI table aligned with Multi Repricer filtering. - Article KPIs support preset periods (7 / 14 / 30 / 90 days) and a custom From/To date window (max 365 days).
- Advanced filters cover buy price, stock, period profit, sales/returns qty, return rate (%), gross revenue, ad costs, and ad cost / sale.
- UI wording uses Return (not Retour); table column Ad cost applied is replaced by Ad cost / sale for the selected period.
- Results are cached in localStorage (10 minutes) with an explicit Refresh button.
- Metabase uses Modular Guest embedding (
embed.js+<metabase-dashboard>,isGuest: true) β not the paid React SDK. Site URL must be HTTPS.
β¨ Details¶
Article analytics table¶
| Area | Behavior |
|---|---|
| Search / filters | SKU, name, Has Details (Shopify / Kaufland / Otto / FBM / FBA), Article Type, advanced rules |
| Period | Last 7 / 14 / 30 / 90 days, or Custom⦠with From / To |
| KPI filters | Applied after sales-stats merge for the selected window; return rate expects percent (e.g. 15 = 15%) |
| Columns | Stock, sales qty, return qty/rate, period profit, gross revenue, Otto ad costs, ad cost / sale |
| Cache | localStorage key per filter/period/page; Refresh forces reload |
Sales stats API¶
GET /articles/stats/salesandGET /articles/{sku}/stats/salesaccept optionalfrom_date+to_date(YYYY-MM-DD, inclusive) instead ofdays.- Batch + dialog clients pass the Analysis window through to these endpoints.
Metabase Guest embed¶
- Backend
GET /api/v1/multi/metabase/embed-tokensigns a Guest JWT (resource.dashboard,params,exp,_embedding_params). - Embed JWT lifetime follows
ACCESS_TOKEN_EXPIRE_MINUTES. - Frontend loads
https://β¦/app/embed.js, setsmetabaseConfigwithisGuest: true, mounts<metabase-dashboard token="β¦">without inline styles. - Compose sets Metabase
MB_SITE_URL(HTTPS) andMB_ENABLE_EMBEDDING_SIMPLE=true.
Related ops (same release window)¶
- Shopify
shopify_deferred_export_retrycron: every hour (was every 3 minutes); startup upserts the schedule if still*/3. - Otto SPA daily ads: richer logging; DB upsert after each report batch; Sync Ads date-range backfill unchanged from 1.8.x.
π§ Deploy¶
- Ensure Postgres update from 1.8.x is applied if not already:
-- docker/postgres/updates/otto_ad_daily.sql
- Set env for service-multi-repricer:
| Variable | Example |
|---|---|
METABASE_SITE_URL |
https://metabase.lage-beauty.de |
METABASE_SECRET_KEY |
Embedding secret from Metabase Admin β Embedding |
METABASE_DASHBOARD_ID |
3 (must match the published Guest dashboard) |
ACCESS_TOKEN_EXPIRE_MINUTES |
Controls embed JWT exp |
- Redeploy Metabase with:
MB_SITE_URL=https://metabase.lage-beauty.de
MB_ENABLE_EMBEDDING_SIMPLE=true
- In Metabase Admin:
- Site URL =
https://metabase.lage-beauty.de(nothttp://) - Embedding β enable Guest embeds
-
Publish the target dashboard for Guest embedding
-
Redeploy service-multi-repricer + frontend.
π Docs / code¶
- Frontend:
frontend/src/pages/Analysis/ - Embed API:
backend/service_multi-repricer/app/api/v1/endpoints/metabase.py - Sales stats:
backend/service_multi-repricer/app/api/v1/endpoints/article_stats.py - Compose:
MB_SITE_URL/MB_ENABLE_EMBEDDING_SIMPLEon themetabaseservice