Taxonomy loader

A classification system used by XBRL. It defines the specific tags for individual items of data. It is the main file to work with, and it is form by the modules, which are the objects where information is contain. When compressed files (ZIP or 7z) are loaded, modules are called and saved in a JSON file. This is important because it is the main source for the rest of information contained in this JSON, such as the taxonomy it belongs or the tables and variables it contains.

Warning

If the taxonomy is in a 7z package, the command 7z must be available, if not, the process will require to install it. Note that with the EBA taxonomy it may take several minutes.

When modules are loaded, the access to the tables that are form with, are available by just calling them from the JSON created before. Each of these tables contains open keys and variables, which are the basic information of the taxonomy. Moreover, its attributes can be extracted.

Finally, Variables are generated by combining the open keys column with the attributes found within the taxonomy modules. variables contains two main aspects: dimensions and attributes. This dimensions may contain units, like base currency, and concepts, and attributes will indicate the valid decimals (precision).

Taxonomy class

class xbridge.taxonomy_loader.Taxonomy

Bases: object

Class representing an XBRL taxonomy

classmethod from_taxonomy(input_path: str | Path)

Returns a Taxonomy object from a JSON taxonomy file

get_module(code: str)

Returns the module with the given code

get_variables_from_module(code: str) list

Returns the variables from the module with the given code

load_modules(input_path: str | Path | None = None)

loads the modules in the taxonomy

property modules

Returns the modules within the taxonomy