Skip to content

[Hotfix] - Fix SEC statement normalization - #7637

Closed
russlan23 wants to merge 1 commit into
openbq-org:feature/v5-secfrom
russlan23:hotfix/sec-standardized-statements
Closed

russlan23 wants to merge 1 commit into
openbq-org:feature/v5-secfrom
russlan23:hotfix/sec-standardized-statements

Conversation

@russlan23

Copy link
Copy Markdown

Why?

Fixes #7634. SEC standardized statements were missing several current-debt XBRL spellings, and the hierarchical rollup could infer operating income from revenue alone, producing a misleading 100% operating margin.

What?

  • Maps NotesAndLoansPayable and OtherShortTermBorrowings to short-term debt across all statement profiles.
  • Maps three current-maturity debt tags to current portion of long-term debt across all profiles.
  • Removes the duplicate generic-payables mapping for OtherShortTermBorrowings where present.
  • Prevents operating income rollup unless at least two contributing children are available.
  • Adds focused schema and imputation regression tests.

Impact

Current debt is classified consistently across industrial, financial, diversified, and insurance statements. Missing operating expenses no longer cause revenue to be presented as operating income.

Testing Done

  • pytest -q openbb_platform/providers/sec/tests/test_company_facts.py -k 'current_debt_tag_mappings or operating_income_not_rolled_up_from_single_child' --tb=short --disable-warnings (5 passed)
  • pytest -q openbb_platform/providers/sec/tests/test_company_facts.py -k 'TestBLKIncomeStatement' --tb=short --disable-warnings (15 passed)
  • git diff --check
  • JSON syntax validation with jq empty

Reviewer Notes

The operating-income guard is deliberately limited to total_operating_income; other parent rows retain the existing generic rollup behavior.

@CLAassistant

CLAassistant commented Aug 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@russlan23
russlan23 marked this pull request as ready for review August 11, 2026 11:59
@piiq

piiq commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Hi @russlan23

Can you check if the issue persists in the feature/v5-sec branch and if so re-target your PR to stack on top of #7525

There is a v5 release in the works and it would be best if the bugfix is available there.

@russlan23

Copy link
Copy Markdown
Author

Both defects are still present on feature/v5-sec at e19d506. I ran the existing regression assertions in isolation against that commit’s schema JSON, RowResult dataclass, and hierarchical-rollup function: all four current-debt profile cases fail, and a lone revenue row is still rolled up as operating income. The same five cases pass against this PR’s current head, 28a2c9c.

This was a dependency-free check of the affected definitions, not the full v5 provider suite. I have not retargeted the PR yet; the next step is validating the fix with the v5 package and its existing SEC tests before stacking it on #7525.

@russlan23
russlan23 force-pushed the hotfix/sec-standardized-statements branch from 28a2c9c to 345ce0f Compare September 8, 2026 12:22
@russlan23
russlan23 changed the base branch from develop to feature/v5-sec September 8, 2026 12:22
@russlan23

Copy link
Copy Markdown
Author

Rebased onto feature/v5-sec at e19d506fb84f and retargeted this PR to stack on #7525. The diff is still the same three files.

In Docker with Python 3.11 and the SEC provider's frozen uv.lock, all five new regression cases fail against the unmodified v5 implementation and pass with the fix. The complete SEC test run passes: 2,265 tests (pytest tests -m 'not integration' -o addopts='' --tb=short -q). Ruff check, Ruff format check, and git diff --check also pass.

Some tests in that selection fetch public SEC/FASB taxonomy data, so the successful full run used network access. The separate integration/ suite was not run.

@deeleeramone
deeleeramone deleted the branch openbq-org:feature/v5-sec September 24, 2026 15:47
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.

[Bug] SEC standardized statements: missing debt tag mappings, and operating income imputed as revenue

4 participants