xbrl-forge
is a Python package designed to streamline the creation of XBRL (eXtensible Business Reporting Language) files. This guide will walk you through its primary functions and how to use them effectively.
Pyhton 3 is needed.
To use xbrl-forge
, install it via pip:
pip install xbrl-forge
This function ensures that the input data is formatted correctly and adheres to the necessary structure for creating XBRL files.
The input data schema is available with descriptions of every key and value here.
data
(dict): The input data to be validated.
The function will not return anything. It will throw an error if the data is not correct according to the schemas.
from xbrl_forge import validate_input_data
validate_input_data(data)
This function loads and preprocesses input data, preparing it for XBRL file generation.
data
(dict): The raw input data.
InputData
: A python object resembing the necessary structure and functions.
from xbrl_forge import load_input_data
data = load_input_data(data)
Generates an XBRL file based on the validated input data.
input_data_list
(List ofInputData
Objects): The input data to be transformed into an XBRL file.styles
(str): Optional CSS information stored in a string.
File
(a custom File object): An object that containes the xbrl structures ready for saving. It can save and package the information via the object functionssave_files(folder_path)
andcreate_package(folder_path)
.
from xbrl_forge import create_xbrl
results = create_xbrl([loaded_data_a, loaded_data_b], style="body { padding: 5px; }")
Here is a complete example that ties the key functions together:
from xbrl_forge import create_xbrl, validate_input_data, load_input_data
# lets say we have 2 data jsons from 2 different systems, data_a and data_b
# validate both data sets
validate_input_data(data_a)
validate_input_data(data_b)
# load data objects
loaded_data_a = load_input_data(data_a)
loaded_data_b = load_input_data(data_b)
# run generation
results = create_xbrl([loaded_data_a, loaded_data_b])
# save either the files
results.save_files("result_folder")
# or the package
results.create_package("result_folder")
The xbrl-forge
package simplifies the process of working with XBRL files by providing tools to validate the input, preprocess, and generate XBRL documents. By following this guide, you can integrate these functions into your workflow and streamline your reporting processes.
For more details, check the official documentation or raise issues for support.