manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
100 stars 37 forks source link

Support nested Facts #59

Closed mrx23dot closed 2 years ago

mrx23dot commented 2 years ago

In https://www.sec.gov/ix?doc=/Archives/edgar/data/0001439725/000156459020056735/bdsx-10q_20200930.htm

for DocumentPeriodEndDate

returns 'September 30,'

ctx ctx

but web view shows: September 30, 2020

Works on others.

(not critical, only using it for sanity checking)

mrx23dot commented 2 years ago

some others: https://www.sec.gov/ix?doc=/Archives/edgar/data/0001122904/000156459020035177/ntgr-10q_20200628.htm https://www.sec.gov/ix?doc=/Archives/edgar/data/0001439725/000156459020056735/bdsx-10q_20200930.htm https://www.sec.gov/ix?doc=/Archives/edgar/data/0001720592/000156459020024317/rpay-10q_20200331.htm

Weirdly it doesn't even find DocumentPeriodEndDate in: (web view shows it) https://www.sec.gov/Archives/edgar/data/0001583107/000155837020010023/tbph-20200630x10q.htm

Also doesn't find StockholdersEquity in (it's highlighted in web view): https://www.sec.gov/ix?doc=/Archives/edgar/data/0001390777/000139077721000037/bk-20201231.htm

manusimidt commented 2 years ago

I understand why this can be confusing, but in the example you provided, the concept dei:DocumentPeriodEndDate really only holds the value September 30.

Nested facts are currently not supported by the libary, but this is one of the features I really want to implement in the near future.

<ix:nonNumeric 
    id="F_000003" 
    name="dei:DocumentPeriodEndDate" 
    contextRef="C_0001439725_20200101_20200930" 
    format="ixt:datemonthdayyearen">September 30, 
        <ix:nonNumeric 
            id="F_000004" 
            name="dei:DocumentFiscalYearFocus" 
            contextRef="C_0001439725_20200101_20200930">2020
        </ix:nonNumeric>
</ix:nonNumeric>

See line 4192 in www.sec.gov/Archives/edgar/data/0001439725/000156459020056735/bdsx-10q_20200930.htm

For now I suggest to use the context of the fact tagged with the concept dei:DocumentPeriodEndDate to get the period date of the document.

mrx23dot commented 2 years ago

Fact end date should also work then. Is there a way to tell if a fact is incomplete (nested)?