Arelle / ixbrl-viewer

The Arelle iXBRL Viewer allows Inline XBRL (or iXBRL) reports to be viewed interactively in a web browser. The viewer allows users to access the tagged XBRL data embedded in an iXBRL report.
Other
103 stars 60 forks source link

[BUG] getUsedScalesMap fails on reports with missing taxonomy definitions #435

Closed paulwarren-wk closed 1 year ago

paulwarren-wk commented 1 year ago

What happened?

If you open a report containing numeric concepts that are missing taxonomy definitions (e.g. because the relevant taxonomy file could not be found), then you get an error on loading the document:

Uncaught TypeError: Cannot read properties of undefined (reading 'split')
    at new QName (qname.js:17:1)
    at iXBRLReport.qname (report.js:248:1)
    at Fact.getScaleLabel (fact.js:284:1)
    at report.js:234:40
    at Array.forEach (<anonymous>)
    at iXBRLReport.getUsedScalesMap (report.js:227:1)
    at Inspector._getScalesOptions (inspector.js:344:1)
    at Inspector.setupSearchControls (inspector.js:333:1)
    at Inspector.searchReady (inspector.js:372:1)
    at inspector.js:154:17

The search controls are stuck with the "Please wait - building index..." mask.

The problem is that we don't include the units for these facts in the JSON, because, without the type information we don't know that they're numeric. getUsedScalesMap reasonably enough assumes that if they have a scale, that they're numeric and calls getScaleLabel which fails because it can't find the unit.

Obviously there are some simple fixes for this specific issue, but I do have a general concern with the approach of continuing in the face of serious XBRL validity errors, as even with this bug fixed, there will be lots of things that don't work in the viewer. I think that Arelle should make it much more obvious when you're working with a report that is not valid according to the specifications, as currently, serious validity errors are mixed in with messages relating to business-level errors from formula rules.

Version

1.1.76-dev

With which browsers are you experiencing the bug?

Chrome

Documents

No response

Screenshots

No response

brettkail-wk commented 1 year ago

Obviously there are some simple fixes for this specific issue, but I do have a general concern with the approach of continuing in the face of serious XBRL validity errors, as even with this bug fixed, there will be lots of things that don't work in the viewer.

Workiva is actively interested in continuing to support these cases. It is very often the case that users want to use the iXBRL viewer on their work-in-progress documents, which might be partially/invalidly tagged.

paulwarren-wk commented 1 year ago

Obviously there are some simple fixes for this specific issue, but I do have a general concern with the approach of continuing in the face of serious XBRL validity errors, as even with this bug fixed, there will be lots of things that don't work in the viewer.

Workiva is actively interested in continuing to support these cases. It is very often the case that users want to use the iXBRL viewer on their work-in-progress documents, which might be partially/invalidly tagged.

Understood - and there's already quite a lot of code in the viewer to cope with viewing invalid documents for this reason.

I've raised a separate issue (#474) to track what, if anything, we do on this more general issue, so that this one can deal with the getUsedScalesMap failure.

austinmatherne-wk commented 1 year ago

I think the particular problem this issue was addressing got fixed up in #446. So, we can probably close this one out and keep tabs on the broader issue over in #474.

paulwarren-wk commented 1 year ago

Agreed - I've confirmed that it also fixes this, but have added some more tests as this was triggering the problem via a different route.