No Semantics to Context References

This email came into the Gepsio inbox recently:

I’ve been playing around with the library. My first exercise for myself is trying to reconstruct the financial statements. I thought I’d group Facts by time periods. The ContextRefNames were not what I expected. There were overlaps in names like FD2015XXX, D2015XXX, I2015XXX. Do you know the difference between the prefixes? I’m using Whole Foods

Is there a particular convention that the contextrefnames follow? I had a look at Walmart and they use a similar, but different convention.

Unfortunately, the answer is “no”.

Context IDs and references have no meaning. They are syntax, not semantics. Context reference names are arbitrary and have meaning only to link items within the individual document instances.

Section 4.7.1 of the XBRL 2.1 specification discusses the “id” attribute of a <context> element:

Every  <context>  element MUST include the  @id attribute. The content of the  @id attribute MUST conform to the [XML] rules for attributes with the ID type ( The  @id attribute identifies the context (see  Section 4.7) so that it may be referenced by item elements.

The specification does not impose any semantics on the contents of the ID attribute.


2 thoughts on “No Semantics to Context References

  1. Hopefully this will help someone. This post was just helpful enough to get me to figure out how to group financials.

    What I did is find the fact with DocumentFiscalPeriodFocus and grab the ContextRef.Id from that fact. That is the id for the most current period of the document. I then loop through all of the facts and pull those with the same ContextRef.Id.

    An alternative if you’re trying to build out the full financials is to find the fact that’s the current period focus and grab the dates from that fact. From there grab all of the other context refs and build out a method that orders the dates, then with that ordering loop through and pull out all of the facts you need.


    • Thank you for the feedback, Nate! Your solution looks like a good one. Perhaps a future version of Gepsio should encapsulate that functionality as a value addition to the API. Thanks for using Gepsio!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s