GithubHelp home page GithubHelp logo

xbrlus / xule Goto Github PK

View Code? Open in Web Editor NEW
24.0 10.0 9.0 27.25 MB

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.

License: Apache License 2.0

Python 21.25% Shell 37.43% HTML 40.70% CSS 0.63%
xbrl vscode-extension

xule's People

Contributors

austinmatherne-wk avatar campbellpryde avatar davidtauriello avatar derekgengenbacher-wf avatar marcward avatar phillipengel avatar stevenbronson-wk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xule's Issues

Inconsistent `.role-description` value when getting taxonomy using `taxonomy(...)`

Edited

This may be a trival issue or I am doing something wrong, I am not getting the correct value for property networks().role-description (or role.description) if a taxonomy is loaded using taxonomy(<taxonomy_url>).

I am trying to use XULE to compare 2 taxonomies, I am loading a taxonomy using arelleCmdLine -f <loaded_taxonoy_url> and then the XULE rule gets the other taxonomy for comparison using taxonomy(<other_taxonomy_url>). It appears that when trying to get the value of property networks().role-description (or role.description) for a specific role uri form both taxonomies, the result is always returned from the taxonomy that was loaded first.

To demonstrate, consider ESEF taxonomy 2021 which has a new role http://www.esma.europa.eu/xbrl/role/all/ifrs_17_role-836600o, this role does not exist in ESEF taxonomy 2019, if I load ESEF taxonomy 2019 first using:

arelleCmdLine -f http://www.esma.europa.eu/taxonomy/2019-03-27/esef_all.xsd ...

Then try to get the role-description property based on ESEF 2021 loaded later in the rule using taxonomy(...) , I get a none value while there should be a description for this role in ESEF 2021 taxonomy, this is the rule I am using:

output 
list(taxonomy("http://www.esma.europa.eu/taxonomy/2021-03-24/esef_all.xsd")
        .networks(none, "http://www.esma.europa.eu/xbrl/role/all/ifrs_17_role-836600o")
        .role-description) /* This returns None, while should return [836600o] Notes - Insurance contracts (IFRS 17) */

Load ESEF 2019 first and run above rule using:

$ arelleCmdLine --plugins xule -f http://www.esma.europa.eu/taxonomy/2019-03-27/esef_all.xsd --internetRecheck never --xule-run --xule-compile link-role-test.xule --xule-rule-set link-role-test.xule.zip --logFormat "%(message)s"

The expected result is [836600o] Notes - Insurance contracts (IFRS 17) but the result I am getting:

set(None)

Now if I load ESEF 2021 first and run the same exact rule using:

$ arelleCmdLine --plugins xule -f http://www.esma.europa.eu/taxonomy/2021-03-24/esef_all.xsd --internetRecheck never --xule-run --xule-compile link-role-test.xule --xule-rule-set link-role-test.xule.zip --logFormat "%(message)s"

We get the correct result Result:

set([836600o] Notes - Insurance contracts (IFRS 17))

If I am not mistaken the results for calling role-description should be consistent no matter which taxonomy gets loaded first, unless I am missing something...

Troubleshooting XULE Script Execution Error with Arelle on Amazon Linux 2

I'm evaluating the XULE plugin with Arelle on Amazon Linux 2, using Python 3.8. My script, successfully executed in XMLSpy 2024, aims to analyze hierarchical XBRL instances for journal entries, using dimensions to define journal headers, lines, and sub-account details. However, while compilation appears successful, running the script with --xule-run results in an error. The script calculates debit and credit travel expenses, showing promising results when tested elsewhere:

namespace cor=http://www.iso.org/awi21926_jisc

output TravelExpense

$DebitEntries = set({covered @concept=cor:JISC04b_GL03_06 where $fact==true}.dimensions())
$CreditEntries = set({covered @concept=cor:JISC04b_GL03_06 where $fact==false}.dimensions())
$TravelExpenses = set({covered @concept=cor:JISC04b_GL03_01 where $fact=='726'}.dimensions())
$totalDebitTravelExpenses = sum(list({covered @cor:CC04w_01 where $fact.dimensions() in $DebitEntries and $fact.dimensions() in $TravelExpenses}))
$totalCreditTravelExpenses = sum(list({covered @cor:CC04w_01 where $fact.dimensions() in $CreditEntries and $fact.dimensions() in $TravelExpenses}))

