Skip to content

Claude/extract special items 016qb pai5y dfh qw h7r uck cc k#47

Open
haowenluo wants to merge 4 commits into
lefterisloukas:mainfrom
haowenluo:claude/extract-special-items-016qbPai5yDFHQwH7rUckCcK
Open

Claude/extract special items 016qb pai5y dfh qw h7r uck cc k#47
haowenluo wants to merge 4 commits into
lefterisloukas:mainfrom
haowenluo:claude/extract-special-items-016qbPai5yDFHQwH7rUckCcK

Conversation

@haowenluo

Copy link
Copy Markdown

No description provided.

claude and others added 4 commits November 20, 2025 15:05
The inventory display was confusing because it showed:
- "Downloaded Filings: 10-K: 5,618" (unique filings from metadata)
- "RAW Filings: 10-K: 85,019 files" (all files on disk)

This caused confusion about why there were ~15 files per filing.

Changes:
- Added _count_unique_filings() method to count unique filings by accession number
- Updated RAW Filings section to show both unique filings and total files
- Added clear labels: "(from metadata)" and "(on disk)"
- Added comparison section showing metadata vs disk discrepancies
- Added explanatory notes about what each metric means
- Shows files-per-filing ratio to make the relationship clear

Now displays:
"10-K: 5,618 unique filings (85,019 total files, ~15.1 files/filing)"

This makes it immediately clear that you have 5,618 unique filings
that are stored as 85,019 total files on disk.
…DnmaNQtFpWqjL8B6Bwq

Fix inventory display to clarify file counts vs unique filings
This commit implements automated extraction of special/nonrecurring items
from financial statements, including restructuring charges, impairments,
litigation settlements, and discontinued operations.

Key changes:
- Added extract_special_items() method with keyword-based pattern matching
- Implemented monetary amount extraction and footnote reference linking
- Added confidence scoring system (0.0-1.0) based on context
- Inserted extraction before table removal to preserve disclosure context
- Added special_items array to JSON output with structured fields
- Added comprehensive configuration in config.json
- Updated README with documentation and usage examples
- Added unit tests for special items extraction

Features:
- Scans Item 8 (Financial Statements) with optional Item 7 (MD&A) scanning
- Extracts amounts in various formats ($X million, $X.X billion, etc.)
- Captures footnote references (Note X, (X), etc.)
- Provides context snippets for each finding
- Includes anchor hash for source traceability
- Supports customizable keywords and confidence thresholds
- Debug logging mode for development and tuning

Implementation follows user-provided design principles:
- Pre-cleaning extraction to preserve table and footnote context
- Lightweight anchor system for post-cleaning source mapping
- Backward compatibility with special_items_enabled flag
- Both raw text and normalized numeric fields for amounts
Enhances special items extraction with two new categories to provide
comprehensive coverage of nonrecurring items commonly found in 10-K
financial statements.

New categories:
- acquisition: Captures M&A-related expenses including transaction costs,
  integration costs, advisory fees, merger expenses, earnout adjustments,
  and purchase price adjustments
- asset_sale: Captures gains/losses from asset sales and divestitures
  including asset disposal, sale of assets, and disposal proceeds

Changes:
- Added 12 M&A-related keywords to "acquisition" category
- Added 8 asset sale keywords to "asset_sale" category
- Reorganized "other" category to focus on remaining items
- Updated confidence scoring: acquisition=0.3 (medium), asset_sale=0.25
- Enhanced README documentation with new category descriptions
- Updated unit tests to validate new categories
- All tests passing successfully

Test results show proper detection:
- Acquisition keywords: transaction costs, advisory fees, integration
- Asset sale keywords: gain on sale, divestiture, asset disposal
- Appropriate confidence scores (0.55-0.80 range)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants