DEV Community

Eqvero
Eqvero

Posted on Edited on

Why SEC companyfacts Drops Off-Balance-Sheet Data Center Leases: Parsing Dimensional XBRL in Python

Query SEC EDGAR's /api/xbrl/companyfacts/ JSON endpoint for Microsoft (CIK 0000789019) or Oracle (CIK 0001341439) after their late-2026 quarterly filings and inspect the uncommenced lease commitments. For Microsoft, the query returns zero. For Oracle, us-gaap:UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount returns $34.15 billion, which covers power and supplier contracts while omitting $288.00 billion in uncommenced data center lease commitments. Across five hyperscalers (Microsoft, Oracle, Meta, Alphabet, and Amazon), third-quarter 2026 filings disclose $1.30 trillion in signed leases that have not yet commenced under ASC 842. Only one of the five appears accurately and up to date in companyfacts.

In this fourth installment of the SEC Filing Data Engineering series, we trace why the companyfacts endpoint drops off-balance-sheet lease commitments and split liabilities, and build a Python parser that extracts them directly from SEC EDGAR's filing-level _htm.xml XBRL instances.

Why companyfacts drops off-balance-sheet leases

Under ASC 842, a lessee records a right-of-use asset and lease liability on the balance sheet only on the commencement date, when the lessor makes the underlying asset available. For a data center under construction, a signed 15-year lease remains an executory contract until handover. Companies disclose those future payments in the lease footnote, yet three structural XBRL behaviors cause companyfacts pipelines to miss or corrupt them.

First, companyfacts omits every fact tagged with an XBRL <xbrli:segment> dimension. In its Q1 FY2027 Form 10-Q (period ended September 30, 2026, filed October 28, 2026), Microsoft tags $364.60 billion of uncommenced leases using the standard us-gaap:UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount element, but qualifies it with us-gaap:LeaseContractualTermAxis (msft:OperatingLeaseMember and a nested msft:FinanceLeaseMember). Alphabet (2026-09-30 Form 10-Q) and Amazon (2026-09-30 Form 10-Q) do the same using UnrecordedUnconditionalPurchaseObligationByCategoryOfItemPurchasedAxis. Alphabet actually reported $75.60 billion unsegmented in Q1 2026 before adding the dimensional member in Q2, leaving companyfacts frozen on a stale March figure while real commitments grew to $130.50 billion.

Second, companyfacts strips company-specific extension namespaces. Oracle tags its $288.00 billion of uncommenced data center commitments in its August 31, 2026 Form 10-Q using orcl:LesseeOperatingLeaseLeaseNotYetCommencedLeaseCommitments. Because companyfacts only indexes standard taxonomies (us-gaap, dei, srt, ecd, ffd), Oracle's custom lease tag never enters the JSON payload. At the same time, Oracle assigns $34.15 billion of unconditional power and supplier obligations to us-gaap:UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount. Any cross-company screen pulling that single us-gaap tag compares Meta's uncommenced leases ($355.73 billion) against Oracle's power contracts ($34.15 billion).

Third, recognized balance sheet lease tags fragment across filings. In its Q3 2026 Form 10-Q, Meta omits both us-gaap:OperatingLeaseLiability (requiring you to sum Current and Noncurrent) and us-gaap:FinanceLeaseLiability. Microsoft keeps OperatingLeaseLiability and FinanceLeaseLiability in its Q1 FY2027 10-Q, but assigns the same element name to the current row ($5.76 billion), the noncurrent row ($21.72 billion), and the combined total ($27.48 billion) inside the same unsegmented context. Taking the first XML match in document order returns the current portion instead of the total.

Verified hyperscaler baseline from SEC EDGAR instances

Parsing each filer's latest SEC-extracted _htm.xml instance directly produces the complete Q3 2026 / Q1 FY2027 lease footprint below:

Ticker Filing & Period End Recognized Operating Recognized Finance Uncommenced Leases Primary XBRL Tagging Pattern
MSFT 10-Q (2026-09-30) $27.48B $70.97B $364.60B us-gaap tag + nested LeaseContractualTermAxis
META 10-Q (2026-09-30) $31.17B N/A $355.73B Unsegmented us-gaap; omits FinanceLeaseLiability in 10-Q
ORCL 10-Q (2026-08-31) $34.62B $9.19B $288.00B Custom orcl: extension tag; us-gaap holds $34.15B power contracts
AMZN 10-Q (2026-09-30) $100.29B $14.49B $164.92B us-gaap tag + OperatingAndFinanceLeasesLeaseNotYetCommencedMember
GOOGL 10-Q (2026-09-30) $20.51B $3.71B $130.50B us-gaap tag + OperatingLeaseLeaseNotYetCommencedMember

