quartic_sdk.utilities.tag_data

Module Contents

Classes

TagData

This helper class is used for getting tag data by calling tagdata cursor api

class quartic_sdk.utilities.tag_data.TagData(tags, start_time, stop_time, api_helper, return_type=Constants.RETURN_PANDAS, wavelengths=[], transformations=[])

This helper class is used for getting tag data by calling tagdata cursor api

static raise_exception_for_transformation_schema(transformations, tags)

We validate the transformations schema. Its schema would be like the following: [{“transformation_type”: “interpolation”, “column”: “1”, “method”: “linear”}, {“transformation_type”: “aggregation”, “aggregation_column”: “2”, “aggregation_dict”: {“1”:{“1”:”max”},”2”:{“2”:”std”}}}] :param transformations: List of transformations in the schema as above :param tags: List of tag ids :return: (None) Does not return anything, raises exception if validation fails

classmethod get_tag_data(cls, tags, start_time, stop_time, api_helper, interval_min=1, aggregation_type='last', wide_df=True, return_type=Constants.RETURN_PANDAS, wavelengths=[], transformations=[])

The method gets the tag data based upon the parameters that are passed here :param start_time: (epoch) Start_time for getting data :param stop_time: (epoch) Stop_time for getting data :param interval_min: (int) The interval duration in minutes for downsampling the data :param aggregation_type: (str) The aggregation function to be used for the query. (Valid values: first, last) :param wide_df: (bool) If the response is needed in wide or long format. Defaults to True. :param return_type: The param decides whether the data after querying will be

json(when value is “json”) or pandas dataframe(when value is “pd”). By default, it takes the value as “json”

Parameters
  • wavelengths – dict containing list of wavelengths(string) as value with key “wavelengths” Used for getting data for a spectral tag for specified wavelengths. An example value here is: {“wavelengths:[‘1460000.0’,’1460001.0’]}

  • transformations

    Refers to the list of transformations. It supports either interpolation or aggregation, depending upon which, we pass the value of this dictionary. If transformation_type is “aggregation”, an optional key can be passed called aggregation_timestamp, which determines how the timestamp information will be retained after aggregation. Valid options are “first”, “last” or “discard”. By default, the last timestamp in each group will be retained. An example value here is: [{

    ”transformation_type”: “interpolation”, “column”: “3”, “method”: “linear”

    }, {

    “transformation_type”: “aggregation”, “aggregation_column”: “4”, “aggregation_dict”: {“3”: “max”}, “aggregation_timestamp”: “last”,

    }]

Returns

(DataIterator) DataIterator object which can be iterated to get the data between the given duration