Converter
The converter
modules holds the Converter class, which converts XBRL-XML to XBRL-CSV
taking as input taxonomy and instance objects.
Main function is to do an inner join between the XML instance and the preprocessed JSON, to generate an XBRL-CSV file.
- class xbridge.converter.Converter(instance_path: str | Path)
Bases:
object
Converter different types of files into others, using the EBA
taxonomy
and XBRL-instance. Each file is extracted and saved in a temporary directory. Then, these files are converted into JSON and again saved in a compressed folder such as ZIP or 7z.Variables
are generated by combining the open keys column with the attributes found within the taxonomymodules
. Then, variable’s dimension is extracted from it with the purpose to be used with the context coming from theXML_instance
, to create thescenario
.Finally, an inner join is done between the variables created and the values from the facts of the
XML_instance
context
.- convert(output_path: str | Path) Path
Convert the
XML Instance
to a CSV file
Generating variables:
Firstly, variables are generated taking the pre-processed tables that form the modules, which URLs are saved in the index.json
file,
and the instance columns that form the XML_instance
. If instance have not got any open keys, variables are not going to be generated.
Index.json
will look like this:
After that, variables are parsed, cleaning them up and an intersection is done with them and the instance columns. Now, the table is generated.
Converting tables:
Tables
are generated, filling them with the variables generated before, and save in a CSV file. It will contain the variable version IDs.
This tables have to be treatise, so they can be used in the conversion process. This treatment consists in replacing hyphens with dots, so CSV files can be generated.
Converting filing indicators:
The filing indicators
show which tables within the module are reported. Reports.json files only indicate XBRL related metadata and the module URL.
Converting parameters:
Parameters
will contain all info related to entity, period, baseCurrency and decimals contained in the XBRL-XML file.