greedo / python-xbrl

xbrl parser written in Python :bulb:

Home Page:https://pypi.python.org/pypi/python-xbrl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

context_ids

artemk93 opened this issue · comments

I have slightly changed xbrl.py to search for tags/values I am interested in. I am using aapl-20150627.xml, link
I was getting zeros for some tags even though they exist in the xbrl file. So I decided to print out context_ids and got

['eol_PE2035----1510-Q0008_STD_91_20150627_0', 'eol_PE2035----1510-Q0008_STD_0_20150627_0']

I then manually checked context id in the xbrl file for the values that I am getting zero and figured out that I need one more context id eol_PE2035----1510-Q0008_STD_273_20150627_0.
If I hard code it like

context_ids = ['eol_PE2035----1510-Q0008_STD_273_20150627_0',
                       'eol_PE2035----1510-Q0008_STD_91_20150627_0',
                       'eol_PE2035----1510-Q0008_STD_0_20150627_0']

It solves the issue with missing values, but it obviously only works for aapl-20150627.xml.
So the issue is that the code doesn't see all the context id.
I have manually checked xbrl file, and here is xbrl format for 2 out of 3 context id's

#THE CODE SEES THIS ONE
<context id="eol_PE2035----1510-Q0008_STD_91_20150627_0_1116875x1116381">
<entity>
<identifier scheme="http://www.sec.gov/CIK">0000320193&gt;&gt;</identifier>
<segment>&gt;&gt;<xbrldi:explicitmember dimension="us-gaap:ConsolidationItemsAxis">us-gaap:MaterialReconcilingItemsMember</xbrldi:explicitmember>&gt;&gt;</segment>
</entity>
<period>
      &gt;&gt;<startdate>2015-03-29&gt;&gt;</startdate>
<enddate>2015-06-27&gt;&gt;</enddate>
</period>

#DOESN'T SEE THIS ONE
<context id="eol_PE2035----1510-Q0008_STD_273_20150627_0_1116875x1116381">
<entity>
<identifier scheme="http://www.sec.gov/CIK">0000320193&gt;&gt;</identifier>
<segment>&gt;&gt;<xbrldi:explicitmember dimension="us-gaap:ConsolidationItemsAxis">us-gaap:MaterialReconcilingItemsMember</xbrldi:explicitmember>&gt;&gt;</segment>
</entity>
<period>
      &gt;&gt;<startdate>2014-09-28&gt;&gt;</startdate>
<enddate>2015-06-27&gt;&gt;</enddate>
</period>