Use Chinese short names in IPO reports
Request: Prefer stock-app-style Chinese display names in IPO report tables, for example 圣邦股份 instead of the full legal issuer name. Changes: - Update the hk-ipo-analyst report naming rule to prefer sourced stock short names in 中文名 columns. - Export stock_short_name into the analysis model dataset. - Make generated single-ticker reports use the short Chinese name as the title/display label while retaining legal names for disambiguation. - Refresh the latest dated report and reports README to use Chinese short names consistently. Verification: - git diff --check - .venv/bin/python -m py_compile scripts/build_analysis_dataset.py scripts/generate_ipo_report.py - CSV validation for stock_short_name on 03661, 01688, and 01191 - Confirmed latest report and README contain no matched full legal issuer names for the refreshed shortlist
This commit is contained in:
@@ -378,6 +378,7 @@ def fetch_rows(conn: sqlite3.Connection) -> list[sqlite3.Row]:
|
||||
m.ticker,
|
||||
m.company_name_en,
|
||||
m.company_name_zh,
|
||||
m.stock_short_name,
|
||||
m.board,
|
||||
m.status,
|
||||
m.listing_date,
|
||||
@@ -466,6 +467,7 @@ def build_records(rows: list[sqlite3.Row], as_of: str) -> list[dict[str, Any]]:
|
||||
"ticker": row["ticker"],
|
||||
"company_name_en": row["company_name_en"],
|
||||
"company_name_zh": row["company_name_zh"],
|
||||
"stock_short_name": row["stock_short_name"],
|
||||
"board": row["board"],
|
||||
"status": row["status"],
|
||||
"listing_date": row["listing_date"],
|
||||
@@ -590,6 +592,7 @@ def write_dataset(records: list[dict[str, Any]], output_path: Path) -> None:
|
||||
"ticker",
|
||||
"company_name_en",
|
||||
"company_name_zh",
|
||||
"stock_short_name",
|
||||
"board",
|
||||
"status",
|
||||
"listing_date",
|
||||
|
||||
@@ -150,9 +150,18 @@ def fmt_int(value: int | None) -> str:
|
||||
return f"{value:,}"
|
||||
|
||||
|
||||
def chinese_display_name(record: dict[str, str]) -> str:
|
||||
return record.get("stock_short_name") or record.get("company_name_zh") or ""
|
||||
|
||||
|
||||
def company_display_name(record: dict[str, str]) -> str:
|
||||
short_name = record.get("stock_short_name") or ""
|
||||
chinese_name = record.get("company_name_zh") or ""
|
||||
english_name = record.get("company_name_en") or ""
|
||||
if short_name and chinese_name and short_name != chinese_name:
|
||||
return f"{short_name}(法定中文名:{chinese_name})"
|
||||
if short_name:
|
||||
return short_name
|
||||
if chinese_name and english_name:
|
||||
return f"{chinese_name}({english_name})"
|
||||
return chinese_name or english_name or "未记录"
|
||||
@@ -416,7 +425,7 @@ def build_report(record: dict[str, str], rows: list[dict[str, str]], stage: str,
|
||||
paths = source_paths(record, stage)
|
||||
source_lines = [f"- `{path}`" for path in paths] or ["- 本阶段没有记录来源路径。"]
|
||||
company_name = company_display_name(record)
|
||||
title_name = record.get("company_name_zh") or record.get("company_name_en") or ""
|
||||
title_name = chinese_display_name(record) or record.get("company_name_en") or ""
|
||||
title_prefix = f"{ticker} {title_name}" if title_name else ticker
|
||||
|
||||
lines = [
|
||||
|
||||
Reference in New Issue
Block a user