Spaces:
Runtime error
Runtime error
Download data/mock/retail_indicators.json from Macbath/indicator-modeling: direct link, hf CLI and curl.
- Browser
- Download file 9.39 kB
-
https://huggingface.co/spaces/Macbath/indicator-modeling/resolve/main/data/mock/retail_indicators.json
- Command line
-
hf download hf://spaces/Macbath/indicator-modeling/data/mock/retail_indicators.json
-
curl -L -o retail_indicators.json https://huggingface.co/spaces/Macbath/indicator-modeling/resolve/main/data/mock/retail_indicators.json
9.39 kB
| [ | |
| { | |
| "id": "retail_001", | |
| "name": "日销售额", | |
| "description": "统计每天的销售总金额,按订单日期聚合", | |
| "category": "销售指标", | |
| "sql_template": "SELECT DATE(order_date) as date, SUM(total_amount) as daily_sales FROM orders WHERE order_date >= '{start_date}' AND order_date <= '{end_date}' GROUP BY DATE(order_date) ORDER BY date", | |
| "dimensions": ["order_date", "store_id"], | |
| "metrics": ["total_amount"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_002", | |
| "name": "客单价", | |
| "description": "平均每个订单的金额,反映客户消费水平", | |
| "category": "销售指标", | |
| "sql_template": "SELECT AVG(order_amount) as avg_order_value FROM orders WHERE order_date >= '{start_date}'", | |
| "dimensions": ["order_date"], | |
| "metrics": ["order_amount"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_003", | |
| "name": "日均订单量", | |
| "description": "统计平均每天的订单数量", | |
| "category": "销售指标", | |
| "sql_template": "SELECT DATE(order_date) as date, COUNT(DISTINCT order_id) as order_count FROM orders GROUP BY DATE(order_date)", | |
| "dimensions": ["order_date"], | |
| "metrics": ["order_id"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_004", | |
| "name": "库存周转率", | |
| "description": "统计商品的库存周转速度,反映库存管理效率", | |
| "category": "库存指标", | |
| "sql_template": "SELECT product_id, SUM(sold_quantity) / AVG(stock_quantity) as turnover_rate FROM inventory JOIN sales ON inventory.product_id = sales.product_id GROUP BY product_id", | |
| "dimensions": ["product_id", "category"], | |
| "metrics": ["sold_quantity", "stock_quantity"], | |
| "update_frequency": "每周" | |
| }, | |
| { | |
| "id": "retail_005", | |
| "name": "门店坪效", | |
| "description": "每平米营业面积的销售额,反映门店运营效率", | |
| "category": "运营指标", | |
| "sql_template": "SELECT store_id, SUM(sales_amount) / AVG(floor_area) as sales_per_sqm FROM stores JOIN sales ON stores.store_id = sales.store_id GROUP BY store_id", | |
| "dimensions": ["store_id"], | |
| "metrics": ["sales_amount", "floor_area"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_006", | |
| "name": "会员复购率", | |
| "description": "统计会员在指定时间段内的复购比例", | |
| "category": "客户指标", | |
| "sql_template": "SELECT COUNT(DISTINCT member_id) as repeat_customers FROM (SELECT member_id, COUNT(DISTINCT order_id) as order_count FROM orders GROUP BY member_id HAVING order_count > 1) t", | |
| "dimensions": ["member_id", "order_date"], | |
| "metrics": ["order_id"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_007", | |
| "name": "商品售罄率", | |
| "description": "统计商品在促销期间的售罄比例", | |
| "category": "库存指标", | |
| "sql_template": "SELECT product_id, SUM(sold_quantity) / SUM(initial_stock) as sellout_rate FROM inventory WHERE promotion_flag = 1 GROUP BY product_id", | |
| "dimensions": ["product_id", "promotion_id"], | |
| "metrics": ["sold_quantity", "initial_stock"], | |
| "update_frequency": "实时" | |
| }, | |
| { | |
| "id": "retail_008", | |
| "name": "促销活动ROI", | |
| "description": "计算促销活动的投资回报率", | |
| "category": "营销指标", | |
| "sql_template": "SELECT promotion_id, (SUM(incremental_sales) - SUM(promotion_cost)) / SUM(promotion_cost) as roi FROM promotions JOIN sales ON promotions.promotion_id = sales.promotion_id GROUP BY promotion_id", | |
| "dimensions": ["promotion_id", "promotion_type"], | |
| "metrics": ["incremental_sales", "promotion_cost"], | |
| "update_frequency": "活动后" | |
| }, | |
| { | |
| "id": "retail_009", | |
| "name": "退货率", | |
| "description": "统计订单中退货订单的占比", | |
| "category": "服务指标", | |
| "sql_template": "SELECT DATE(order_date) as date, COUNT(DISTINCT CASE WHEN return_flag = 1 THEN order_id END) / COUNT(DISTINCT order_id) as return_rate FROM orders GROUP BY DATE(order_date)", | |
| "dimensions": ["order_date", "store_id"], | |
| "metrics": ["return_flag", "order_id"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_010", | |
| "name": "会员活跃度", | |
| "description": "统计近30天有购买行为的会员占比", | |
| "category": "客户指标", | |
| "sql_template": "SELECT COUNT(DISTINCT CASE WHEN DATEDIFF(NOW(), last_purchase_date) <= 30 THEN member_id END) / COUNT(DISTINCT member_id) as active_rate FROM members", | |
| "dimensions": ["member_level"], | |
| "metrics": ["last_purchase_date"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_011", | |
| "name": "连带率", | |
| "description": "平均每个订单包含的商品件数", | |
| "category": "销售指标", | |
| "sql_template": "SELECT AVG(item_count) as avg_items_per_order FROM (SELECT order_id, COUNT(DISTINCT item_id) as item_count FROM order_items GROUP BY order_id) t", | |
| "dimensions": ["order_id"], | |
| "metrics": ["item_id"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_012", | |
| "name": "折扣率", | |
| "description": "统计订单的平均折扣比例", | |
| "category": "销售指标", | |
| "sql_template": "SELECT AVG((original_price - actual_price) / original_price) as discount_rate FROM orders WHERE discount_flag = 1", | |
| "dimensions": ["order_date", "store_id"], | |
| "metrics": ["original_price", "actual_price"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_013", | |
| "name": "新品销售占比", | |
| "description": "统计新品销售额占总销售额的比例", | |
| "category": "产品指标", | |
| "sql_template": "SELECT SUM(CASE WHEN DATEDIFF(NOW(), launch_date) <= 30 THEN sales_amount ELSE 0 END) / SUM(sales_amount) as new_product_ratio FROM products JOIN sales ON products.product_id = sales.product_id", | |
| "dimensions": ["category"], | |
| "metrics": ["sales_amount", "launch_date"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_014", | |
| "name": "会员留存率", | |
| "description": "统计新会员在后续月份的留存比例", | |
| "category": "客户指标", | |
| "sql_template": "SELECT MONTH(registration_date) as cohort_month, COUNT(DISTINCT member_id) as retained_count FROM members WHERE DATEDIFF(last_purchase_date, registration_date) >= 30 GROUP BY MONTH(registration_date)", | |
| "dimensions": ["registration_date", "member_level"], | |
| "metrics": ["last_purchase_date"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_015", | |
| "name": "购物车转化率", | |
| "description": "统计加入购物车的商品最终完成购买的比例", | |
| "category": "转化指标", | |
| "sql_template": "SELECT COUNT(DISTINCT CASE WHEN purchase_flag = 1 THEN cart_id END) / COUNT(DISTINCT cart_id) as cart_conversion_rate FROM shopping_cart", | |
| "dimensions": ["cart_date"], | |
| "metrics": ["purchase_flag"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_016", | |
| "name": "门店客流", | |
| "description": "统计每天进店客流数量", | |
| "category": "运营指标", | |
| "sql_template": "SELECT DATE(visit_date) as date, COUNT(DISTINCT visitor_id) as foot_traffic FROM store_visits GROUP BY DATE(visit_date)", | |
| "dimensions": ["visit_date", "store_id"], | |
| "metrics": ["visitor_id"], | |
| "update_frequency": "每天" | |
| }, | |
| { | |
| "id": "retail_017", | |
| "name": "员工生产率", | |
| "description": "统计每个员工的平均销售额", | |
| "category": "人力资源指标", | |
| "sql_template": "SELECT employee_id, SUM(sales_amount) / COUNT(DISTINCT work_date) as daily_sales_per_emp FROM employees JOIN sales ON employees.employee_id = sales.employee_id GROUP BY employee_id", | |
| "dimensions": ["employee_id", "store_id"], | |
| "metrics": ["sales_amount", "work_date"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_018", | |
| "name": "供应商交货准时率", | |
| "description": "统计供应商按时交货的订单占比", | |
| "category": "供应链指标", | |
| "sql_template": "SELECT supplier_id, COUNT(DISTINCT CASE WHEN DATEDIFF(actual_delivery_date, promised_date) <= 0 THEN po_id END) / COUNT(DISTINCT po_id) as on_time_rate FROM purchase_orders GROUP BY supplier_id", | |
| "dimensions": ["supplier_id"], | |
| "metrics": ["actual_delivery_date", "promised_date"], | |
| "update_frequency": "每月" | |
| }, | |
| { | |
| "id": "retail_019", | |
| "name": "交叉销售率", | |
| "description": "统计购买某商品的客户同时购买其他商品的比例", | |
| "category": "销售指标", | |
| "sql_template": "SELECT p1.product_id as base_product, COUNT(DISTINCT CASE WHEN p2.product_id IS NOT NULL THEN o1.order_id END) / COUNT(DISTINCT o1.order_id) as cross_sell_rate FROM order_items o1 JOIN order_items o2 ON o1.order_id = o2.order_id AND o1.product_id != o2.product_id GROUP BY p1.product_id", | |
| "dimensions": ["base_product_category"], | |
| "metrics": ["product_id"], | |
| "update_frequency": "每周" | |
| }, | |
| { | |
| "id": "retail_020", | |
| "name": "库存龄期分析", | |
| "description": "统计库存中不同龄期商品的占比", | |
| "category": "库存指标", | |
| "sql_template": "SELECT CASE WHEN DATEDIFF(NOW(), stock_date) <= 30 THEN '0-30天' WHEN DATEDIFF(NOW(), stock_date) <= 60 THEN '31-60天' ELSE '60天以上' END as age_group, SUM(stock_quantity) as quantity FROM inventory GROUP BY age_group", | |
| "dimensions": ["product_id", "age_group"], | |
| "metrics": ["stock_quantity", "stock_date"], | |
| "update_frequency": "每周" | |
| } | |
| ] | |