Skip to content

Latest commit

 

History

History
122 lines (90 loc) · 3.5 KB

ARCHITECTURE.md

File metadata and controls

122 lines (90 loc) · 3.5 KB

Inline XBRL Viewer architecture

This document provides developer documentation for various aspects of the Inline XBRL Viewer.

JSON data

The viewer relies on a block of JSON data that is embedded within the primary XHTML file of the viewer. This avoids having to do full XBRL processing within the viewer, and avoids the need to access the report's taxonomy from the viewer.

The format of the JSON data is described below. Newer viewers are expected to work correctly with data generated by an older plugin version within the same major version, degrading new features gracefully if required.

{
    "features": [],
    "prefixes": {},
    "roles": {},
    "languages": {},
    "sourceReports": [
        {
            "docSetFiles": [],
            "targetReports": [
                {
                    "localDocs": {},
                    "roleDefs": {},
                    "concepts": {},
                    "facts": {},
                    "rels": {},
                }
            ]
        }
    ],
    "validation": [],
    "filingDocuments": "foo.zip"
}

A viewer can contain one or more "source reports", each producing one or more target report.

A source report is an Inline XBRL Document Set, comprising one or more Inline XBRL Documents. A target report is the XBRL data obtained from extracting a given target document from the source report.

Target documents are not yet supported, so at present, there will always be one target report per source report.

prefixes

prefixes is a map of namespace prefixes to namespace URIs. It is shared by all Target Reports.

languages

"languages": {
    "en-us": "English (US)",
    "en": "English",
    "fr": "French",
},

A map of language codes to language labels. There should be an entry here for every language code used by a label in a report.

sourceReports

sourceReports is an array of objects of report data. Prior to multi-document support, this property was not present, and the docSetFiles property, and the properties of the objects within targetReports appeared at the top-level.

There is an object in this array for each separate Inline XBRL Document Set in the viewer.

docSetFiles

docSetFiles is a list of files in the document set. It is used to load other documents in the document set into iframes in tabs in the viewer.

docSetFiles is a list of relative URLs.

targetReports

An array of objects, one for each target document obtained from the enclosing source report.

localDocs

{
    "filename.xsd": ["schema"],
    "inline.xhtml": ["inline"],
}

localDocs is the set of XBRL files local to the filing (i.e. the Inline XBRL files, and any extension taxonomies).

The property is used to populate a summary of the files in the filing in the document summary panel.

IDs and Viewer Unique IDs

The viewer requires all iXBRL facts to have id attributes. The Python plugin will add id attributes to facts if not present. IDs are required to be unique within an Inline XBRL Document Set, but in order to avoid collisions between IDs in different Inline XBRL Document Sets when multiple source reports are present, the JavaScript viewer internally uses "viewer unique IDs", which are the id attribute values prefixed by the source report index (e.g 0-f1 is f1 in the first report). The original id attributes are only used to resolve footnotes and continuation chains during the pre-process phase. Facts are selected via the ivids data attribute on wrapper nodes, which uses viewer unique IDs.