Extracting segmented and custom lease tags in Python

The script below resolves each CIK's latest 10-K or 10-Q via the SEC submissions endpoint, downloads the {primary_stem}_htm.xml extracted instance, maps every contextRef to its period and explicit dimensions, and applies four guards: taking max() over unsegmented totals to bypass duplicate row tagging, summing Current + Noncurrent when totals are absent, inspecting dimensional members for lease-specific qualifiers, and deduplicating identical values produced by nested inline XBRL tags.

import gzip
import json
import urllib.request
import xml.etree.ElementTree as ET
from typing import Any, Dict, List, Optional, Tuple

HEADERS = {
    "User-Agent": "EqveroResearch/1.0 (ops@eqvero.com)",
    "Accept-Encoding": "gzip, deflate",
}


def fetch_bytes(url: str) -> bytes:
    req = urllib.request.Request(url, headers=HEADERS)
    with urllib.request.urlopen(req, timeout=25) as resp:
        raw = resp.read()
        if resp.info().get("Content-Encoding") == "gzip" or raw[:2] == b"\x1f\x8b":
            raw = gzip.decompress(raw)
        return raw


def get_latest_periodic_filing(cik: str) -> Dict[str, str]:
    cik_padded = cik.strip().zfill(10)
    sub = json.loads(fetch_bytes(f"https://data.sec.gov/submissions/CIK{cik_padded}.json"))
    recent = sub["filings"]["recent"]
    for i, form in enumerate(recent["form"]):
        if form in ("10-K", "10-Q"):
            return {
                "form": form,
                "filed": recent["filingDate"][i],
                "report_date": recent["reportDate"][i],
                "accession": recent["accessionNumber"][i],
                "primary_doc": recent["primaryDocument"][i],
            }
    raise RuntimeError(f"No 10-K/10-Q found for CIK {cik_padded}")


def parse_lease_instance(cik: str) -> Dict[str, Any]:
    filing = get_latest_periodic_filing(cik)
    cik_int = str(int(cik))
    accn_clean = filing["accession"].replace("-", "")
    stem = filing["primary_doc"].rsplit(".", 1)[0]
    xml_url = f"https://www.sec.gov/Archives/edgar/data/{cik_int}/{accn_clean}/{stem}_htm.xml"
    root = ET.fromstring(fetch_bytes(xml_url))

    contexts: Dict[str, Dict[str, Any]] = {}
    for elem in root:
        if elem.tag.split("}")[-1] != "context":
            continue
        cid = elem.attrib.get("id", "")
        instant = None
        end_date = None
        dims: List[str] = []
        for node in elem.iter():
            local = node.tag.split("}")[-1]
            if local == "instant" and node.text:
                instant = node.text.strip()
            elif local == "endDate" and node.text:
                end_date = node.text.strip()
            elif local == "explicitMember" and node.text:
                dim = node.attrib.get("dimension", "").split(":")[-1]
                mem = node.text.strip().split(":")[-1]
                dims.append(f"{dim}={mem}")
        contexts[cid] = {"date": instant or end_date or "", "dims": dims}

    target_date = filing["report_date"]
    target_tags = {
        "OperatingLeaseLiability",
        "OperatingLeaseLiabilityCurrent",
        "OperatingLeaseLiabilityNoncurrent",
        "FinanceLeaseLiability",
        "FinanceLeaseLiabilityCurrent",
        "FinanceLeaseLiabilityNoncurrent",
        "UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount",
        "LesseeOperatingLeaseLeaseNotYetCommencedLeaseCommitments",
        "LesseeOperatingLeaseNotYetCommenced",
        "LesseeFinanceLeaseNotYetCommenced",
    }

    facts: Dict[str, List[Tuple[float, List[str]]]] = {}
    for elem in root:
        local = elem.tag.split("}")[-1]
        if local not in target_tags:
            continue
        ctx = contexts.get(elem.attrib.get("contextRef", ""))
        if not ctx or ctx["date"] != target_date:
            continue
        try:
            val = float((elem.text or "").strip())
        except ValueError:
            continue
        facts.setdefault(local, []).append((val, ctx["dims"]))

    def max_unsegmented(tag: str) -> Optional[float]:
        # Filers such as MSFT tag Current, Noncurrent, and Total rows with the same element
        vals = [val for val, dims in facts.get(tag, []) if not dims]
        return max(vals) if vals else None

    op_total = max_unsegmented("OperatingLeaseLiability")
    if op_total is None:
        op_cur = max_unsegmented("OperatingLeaseLiabilityCurrent")
        op_non = max_unsegmented("OperatingLeaseLiabilityNoncurrent")
        if op_cur is not None or op_non is not None:
            op_total = (op_cur or 0.0) + (op_non or 0.0)

    fin_total = max_unsegmented("FinanceLeaseLiability")
    if fin_total is None:
        fin_cur = max_unsegmented("FinanceLeaseLiabilityCurrent")
        fin_non = max_unsegmented("FinanceLeaseLiabilityNoncurrent")
        if fin_cur is not None or fin_non is not None:
            fin_total = (fin_cur or 0.0) + (fin_non or 0.0)

    candidates: List[Tuple[str, float, List[str]]] = []
    for tag in (
        "LesseeOperatingLeaseLeaseNotYetCommencedLeaseCommitments",
        "LesseeOperatingLeaseNotYetCommenced",
        "LesseeFinanceLeaseNotYetCommenced",
    ):
        for val, dims in facts.get(tag, []):
            candidates.append((tag, val, dims))

    for val, dims in facts.get("UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount", []):
        if any("Lease" in d for d in dims):
            candidates.append(("UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount", val, dims))
        elif not dims and not candidates:
            # Captures unsegmented lease commitments (Meta), though non-lease filers need text verification
            candidates.append(("UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount", val, dims))

    # Deduplicate identical dollar values produced by dual Operating/Finance nested iXBRL tags
    seen_vals = set()
    uncommenced = []
    for tag, val, dims in candidates:
        if val not in seen_vals:
            seen_vals.add(val)
            uncommenced.append({"tag": tag, "val": val, "dims": dims})

    return {
        "filing": filing,
        "operating_lease_liability": op_total,
        "finance_lease_liability": fin_total,
        "uncommenced": uncommenced,
    }


