edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

TenK Item 7 overflows to end-of-document when the TOC parse only anchors a subset of items (Coeur Mining 10-K)

Open sf1tzp opened this issue 4 months ago • 0 comments

Issue Type

  • [x] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [ ] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [ ] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: 5.43.0 Python Version: 3.13.2 Operating System: Ubuntu 24.04.4 LTS

Bug Description

What you expected to happen:

part_ii_item_7's end boundary should not default to end-of-document when the TOC parse fails to anchor subsequent items — the body headers for Items 7A/8/9A are present and line-anchored ("Item 7A.\xa0\xa0...Quantitative and Qualitative Disclosures..."), so body-header recovery has clean boundaries to use. Alternatively, when a pattern-detected named section (mda) exists and the TOC-detected equivalent is anomalously larger, the size anomaly should at least surface in Section.warnings.

What actually happened:

For Coeur Mining's FY2025 10-K, TenK['Item 7'] (and the management_discussion property) returns 257,440 chars running from the Item 7 header to the director signatures at the end of the filing, with Items 7A, 8, 9A, 10 and 11 embedded inside. The real MD&A is ~124k chars.

The cause is visible in the section map: the TOC-based detection pass (confidence 0.95) only anchored a subset of items — part_ii_item_7 is the last TOC-detected section, with no entries for 7A/8/9/9A or Parts III/IV — so its end boundary defaults to end-of-document. The same happens to part_i_item_1b (317k chars for what should be a one-line "Unresolved Staff Comments" stub).

Notably, the pattern-based pass got it right: document.sections['mda'] is a correctly bounded 123,925-char section (starts at the MD&A title, contains no later item headers, ends where Item 7A begins). But the item-lookup layer prefers the higher-confidence TOC result, so the good extraction loses the tiebreak. Neither the body-header item recovery nor Section.warnings anomaly flagging fires — warnings is [] on every section despite the 2x/470x size anomalies.

Error message (if any):

None — the over-capture is silent (confidence 0.95, warnings == [] on every section).

Reproduction

Company/Ticker: Coeur Mining, Inc. (CDE), CIK 0000215466 Time Period: FY2025 (period 2025-12-31, filed 2026-02-18) Relevant Forms: 10-K, accession 0000215466-26-000004

Minimal code to reproduce:

import os
os.environ.setdefault("EDGAR_IDENTITY", "you [email protected]")
from edgar import find

f = find("0000215466-26-000004")
tenk = f.obj()
print("full text:", len(f.text()))        # 563,002

# Item lookup returns the overflowed TOC section:
mda = tenk["Item 7"]
print(len(mda))                            # 257,440
print(mda[-200:])                          # ...director signature block (end of 10-K)

# Later item headers are embedded inside "Item 7":
import re
for item in ["Item 7A", "Item 8", "Item 9A"]:
    m = re.search(rf"(?m)^\s*{item}\s*\.", mda)
    print(item, "->", m.start() if m else None)

# The pattern-detected named section is correct:
print(len(dict(tenk.document.sections.items())["mda"].text()))   # 123,925

# Section map shows the incomplete TOC parse:
for name, s in tenk.document.sections.items():
    print(name, len(s.text() or ""), getattr(s, "confidence", None),
          getattr(s, "detection_method", None), getattr(s, "warnings", None))

Observed:

full text: 563002

tenk["Item 7"]: 257440 chars
  embedded headers: Item 7A @ 91688, Item 8 @ 99357, Item 9A @ 232505,
                    Item 10 @ 237351, Item 11 @ 238015
  tail: "...J. Kenneth Thompson  Director  February 18, 2026"   (end of filing)

section map (name: chars, confidence, method):
  part_i_item_1:    25622  0.95 toc
  part_i_item_1a:  100773  0.95 toc
  part_i_item_1b:  317604  0.95 toc      <- overflow (should be a stub)
  part_i_item_1c:    4474  0.95 toc
  part_i_item_2:    53892  0.95 toc
  part_i_item_4:      252  0.95 toc
  part_ii_item_5:    1529  0.95 toc
  part_ii_item_7:  257440  0.95 toc      <- overflow; last TOC anchor, runs to EOF
  business:        126529  0.63 pattern
  risk_factors:    100951  0.63 pattern
  mda:             123925  0.70 pattern   <- correct MD&A
  market_risk:       7650  0.70 pattern
  financial_statements: 202560 0.63 pattern
  controls_procedures:  192365 0.63 pattern
  ...
  (warnings == [] on every section)

