edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

BDC industry cleanup discards all but the last member of an enumeration set

Open synfonia-llc opened this issue 1 month ago • 1 comments

Issue Type

  • [ ] Data Quality Issue (incorrect financial values, missing data)
  • [x] 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: main@2323d732 (reports 5.62.0); v5.62.0 (commit 5068cc54) gives the same output Python Version: 3.14.4 Operating System: Windows 11

Bug Description

What you expected to happen: Cleaning an industry enumeration-set value retains both Healthcare and Technology rather than silently assigning only the last member. Member labels are resolved where available, and expanded-name URIs are not restricted to the HTTP scheme.

What actually happened: The first synthetic input uses two actual 2025 US-GAAP domain members in lexicographic order. clean_industry_label() returns only the last member's readable name. The other inputs show its fallback behavior for an acronym and a URN. No real portfolio allocation amount is asserted.

Output on main@2323d732 (identical on v5.62.0 at commit 5068cc54):

'http://fasb.org/us-gaap/2025#HealthcareSectorMember http://fasb.org/us-gaap/2025#TechnologySectorMember' -> 'Technology Sector'
'http://www.example.com/20240331#ITServicesMember' -> 'ITServices'
'urn:example:2024#SoftwareSectorMember' -> 'urn:example:2024#SoftwareSector'

Error message (if any): No exception is raised.

Reproduction

Company/Ticker: Not applicable; synthetic inputs isolate the reported behavior. Time Period: Not applicable; the first input uses 2025 US-GAAP member names. Relevant Forms: XBRL-bearing BDC reports (10-K, 10-Q); no filing was downloaded.

No network access is needed for the reproduction.

Minimal code to reproduce:

from edgar import set_identity
set_identity("Your Name [email protected]")
from edgar.bdc.industry import clean_industry_label

for value in (
    "http://fasb.org/us-gaap/2025#HealthcareSectorMember http://fasb.org/us-gaap/2025#TechnologySectorMember",
    "http://www.example.com/20240331#ITServicesMember",
    "urn:example:2024#SoftwareSectorMember",
):
    print(repr(value), "->", repr(clean_industry_label(value)))

Additional Context

clean_industry_label() takes the suffix after the final # (line 51) and handles a URI only when it starts with http. It is used for the industry enumeration in edgar/bdc/investments.py (lines 2933 and 3107) and on the data-set path in edgar/bdc/datasets.py (line 210). The BDC guide says each investment carries the industry as the filer wrote it, and lists enumeration as an industry source. The official 2025 US-GAAP schema declares InvestmentIndustrySectorExtensibleEnumeration as enum2:enumerationSetItemType; HealthcareSectorMember and TechnologySectorMember are declared domain members. Extensible Enumerations 2.0 allows a set of expanded-name URIs. The demonstration is deliberately sorted and uses existing members; it does not depend on a malformed or unknown-member value. Label-linkbase resolution is a broader capability than preserving the two members, and is not claimed to have been exercised by this helper-only example. Whether filers in practice report several sectors in one value was not measured.

Related: #1255 requests additive enumeration metadata and structured values; this report concerns loss inside an existing BDC consumer.


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

synfonia-llc avatar Oct 22 '26 14:10 synfonia-llc

@dgunning, here is our current thinking on the root cause, proposed behavior, and coordination with other issues.

Root Cause:

clean_industry_label() takes the text after the final fragment marker, discarding earlier members of a multi-member industry enumeration. The demonstrated member loss is synthetic; real multi-member portfolio prevalence and monetary errors remain unestablished.

Proposed Behavior:

Preserve every source industry member and its classification state on the original holding or dataset row, with all members visible and no arbitrary scalar sector for multiple members. Filters should return that holding once, and the recommended summary should include its amount once in an explicit Multiple classifications — unallocated group, without inventing an allocation. Prevent a multi-member holding from donating its display, members or sector through either per-filing or DERA peer recovery. Preserve observable nil, empty, absent and unresolved states; complete nil distinction depends on the ordinary-instance repair in #1254.

Coordination:

Keep a separate PR using the shared member contract from #1255 and #1760, with maintainer agreement on the summary policy. Keep #1669 identifier recovery and #1784 reported subtotals separate, and preserve PR #1819 holding-selection controls.

Below, please find the full design document. Please let me know your thoughts.

Brian

Attachment: design-public.md, Preserve every BDC industry enumeration member — #1712.

AI assistance: Codex; GPT-6.1 Sol (High) reproduced the current helper behavior, inspected its consumers and finalized the public wording; GPT-6 Astra (Max) developed the architecture, and a separate GPT-6 Astra (Max) independently reviewed source membership, missingness, amount preservation and aggregation semantics; Claude Opus 5.5 (High) performed adversarial review and independent resolution; GPT-6.1 Sol (High) revised the donor and source-state boundaries in response. A separate GPT-6.1 Sol (High) completed focused financial/source and public-text review of the revised proposal.

synfonia-llc avatar Oct 27 '26 11:10 synfonia-llc