-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing Failures for Empty Fact Values and 'nil' Text in XBRL Documents #113
Comments
Hey @rahulsinghal11 , sorry for the late answer.. According to the XBRL Specification an ix:nonFraction element must have a value. That's probably the reason why I never encountered issues with this on submissions from USA and UK. However, since this is really easy to fix (as you also stated) I am happy to implement it in the next release. Thanks! |
Hi @manusimidt These changes are non-disruptive and will not negatively impact any existing functionality and only add additional checks to prevent potential errors that would have otherwise anyway occurred. The modifications are careful enough to ensure stability and enhance the overall performance of the library. If there's anything else I can do to assist you or contribute to further improving this library, please don't hesitate to let me know. |
Hi
I would like to draw your attention to 2 issues I encountered while parsing XBRL documents. I have identified two simple yet effective solutions to these problems.
Firstly, I noticed that when the fact value within an XBRL document is an empty string, the parsing process fails eg:
></ix:nonFraction>
. This gives an error converting the string to float. To overcome this issue, I propose a minor modification above line 575 of the instance.py file in the py-xbrl repository:py-xbrl/xbrl/instance.py
Line 575 in 03b40e3
fact_value = '0' if if fact_value == '' else fact_value
By implementing this change, the parsing functionality will handle empty fact values gracefully.
Secondly, I encountered another problem related to the text within the XBRL document. In some cases, the string 'nil' is used in the document, which causes parsing failures for numerous XBRL documents eg:
>Nil</ix:nonFraction>
. This gives an error converting Nil to a number. To address this, I suggest the following addition to line 314 of the init.py file within the transformations module:py-xbrl/xbrl/transformations/__init__.py
Line 314 in 03b40e3
if arg == 'no' or arg == 'none' or arg == 'nil':
Incorporating this adjustment will ensure that 'nil' is recognized and handled correctly during the parsing process.
I have thoroughly tested these two fixes with various XBRL documents and successfully parsed all of them. Therefore, I believe these changes will greatly improve the reliability and robustness of the py-xbrl library.
I kindly request your review and consideration of these proposed solutions. Your feedback and thoughts on these modifications would be greatly appreciated.
Thank you for your attention and dedication to maintaining the py-xbrl library.
The text was updated successfully, but these errors were encountered: