Converting Hard Coded Fundamental Accounting Concept Rules to Metadata
Thursday, November 12, 2015 at 08:26AM
Charlie in Demonstrations of Using XBRL

Business rules don't belong in code, they should be metadata.  Why do people sometimes put what should be metadata into code?  Well, I did it because I am not that good of a programmer.

But now it is time to separate the code and metadata.

First, let me explain the metadata.  This is a list of what I call "report frame codes".  A report frame is simply a style of reporting.  Here is the list in human readable form. Here is that same list in machine readable form (RSS). And here is another version of the list in machine readable form (RDF).

Those human and machine readable lists point to information about each report frame.  I will use ONE report frame as an example, INTBX-BSU-CF1-ISS-IEMIX-OILN.  For each report frame you get:

So, that is all the metadata.

Now, here is my mistake.  This Excel application does the following:

  1. For a list of economic entities that use the report frame INTBX-BSU-CF1-ISS-IEMIX-OILN that is provided in the "List" worksheet;
  2. It gets the XBRL-based filing from the SEC web site,
    1. reads the fundamental accounting concept information per the mapping rules,
    2. goes through the impute rules to derive values for fundamental accounting concepts that were not explicitly reported,
    3. tests the relations between the fundamental accounting concepts,
    4. and then puts all that information into the Excel spreadsheet.

So, what is the problem?  If you look at the Excel code, it DOES NOT use that metadata.  The mapping rules and the impute rules are HARD CODED into the Excel application.  This Excel spreadsheet uses the style of getting the fundamental accounting concept relations of the very first version of the tool used to obtain this information.  I modified the rules to match as much as possible the current rules of the INTBX-BSU-CF1-ISS-IEMIX-OILN report frame.  So, it works; but it ONLY WORKS FOR ONE REPORT FRAME!

And THAT is the problem.

What if I wanted to do the same thing for a DIFFERENT report frame?  Simple, create another Excel application that is hard coded for THAT report frame.  Repeat this same process for all 143 report frames!  Not a good idea.

Alternatively, the Excel application could be modified to use the metadata above rather than hard coding the mapping rules and impute rules with massive numbers of IF...THEN statements that are hard to change, hard to maintain, and therefore not very flexible.

A better way is to point the Excel application to a report frame, read the metadata for that report frame, and then point to the list of filings with that report frame.

If someone who understands how to program reads the code, they will immediately see the problems of the IF...THEN statements in the code.

(PLEASE NOTE!!! The metadata available now is not the most current version of this metadata.  The reason is that I am constantly updating this metadata for new mappings, new impute rules, fixing bugs, adding new report frames and so on as I try and get the fundamental accounting concepts dialed in.  If you need the most current version of the metadata please contact me.  I will update this information publically at the end of the year.)

(PLEASE NOTE!!!!  All of this metadata is represented in XBRL, except the impute rules.  Not representing the impute rules in XBRL was a mistake.  Future versions of this will also provide the impute rules in XBRL Formula.)

Article originally appeared on XBRL-based structured digital financial reporting (http://xbrl.squarespace.com/).
See website for complete article licensing information.