quartic_sdk.core.iterators

Submodules

Package Contents

Classes

EntityListIterator

The given class is the entity list iterator which will be used to iterate

TagDataIterator

The given class is the iterator class, which will be used to iterate

class quartic_sdk.core.iterators.EntityListIterator(base_entity_list)

The given class is the entity list iterator which will be used to iterate for the given list of entities

__next__(self)

Return the subsequent iteration results starting from 0 as index

class quartic_sdk.core.iterators.TagDataIterator(tags, start_time, stop_time, total_count, batch_size, api_helper, sampling_ratio=1, return_type=Constants.RETURN_JSON, wavelengths={}, transformations=[])

The given class is the iterator class, which will be used to iterate for getting the tag data values at the given intervals

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

create_post_data(self)

We create the required post data which will be used for making the POST call

__iter__(self)

Return the data iterator with the data fetch state set at 0

__next__(self)

Get the next object in the iteration. Note that the return object is inclusive of time ranges

classmethod create_tag_data_iterator(cls, tags, start_time, stop_time, api_helper, sampling_ratio=1, return_type=Constants.RETURN_PANDAS, batch_size=Constants.DEFAULT_PAGE_LIMIT_ROWS, wavelengths={}, transformations=[])

The method creates the TagDataIterator instance 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 sampling_ratio: sampling_ratio of the data :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