SBTi.data.sbti
Module Contents
Classes
Data provider skeleton for SBTi. This class only provides the sbti_validated field for existing companies. |
- class SBTi.data.sbti.SBTi(config: Type[SBTi.configs.PortfolioCoverageTVPConfig] = PortfolioCoverageTVPConfig)
Data provider skeleton for SBTi. This class only provides the sbti_validated field for existing companies. Updated to DEFAULT to per-company format for TR Testing consistency. Enhanced to extract detailed target information when available.
- _detect_format(self, df)
Detect the format of the CTA file: - ‘old’: Original format with Title Case columns - ‘new_company’: New per-company format (one row per company) - PREFERRED - ‘new_target’: New per-target format (multiple rows per company)
- _ensure_compatible_format(self, df)
Convert CTA file to the format expected by the configs OPTIMIZED FOR PER-COMPANY FORMAT
- filter_cta_file(self, targets)
Filter the CTA file to create a dataframe that has one row per company with the columns “Action” and “Target”. If Action = Target then only keep the rows where Target = Near-term.
Handles all three formats: old, new per-company, and new per-target.
- get_company_targets(self, company_name: str = None, isin: str = None, lei: str = None)
Get all targets for a specific company. Only works with per-target format.
- Parameters
company_name – Company name to search for
isin – ISIN to search for
lei – LEI to search for
- Returns
DataFrame with all targets for the company
- get_companies(self, companies: List[SBTi.interfaces.IDataProviderCompany], id_map: Dict[str, Tuple[str, str]]) List[SBTi.interfaces.IDataProviderCompany]
Get company data from SBTi database and add sbti_validated field.
- Parameters
companies – A list of IDataProviderCompany instances
id_map – A map from company id to a tuple of (ISIN, LEI)
- Returns
A list of IDataProviderCompany instances, supplemented with the SBTi information
- get_sbti_targets(self, companies: List[SBTi.interfaces.IDataProviderCompany], id_map: Dict[str, Tuple[str, str]]) Tuple[List[SBTi.interfaces.IDataProviderCompany], Dict[str, List[SBTi.interfaces.IDataProviderTarget]]]
Enhanced version that returns both validation status AND target details when available.
- Parameters
companies – A list of IDataProviderCompany instances
id_map – A map from company id to a tuple of (ISIN, LEI)
- Returns
A tuple of: - List of IDataProviderCompany instances, supplemented with the SBTi information - Dictionary mapping company_id to list of IDataProviderTarget instances