manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
111 stars 40 forks source link

Taxonomy xsd:annotation/xsd:appinfo/link:roleType links aren't populated #7

Closed shaunclimbon closed 3 years ago

shaunclimbon commented 3 years ago

Describe the bug A clear and concise description of what the bug is:

First off, great module! Thanks a ton for putting this out there. I was getting xbrl brain-damage until I came across this repo.

Following logical expression doesn't evaluate as expected: https://github.com/manusimidt/xbrl_parser/blob/e72c683166d41de1a5eaca87e52971aa5dda7df7/xbrl_parser/taxonomy.py#L179 This is because bool(elr_definition) returns false even if Element.find doesn't return None. I assume because len(elr_definition) evaluates to 0 (or maybe __bool__).

To Reproduce Steps to reproduce the behavior:

Just observe that parsed instance will have an empty taxonomy.link_roles. Tested with: http://www.xbrlsite.com/US-GAAP/BasicExample/2010-09-30/abc-20101231.xml

Expected behavior A clear and concise description of what you expected to happen:

taxonomy.link_roles should be populated. Can change not elr_definition or not elr_definition.text to elr_definition == None or not elr_definition.text

Screenshots If applicable, add screenshots to help explain your problem:

manusimidt commented 3 years ago

@mkycrb Thank you for your issue, really helps me to improve this repository. Until now i am mainly parsing SEC submissions and thus it is very helpful to get feedback from people that tried the parser with other xbrl documents.

You are correct, the parser does not parse the extended link roles defined in the taxonomy extension schema file.

I will investigate the issue and deploy a fix in the following days 👍