📜 ⬆️ ⬇️

XBRL: just about the complex - Chapter 6. Immersion in the XBRL - Part 2. Improving the result

6.2. Improving the result


Yesterday we were quite pleased with the result. But we slept well and realized that this is not yet what we would like to receive.


The reporting form in our example contained several sections - for totals, as well as for grouping by sex and age groups. And she didn’t have this ugly ' http://www.xbrl.org/2003/role/link ' header at the top of the report.


As it turned out, our report visualization application uses the presentationLink element to define report sections and displays its role as a section header. In the first approach, we used the default role for our only presentationLink, which explains the appearance of the ugly header.


So, first of all, we need to set up sections of the report with headings that at least mean something.


Note: We will use copies of previous developments, changing the date from 2006-01-01 to 2006-01-02. In addition, today we will create several versions, so each of them will make its own folder (a, b, c, etc.), and specify it in all file names. We will describe in detail only the changes relative to the previous version.


6.2.1. Section Setup


To configure sections in our report, you need to make a few changes:



6.2.1.1. New roles


Our report visualization application uses presentationLink from our presentation reference database to define sections. The section name is taken from the presentationLink role. So, we need to define new roles in the taxonomy scheme to indicate the correct names.


The reporting form from our example is divided into three sections: Totals, Gender and Age, so we will define the corresponding roles. They are placed inside the appinfo element, which in turn is inside the annotation element:


 <link:roleType roleURI="http://www.sample.com/totalEmployees" id="totalEmployees"> <link:definition>Total number of employees</link:definition> <link:usedOn>link:presentationLink</link:usedOn> </link:roleType> <link:roleType roleURI="http://www.sample.com/genderDemographics" id="genderDemographics"> <link:definition>Gender related demographics on employees</link:definition> <link:usedOn>link:presentationLink</link:usedOn> </link:roleType> <link:roleType roleURI="http://www.sample.com/ageDemographics" id="ageDemographics"> <link:definition>Age related demographics on employees</link:definition> <link:usedOn>link:presentationLink</link:usedOn> </link:roleType> 

Roles are defined as link:roleType with two attributes and two child elements:



6.2.1.2. Abstract root concepts


Instead of one abstract root concept that was used last time, we will define three new ones, one for each section.


 <element id="sample_section_totals" name="section_totals" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" abstract="true" nillable="true" /> <element id="sample_section_gender" name="section_gender" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" abstract="true" nillable="true" /> <element id="sample_section_age" name="section_age" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" abstract="true" nillable="true" /> 

Each concept can be used as the root element of one presentation hierarchy.


6.2.1.3. Presentation links


The final step is to update the base links of presentations. First of all, we need to make new roles available for use. We do this by defining new links.


 <roleRef xlink:type="simple" xlink:href="sample-2006-01-02a.xsd#totalEmployees" roleURI="http://www.sample.com/totalEmployees" /> <roleRef xlink:type="simple" xlink:href="sample-2006-01-02a.xsd#genderDemographics" roleURI="http://www.sample.com/genderDemographics" /> <roleRef xlink:type="simple" xlink:href="sample-2006-01-02a.xsd#ageDemographics" roleURI="http://www.sample.com/ageDemographics" /> 


Now we can define separate presentationLink for each section of the report.


 <presentationLink xlink:type="extended" xlink:role="http://www.sample.com/totalEmployees" > <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_section_totals" xlink:label="concept_section_totals" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_total" xlink:label="concept_nr_employees_total" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_totals" xlink:to="concept_nr_employees_total" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/label" /> </presentationLink> <presentationLink xlink:type="extended" xlink:role="http://www.sample.com/genderDemographics" > <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_section_gender" xlink:label="concept_section_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_male" xlink:label="concept_nr_employees_male" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_female" xlink:label="concept_nr_employees_female" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_gender" xlink:to="concept_nr_employees_male" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_gender" xlink:to="concept_nr_employees_female" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> </presentationLink> <presentationLink xlink:type="extended" xlink:role="http://www.sample.com/ageDemographics " > <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_section_age" xlink:label="concept_section_age" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_age_up_to_20" xlink:label="concept_nr_employees_age_up_to_20" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_age_21_to_40" xlink:label="concept_nr_employees_age_21_to_40" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02a.xsd#sample_nr_employees_age_41_and_up" xlink:label="concept_nr_employees_age_41_and_up" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_up_to_20" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_21_to_40" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_41_and_up" order="3" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> </presentationLink> 

Each presentationLink element uses the role defined for the corresponding section of the report. Hierarchies within the presentationLink are also formed only from concepts related to the corresponding section.


6.2.1.4. Let's see what happened

When we re-use our simple application to visualize the report, we will see where the best result. The report is divided into three sections, and each of them has its own title.


image


Please note that we have built a new report. The data in it is the same as in the past, the only difference is in the taxonomy to which it refers.


However, there is one thing that is annoying - the sections are not in the order we would like. In the presentation hierarchy, we can specify the order of the children, but at the taxonomy level we cannot do the same for sections.


