Thursday, December 30, 2010

Jan 2011 CTP Released

I have just released a new build out to the Gepsio Codeplex site. This release, the January 2011 Community Technology Preview, is available to download from the site. This release adds formal support for calculation lniks, arcs and validation.

As always, your feedback and bug reports are welcome. You can send feedback here, and you can file a bug report here. I see that some reports have already been filed. This means that I have some work to do, but it also means that a few people are using Gepsio and working with it. Thank you to these early adopters!

My plan for the next release (which will hopefully be the Feb 2011 CTP) is to get the precision inference tests available in the XBRL-CONF-CR3-2007-03-05 test suite to pass. Since much of the precision inference work was implemented for this Jan 2011 CTP release, I am hoping for smooth sailing with regards to the precision inference tests. Time permitting, I can work on some of the already-filed issues and some code commenting.

Enjoy the Jan 2011 CTP!

Wednesday, December 29, 2010

Calculation Binding Tests Pass

I have just checked in changeset 54311 to the Gepsio codebase. This check completes support for the calculation binding and validation rules given in the XBRL specification. Gepsio will now throw an exception if calculation links are found with incorrect values. The decimals and precision attributes are honored on numeric facts, and precision is inferred where necessary. The weight attribute found on calculation arcs are also honored.

I will be using this changeset to make the next official CTP release. Once I update some documentation, I will be releasing a new binaries for those wishing to grab the .NET assembly without having to build the source. Look for the Jan 2011 CTP soon!

Monday, December 27, 2010

Precision Inference Code Checked In

I have just checked in code that implements section 4.6.6 (“Inferring Precision”) of the XBRL specification. I used the technique that I mentioned in my last post to unit test the code, and all seven examples given in section 4.6.6 have been implemented as unit tests and all examples pass.

This work adds the following properties to the Fact class:

  • bool DecimalsSpecified: This property evaluates to true if the fact was specified in the XBRL fragment with a decimals attribute value and false otherwise.
  • bool PrecisionSpecified: This property evaluates to true if the fact was specified in the XBRL fragment with a precision attribute value and false otherwise.
  • int Precision: This property specifies the number of significant figures to be assumed to be correct in calculations involving the fact’s values.
  • bool PrecisionInferred: This property evaluates to true if the precision of the fact was calculated using the rules in section 4.6.6 of the XBRL specification and false otherwise.

If the value of the PrecisionInferred property is true, then the value of PrecisionSpecified will be false, and the value of the Precision property can assumed to be calculated in accordance with the rules in section 4.6.6 of the XBRL spec. If the value of the PrecisionInferred property is false, then the value of PrecisionSpecified will be true, and the value of the Precision property can assumed to be specified in the XBRL fragment through the precision attribute on the fact’s element.

Monday, December 20, 2010

Unit Testing Precision Inferrence

I am currently implementing section 4.6.6 of the XBRL spec ("Inferring Precision") as a part of my overall effort to add support for an XBRL item's precision and decimals attributes to Gepsio. This section of the spec contains a very nice table in Example 13 that provides examples of sample fact values, decimals attribute values, and the calculated value of the inferred precision for the fact. Since the XBRL-CONF-CR3-2007-03-05 conformance suite doesn't provide test coverage specifically for the values in this table, I have implemented specific unit tests for Gepsio to cover each row in the Example 13 table.

I have created a sample XBRL document for each row of the table, and each row has a corresponding unit test. For example, the first row of the Example 13 table states that a fact value of 123 and a decimals attribute of 2 should carry and implied precision of 5. To test this, I created an XBRL document containing this value as a fact:

<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="
http://www.xbrl.org/2003/instance"
  xmlns:link="
http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="
http://www.w3.org/1999/xlink"
  xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
  xmlns:iso4217="
http://www.xbrl.org/2003/iso4217"
  xmlns:inferprecisiontestcase="
http://gepsio.codeplex.com/InferPrecisionTest">
  <link:schemaRef xlink:href="Example13.xsd" xlink:type="simple" />
  <context id="context">
    <entity>
      <identifier scheme="
