:mod:`quartic_sdk.core.entity_helpers.entity_list` ================================================== .. py:module:: quartic_sdk.core.entity_helpers.entity_list Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quartic_sdk.core.entity_helpers.entity_list.EntityList .. class:: EntityList(class_type, entities_list=[]) The given class refers to the list of specific `class_type` of entity .. method:: __repr__(self) Return the representation of the entitylist .. method:: __str__(self) Return the stringified representation of the entitylist .. method:: _validate_type(self, instance) We validate that the type of the object is the same as defined for the class definition .. method:: get(self, name, value) We return the entity with the given value for the name of the attribute .. method:: all(self) We return the list of all entities for the given object .. method:: first(self) Return the first element of the list .. method:: last(self) Return the last element of the list .. method:: count(self) Returns the length of all entities .. method:: filter(self, **kwargs) We filter the entities based upon the given conditions There might be multiple conditions :param kwargs: Dict which maps `filter_key` to filter_value The `filter_key` can be decomposed into two parts: (attribute, operator) For instance, if `filter_key` is `created_at__lt` then ('created_at', 'lt') It might also be a simple query where we check for equality, then `filter_key` is simply the attribute name .. method:: check_object_in_list(self, instance) We check whether the instance is already in the list :param instance: Object that is to be added to the list .. method:: add(self, instance) We add the given object instance to the entities list of the class .. method:: exclude(self, **kwargs) We return the EntityList after removing the entities with the attributes having the given values :param kwargs: Dict which maps `filter_key` to filter_value .. method:: __iter__(self) We override the iterator to allow the user to iterate on the class .. method:: __getitem__(self, key) Override the method to get the entity list value at the given index .. method:: __eq__(self, other) Check equality of two entity list objects .. method:: __bool__(self) Override to get the bool value of the class if required .. method:: data(self, start_time, stop_time, sampling_ratio=1, return_type=Constants.RETURN_PANDAS, batch_size=Constants.DEFAULT_PAGE_LIMIT_ROWS, transformations=[]) Get the data of all tags in the list between the given start_time and stop_time for the given sampling_ratio :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" :param 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", }] :return: (DataIterator) DataIterator object which can be iterated to get the data between the given duration