The following are the categories that will be available for filters in the UI. In case of adding a new category, the first input ‘model.DataType.subject’ is the field from the model that will be used , display represents the way this field will be visible in the UI to the user, operations mark all the possible operations that can be done on that field (so far supported are: “==”, “!=”, “<”, “>”, “in”, “not in”). Type represents the type of input that is expected. So far string, date and list are supported.
In order to define a default filter, from the adapter interface add:
'conditions': FilterChain(fields= [FilterChain.datatype + ".subject", FilterChain.datatype + ".some_attribute", values= [["John Doe", "JohnDoe1"], "Some Attr Value"], operations= ["in", "=="])
- class tvb.core.entities.filters.chain.FilterChain(display_name='', fields=None, values=None, operations=None, operator_between_fields='and')¶
Class used to filter tables displayed in UI, based on few criteria. Initialize filter with a list of fields, and corresponding values.
- add_condition(field_name, operation_string, value)¶
Append to the list of conditions.
- algorithm = '$$ALGORITHM_INPUT$$'¶
- algorithm_category = '$$ALGORITHM_CATEGORY_INPUT$$'¶
- algorithm_category_replacement = 'AlgorithmCategory'¶
- algorithm_replacement = 'Algorithm'¶
- datatype = '$$DATATYPE_INPUT$$'¶
- datatype_replacement = 'DataType'¶
- classmethod from_json(input_dict)¶
From a JSON dictionary create a filter instance.
- classmethod get_filters_for_type(data_name)¶
Return the list of filters to appear in UI.
Python evaluate of the filter against a current given DataType Check a filter instance next to a given input.
datatype_to_check – the dataType to be checked against this filter instance
true if input passed false if input failed
- get_sql_filter_equivalent(datatype_to_check='DataType', operation_to_check='Operation', algorithm_to_check='Algorithm', algocategory_to_check='AlgorithmCategory')¶
Returns the computed SQL string from the given filter. The method may return None if the filter is None or the fields of the filter are not set.
The input to this method should be a string representing the name under which the variable you want to be filtered was binded in the callers namespace. e.g.
- def foo(var_to_filter, filter_entity):
- operation = '$$OPERATION_INPUT$$'¶
- operation_replacement = 'Operation'¶
Return a dictionary representation of the filter, to be used when needed.
- exception tvb.core.entities.filters.exceptions.InvalidFilterChainInput(message)¶
Exception raised if a input that does not match the declared filter is passed as input.
- class tvb.core.entities.filters.factory.StaticFiltersFactory¶
Factory class to build lists with static used filters through the application.
- FULL_VIEW = 'Full view'¶
- RELEVANT_VIEW = 'Relevant view'¶
- static build_datatype_filters(selected='Relevant view', single_filter=None)¶
Return all visibility filters for data structure page, or only one filter.
- static build_operations_filters(simulation_algorithm, logged_user_id)¶
list of filters that can be applied on Project View Operations page.