Taxonomy API Reference#
Taxonomy registry and metadata loader in nse_xbrl_parser.taxonomy.
Taxonomy Registry#
- class nse_xbrl_parser.taxonomy.registry.TaxonomyRegistry(catalog_path=None)[source]#
Bases:
objectRegistry managing all 58 official taxonomy definitions.
- Parameters:
catalog_path (Optional[Path])
- get_by_id(taxonomy_id)[source]#
Lookup taxonomy by its ID (1 to 58).
- Parameters:
taxonomy_id (int)
- Return type:
TaxonomyInfo | None
- find_by_name(search_term)[source]#
Search taxonomies by keyword in name or regulation (e.g. ‘Shareholding’, ‘Financial’, ‘Governance’).
- Parameters:
search_term (str)
- Return type:
- get_financial_taxonomies()[source]#
Get all Regulation 33 Financial Results taxonomies.
- Return type:
- get_corporate_governance_taxonomy()[source]#
Get Regulation 27(2) Corporate Governance taxonomy.
- Return type:
TaxonomyInfo | None
Get Regulation 31 Shareholding Pattern taxonomy.
- Return type:
TaxonomyInfo | None
- class nse_xbrl_parser.taxonomy.registry.TaxonomyInfo(*, id, name, regulation, all_links=<factory>, taxonomy_links=<factory>, utility_links=<factory>)[source]#
Bases:
BaseModelMetadata describing a specific NSE/BSE filing taxonomy.
- Parameters:
- property primary_taxonomy_url: str | None#
Return the direct download URL for the taxonomy package if available.
- property primary_utility_url: str | None#
Return the direct download URL for the Excel utility if available.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Downloader & Linkbase#
- class nse_xbrl_parser.taxonomy.downloader.AsyncTaxonomyDownloader(cache_dir=None)[source]#
Bases:
objectAsync downloader and local cache for taxonomy schema and linkbase packages.
- Parameters:
cache_dir (Optional[Path])
- async download_taxonomy_archive(taxonomy, force_reload=False)[source]#
Download and cache the ZIP archive for a taxonomy category.
- Parameters:
taxonomy (TaxonomyInfo)
force_reload (bool)
- Return type:
- async load_taxonomy_metadata(taxonomy)[source]#
Download (if needed) and parse schemas and label linkbases from the taxonomy package.
- Parameters:
taxonomy (TaxonomyInfo)
- Return type:
Tuple[TaxonomySchema | None, TaxonomyLinkbase | None]
- class nse_xbrl_parser.taxonomy.linkbase.TaxonomyLinkbase(*, labels=<factory>, calculations=<factory>)[source]#
Bases:
BaseModelContainer for parsed linkbase data.
- calculations: List[CalculationArc]#
- classmethod from_label_xml(content)[source]#
Parse a label linkbase file (
*-lab.xml,*-label.xml).- Parameters:
- Return type:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class nse_xbrl_parser.taxonomy.schema.TaxonomySchema(*, target_namespace='', elements=<factory>)[source]#
Bases:
BaseModelContainer for parsed taxonomy schemas.
- Parameters:
target_namespace (str)
elements (Dict[str, SchemaElement])
- elements: Dict[str, SchemaElement]#
- classmethod from_xsd_content(content)[source]#
Parse an XSD file into a TaxonomySchema model.
- Parameters:
- Return type:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class nse_xbrl_parser.taxonomy.schema.SchemaElement(*, name, id=None, type=None, substitution_group=None, period_type=None, balance=None, is_abstract=False, is_nillable=True, target_namespace=None)[source]#
Bases:
BaseModelRepresents a concept element declared in an XBRL taxonomy schema (.xsd).
- Parameters:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].