{"slug": "extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs", "title": "Extracting Top-5 Customer and Supplier Tables from 250-Page China A-Share PDFs (Without Burning LLM Tokens)", "summary": "A developer built a lightweight pipeline that extracts Top-5 customer and supplier disclosures from 200-300 page CNINFO annual report PDFs for China A-shares, streaming files in memory with pypdf and scanning for anchor keywords instead of loading full documents into an LLM context. The approach caps each extraction at roughly 3,000-5,000 input tokens by expanding keyword hits by one page, and caches results in SQLite by symbol and fiscal year with exact page numbers. The developer published a public sandbox and a Streamable HTTP MCP server on the official MCP Registry, with sample extractions for Luxshare, CATL and Kweichow Moutai.", "body_md": "I run a small paper-trading setup that tracks China A-shares (Shanghai, Shenzhen, and Beijing exchanges). For event signals and supply-chain risk, official regulatory filings on CNINFO (China's equivalent of SEC EDGAR) are way cleaner than scraped news.\n\nThe catch is that Chinese annual reports are usually 200 to 300 page PDFs. If you dump the whole file into an LLM context window every time you want to check customer concentration, it is slow and expensive.\n\nHere is the lightweight pipeline I ended up building to pull Top-5 customer and supplier disclosures on demand, plus a few real FY2025 extractions that stood out.\n\nCNINFO exposes two public JSON endpoints that work reliably without headless browser scraping:\n\n`POST http://www.cninfo.com.cn/new/information/topSearch/query?keyWord=300750` to resolve the company's `orgId`.` POST http://www.cninfo.com.cn/new/hisAnnouncement/query` with `category=category_ndbg_szsh` and `stock={symbol},{orgId}` to list annual reports.\nOne small gotcha: CNINFO mixes full annual reports, short summaries (`摘要`), English translations, and correction notices in the same category. Filtering out those suffixes and sorting by `(fiscal_year, announcementTime)` reliably picks the latest full Chinese report.\n\nCSRC mandates a standard disclosure section in every A-share annual report covering Top-5 customers and Top-5 suppliers. Instead of saving 20MB PDFs to disk or parsing all 250 pages, I stream the PDF in memory with `pypdf`, skip the first 4 table-of-contents pages, and scan for anchor keywords (`主要销售客户`, `前五名客户`, `主要供应商`, `前五名供应商`) alongside numeric table signals (`%`, `万元`, `销售金额`, `采购金额`).\n\n```\nfor idx in range(total_pages):\n    if total_pages > 20 and idx < 4:\n        continue\n    txt = (reader.pages[idx].extract_text() or \"\").strip()\n    if any(kw in txt for kw in STRONG_KEYWORDS) and any(\n        sig in txt for sig in (\"%\", \"万元\", \"销售金额\", \"采购金额\", \"占比\")\n    ):\n        hit_pages.append(idx + 1)\n```\n\nExpanding each hit by `+1` page catches split tables while capping total context at 6 pages. That brings each extraction down to roughly 3,000 to 5,000 input tokens.\n\nTwo real-world quirks broke my first prototype:\n\n`客户一`) instead of the real company name. The extraction prompt is strict about never guessing: if the PDF gives a real name, translate it to English; if it is anonymized, explicitly return `\"anonymized\": true`.`更正/修订公告`). Keeping both the old and corrected rows poisons downstream signals, so I added `filing_status: \"superseded\"` and `supersedes_id` linking to filter stale rows out by default.\nFinally, each extracted result is cached in SQLite by `(symbol, fiscal_year)` along with the exact PDF page numbers so repeat lookups cost zero tokens.\n\n| Company | Top-5 Customers | Top-5 Suppliers | Exact PDF Pages | Notable Detail | \n|---|---|---|---|---|\n| **Luxshare (`002475`)** | 65.04% (RMB 216.2B) | 52.97% (RMB 132.0B) | pp. 19-20 | Customer #1 alone is 56.68% of total sales (anonymized) | \n| **CATL (`300750`)** | 38.96% (RMB 165.1B) | 10.38% (RMB 59.9B) | pp. 28-29, 209-210 | Largest single customer is 13.73%, 0% related-party | \n| **Kweichow Moutai (`600519`)** | 10.10% (RMB 17.0B) | 38.12% (RMB 3.5B) | pp. 11-13 | 3.77% related-party sales, 15.22% related-party purchases | \n\nI put up a public sandbox (no signup required) at [filings.cnpulse.cn](https://filings.cnpulse.cn) with preset buttons for Luxshare, CATL, and Moutai, or you can test any 6-digit A-share ticker via cURL:\n\n```\ncurl -H \"X-API-Key: cf_demo_public_readonly\" \\\n  \"https://filings.cnpulse.cn/v1/supply-chain/300750\"\n```\n\nIt also runs as a Streamable HTTP MCP server (published on the official MCP Registry as `cn.cnpulse.filings/chinafilings`):\n\n```\n{\n  \"mcpServers\": {\n    \"chinafilings\": {\n      \"url\": \"https://filings.cnpulse.cn/mcp\",\n      \"headers\": {\n        \"X-API-Key\": \"cf_demo_public_readonly\"\n      }\n    }\n  }\n}\n```\n\nIf you work with Asian equity data, what other tables buried inside CNINFO annual reports would be worth extracting next? And if you test a weird A-share ticker whose PDF layout trips up the page matcher, drop the code in the comments.", "url": "https://wpnews.pro/news/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs", "canonical_source": "https://dev.to/bbscs/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs-without-burning-llm-e2n", "published_at": "2026-11-30 17:37:09+00:00", "updated_at": "2026-11-30 17:45:37.987285+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "agent-protocols", "large-language-models"], "entities": ["CNINFO", "Luxshare", "CATL", "Kweichow Moutai", "MCP Registry", "CNPulse"], "also_reported_by": [], "takeaway": "Scanning only keyword-anchored pages plus one adjacent page instead of the full PDF cuts each Top-5 customer/supplier extraction to roughly 3,000-5,000 input tokens.", "recommendation": {"advice": "Skip full-document context: stream the PDF, scan for anchor keywords plus numeric table signals, expand hits by one page, and cache results by symbol and fiscal year to make repeat lookups cost zero tokens.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs", "markdown": "https://wpnews.pro/news/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs.md", "text": "https://wpnews.pro/news/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs.txt", "jsonld": "https://wpnews.pro/news/extracting-top-5-customer-and-supplier-tables-from-250-page-china-a-share-pdfs.jsonld"}}