SBTi.data

This module contains classes that create connections to data providers.

Submodules

Package Contents

Classes

DataProvider

General data provider super class.

CSVProvider

Data provider skeleton for CSV files. This class serves primarily for testing purposes only!

ExcelProvider

Data provider skeleton for CSV files. This class serves primarily for testing purposes only!

Bloomberg

Data provider skeleton for Bloomberg.

CDP

Data provider skeleton for CDP.

ISS

Data provider skeleton for ISS.

Trucost

Data provider skeleton for Trucost.

Urgentem

Data provider skeleton for Urgentem.

class SBTi.data.DataProvider(**kwargs)

Bases: abc.ABC

General data provider super class.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.CSVProvider(path: str, path_targets: str, encoding: str = 'utf-8')

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for CSV files. This class serves primarily for testing purposes only!

Parameters

config – A dictionary containing a “path” field that leads to the path of the CSV file

get_targets(self, company_ids: list) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

_target_df_to_model(self, df_targets)

transforms target Dataframe into list of IDataProviderTarget instances

Parameters

df_targets – pandas Dataframe with targets

Returns

A list containing the targets

get_company_data(self, company_ids: list) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.ExcelProvider(path: str, config: Type[SBTi.configs.ColumnsConfig] = ColumnsConfig)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for CSV files. This class serves primarily for testing purposes only!

Parameters

config – A dictionary containing a “path” field that leads to the path of the CSV file

get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

_target_df_to_model(self, df_targets)

transforms target Dataframe into list of IDataProviderTarget instances

Parameters

df_targets – pandas Dataframe with targets

Returns

A list containing the targets

get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.Bloomberg(**kwargs)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for Bloomberg.

_request(self, endpoint: str, data: dict) Optional[object]

Request data from the server. Note: This request does in no way reflect the actual implementation, this is only a stub to show what a potential API request COULD look like.

Parameters
  • endpoint – The endpoint of the API

  • data – The data to send as a body

Returns

The returned data, None in case of an error.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.CDP(**kwargs)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for CDP.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.ISS(**kwargs)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for ISS.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.Trucost(**kwargs)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for Trucost.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Parameters

companies – A list of companies. Each company should be a dict with a “company_name” and “company_id” field.

Returns

The original list, enriched with a field called “sbti_target_status”

class SBTi.data.Urgentem(**kwargs)

Bases: SBTi.data.data_provider.DataProvider

Data provider skeleton for Urgentem.

abstract get_targets(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderTarget]

Get all relevant targets for a list of company ids (ISIN). This method should return a list of IDataProviderTarget instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the targets

abstract get_company_data(self, company_ids: List[str]) List[SBTi.interfaces.IDataProviderCompany]

Get all relevant data for a list of company ids (ISIN). This method should return a list of IDataProviderCompany instances.

Parameters

company_ids – A list of company IDs (ISINs)

Returns

A list containing the company data

abstract get_sbti_targets(self, companies: list) list

For each of the companies, get the status of their target (Target set, Committed or No target) as it’s known to the SBTi.

Returns

The original list, enriched with a field called “sbti_target_status”