AIOconnect Impact API

List of Functions

Definition of Functions

aioconnect.impact_api.create_DOT(token: str, DOT_name: str, DOT_baseline: float, DOT_description: Optional[str] = None, DOT_type_id: str = '6019fa2072b96c00133df326', METRIC_type_id: str = '5fb7bf2f8ce87f0012fcc8f3')

Create a new DOT in AIO Impact.

Parameters
tokenstr

Token which was returned from the user login.

DOT_namestr

Name of the DOT.

DOT_baselinefloat

Baseline value of the DOT.

DOT_descriptionstr = DOT_name

Description of the DOT.

DOT_type_idstr = “6019fa2072b96c00133df326”

ID of the DOT type.

METRIC_type_idstr = “5fb7bf2f8ce87f0012fcc8f3”

ID of the METRIC type.

Returns
requests.Response

HTTP response.

Examples

>>> token = aioconnect.get_token(
>>> email="firstname.lastname@aioneers.com", password="xxx",
>>> )
>>>
>>> res = aioconnect.create_DOT(
>>>     token=token,
>>>     DOT_name="TEST_DOT",
>>>     DOT_description="TEST_DOT description",
>>>     DOT_baseline=1234,
>>>     DOT_type_id="6019fa2072b96c00133df326",
>>>     METRIC_type_id="5fb7bf2f8ce87f0012fcc8f3",
>>> )
aioconnect.impact_api.create_bulk_DOT(token: str, dots_df: pandas.core.frame.DataFrame, DOT_type_id: str = '6019fa2072b96c00133df326', METRIC_type_id: str = '5fb7bf2f8ce87f0012fcc8f3')

Function to create DOTs from a data frame and additional key.

Parameters
tokenstr

Token which was returned from the user login.

dots_dfPandas.DataFrame

Dataframe which contains the key in the same format as it would be in the CSV upload.

DOT_type_idstr

ID of the DOT type.

METRIC_type_idstr

ID of the METRIC type.

Returns
requests.Response

Returns the HTTP response.

Examples

>>> username, df_t = transform_string(arg_string = "UserDirectory=AZUREQLIK; UserId=sebastian.szilvas@aioneers.com;DOT_name=1045,1058,1110,1449,3114;DOT_description=4K Ultra HD_1045,4K Ultra HD_1110,4K Ultra HD_1449,4K Ultra HD_3114,TVs_1000_1058;DOT_baseline=10846.75202,210810.99078,23874.0138,77647.14595363676,78107.53207446463")
>>> mytoken = get_token()
>>> res = create_bulk_DOT(
>>>     token = mytoken,
>>>     dots_df = df_t,
>>>     DOT_type_id = "6019fa2072b96c00133df326",
>>>     METRIC_type_id = "5fb7bf2f8ce87f0012fcc8f3",
>>> )
aioconnect.impact_api.delete_DOT_wID(token: str, DOT_id: str)

Function to delete a DOT.

Parameters
tokenstr

Token which was returned from the user login.

DOT_idstr

ID of the DOT.

Returns
requests.Response

Returns the HTTP response.

Examples

>>> token = aioconnect.get_token(
>>> email="firstname.lastname@aioneers.com", password="xxx",
>>> )
>>> res = delete_DOT_wID(
>>>     token = token,
>>>     DOT_id = "606b54d1c8153d00193838bd",
>>> )
aioconnect.impact_api.get_list(token: str, url: str = 'https://dev-api.aioneers.tech/v1/', object: str = 'dotTypes', key: str = '_id')list

Get List of values for a key of an object of the API.

Parameters
tokenstr

Token which was returned from the user login.

urlstr = “https://dev-api.aioneers.tech/v1/

Url of the API.

objectstr = “dotTypes”

Object to be extracted from the API.

keystr = “_id”

Key of the DOT.

Returns
list

Values for the provided key of the object.

Raises
ValueError

In case there was an object type given which does not exist.

aioconnect.impact_api.get_object(token: str, url: str = 'https://dev-api.aioneers.tech/v1/', object: str = 'dotTypes')list

Get JSON object.

Parameters
tokenstr

Token which was returned from the user login.

urlstr = “https://dev-api.aioneers.tech/v1/

Url of the API.

objectstr = “dotTypes”

Object to be extracted from the API.

Returns
list

List of JSON objects.

Raises
ValueError

Raises ValueError when the input is not correct.

aioconnect.impact_api.get_token(email: str, password: str)

Log into AIO Impact and get a token.

Parameters
emailstr

Email address of the user account.

passwordstr

Password of the user account.

Returns
str

Bearer token.

Examples

>>> aioconnect.get_token(
>>>     email="firstname.lastname@aioneers.com", password="xxx",
>>> )
aioconnect.impact_api.transform_string(arg_string: str)pandas.core.frame.DataFrame

Transform the string input from Qlik Sense and extract the relevant key.

Parameters
arg_stringstr

Input string sent from Qlik Sense.

Returns
str

The username, extracted from the string.

Pandas.DataFrame

A dataframe containing the key in a structured format.

Examples

>>> input_from_qlik = "UserDirectory=AZUREQLIK; UserId=sebastian.szilvas@aioneers.com;DOT_name=1045,1058,1110,1449,3114;DOT_description=4K Ultra HD_1045,4K Ultra HD_1110,4K Ultra HD_1449,4K Ultra HD_3114,TVs_1000_1058;DOT_baseline=10846.75202,210810.99078,23874.0138,77647.14595363676,78107.53207446463"
>>> (username, dots_df) = transform_string(arg_string=input_from_qlik)
aioconnect.impact_api.upsert_DOT(token: str, dataframe: pandas.core.frame.DataFrame)list

Create a new DOT in AIO Impact or update it if the DOT is already existing.

Parameters
tokenstr

Token which was returned from the user login.

dataframePandas.DataFrame

Dataframe containing DOT details.

Returns
requests.Response

HTTP response.

Examples

>>> token = aioconnect.get_token(
>>> email="firstname.lastname@aioneers.com", password="xxx",
>>> )
>>> res = aioconnect.upsert_DOT(
>>>     token=token,
>>>     dataframe = df
>>> )