Skip to content

[Hotfix] - Fix SEC statement normalization - #7683

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

russlan23 wants to merge 1 commit into
openbq-org:v5from
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.

This supersedes #7637, which GitHub closed automatically when its temporary feature/v5-sec base branch was deleted after #7525 merged. The same focused fix is now rebased onto the current v5 branch.

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 tests/test_company_facts.py -q — 139 passed
  • pytest tests -m 'not integration' -o addopts='' --tb=short -q — 2,265 passed
  • ruff check openbb_sec/utils/statement_schema/_imputation.py tests/test_company_facts.py
  • ruff format --check openbb_sec/utils/statement_schema/_imputation.py tests/test_company_facts.py
  • git diff --check upstream/v5...HEAD

The full SEC test selection used the repository's frozen uv.lock in Docker with Python 3.11. The separate integration/ suite was not run.

Reviewer Notes

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

@deeleeramone

Copy link
Copy Markdown
Collaborator

Hi, thanks for the PR and proposed fix. However, the implementation is flawed by conflating NotesAndLoansPayable with short-term/current liabilities on the balance sheet. The official XBRL definition for this tag is:

Including the current and noncurrent portions, carrying value as of the balance sheet date of all notes and loans payable (with maturities initially due after one year or beyond the operating cycle if longer).

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