Add A/H share-class mapping workflow

Request:
- Add a repeatable mechanism so HK IPO reports detect issuers that already have Mainland A shares.
- Include a third internet/official-exchange cross-check layer beyond structured history and prospectus scans.

Changes:
- Add listed_share_classes schema support for same-issuer A-share mappings and evidence links.
- Add scripts/archive_a_share_mappings.py to scan prospectus extracted text, reject sponsor/portfolio/cornerstone false positives, archive optional official web evidence and A-share/FX quote evidence, and export snapshots on write.
- Surface a_share_* fields in the analysis dataset and single-ticker report output.
- Update hk-ipo analyst/archivist skill rules and scheduled refresh prompt to require the three-layer A/H mapping check.

Verification:
- python3 -m py_compile scripts/archive_a_share_mappings.py scripts/build_analysis_dataset.py scripts/generate_ipo_report.py
- .venv/bin/python scripts/archive_a_share_mappings.py --as-of 2026-06-24T00:00:00Z --tickers 00668,01688,03661,09630 --dry-run
- .venv/bin/python scripts/build_analysis_dataset.py --db /tmp/hk_ipo_ah_dataset_test.sqlite --dataset /tmp/hk_ipo_ah_dataset_test.csv --report /tmp/hk_ipo_ah_model_test.md --as-of 2026-06-24T00:00:00Z
- .venv/bin/python scripts/generate_ipo_report.py 09630 --dataset /tmp/hk_ipo_ah_dataset_test.csv --stdout --as-of 2026-06-24T00:00:00Z
- git diff --check

Next useful context:
- Dry-run detected 00668->300866.SZ, 01688->002600.SZ, 03661->300661.SZ, and 09630->688630.SH.
- A false positive 01688->300476.SZ from a cornerstone investor parent was rejected by the issuer-context filter.
This commit is contained in:
2026-06-24 07:21:21 +00:00
parent d3b67fa473
commit 7cbdd533b0
7 changed files with 710 additions and 0 deletions
+23
View File
@@ -164,6 +164,29 @@ CREATE TABLE IF NOT EXISTS source_refs (
CHECK (local_path NOT LIKE '%\%')
);
CREATE TABLE IF NOT EXISTS listed_share_classes (
share_class_id TEXT PRIMARY KEY,
ticker TEXT NOT NULL REFERENCES ipo_master(ticker),
share_class_type TEXT NOT NULL,
related_ticker TEXT NOT NULL,
exchange TEXT NOT NULL,
board TEXT,
relationship TEXT NOT NULL,
company_name TEXT,
listed_date TEXT,
detection_method TEXT NOT NULL,
confidence TEXT NOT NULL,
prospectus_source_id TEXT REFERENCES source_refs(source_id),
web_source_id TEXT REFERENCES source_refs(source_id),
evidence_text TEXT,
data_as_of TEXT NOT NULL,
notes TEXT,
UNIQUE (ticker, share_class_type, related_ticker),
CHECK (share_class_type IN ('A_share', 'other_onshore_share')),
CHECK (relationship IN ('same_issuer', 'parent', 'subsidiary', 'affiliate', 'comparable')),
CHECK (confidence IN ('high', 'medium', 'low'))
);
CREATE TABLE IF NOT EXISTS data_gaps (
gap_id TEXT PRIMARY KEY,
ticker TEXT NOT NULL REFERENCES ipo_master(ticker),