One solution to this problem is to put it on the shoulders of the application for visualizing the report. As is often the case, our simple application sorts the sections alphabetically. Changing the description of the roles, we can set the order of the sections.


image


Now everything looks better, but you shouldn’t rely on such feature of the report visualization software as alphabetical sorting. In real life, this is not uncommon, but we will try to come up with a better solution.


6.2.2. Back to the development


So, the creation of three sections made the report more structured, but the result is still not good enough.


There is another possibility: presentation links allow you to define a hierarchy of concepts, but so far we have only used flat hierarchies - just one list of child elements under the root abstract concept. Perhaps we should try to achieve more in terms of hierarchies.


6.2.2.1. New roles

Using separate roles to define section headers was a good idea, so in this version we will leave one role for this purpose.


 <link:roleType roleURI="http://www.sample.com/employeeDemographics" id="employeesDemographics"> <link:definition>Employees demographics</link:definition> <link:usedOn>link:presentationLink</link:usedOn> </link:roleType> 

6.2.2.2. Abstract concepts

We will leave the abstract concept of 'presentation_root' and the abstract root concepts of sections from the previous version. This will give us enough concepts to build a beautiful hierarchy.


6.2.2.3. Shortcuts

Until now, the abstract concepts we define have not been labeled. In the current version we will add them. The process will not be described in detail, because We have already analyzed all this before.


6.2.2.4. Multi-level links of presentations

The presentation reference database in this version defines hierarchies with more than one level.


 <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_presentation_root" xlink:to="concept_section_totals" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/label" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_totals" xlink:to="concept_nr_employees_total" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/label" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_presentation_root" xlink:to="concept_section_gender" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/label" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_gender" xlink:to="concept_nr_employees_male" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_gender" xlink:to="concept_nr_employees_female" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_presentation_root" xlink:to="concept_section_age" order="3" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/label" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_up_to_20" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_21_to_40" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_section_age" xlink:to="concept_nr_employees_age_41_and_up" order="3" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> 

Under the abstract presentation_root concept, there are three child abstract root concept sections. Under each of them are child concepts of the relevant section.


6.2.2.5. Look at this!

The result of the new version of the report is as follows:


image


This hierarchy allows us to specify the exact location and order of concepts. But this is still not what I would like to receive. We had to return to using only one section. What if someone wants to use only one of the sections of the report? I feel there will be a third version!


6.2.3. We are reviewing sections of the report


In our third and last version for today, let's think about the report sections for a while. We have already learned how to do several different sections. But was this really the right one?


Keep in mind that sections of an XBRL report tend to group related information. Someone may decide to use only one section and still expect to receive a full report.


Perhaps this is not applicable to our example, but if you look at the real taxonomy, you will find that the report sections often represent the same data in different forms — an example is the taxonomy with sections for balance sheet and profit / loss.


Would someone interested in demography want to be content with just the total number of employees? Perhaps, but not likely. On the other hand, looking at the detalization of demographic data by gender or age group, I also want to see the final values ​​(imagine a complex report with more than two concepts in the section).


What if we divide the report into two sections - gender and age demography, each of which will include totals? This is what we will do in the new version.


6.2.3.1. Roles

We define sections as in the first version (2006-01-02a), but only for gender and age.


6.2.3.2. Abstract concepts

As you will see later, we no longer need abstract concepts.


6.2.3.3. Presentation hierarchy

Adding totals to each section allows us to use the concepts already defined in the taxonomy as the root of the presentation hierarchy and allows us not to create new abstract concepts.


 <presentationLink xlink:type="extended" xlink:role="http://www.sample.com/genderDemographics" > <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_total" xlink:label="concept_nr_employees_total" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_male" xlink:label="concept_nr_employees_male" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_female" xlink:label="concept_nr_employees_female" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_nr_employees_total" xlink:to="concept_nr_employees_male" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_nr_employees_total" xlink:to="concept_nr_employees_female" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> </presentationLink> <presentationLink xlink:type="extended" xlink:role="http://www.sample.com/ageDemographics" > <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_total" xlink:label="concept_nr_employees_total" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_age_up_to_20" xlink:label="concept_nr_employees_age_up_to_20" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_age_21_to_40" xlink:label="concept_nr_employees_age_21_to_40" /> <loc xlink:type="locator" xlink:href="sample-2006-01-02c.xsd#sample_nr_employees_age_41_and_up" xlink:label="concept_nr_employees_age_41_and_up" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_nr_employees_total" xlink:to="concept_nr_employees_age_up_to_20" order="1" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_nr_employees_total" xlink:to="concept_nr_employees_age_21_to_40" order="2" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> <presentationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="concept_nr_employees_total" xlink:to="concept_nr_employees_age_41_and_up" order="3" priority="0" use="optional" preferredLabel="http://www.xbrl.org/2003/role/terseLabel" /> </presentationLink> 

6.2.3.4. The resulting report

So, this is what we managed to achieve:


image


I do not know about you, but it seems to me that it turned out pretty well. Each section has become clear and self-sufficient. Let it be the final result of today.






')

Source: https://habr.com/ru/post/335788/


All Articles