manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files

Home Page:https://py-xbrl.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2 name space errors

mrx23dot opened this issue · comments

For these two:
https://www.sec.gov/Archives/edgar/data/0001686850/000121390021042028/f10q0621_motusgihold.htm
https://www.sec.gov/Archives/edgar/data/0001553643/000121390021017556/f10k2020_relmadatherapeutic.htm

I get:

Traceback (most recent call last):
    inst = XbrlParser(cache).parse_instance(url)
  File "C:\python36\lib\site-packages\xbrl\instance.py", line 653, in parse_instance
    return parse_ixbrl_url(url, self.cache)
  File "C:\python36\lib\site-packages\xbrl\instance.py", line 363, in parse_ixbrl_url
    return parse_ixbrl(instance_path, cache, instance_url)
  File "C:\python36\lib\site-packages\xbrl\instance.py", line 406, in parse_ixbrl
    context_dir = _parse_context_elements(xbrl_resources.findall('xbrli:context', NAME_SPACES), ns_map, taxonomy, cache)
  File "C:\python36\lib\site-packages\xbrl\instance.py", line 574, in _parse_context_elements
    member_tax = _load_common_taxonomy(cache, ns_map[member_prefix], taxonomy)
  File "C:\python36\lib\site-packages\xbrl\instance.py", line 630, in _load_common_taxonomy
    if tax is None: raise TaxonomyNotFound(namespace)
xbrl.TaxonomyNotFound: The taxonomy with namespace http://xbrl.sec.gov/stpr/2021 could not be found. Please check if it is imported in the schema file

Maybe it's missing www?

Is it a filling or a lib issue ?

Cheers

The taxonomy (STPR 2021) that the parser can not find is in draft and not officially released.
See https://www.sec.gov/structureddata/osddrafttaxonomyfiles
I am not quite sure why these two submissions use this taxonomy, however I will add it to the mapping :)

Why doesn't the recursion include base taxonomy downloads?
The lib already knows what's missing, so we wouldn't need to hardcode the new docs every year.

The libary does indeed automatically download and parse all taxonomies that are imported in the respective taxonomy schema files.
However some filers (expecially from the US) do not import the taxonomies.

They declare the namespace:

<xbrli:xbrl xmlns:dei="http://xbrl.sec.gov/dei/2020-01-31">...</xbrli:xbrl>

but the following schema import is missing:

<xs:import 
  namespace="http://xbrl.sec.gov/dei/2020-01-31" 
  schemaLocation="https://xbrl.sec.gov/dei/2020/dei-2020-01-31.xsd"/>

Using a namespace without declaring the schema url for the taxonomy behind the namespace is bad practice. But the SEC tolerates this for the following standard taxonomies:
https://www.sec.gov/info/edgar/edgartaxonomies.shtml

Therefore the mapping is used in case the filing lacks the appropriate mapping between namespace and schema url.

When we extract the imports cannot we just try to add the declared namespaces too?
(at least the ones that look like URL) Just make it universal.