Additional Context

Root cause (two gaps that combine)

1. _is_bold_header misses split-span headers — TOCAnalyzer._is_bold_header (edgar/documents/utils/toc_analyzer.py) only checks the element's own inline style (h1–h6 tag, or font-weight:bold|>=600 in el.get('style')). Coeur's body item headers are a <div style="margin-top:14pt"> whose weight lives on child spans — and the spans are split so that only the title span is bold:

<div style="margin-top:14pt">
  <span style="...font-weight:400...">Item 7A.</span>
  <span style="...font-style:italic;font-weight:400...">&#160;&#160;...</span>
  <span style="...font-weight:700...;text-decoration:underline">Quantitative and Qualitative Disclosures About Market Risk</span>
</div>

So the body-header scan matches zero headers on this filing — calling _analyze_body_item_headers directly returns {}. The bold-child recognition added in 5.40.1 for the section-pattern strategies (GH #880) was not applied to this scanner.

2. Body-header recovery is all-or-nothing behind a floor gate — in TOCAnalyzer.analyze_toc_structure:

if self._canonical_item_count(result) < self._expected_item_floor():   # floor = 8 for 10-K
    body = self._analyze_body_item_headers(html_content, tree=tree)
    if self._canonical_item_count(body) > self._canonical_item_count(result):
        return body                                                    # wholesale replace

Coeur's TOC parse anchors exactly 8 canonical items (1, 1A, 1B, 1C, 2, 4, 5, 7) → 8 < 8 is false → recovery never runs even once gap 1 is fixed. And because it replaces rather than merges, a partially-good TOC parse can't be repaired by a partially-good body scan. A union-merge (run the body scan when the map is gappy, fill in only the items the TOC missed, TOC wins conflicts) would fix this class generally: each Coeur body header has an anchor div with an id a few siblings before it (e.g. i96e67f5c3ce24f5882bca23c01e2ca6f_115), so the existing {section_key: anchor_id} contract works once the header matches.

Direct harness showing the gate:

from edgar.documents.utils.toc_analyzer import TOCAnalyzer
a = TOCAnalyzer(form="10-K")
toc = a.analyze_toc_structure(html)                # 8 items, ends at part_ii_item_7
body = a._analyze_body_item_headers(html)          # {} (should find 7A/8/9A/10/11)
print(a._canonical_item_count(toc), a._expected_item_floor())   # 8, 8

Impact

Downstream consumers reading tenk["Item 7"] get 2x the real MD&A plus the entire back half of the 10-K (financial statements, controls, Part III stubs, signatures), which silently duplicates content across sections and inflates token counts for NLP/RAG pipelines. Because the TOC pass reports confidence 0.95 and no warnings, there is no signal to detect the over-capture without scanning for embedded item headers.

Related prior art (all distinct failure modes)

  • #891 (fixed 5.42.0) — split-node Item 7. headers in the pattern/heading strategies; the same split-styling family, but the TOC body scanner still has the single-element assumption.
  • #880 (fixed 5.40.1) — bold-child heading recognition for Part III boundaries ("Strategy 3b"); not applied to _is_bold_header in the TOC analyzer.
  • #873, #836 — other TOC/section boundary repairs; different mechanisms.

Standard filers (e.g. AAPL FY2025 10-K, 0000320193-25-000079) parse correctly on 5.43.0 — all items bounded, including Part III stubs. Happy to provide additional problem filings if useful, and happy to submit a PR for the two-part fix (bold-child recognition in _is_bold_header + union-merge recovery) with regression tests against this filing plus AAPL/Citigroup controls.


This issue will be handled using EdgarTools' systematic issue resolution workflow. A reproduction test will be created to verify the fix.

sf1tzp avatar Jul 24 '26 01:07 sf1tzp