market-assistant/backend/pipeline/brief_concentration.py
hub-gif 3d6193af06 feat(brief): plain-language concentration keys and copy
- Add first_share/top_three_combined_share plus cr1/cr3 readers
- Brief/schema/footnotes and LLM prompts avoid dev jargon where possible
- Frontend JD analysis/dataset hints in business-friendly wording

Made-with: Cursor
2026-04-14 17:28:52 +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")