market-assistant/backend/pipeline/reporting/brief_concentration.py
hub-gif 6280e436d8 feat(pipeline): JD 流水线 CSV 纯中文表头与模块目录重构
- 统一 csv_schema 与搜索/合并/评价/商详导出为纯中文列名,入库与视图按中文表头解析

- 竞品分析报告兼容新旧表头;新增 csv_header_rewrite 与 rewrite_pipeline_csv_headers 管理命令

- 调整 pipeline 至 jd、llm、reporting、demos 子包并更新任务与测试引用

- 新增购买者优惠摘要抽取、合并表 regen/ingest 命令、0016 迁移及相关测试

Made-with: Cursor
2026-04-15 16:02:29 +08:00

25 lines
820 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""竞品简报「集中度」块:对外字段名面向非技术用户,并兼容旧键名。"""
from __future__ import annotations
from typing import Any
def concentration_first_share(block: dict[str, Any] | None) -> Any:
"""最大一家占全部相关行的比例01。新键 ``first_share``,旧键 ``cr1``。"""
if not block:
return None
v = block.get("first_share")
if v is not None:
return v
return block.get("cr1")
def concentration_top_three_share(block: dict[str, Any] | None) -> Any:
"""前三名合计占全部相关行的比例01。新键 ``top_three_combined_share``,旧键 ``cr3``。"""
if not block:
return None
v = block.get("top_three_combined_share")
if v is not None:
return v
return block.get("cr3")