xbrlus / xule

An open-source XBRL processor for business rules, rendering and custom data reporting. See https://xbrl.us/xule for documentation and https://xbrl.us/xule-editor for a VS Code syntax highlighter.
Apache License 2.0
25 stars 10 forks source link

Is it possible to run custom Xule query in arelle? #5

Closed selgamal closed 2 years ago

selgamal commented 2 years ago

Following the instructions here I can run dqc rule validation.

I am wondering if it is possible to run custom XULE query in arelle against the loaded instance, same way I can do that with XBRL formula?

davidtauriello commented 2 years ago

Before a XULE expression can be executed it needs to be compiled. The expression can be either compiled at run time or compiled and saved and run separately. The latter is how the Data Quality Committee ruleset .zip files are distributed from the reference implementation code.

As an example, the snippet below as 'Assets.xule' - it will return the value of Assets with no dimensions reported in specified filings:

output assets[@concept.local-name = 'Assets']

In the command below the xule file called Assets.xule will be compiled and processed in a single step.

python3.9 arellecmdline.py --plugins 'xule' -f https://www.sec.gov/Archives/edgar/data/1095595/000095010320007907/ceo-20191231.xml --noCertificateCheck --xule-compile Assets.xule --xule-run --xule-rule-set Assets.zip

This command uses the Arelle command line program called arellecmdline.py.

The xule plugin is called using the --plugins argument which is included in the Arelle plugins library in the Arelle distribution.

The command line uses some additional options:

selgamal commented 2 years ago

Thank you very much for the information, that works perfectly, results:

[info] Activation of plug-in XBRL rule processor (xule) successful, version Check version using Tools->Xule->Version on the GUI or --xule-version on the command line. - xule
[info] Xule version: 3.0.23303 -
2022-05-21T07:03:18.793996: post parse start
2022-05-21T07:03:18.794207: post parse end. Took 0:00:00.000211
2022-05-21T07:03:18.794719: Parsing finished. Took 0:00:00.044735
[info] loaded in 1.55 secs at 2022-05-21T07:03:18 - https://www.sec.gov/Archives/edgar/data/1095595/000095010320007907/ceo-20191231.xml
[assets] 624,089,000,000 - https://www.sec.gov/Archives/edgar/data/1095595/000095010320007907/ceo-20191231.xml 11545
[assets] 686,381,000,000 - https://www.sec.gov/Archives/edgar/data/1095595/000095010320007907/ceo-20191231.xml 11450
[assets] 757,731,000,000 - https://www.sec.gov/Archives/edgar/data/1095595/000095010320007907/ceo-20191231.xml 11711