if __name__ == "__main__":
    for ticker, cik in [
        ("MSFT", "0000789019"),
        ("META", "0001326801"),
        ("ORCL", "0001341439"),
        ("AMZN", "0001018724"),
        ("GOOGL", "0001652044"),
    ]:
        res = parse_lease_instance(cik)
        f = res["filing"]
        op_s = f"${res['operating_lease_liability']/1e9:.2f}B" if res["operating_lease_liability"] is not None else "N/A"
        fin_s = f"${res['finance_lease_liability']/1e9:.2f}B" if res["finance_lease_liability"] is not None else "N/A"
        unc_s = ", ".join(f"${c['val']/1e9:.2f}B" for c in res["uncommenced"]) or "None"
        print(f"{ticker} ({f['form']} {f['report_date']}): Op={op_s} | Fin={fin_s} | Uncommenced={unc_s}")
Enter fullscreen mode Exit fullscreen mode

Edge cases to verify in production

When extending this parser across broader SEC universes, handle three remaining gaps:

  1. Undiscounted commitments vs. balance sheet present value. Uncommenced lease disclosures report gross undiscounted future cash payments, whereas recognized lease liabilities are discounted present values. Oracle's August 2026 maturity schedule shows $13.43 billion of imputed interest on $48.05 billion of operating lease payments (a 28% discount), so you should discount uncommenced streams before adding them to funded debt.
  2. Mixed non-lease obligations under the same us-gaap tag. Because Oracle tags $34.15 billion of unconditional power contracts under UnrecordedUnconditionalPurchaseObligationBalanceSheetAmount without a lease dimension, any pipeline reading an unsegmented value from that tag should verify that the surrounding footnote text mentions leases rather than supplier take-or-pay agreements.
  3. Subsequent events and narrative-only filers. Some issuers omit numeric XBRL tags on post-period commitments or custom leases altogether. Running a fallback check on the Leases and Subsequent Events TextBlock tags catches obligations signed between quarter-end and the filing date.

Previous installments in the SEC Filing Data Engineering series: Parsing SEC EDGAR Facts: Reconciling Cash Flow with Python, Why Quarter-over-Quarter SEC EDGAR Facts Break: Normalizing Discrete vs YTD Durations in XBRL, and The SEC EDGAR Accession Number Trap: Disentangling Restatements and Comparative Reclassifications in Python.

Top comments (0)