Is it possible to recreate tables from a 10-Q document using linkbases and facts?

33 Views Asked by At

For reference, I am testing on this Netflix 10-Q.

Using just the presentation linkbase, I am able to reconstruct what the tables should look like. Tabs indicate indents. This is the statement of financial position:

- us-gaap_StatementOfFinancialPositionAbstract
-- us-gaap_AssetsAbstract
--- us-gaap_AssetsCurrentAbstract
---- us-gaap_CashAndCashEquivalentsAtCarryingValue
---- us-gaap_OtherAssetsCurrent
---- us-gaap_AssetsCurrent
--- nflx_ContentAssetsNetNoncurrent
--- us-gaap_PropertyPlantAndEquipmentNet
--- us-gaap_OtherAssetsNoncurrent
--- us-gaap_Assets
-- us-gaap_LiabilitiesAndStockholdersEquityAbstract
--- us-gaap_LiabilitiesCurrentAbstract
---- nflx_ContentLiabilitiesCurrent
---- us-gaap_AccountsPayableCurrent
---- us-gaap_AccruedLiabilitiesCurrent
---- us-gaap_ContractWithCustomerLiabilityCurrent
---- us-gaap_ShortTermBorrowings
---- us-gaap_LiabilitiesCurrent
--- nflx_ContentLiabilitiesNoncurrent
--- us-gaap_LongTermDebtNoncurrent
--- us-gaap_OtherLiabilitiesNoncurrent
--- us-gaap_Liabilities
--- us-gaap_CommitmentsAndContingencies
--- us-gaap_StockholdersEquityAbstract
---- us-gaap_CommonStockValue
---- us-gaap_TreasuryStockCommonValue
---- us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax
---- us-gaap_RetainedEarningsAccumulatedDeficit
---- us-gaap_StockholdersEquity
--- us-gaap_LiabilitiesAndStockholdersEquity

Is it possible to leverage the facts and the definitions / calculation linkbase to work out what value and period these facts refer to for this specific table?

For parsing, I am using py-xbrl.

Here is a code snippet of what I have done so far:

schema_url = "https://www.sec.gov/Archives/edgar/data/1065280/000106528022000368/nflx-20220930.htm"
inst: XbrlInstance = parser.parse_instance(schema_url)
table = inst.taxonomy.pre_linkbases[0].extended_links[4]

simple_table = bs.to_simple_dict()
stack = [(simple_table, 0)]

fact_maps = defaultdict(list)
for f in inst.facts:
    fact_maps[f.concept.xml_id].append(f)
fact_map = {f.concept.xml_id: f for f in inst.facts}

while stack:
    n, indent = stack.pop()
    if n.get("role"):
        print("-" * indent, n["role"])
    concept_id = n.get("concept_id")
    if concept_id:
        print("-" * indent, concept_id)
        # matched_facts = fact_maps.get(concept_id)
        # if matched_facts:
        # for matched_fact in matched_facts:
        # print("-" * indent, matched_fact)
    children = n.get("children", [])
    for c in children[::-1]:
        stack.append((c, indent + 1))
0

There are 0 best solutions below