http://gepsio.codeplex.com">entity</identifier>
    </entity>
    <period>
      <instant>2006-07-28</instant>
    </period>
  </context>
  <unit id="unit">
    <measure>iso4217:EUR</measure>
  </unit>
  <inferprecisiontestcase:A contextRef="context" unitRef="unit" decimals="2">123</inferprecisiontestcase:A>
</xbrl>


This sample document is associated with an appropriate schema:

<?xml version="1.0" encoding="utf-8"?>
<schema
  xmlns="
http://www.w3.org/2001/XMLSchema"
  xmlns:xbrli="
http://www.xbrl.org/2003/instance"
  xmlns:link="
http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="
http://www.w3.org/1999/xlink"
  xmlns:inferprecisiontestcase="
http://gepsio.codeplex.com/InferPrecisionTest"
  targetNamespace="
http://gepsio.codeplex.com/InferPrecisionTest"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified">
  <import namespace="
http://www.xbrl.org/2003/instance" schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd" />
  <element id="calcinferprecisiontestcase_A" name="A" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant" nillable="true" />
</schema>


The unit test simply loads this XBRL document, looks for the document's fact, and checks the fact's properties to ensure that the correct values are available:

        [TestMethod]
        public void Example13Row1()
        {
            XbrlDocument NewXbrlDocument = new XbrlDocument();
            NewXbrlDocument.Load(@"..\..\..\JeffFerguson.Test.Gepsio\InferPrecisionTestDocuments\Example13Row1.xbrl");
            Assert.AreEqual<int>(1, NewXbrlDocument.XbrlFragments.Count, "No XBRL fragments found.");
            XbrlFragment FirstFragment = NewXbrlDocument.XbrlFragments[0];
            Assert.AreEqual<int>(1, FirstFragment.Facts.Count, "No facts found in fragment.");
            Fact FirstFact = FirstFragment.Facts[0];
            Assert.IsTrue(FirstFact.DecimalsSpecified);
            Assert.IsFalse(FirstFact.PrecisionSpecified);
            Assert.IsTrue(FirstFact.PrecisionInferred);
            Assert.AreEqual<int>(5, FirstFact.Precision);
        }


I will follow this pattern for every row in the Example table to ensure that there is adequate test coverage for Gepsio's calculation of inferred precision values for a fact.

These tests leverage a new Fact property called PrecisionInferred, which will be available in the next build.

Friday, December 17, 2010

Renewed Focus on Gepsio Development

I released a CTP of the Gepsio code base in the early months of 2009, not quite knowing what to expect. I have, since that time, been humbled to find that it has received 10,354 page views, 2,779 visits and 1,598 downloads. I realize that that's a far cry from a large scale effort, but it does show that there are people curious about how XBRL might be used in a .NET context.

It is that curiosity that has led me back to continue develop on Gepsio, and this blog is one part of that renewed development focus. My goal with Gepsio is to provide parsing, validation and object model exposure for XBRL documents for .NET developers.

My unit testing methodology for Gepsio is to get Gepsio to a state in which it can be used to successfully validate all of the tests in the XBRL-CONF-CR3-2007-03-05 conformance suite published by the XBRL folks in 2007 (I know that newer conformance suites exist, and I will get to those at some point in the future). Once I find a test that doesn't pass with a Gepsio build, I investigate the issue, put the necessary upgrades into Gepsio and rerun the conformance suite until the previously failing test passes. In this way, I can be confident that I am adding only what is necessary to Gepsio while still ensuring that the final builds pass a subsection of tests. As of the latest Gepsio build, the following XBRL-CONF-CR3-2007-03-05 conformance suite test groups are correctly implemented in Gepsio:
  • ID Scope Tests
  • Context Tests
  • Period Type Tests
  • Unit of Measure Tests
  • Decimal and Precision Mutual Exclusion and prohibition on nil items
  • Required Arc in Definition Linkbase
  • Schema References
The next area of focus for Gepsio is to implement the calculation binding code, which will implement support for the precision and decimals attributes on an XBRL item.

Thank you for your interest in Gepsio. If you have any questions or comments, please feel free to let me know.