[FEATURE] Add a public members_of(standard_concept) to list the XBRL tags in a standardization family
Feature Category
- [x] New API functionality
- [ ] Performance improvement
- [x] Developer experience improvement
- [ ] Documentation enhancement
- [ ] Tool/utility addition
Problem Statement
Is your feature request related to a problem? Please describe.
The standardization layer answers "which standard concept is this tag?" (ReverseIndex.lookup, get_standard_concept, get_display_name, and the standard_concept column in Statement.to_dataframe()), but there is no public call for the reverse question: "which XBRL tags belong to this standard concept?". A caller who wants every tag in the Revenue family, for example to find the revenue row or revenue facts regardless of which tag a filer used, has to read private attributes of ReverseIndex.
The only public-looking method, MappingStore.get_company_concepts(standard_concept), does not return the shipped mapping data. It reads the legacy MappingStore.mappings dictionary, so on 5.60.0 it returns 4 us-gaap_-prefixed tags for Revenue, while the reverse index maps 130 tags to Revenue. It returns nothing for the concept names the reverse index uses (Revenues, NetIncomeLoss), and the legacy dictionary has a _comment_revenue_hierarchy pseudo-key. A caller cannot tell from the method name or docstring that the answer is a small, differently-keyed subset.
Who would benefit from this feature?
- [ ] Beginner Python users working with SEC filings
- [x] Financial analysts and researchers
- [x] Advanced developers building financial applications
- [x] Data scientists working with financial datasets
Proposed Solution
Describe the solution you'd like
A documented, public ReverseIndex.members_of(standard_concept) (with a module-level members_of() convenience next to lookup() and get_standard_concept()), returning the XBRL tags the shipped mapping assigns to that standard concept. Suggested details:
- Accept the same standard concept name that
lookup()returns instandard_concepts("Revenue","TradeReceivables", and so on). - Return tags without a taxonomy prefix, in the same form
lookup()accepts. - For tags that are ambiguous (
is_ambiguous), either include them with their candidate list or return a small result object per tag (tag,section,is_total,confidence,ambiguous). The index already holds these fields, andMappingResultdoes not currently exposeconfidence,sectionoris_totalpublicly. - Make
MappingStore.get_company_concepts()either delegate to the same data or state in its docstring that it covers only the legacy store.
Describe alternatives you've considered
Iterate ReverseIndex._index and filter on the private standard_tags key, shown below. It works on 5.60.0 but depends on an underscore attribute and an undocumented dict layout, and there is no guarantee either survives a release. Reading gaap_mappings.json directly has the same problem and bypasses the industry overrides and ambiguity handling the index applies.
Use Case Example
How would you use this feature?
Runnable against 5.60.0 with public calls plus the private workaround. Nothing here touches the network.
import platform
import edgar
from edgar.xbrl.standardization import get_default_store
from edgar.xbrl.standardization.reverse_index import get_reverse_index
print("edgartools", edgar.__version__, "| Python", platform.python_version(), "|", platform.platform())
ri = get_reverse_index()
# Forward direction works: tag -> standard concept
for tag in ("Revenues", "RevenueFromContractWithCustomerExcludingAssessedTax", "SalesRevenueNet"):
r = ri.lookup(tag)
print(f"lookup({tag!r}) ->", (r.standard_concepts, r.display_names) if r else None)
# Reverse direction has no public method
public = [n for n in dir(ri) if not n.startswith("_")]
print("public ReverseIndex members:", public)
print("has members_of / get_members / tags_for:", [n for n in public if "member" in n or n.startswith("tags")])
# MappingStore.get_company_concepts is the closest public method
store = get_default_store()
for std in ("Revenue", "Revenues", "Net Income", "NetIncomeLoss"):
print(f"MappingStore.get_company_concepts({std!r}) -> {len(store.get_company_concepts(std))} concepts")
# Workaround today: private attributes
members = sorted(t for t, e in ri._index.items() if "Revenue" in e.get("standard_tags", []))
print("tags whose private index standard_tags contain 'Revenue':", len(members), members[:5])
legacy = store.get_company_concepts("Revenue")
print("MappingStore.get_company_concepts('Revenue'):", sorted(legacy))
print("legacy answer vs index, tags missing from legacy:", len(set(members) - {t.split("_", 1)[-1] for t in legacy}))
Desired usage:
from edgar.xbrl.standardization.reverse_index import members_of
revenue_tags = members_of("Revenue") # e.g. {"Revenues", "SalesRevenueNet", ...}
# then filter facts or statement rows to any tag in the family
Implementation Considerations
Complexity Level:
- [x] Simple (minor API addition)
- [ ] Moderate (new functionality with existing patterns)
- [ ] Complex (significant architectural changes)
The data is already loaded in ReverseIndex._index; this is an inversion of it, which can be built lazily once and cached.
Backwards Compatibility:
- [x] This feature maintains backwards compatibility
- [ ] This feature might break existing code (please explain below)
- [ ] Unsure about compatibility impact
Additional Context
Environment: edgartools 5.60.0 (main), Python 3.14.4, Windows 11 (10.0.26200).
Output of the script above on 5.60.0 (long lines trimmed):
edgartools 5.60.0 | Python 3.14.4 | Windows-11-10.0.26200-SP0
lookup('Revenues') -> (['Revenue'], ['Revenue'])
lookup('RevenueFromContractWithCustomerExcludingAssessedTax') -> (['Revenue'], ['Revenue'])
lookup('SalesRevenueNet') -> (['Revenue'], ['Revenue'])
public ReverseIndex members: ['concept_to_display_name', 'get_ambiguous_candidates', 'get_display_name', 'get_standard_concept', 'is_ambiguous', 'is_excluded', 'lookup', 'metadata', 'stats']
has members_of / get_members / tags_for: []
MappingStore.get_company_concepts('Revenue') -> 4 concepts
MappingStore.get_company_concepts('Revenues') -> 0 concepts
MappingStore.get_company_concepts('Net Income') -> 2 concepts
MappingStore.get_company_concepts('NetIncomeLoss') -> 0 concepts
tags whose private index standard_tags contain 'Revenue': 130 ['AdmissionsRevenue', 'BinderSalesRevenue', 'BrokeredNaturalGasMarginRevenue', 'CapitalLeasesIncomeStatementDirectFinancingLeaseRevenue', 'CargoAndFreightRevenue']
MappingStore.get_company_concepts('Revenue'): ['us-gaap_OperatingRevenue', 'us-gaap_Revenue', 'us-gaap_Revenues', 'us-gaap_SalesRevenueNet']
legacy answer vs index, tags missing from legacy: 127
Impact on 10-K/10-Q extraction: pipelines that pull one line (revenue, cost of revenue, net income, capex) across many filers need the set of tags a standard concept covers, to find the right fact or row when a filer uses an industry or older tag. Today that set is only reachable through private attributes. The groups are valuation-oriented buckets rather than exact synonyms (the Revenue family mixes component and total tags), which is another reason callers need to see the members and their is_total and section fields instead of guessing.
Related Issues/Features:
Searched open and closed issues for members_of, reverse index, standardization mapping, get_company_concepts, gaap_mappings and ReverseIndex; none requests this. Loosely related: #914 (line-item tags mapped to total concepts) and #494 (docs on customizing standardization).
Note from the reporter: this issue was submitted with Claude, through the GitHub CLI, so the issue template's labels were not applied automatically. It is a Feature Request and should be labeled enhancement. Sorry for the extra triage step, and thank you!
@dgunning, here is our current thinking on the root cause, proposed behavior, and coordination with other issues.
Root Cause:
There is no public API for discovering a standardization family's effective members, and simply inverting the raw mapping data would include candidates rejected by forward lookup.
Proposed Behavior:
Add members_of() using the same exclusions, industry overrides and total guards as lookup(). Return structured records with every surviving candidate and its metadata, retaining qualified identities and explicitly marking bare legacy keys as unqualified. Family membership and candidate order do not establish financial equivalence or permit selection or aggregation without the source context.
Coordination:
Keep #1423 separate, preferably after #1422 so it reuses the metadata contract. Coordinate identity and legacy-store migration with #1446, and leave financial selection to #1452. Preserve #1444's guards landed in #1808.
Below, please find the full design document. Please let me know your thoughts.
Brian
Attachment: design-public.md, Proposal for #1423: list effective mapping candidates without implying equivalence.
AI assistance: Codex; GPT-6.1 Sol (High) for current-source scouting, an offline membership probe, and final writing; GPT-6 Astra (Max) for architecture and design drafting, with a separate agent providing independent financial statement review of candidate membership, source identity, and selection limits.
Hi Dwight, I would love to help out with this!