"The total travel expenses are Debit:{$totalDebitTravelExpenses} JPY Credit:{$totalCreditTravelExpenses} JPY"

Successful output in XMLSpy 2023:

Successfully executed XULE on JISCinstance.xbrl in 16ms
    [TravelExpense] The total travel expenses are Debit:28,096 JPY Credit:None JPY

On Arelle, compilation feedback is positive, but execution fails:

(arelle-env) [ec2-user Arelle]$ python arelleCmdLine.py --plugins xule --xule-compile /home/ec2-user/UADC/data/xule/travel_expense.xule --xule-rule-set /home/ec2-user/UADC/data/xule/travel_expense.zip
[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.23722 -
2024-03-24T14:02:47.357186: travel_expense.xule parse start
2024-03-24T14:02:47.932898: travel_expense.xule parse end. Took 0:00:00.575712
2024-03-24T14:02:47.933101: travel_expense.xule ast start
2024-03-24T14:02:47.933378: travel_expense.xule ast end. Took 0:00:00.000277
2024-03-24T14:02:47.933405: post parse start
2024-03-24T14:02:47.934987: post parse end. Took 0:00:00.001582
2024-03-24T14:02:47.936886: Parsing finished. Took 0:00:00.581420

(arelle-env) [ec2-user Arelle]$ python -m arelle.CntlrCmdLine --plugin xule --xule-run --xule-rule /home/ec2-user/UADC/data/xule/travel_expense.zip
[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.23722 -
[xule:error] rule TravelExpense: 'all' -

(arelle-env) [ec2-user Arelle]$

Could you review my approach to ensure it's correct? I'm looking to refine this process before advancing to XINCE for trial balance reporting. Your insights on proceeding with this test would be greatly appreciated.

Using xule within a Python script

Hi, I wish to use xule to extract pertinent data from SEC 10-Q filings but I'm not finding any documentation on how to do so strictly within Python. Is it possible, given that this project is written in Python?

Missing reference warning when -f uses a local file in arelle

Hello,

I am using arelle, and when passing a local file path in -f, I get missing reference errors. The local file is the exact source from the url. For example:

python3.9 arelleCmdLine.py --plugins xule -f https://www.sec.gov/Archives/edgar/data/62996/000006299622000041/mas-20220930.htm --noCertificateCheck --xule-compile "sample.xule" --xule-run --xule-rule-set "compiled_rules.zip" --xule-compile-type="json"

Works correctly, but:

python3.9 arelleCmdLine.py --plugins xule -f data/mas-20220930.htm --noCertificateCheck --xule-compile "sample.xule" --xule-run --xule-rule-set "compiled_rules.zip" --xule-compile-type="json"

Gives warnings such as:

[ix11.12.1.2:missingReferences] Instance fact missing schema definition: us-gaap:RightOfUseAssetObtainedInExchangeForOperatingLeaseLiability of Inline Element ix:nonFraction - mas-20220930.htm 24012

My xule file is:

namespace us-gaap=http://fasb.org/us-gaap/2022
namespace mas=https://www.sec.gov/Archives/edgar/data/62996/000006299622000041/mas-20220930.xsd

output query-test
navigate summation-item descendants

Do the namespaces need to be local files too when running from a local file?
Thanks

40% slower performance from v23379.2 to v23570.2

After an investigation it was discovered that performance degradation was introduced with XULE processor upgrade from 23379.2 to 23570.2 appears to be the issue. I have tested XBRL validation duration with a project having 5000+ tags, arelle version 2.11.8, DQC version 20.0.2 (supported by both xule versions) and XULE plugin versions 23379.2 and 23570.2: with XULE 23570.2 validation is around 40% slower (120-130 seconds) than with XULE 23379.2 (~90 seconds).

XINCE for creation of xbrl instance not working

Hi, I have been trying to generate with XBRL instance using the XINCE plugin in Arelle. But the plugin code seems incomplete here.

parser.error("Xule to instance requires a xule rule set (--xule-rule-set)")
. the plugin is supposed to call the create_instance function with a model instance ( that can be a model xbrl ) and generate the instance respectively. Or please correct me if i am taking this in wrong direction.

parse error for list/set with string members with whitespace between them

declarations (from DQC us\2021\constant.xule) like
constant $REPORT_TYPE_EXCLUSIONS = set( 'S-1', 'S-3', 'S-4', 'S-6', 'S-8', 'S-11', 'S-20', 'S-1/A', 'S-3/A', 'S-4/A', 'S-6/A', 'S-8/A', 'S-11/A', 'S-20/A', 'F-1','F-3', '10-12G', '10-12G/A')
trigger pyparsing.exceptions.ParseException: Expected string_end, found '(' (at char 38), (line:1, col:39)

removing the space inside the set like in
constant $REPORT_TYPE_EXCLUSIONS = set('S-1','S-3','S-4','S-6','S-8','S-11','S-20','S-1/A','S-3/A','S-4/A','S-6/A','S-8/A','S-11/A','S-20/A','F-1','F-3','10-12G','10-12G/A')
parses successfully;

the whitespace doesn't hurt when the list contains numbers, e.g.
constant $REPORT_TYPE_EXCLUSIONS = set(1, 2, 3, 4)
also parses successfully;

same for list ...

How to properly include the namespace us-gaap?

I am trying to get all the parent-child relationships in an xsd file. When I run my xule file (using the Arelle command line python file):

output example
navigate parent-child descendants

I get the expected list of results back (us-gaap:InterestAndDividendIncomeOperating, us-gaap:InterestExpense, us-gaap:NoninterestIncome, gs:InvestmentManagement, us-gaap:BrokerageCommissionsRevenue, etc).

I want to get the full hierarchy of these values, and am planning on going one at a time, getting their respective children and building a tree. I am trying to start this process by getting the children of us-gaap:NoninterestIncome by doing:

output example
navigate parent-child descendants from us-gaap:NoninterestIncome

I get an empty list back. The VSCode extension is saying that us-gaap is an unknown namespace. I try to include it like so:

namespace us-gaap=https://xbrl.fasb.org/us-gaap/2021/

output example
navigate parent-child descendants from us-gaap:NoninterestIncome

And get an empty list back again. When hovering over us-gaap:NoninterestIncome, the VSCode extension gives:

Unknown local name: NoninterestIncome in namespace https://xbrl.fasb.org/us-gaap/2021/ (built-in)

How do I properly include the us-gaap namespace? Thanks for making xule!

Where filter for concept ids in summation-item queries

I am trying to include ids in the where filter for summation-item queries:

namespace us-gaap=http://fasb.org/us-gaap/2022
namespace mas=https://www.sec.gov/Archives/edgar/data/62996/000006299622000041/mas-20220930.xsd

output query-test
navigate summation-item parents from us-gaap:ProfitLoss where $source.id == "id3VybDovL2RvY3MudjEvZG9jOjk4YWIxYzMyMDg3YTQ3MzZhMzkyZDVjYTRkNDM0YWRiL3NlYzo5OGFiMWMzMjA4N2E0NzM2YTM5MmQ1Y2E0ZDQzNGFkYl83My9mcmFnOmViNzcyZmU1NzQxOTQzNTVhOGZjYjAxZDdhOGJlYjIwL3RhYmxlOjM5NGU5YTIxODNmNTQ5Y2Q5MWVhNDZmNjRlNmYyNThhL3RhYmxlcmFuZ2U6Mzk0ZTlhMjE4M2Y1NDljZDkxZWE0NmY2NGU2ZjI1OGFfNy0xLTEtMS05MzA5OQ_c5ea3522-659e-426d-8097-9d7b4124ec51"

But this does not seem to work, is there support for something like this? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.