Spaces:
Runtime error
Runtime error
Commit History
-
feat: upgrade Meta API to ad-level (η΄ ζηΊ§ε«) data pullβ
wen Qiu- Change level from "campaign" to "ad" to get per-creative metrics - Add ad_name, ad_id, adset_name, adset_id fields - Update dedup key to include ad_name - Support --level flag for flexible granularity Made-with: Cursor381a123
-
refactor: simplify data pipeline to single source (Sheets platform tabs only)β
wen Qiu- Remove Export sheet and local CSV as data sources, only read Meta/Google/Criteo/Bing platform tabs from Google Sheets - Remove _merge_api_data and _platforms_loaded_from_sheets - Write raw numbers to Sheets instead of formatted strings ($, %) to eliminate precision loss in round-trip - Add country to write dedup key (country, date, campaign_name) - Fix _quick_sync_stale_platforms to write back to Sheets instead of only saving local CSV - Only apply ffill when data source is Excel (not API Sheets) - Add daily throttle to quick sync to avoid redundant API calls Made-with: Cursora2b76e3 -
fix: apply ffill before filtering Export rows by platformβ
wen QiuRoot cause: Export sheet uses hierarchical layout where platform name only appears on the first row of each group, with subsequent rows left blank. When checking which rows to exclude (because API platform sheets exist), blank platform cells were not matched against platform names like "Meta"/"Google", so those rows survived the filter. After later ffill in load_daily_data, they became duplicates of the API data. Fix: Apply ffill to the platform column *before* the exclusion check, so all rows belonging to a platform are correctly identified and removed when that platform has its own API sheet. Made-with: Cursorf194379 -
fix: prevent duplicate data when Export table and platform sheets overlapβ
wen QiuRoot cause: _load_from_google_sheets was reading both the Export sheet (which contains all platforms) AND individual platform sheets (Meta, Google, Criteo, Bing written by API sync), then concatenating them. This caused campaigns present in both sources to be double-counted, inflating Cost/Revenue figures (e.g. US Conversion showing $407K instead of the correct $307K). Fix: When a platform has its own API-synced sheet, exclude that platform's rows from the Export sheet before merging. The API sheet data takes priority as it's more current and accurately formatted. Made-with: Cursor48fbfa9 -
fix: remove scopes from OAuth credentials to avoid invalid_scope errorβ
wen QiuMade-with: Cursor1c3f337 -
feat: add GitHub Actions workflow for Meta data syncβ
wen QiuHF Spaces blocks graph.facebook.com, so Meta data is synced via GitHub Actions instead. Runs daily at 09:00 Beijing time. Also refactored Google auth in loader.py to support OAuth refresh token (via GOOGLE_OAUTH_* env vars) in addition to service account, enabling GitHub Actions to write to Sheets without a service account key file. Made-with: Cursor164fe15 -
feat: add P3 ζζΎεζεΌζ (campaign analysis engine)β
wen Qiu- Campaign Name 12-field parser with audience classification - Dynamic config loader from Google Sheets (budgets, KPI, benchmarks) - Per-objective metrics engine (Purchase/Lead/ATC/Linkclick/Pageview/PE) - L1-L4 hierarchical aggregation (market β funnel β platform β campaign) - Benchmark annotation (red/yellow/green) driven entirely by Sheets data - Diagnostic rules engine with actionable recommendations - Markdown weekly report formatter - API routes: GET /api/p3/analysis, GET /api/p3/config, POST /api/p3/push - 16 unit tests for campaign name parser - Fix Python 3.9 compatibility (from __future__ import annotations) - Fix percentage parsing bug (0.14% was incorrectly kept as 0.14) Made-with: Cursorebb46dc
-
refactor: consolidate repo structure, remove upload_to_github duplicationβ
unknownMade-with: Cursor3291500