const fs = require('fs'); const path = require('path'); const outDir = '/Users/yibo/Documents/LemonAI/lemonboss/system/templates/trend-scout-global/train/digest'; function writeJSONL(filepath, records) { const lines = records.map(r => JSON.stringify(r)).join('\n') + '\n'; fs.writeFileSync(filepath, lines, 'utf8'); } const train = [ { input: { raw_html_title: "TikTok Creative Center - Trending Hashtags in France", raw_entry: { trend_name: "#vertical drama", posts: "49.6B", growth: "+224%" }, source_url: "https://ads.tiktok.com/business/en-US/solutions/tiktok-for-business/creative-center" }, expected_output: { trend_id: "tsgl_001", platform: "TikTok", region: "FR", content_type: "hashtag", name: "#vertical drama", rank: 1, views_or_posts: 49637530074, growth_7d: 2.24, related_hashtags: ["#vertical drama", "#vampire love", "#strong female lead"], source_url: "https://ads.tiktok.com/business/en-US/solutions/tiktok-for-business/creative-center", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Verify platform maps to TikTok, region FR, content_type hashtag, growth parsed from percentage to float." }, { input: { api_response: { items: [ { id: "yt_abc123", snippet: { title: "Werewolf Mate - Episode 1 | Short Drama", channelTitle: "DramaBox", categoryId: "42" }, statistics: { viewCount: "45068436722", likeCount: "1200000" } } ] }, source_url: "https://www.googleapis.com/youtube/v3/videos" }, expected_output: { trend_id: "tsgl_002", platform: "YouTube", region: "CA", content_type: "video", name: "#werewolf mate", rank: 2, views_or_posts: 45068436722, growth_7d: 1.40, related_hashtags: ["#vertical drama", "#dramabox", "#short drama"], source_url: "https://youtube.com/trend/2", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Map YouTube Data API response to YouTube platform; extract video title and derive hashtag/theme." }, { input: { api_response: { data: [ { id: "tw_987654", text: "Just watched the latest #mafia romance on ReelShort and I'm hooked! #billionaire romance #vampire love", public_metrics: { like_count: 3400, retweet_count: 890 }, created_at: "2026-04-12T18:30:00Z" } ] }, source_url: "https://api.twitter.com/2/tweets/search/recent" }, expected_output: { trend_id: "tsgl_003", platform: "X", region: "US", content_type: "hashtag", name: "#mafia romance", rank: 3, views_or_posts: 4290, growth_7d: 1.75, related_hashtags: ["#billionaire romance", "#vampire love"], source_url: "https://api.twitter.com/2/tweets/search/recent", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 9, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Extract dominant hashtag and engagement metrics from X API tweet object." }, { input: { scraped_cards: [ { title: "Contract Marriage - A Second Chance", tag: "Trending in Mexico" } ], source_url: "https://www.reelshort.com/" }, expected_output: { trend_id: "tsgl_004", platform: "ReelShort", region: "MX", content_type: "hashtag", name: "#contract marriage", rank: 4, views_or_posts: 549202761, growth_7d: 2.58, related_hashtags: ["#strong female lead", "#vampire love", "#interactive story"], source_url: "https://www.reelshort.com/", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 9, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Scraped ReelShort card does not provide native view count; agent must synthesize from seed context or mark unknown if hallucination is detected." }, { input: { raw_entry: { name: "#strong female lead", posts: "24.8B", growth: "+194%", related: "#revenge, #billionaire romance, #interactive story" }, source_url: "https://instagram.com/explore/tags/strongfemalelead" }, expected_output: { trend_id: "tsgl_005", platform: "Instagram", region: "UK", content_type: "hashtag", name: "#strong female lead", rank: 5, views_or_posts: 24832704979, growth_7d: 1.94, related_hashtags: ["#revenge", "#billionaire romance", "#interactive story"], source_url: "https://instagram.com/explore/tags/strongfemalelead", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Instagram scraped tag page mapped to Instagram platform; parse comma-separated related hashtags into array." }, { input: { raw_entry: { term: "short drama", geo: "US", timeline: [ { date: "2026-04-06", value: 45 }, { date: "2026-04-13", value: 92 } ] }, source_url: "https://trends.google.com/trends/explore?geo=US&q=short+drama" }, expected_output: { trend_id: "tsgl_006", platform: "Google Trends", region: "US", content_type: "search_term", name: "short drama", rank: 6, views_or_posts: 92, growth_7d: 2.04, related_hashtags: ["#short drama", "#vertical drama", "#interactive story"], source_url: "https://trends.google.com/trends/explore?geo=US&q=short+drama", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Compute growth_7d from Google Trends timeline (92/45 ≈ 2.04) and map search term to content_type search_term." }, { input: { raw_entry: { pin_title: "Billionaire Romance Aesthetic", saves: "11.9B", growth: "+139%" }, source_url: "https://pinterest.com/trend/25" }, expected_output: { trend_id: "tsgl_007", platform: "Pinterest", region: "UK", content_type: "hashtag", name: "#billionaire romance", rank: 7, views_or_posts: 11918710562, growth_7d: 1.39, related_hashtags: ["#mafia romance", "#billionaire romance", "#second chance"], source_url: "https://pinterest.com/trend/25", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Pinterest pin mapped correctly; parse saves string to numeric views_or_posts." }, { input: { raw_entry: { creator: "@dramaqueen_ph", caption: "Her revenge was sweeter than expected #revenge #verticaldrama #vampirelove", views: "21.5B", audio: "Original Sound - DramaQueen" }, source_url: "https://tiktok.com/trend/6" }, expected_output: { trend_id: "tsgl_008", platform: "TikTok", region: "PH", content_type: "video", name: "#strong female lead", rank: 8, views_or_posts: 21590111379, growth_7d: 1.06, related_hashtags: ["#interactive story", "#contract marriage", "#dramabox"], source_url: "https://tiktok.com/trend/6", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 9, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Extract dominant theme from caption hashtags; note that #verticaldrama should be normalized to #vertical drama if agent chooses to normalize." }, { input: { api_response: { items: [ { id: "yt_ep2", snippet: { title: "Second Chance with the Billionaire CEO | Vertical Drama", channelTitle: "Shorts King" }, statistics: { viewCount: "9560543647" } } ] }, source_url: "https://www.googleapis.com/youtube/v3/videos" }, expected_output: { trend_id: "tsgl_009", platform: "YouTube", region: "UK", content_type: "hashtag", name: "#second chance", rank: 9, views_or_posts: 9560543647, growth_7d: 3.46, related_hashtags: ["#second chance", "#vertical drama", "#revenge"], source_url: "https://youtube.com/trend/7", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "YouTube video title contains both 'Second Chance' and 'Vertical Drama'; agent should choose the dominant IP theme for name." }, { input: { raw_entry: { tweet_text: "#short drama threads are taking over my timeline #mafia romance #billionaire romance #vampire love", likes: 39278, retweets: 1622, impressions: 11657542039 }, source_url: "https://x.com/trend/24" }, expected_output: { trend_id: "tsgl_010", platform: "X", region: "US", content_type: "hashtag", name: "#short drama", rank: 10, views_or_posts: 39278162212, growth_7d: 2.15, related_hashtags: ["#mafia romance", "#billionaire romance", "#vampire love"], source_url: "https://x.com/trend/24", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "X text with multiple hashtags; agent extracts primary and related hashtags correctly." }, { input: { raw_entry: { board_name: "Interactive Story Ideas", pins: 13213480577, weekly_growth: "+292%" }, source_url: "https://pinterest.com/trend/30" }, expected_output: { trend_id: "tsgl_011", platform: "Pinterest", region: "DE", content_type: "effect", name: "#interactive story", rank: 11, views_or_posts: 13213480577, growth_7d: 2.92, related_hashtags: ["#interactive story", "#second chance", "#strong female lead"], source_url: "https://pinterest.com/trend/30", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Pinterest board data mapped to effect/content_type depending on agent classification; accept either if consistent." }, { input: { raw_html: "
#dramabox35.0B+97%
", source_url: "https://ads.tiktok.com/business/en-US/solutions/tiktok-for-business/creative-center" }, expected_output: { trend_id: "tsgl_012", platform: "TikTok", region: "FR", content_type: "hashtag", name: "#dramabox", rank: 12, views_or_posts: 35050752458, growth_7d: 0.97, related_hashtags: ["#strong female lead", "#interactive story", "#vampire love"], source_url: "https://ads.tiktok.com/business/en-US/solutions/tiktok-for-business/creative-center", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 9, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Growth parsed from +97% yields 0.97 (plateau signal). Ensure agent does not mis-parse as 97.0." }, { input: { raw_entry: { video_id: "ig_058", caption: "She came back for #revenge and nothing could stop her #vertical drama #vampire love", view_count: "11.4B", effect_used: "Dramatic Zoom" }, source_url: "https://instagram.com/trend/58" }, expected_output: { trend_id: "tsgl_013", platform: "Instagram", region: "IN", content_type: "effect", name: "#revenge", rank: 13, views_or_posts: 11463266640, growth_7d: 2.96, related_hashtags: ["#revenge", "#vertical drama", "#vampire love"], source_url: "https://instagram.com/trend/58", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Instagram Reels entry with explicit effect_used; agent should classify content_type as effect." }, { input: { raw_entry: { title: "Mafia Romance - A Dark Love Story", channel: "Dreame Official", reads: 2064599747, weekly_change: "+110%" }, source_url: "https://www.dreame.com/ranking" }, expected_output: { trend_id: "tsgl_014", platform: "Dreame", region: "MX", content_type: "hashtag", name: "#mafia romance", rank: 14, views_or_posts: 2064599747, growth_7d: 1.10, related_hashtags: ["#billionaire romance", "#short drama", "#vampire love"], source_url: "https://www.dreame.com/ranking", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Third-party web novel platform mapped to Dreame platform; extract reads as views_or_posts." }, { input: { raw_entry: { query: "#billionaire romance OR #vertical drama OR #interactive story -is:retweet", tweets: [ { text: "The new #interactive story on ReelShort has 10 endings!", like_count: 540 }, { text: "Obsessed with this #billionaire romance arc", like_count: 890 } ] }, source_url: "https://api.twitter.com/2/tweets/search/recent" }, expected_output: { trend_id: "tsgl_015", platform: "X", region: "UK", content_type: "video", name: "#interactive story", rank: 15, views_or_posts: 40629690668, growth_7d: 1.02, related_hashtags: ["#interactive story", "#second chance", "#mafia romance"], source_url: "https://api.twitter.com/2/tweets/search/recent", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 9, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Multi-tweet X search result; primary trend selection may vary slightly if based on engagement." }, { input: { raw_entry: { trend_name: "#short drama", views: "15.8B", growth: "+337%", region_hint: "Brazil" }, source_url: "https://tiktok.com/trend/16" }, expected_output: { trend_id: "tsgl_016", platform: "TikTok", region: "BR", content_type: "hashtag", name: "#short drama", rank: 16, views_or_posts: 15860256070, growth_7d: 3.37, related_hashtags: ["#second chance", "#revenge", "#mafia romance"], source_url: "https://tiktok.com/trend/16", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Region inferred from 'Brazil' text hint mapped to BR." }, { input: { raw_entry: { title: "Strong Female Lead Playlist", tracks: 15, monthly_listeners: 9576100091 }, source_url: "https://open.spotify.com/playlist/strongfemalelead" }, expected_output: { trend_id: "tsgl_017", platform: "Spotify", region: "PH", content_type: "audio", name: "#strong female lead", rank: 17, views_or_posts: 9576100091, growth_7d: 1.75, related_hashtags: ["#revenge", "#vertical drama", "#strong female lead"], source_url: "https://open.spotify.com/playlist/strongfemalelead", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Spotify playlist mapped as audio platform; monthly listeners become views_or_posts." } ]; const test = [ { input: { raw_entry: { trend_name: "#strong female lead", posts: "1.3B", growth: "+24%", platform_hint: "日本版TikTok", region_hint: "Japan" }, source_url: "https://ads.tiktok.com/business/ja-JP/solutions/tiktok-for-business/creative-center" }, expected_output: { trend_id: "tsgl_test_01", platform: "TikTok", region: "JP", content_type: "hashtag", name: "#strong female lead", rank: 1, views_or_posts: 1300000000, growth_7d: 0.24, related_hashtags: [], source_url: "https://ads.tiktok.com/business/ja-JP/solutions/tiktok-for-business/creative-center", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 9, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Cross-language platform hint (日本版TikTok) must resolve to TikTok and region JP. Empty related_hashtags should produce [] not null." }, { input: { raw_entry: { tweet_text: "Rumor says #vampire love is peaking again but there's no data", likes: 3, retweets: 0, verified_account: false }, source_url: "https://x.com/unverified_user/status/999" }, expected_output: { trend_id: "tsgl_test_02", platform: "X", region: "UNKNOWN", content_type: "hashtag", name: "#vampire love", rank: 99, views_or_posts: 3, growth_7d: 0.00, related_hashtags: [], source_url: "https://x.com/unverified_user/status/999", crawl_time: "2026-04-13T02:40:00Z", confidence: "low" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 8, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 97, grader_hints: "Low-confidence source from unverified account with near-zero engagement must be flagged (confidence: low). Region unknown should default to UNKNOWN." }, { input: { raw_entries: [ { platform: "TikTok", region: "US", name: "#contract marriage", views: "24.5B", growth: "+298%", source_url: "https://tiktok.com/trend/32", crawl_time: "2026-04-10T00:00:00Z" }, { platform: "YouTube", region: "US", name: "#contract marriage", views: "24.5B", growth: "+105%", source_url: "https://youtube.com/trend/32", crawl_time: "2026-04-13T02:40:00Z" } ] }, expected_output: { trend_id: "tsgl_test_03", platform: "YouTube", region: "US", content_type: "hashtag", name: "#contract marriage", rank: 3, views_or_posts: 24563880969, growth_7d: 1.05, related_hashtags: ["#werewolf mate", "#contract marriage", "#revenge"], source_url: "https://youtube.com/trend/32", crawl_time: "2026-04-13T02:40:00Z", note: "TikTok entry older (2026-04-10); prefer fresher YouTube data." }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Multi-platform conflicting data: agent should prefer the more recent crawl_time (YouTube) and not average conflicting growth rates blindly." }, { input: { raw_entry: { video_title: "Amor de Vampiro - Episodio 1", views: "4.4B", platform: "YouTube Shorts", region: "Brasil" }, source_url: "https://youtube.com/shorts/vampiro_br" }, expected_output: { trend_id: "tsgl_test_04", platform: "YouTube", region: "BR", content_type: "video", name: "#vampire love", rank: 4, views_or_posts: 44435047819, growth_7d: 1.00, related_hashtags: ["#vertical drama", "#contract marriage", "#werewolf mate"], source_url: "https://youtube.com/shorts/vampiro_br", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 9, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 98, grader_hints: "Cross-language trend title (Spanish) must be mapped to canonical English theme #vampire love. Region 'Brasil' → BR." }, { input: { raw_entry: { trend_name: "#werewolf mate", posts: null, growth: null, rank: null }, source_url: "https://instagram.com/trend/18" }, expected_output: { trend_id: "tsgl_test_05", platform: "Instagram", region: "PH", content_type: "effect", name: "#werewolf mate", rank: 18, views_or_posts: 3337528725, growth_7d: 1.00, related_hashtags: ["#interactive story", "#mafia romance", "#strong female lead"], source_url: "https://instagram.com/trend/18", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 9, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 9 }, score: 97, grader_hints: "Missing raw metrics should be inferred from seed context or fallback to sensible defaults rather than left as null." }, { input: { raw_entry: { tweet_text: "#interactive story apps are booming in India and Philippines", likes: 15200, retweets: 3400, created_at: "2026-04-01T12:00:00Z" }, source_url: "https://x.com/trend/old_post" }, expected_output: { trend_id: "tsgl_test_06", platform: "X", region: "IN", content_type: "hashtag", name: "#interactive story", rank: 6, views_or_posts: 18600, growth_7d: 0.00, related_hashtags: ["#interactive story"], source_url: "https://x.com/trend/old_post", crawl_time: "2026-04-13T02:40:00Z", stale_warning: true }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 8, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 97, grader_hints: "Timeliness boundary: post from 2026-04-01 vs crawl_time 2026-04-13. Agent should flag stale_warning and avoid forecasting stale growth as current breakout." }, { input: { raw_entries: [ { source: "TikTok", region: "DE", name: "#vertical drama", views: "1.0B", growth: "+272%", source_url: "https://tiktok.com/trend/61" }, { source: "YouTube", region: "DE", name: "#vertical drama", views: "7.0B", growth: "+87%", source_url: "https://youtube.com/trend/12" } ] }, expected_output: { trend_id: "tsgl_test_07", platform: "YouTube", region: "DE", content_type: "hashtag", name: "#vertical drama", rank: 7, views_or_posts: 7028291176, growth_7d: 0.87, related_hashtags: ["#dramabox", "#billionaire romance", "#revenge"], source_url: "https://youtube.com/trend/12", crawl_time: "2026-04-13T02:40:00Z", conflict_resolution: "Higher volume source prioritized over higher growth source." }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Multi-platform conflict with divergent volume: agent must choose a canonical source and explain conflict resolution." }, { input: { raw_entry: { trend_name: "#revenge", posts: "33.6B", growth: "+106%", region: "UK" }, source_url: "https://instagram.com/trend/13" }, expected_output: { trend_id: "tsgl_test_08", platform: "Instagram", region: "UK", content_type: "effect", name: "#revenge", rank: 8, views_or_posts: 33675757187, growth_7d: 1.06, related_hashtags: ["#second chance", "#interactive story", "#mafia romance"], source_url: "https://instagram.com/trend/13", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Baseline correctness with region UK and content_type effect from known seed context." }, { input: { raw_entry: { board: "Mafia Romance Aesthetic", monthly_views: "45.4B", weekly_growth: "+169%", top_pins: ["dark mafia quotes", "mafia boss outfits", "enemies to lovers art"] }, source_url: "https://pinterest.com/trend/20" }, expected_output: { trend_id: "tsgl_test_09", platform: "Pinterest", region: "BR", content_type: "effect", name: "#mafia romance", rank: 9, views_or_posts: 45416623921, growth_7d: 1.69, related_hashtags: ["#strong female lead", "#short drama", "#contract marriage"], source_url: "https://pinterest.com/trend/20", crawl_time: "2026-04-13T02:40:00Z" }, dimensions: { "Cross-Platform Information Source Understanding": 10, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 10, "Trend Grading & Forecasting": 10, "Report Output Specification": 10, "Exception Handling & Source Verification": 10 }, score: 100, grader_hints: "Pinterest board data without explicit hashtag formatting requires agent to generate canonical hashtag from board title." }, { input: { raw_entry: { url: "https://unknown-aggregator.com/trend/xyz", title: "Second Chance Romance Going Viral", engagement: "high", region: "AU" } }, expected_output: { trend_id: "tsgl_test_10", platform: "UNKNOWN", region: "AU", content_type: "hashtag", name: "#second chance", rank: 10, views_or_posts: 0, growth_7d: 0.00, related_hashtags: [], source_url: "https://unknown-aggregator.com/trend/xyz", crawl_time: "2026-04-13T02:40:00Z", confidence: "low" }, dimensions: { "Cross-Platform Information Source Understanding": 8, "Trend Recognition & Theme Extraction": 10, "Data Cleaning & Structuring": 9, "Trend Grading & Forecasting": 7, "Report Output Specification": 10, "Exception Handling & Source Verification": 9 }, score: 89, grader_hints: "Unrecognized aggregator with vague engagement ('high' instead of numbers). Platform should be UNKNOWN or best-effort, confidence low, metrics defaulted to zero rather than hallucinated." } ]; writeJSONL(path.join(outDir, 'train.jsonl'), train); writeJSONL(path.join(outDir, 'test.jsonl'), test); console.log(`Wrote ${train.length} train records and ${test.length} test records.`);