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')[source]¶
Class used to filter tables displayed in UI, based on few criteria. Initialize filter with a list of fields, and corresponding values.
- algorithm = '$$ALGORITHM_INPUT$$'¶
- algorithm_category = '$$ALGORITHM_CATEGORY_INPUT$$'¶
- algorithm_category_replacement = 'AlgorithmCategory'¶
- algorithm_replacement = 'Algorithm'¶
- datatype = '$$DATATYPE_INPUT$$'¶
- datatype_replacement = 'DataType'¶
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')[source]¶
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'¶
- exception tvb.core.entities.filters.exceptions.InvalidFilterChainInput(message)[source]¶
Exception raised if a input that does not match the declared filter is passed as input.
- exception tvb.core.entities.filters.exceptions.InvalidFilterEntity(message)[source]¶
Exception raised if a filter entity has contradicting values for operations and values. for example: in None, not in 1
- class tvb.core.entities.filters.factory.StaticFiltersFactory[source]¶
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)[source]¶
Return all visibility filters for data structure page, or only one filter.