Compare fresh grocery prices across Hema (盒马), Dingdong Maicai (叮咚买菜), Meituan Maicai (美团买菜), and Pupu Supermarket (朴朴超市). Align different unit standards, find the best total price, and output a ready-to-shop procurement plan.
PathDescriptionscripts/compare.pyMain CLI script — parse list, compare prices, output planschemas/input.schema.jsonJSON Schema for workflow inputschemas/output.schema.jsonJSON Schema for workflow outputreferences/platforms.jsonPlatform reference data (coverage, fees, features)references/categories.jsonProduct category keywords and unit standards
bash
# Compare a shopping list across all 4 platforms
python scripts/compare.py --list "猪肉500g, 西红柿3个, 鸡蛋一盒, 牛奶1L"
# Compare on specific platforms only
python scripts/compare.py --list "牛腩800g, 西兰花2颗, 豆腐1盒" --platforms hema,dingdong
# JSON output for programmatic use
python scripts/compare.py --list "苹果1kg, 大米5kg" --output json
# Validate schemas
python scripts/compare.py --validate-schemas
python scripts/compare.py --list "鸡蛋, 牛奶, 猪肉" --platforms hema,dingdongInput: Free-text shopping list (e.g., "猪肉500g, 西红柿3个, 鸡蛋一盒, 牛奶1L") or uploaded historical order screenshot.
Output: Structured item list: [{name, spec, quantity, category}].
Logic: Use LLM to extract item name, normalize spec (e.g., "两斤" → 1000g), infer quantity. Flag ambiguous items for user confirmation.
Input: Structured item list. Action: Search each item on Hema, Dingdong, Meituan Maicai, Pupu (via web fetch or API). Output: Raw search results per platform per item. Logic: Handle platform-specific search APIs. If direct API unavailable, use web scraping fallback. Cache results for 15 minutes.
Input: Raw search results with varying units (500g, 1份, 1斤, 每袋). Output: All prices normalized to CNY/500g. Logic: 1 斤 = 500g; 1 份 / 1 袋 → estimate from product details, or ask user. Round to 2 decimal places.
Input: Normalized prices per item per platform. Output: Comparison matrix table.
ItemSpecHemaDingdongMeituanPupuBestPork belly500g¥29.9¥27.8¥31.5¥28.0Dingdong
Logic: Highlight the best price per item. Mark N/A when platform doesn't carry the item.
Input: Price matrix + user's quantity per item. Output: Total cost per platform including delivery fees and available coupons. Logic: Base total = sum(unit_price × quantity). Add delivery fee. Subtract available coupons/promotions. Compare single-platform vs split-order scenarios.
Input: Total cost results. Output: Recommendations with trade-off labels. Logic:
Input: User's chosen strategy. Output: Ready-to-shop list organized by platform.
text
=== 盒马 (Hema) ===
- 鸡蛋 30枚装 ×1 ¥19.9
- 牛奶 1L ×2 ¥13.8/ea
Subtotal: ¥33.7
Logic: Group items by platform. Include estimated delivery time window.
Input: Item + target price + platform. Output: Confirmation. Alert fires when condition met. Logic: Store in local state. Poll prices every 4 hours during active hours.
User: "帮我比价:猪肉一斤,鸡蛋一盒,青菜500g,在盒马和叮咚买菜" Expected Output: Comparison matrix for 3 items across 2 platforms, with total cost.
User: "这周买菜清单:牛腩800g、西兰花2颗、豆腐1盒、酸奶6杯、苹果1kg、大米5kg。帮我看看哪个平台最便宜" Expected Output: Full comparison across all 4 platforms, split-order suggestion if applicable.
User: "我想买品质好的海鲜:三文鱼200g和基围虾500g,哪个平台新鲜度口碑好?价差多大?" Expected Output: Quality-first ranking with price comparison for seafood items.
User: "预算100块,要买够3天的菜(2人份):肉、蛋、3种蔬菜、水果。推荐最优组合" Expected Output: Budget-optimized shopping list with per-platform allocation.
User: "帮我盯着盒马的澳洲肥牛卷,降到25块以下通知我" Expected Output: Alert set confirmation. Later: notification when condition triggers.
User: [uploads Dingdong order screenshot] "上次在叮咚买的这些,这次想对比下盒马和朴朴" Expected Output: Parsed list from screenshot, comparison across 3 platforms.
Scenario: Family of 3, weekly grocery shopping, budget-conscious. Input: "本周买菜:五花肉1000g、鸡胸肉500g、西红柿6个、黄瓜3根、白菜1颗、鸡蛋30枚、牛奶2L、苹果1kg、香蕉1把、大米10kg" Steps:
Scenario: Hotpot party for 8 people, bulk purchase. Input: "火锅食材:肥牛2kg、肥羊1.5kg、虾滑500g、丸子1kg、豆腐2盒、蘸料8份、饮料2大瓶" Steps:
Scenario: Just moved, unfamiliar with local platforms. Want to know which platform is most reliable. Input: "我刚搬到深圳,平时买菜哪个平台性价比最高?帮我比价5样日常菜" Steps:
ConditionBehaviorItem not found on any platformReport "未找到", suggest similar itemPlatform API rate-limitedGraceful fallback: estimate from cached data, flag as "estimated"Quantity too small (e.g., 10g)Warn user, suggest minimum purchase unitAmbiguous item name (e.g., "白菜" could be napa or bok choy)Show both options, ask to clarifyPrice mismatch with user screenshotFlag discrepancy, suggest re-checkUser in unsupported cityCheck coverage map; recommend available platformsAll platforms have same priceReport tie, recommend by delivery speedMulti-currency or non-CNY requestOnly support CNY; inform userScreenshot OCR failsAsk user to type items manually
Error CodeScenarioHandlingE-PLATFORM-DOWNPlatform unavailable (maintenance/outage)Skip platform, flag in matrix as "不可用"E-PARSE-FAILShopping list parsing failedShow what was parsed, ask user to correctE-RATE-LIMITToo many queries in short timeWait and retry with exponential backoff (max 3)E-CACHE-STALECached price > 30 min oldShow with "可能已过期" warning, offer refreshE-OCR-FAILScreenshot text extraction failedPrompt user for manual inputE-NO-COVERAGEUser location not served by any platformShow coverage map, suggest alternatives