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
109 stars 40 forks source link

Add namespace to Concept #141

Open mariuszlipinski opened 1 month ago

mariuszlipinski commented 1 month ago

I would like to suggest to add a namespace property to Concept class:

Changes to Concept class:

    self.name: str = name
    self.namespace: str or None = None -- add this line
    self.substitution_group: str or None = None

Then in instance.py file add those lines:

        concept: Concept = tax.concepts[tax.name_id_map[concept_name]]
        concept.namespace = taxonomy_ns -- add this in line 395

    concept: Concept = tax.concepts[tax.name_id_map[concept_name]]
    concept.namespace = ns_map[taxonomy_prefix] -- add this in line 503

            dimension_concept: Concept = dimension_tax.concepts[dimension_tax.name_id_map[dimension_concept_name]]
            dimension_concept.namespace = ns_map[dimension_prefix] -- add this in line 657
            member_concept: Concept = member_tax.concepts[member_tax.name_id_map[member_concept_name]]
            member_concept.namespace = ns_map[member_prefix] -- add this