# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['sustainalytics']

package_data = \
{'': ['*']}

install_requires = \
['pandas>=1.4.3,<2.0.0', 'requests>=2.28.1,<3.0.0', 'tqdm>=4.64.0,<5.0.0']

setup_kwargs = {
    'name': 'sustainalytics',
    'version': '0.2.0',
    'description': 'This is a package that helps clients access sustainalytics API',
    'long_description': "#### Introduction\n\n**Starting with sustainalytics 0.2.0, the package is compatible with API v2 only. If a v1-compatible version is needed, please install version 0.1.2 via this command:**\n\n```python\npip install pip install sustainalytics==0.1.2\n```\n\n\nThis python package provides access to Sustainalytics API (Application Programming Interface) service which provides developers with 24x7 programmatic access to Sustainalytics data. The API has been developed based on market standards with a primary focus on secure connectivity and ease of use. It allows users to retrieve and integrate Sustainalytics data into their own internal systems and custom or third-party applications\n\nThis document is meant to provide developers with python sample code for the Sustainalytics API service.\nTechnical documentation can also be found on the dedicated [website](https://api.sustainalytics.com/swagger/ui/index/index.html) for the API.\n\n![Figure1](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/Figure1.PNG)\n\n#### Installation\n<p>Install the package via pip with code below:\n\n\n```python\npip install sustainalytics\n```\n\nTo Upgrade:\n\n\n```python\npip install --upgrade sustainalytics\n```\n\n#### Connection\nA clientid and a secret key must be provided by the Sustainalytics Team in order to access the API.\nSee connection via python:\n\n\n```python\nfrom sustainalytics.api import API\n\n#Access\nclient_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\nclient_secret_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\n\ncon = API(client_id=client_id, client_secretkey=client_secret_key)\n\n#returns Bearer\nprint(con.access_headers)\n```\n\n### Endpoints\n\n#### DataService\n\nThe DataService enables the user to call the research data associated with the companies in the universe of access. Within this service there are two endpoints, as described below.\n\n![](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/dataservice.png)\n\nThe code below shows you how to extract data from these endpoints\n\n#### GetData \n\nRetrieves data from the DataService endpoint. 'identifiers' and 'productId' are **mandatory** endpoints\n\n\n##### __The 'identifiers' and 'productId' arguments can be combined with only one of the other arguments:__\n\n__identifiers__ : A list of security or entity identifiers separated by comma. You can obtain list of EntityIds from the con.get_universe_entityIds(keep_duplicates=True)\n\n__packageIds__ : A list of package ids separated by comma. You can obtain list of PackageIds from the con.get_packageIds()\n\n__fieldClusterIds__ : A list of field cluster ids separated by comma. You can obtain list of FieldClusterIds from the con.get_fieldClusterIds()\n\n__fieldIds__ : A list of field ids separated by comma. You can obtain list of FieldIds from the con.get_fieldIds()\n\n![](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/ds_params.png)\n\n\n```python\n#### GetData\ndata = con.get_data(identifiers=[], productId=[], packageIds=[], fieldClusterIds=[], fieldIds=[])\n#returns data for the specified identifier(s). 'identifiers' and 'productId' are required for the function to work.\nprint(data)\n```\n\n#### Product Structure & Definitions\n\nEach product is built from __data packages__ and each data package is built from __field clusters__. The __datafields__ are the smallest components of the product structure. \n\nThe Product Structure service provides an overview  of the data fields available in the  Sustainalytics API and the unique __FieldIds__ linked to each of these data fields. Within this service there are three endpoints, as described below.\n\n![Figure2](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/fids.png)\n\nThe code below shows you how to extract data from these endpoints\n\n\n```python\n#### FieldDefinitions\nfield_definitions = con.get_fieldDefinitions(dtype='dataframe') #by default dtype='json'\nprint(field_definitions)\n\n#### FieldMappings\nfield_mappings = con.get_fieldMappings(dtype='dataframe') #by default dtype='json'\nprint(field_mappings)\n\n#### FieldMappingDefinitions\nfield_mapping_definition = con.get_fieldMappingDefinitions(dtype='dataframe') #by default dtype='json'\nprint(field_mapping_definition)\n\n#### Extra FieldDefinition (non-Swagger)\nfullFieldDef = con.get_fullFieldDefinitions(dtype='dataframe')\nprint(fullFieldDef)\n```\n\n#### Reports\n\nThe ReportService endpoint allows users to retrieve a list of all available PDF report types by ReportId, ReportType, and ReportName for companies belonging to the universe of access. \n\n__(Please note this Endpoint is not part of the standard API product.)__\n\n![Figure3](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/reports.png)\n\nThe code below shows you how to extract data from these endpoints\n\n\n```python\n####ReportService\nreport_info = con.get_pdfReportInfo(productId=x,dtype='dataframe')  #by default dtype='json'\nwhere x be any integer value of existing product ids (for example, 10 for Corporate Data)\n#returns all the available report fieldIDs (reportids)\nprint(report_info)\n\n####ReportService(identifier)(reportid)\nreport_identifier_reportid = con.get_pdfReportUrl(identifier=x, reportId=y)\n#returns the url to given pdf report for specified companies (if available)\nprint(report_identifier_reportid)\n```\n\nThe function supports only 1 identifier and reportID per call.\n\n####  Universe of Access\n\nThe UniverseOfAccess endpoint allows users to determine the list of EntityIds contained in the universe of access (all permissioned securities lists).\n\n![Figure4](https://github.com/Kienka/sustainalytics/raw/master/sustainalytics/univ.png)\n\n\n```python\n####UniverseofAccess\nuniverse = con.get_universe_access(dtype='dataframe') #by default dtype='json'\n#returns all universe constituents\nprint(universe)\n```\n\n\n```python\n#### Extra non-Swagger functions\nfieldClusterIds = con.get_fieldClusterIds()\n#returns all clusterIds\nprint(fieldClusterIds)\n\nfieldIds = con.get_fieldIds()\n#returns all fieldIDs\nprint(fieldIds)\n\nfieldsInfo = con.get_fieldsInfo()\n#returns fields info\nprint(fieldsInfo)\n\nproductIds = con.get_productIds()\n#returns product IDs\nprint(productIds)\n\npackageIds = con.get_packageIds()\n#returns package IDs\nprint(packageIds)\n\npackageInfo = con.get_packageInfo()\n#returns package info\nprint(packageInfo)\n```\n",
    'author': 'Kienka Cromwell Kio',
    'author_email': 'kienka.kio@sustainalytics.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/Kienka/sustainalytics',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
