populse_mia.data_manager.filter

Module that handle the filter class which contains the results of both rapid and advanced search

Contains:
Class:
  • Filter

Classes

Filter(name, nots, values, fields, links, ...)

Class that represent a Filter, containing the results of both rapid and advanced search.

class populse_mia.data_manager.filter.Filter(name, nots, values, fields, links, conditions, search_bar)[source]

Bases: object

Class that represent a Filter, containing the results of both rapid and advanced search.

The advanced search creates a complex query to the database and is a combination of several “query lines” which are linked with AND or OR and all composed of: - A negation or not - A tag name or all visible tags - A condition (==, !=, >, <, >=, <=, CONTAINS, IN, BETWEEN) - A value

Parameters:
  • name – filter’s name

  • nots – list of negations (”” or NOT)

  • values – list of values

  • fields – list of list of fields

  • links – list of links (AND/OR)

  • conditions – list of conditions (==, !=, <, >, <=, >=, IN, BETWEEN, CONTAINS, HAS VALUE, HAS NO VALUE)

  • search_bar – value in the rapid search bar

__init__(name, nots, values, fields, links, conditions, search_bar)[source]

Initialization of the Filter class.

Parameters:
  • name – filter’s name

  • nots – list of negations (”” or NOT)

  • values – list of values

  • fields – list of list of fields

  • links – list of links (AND/OR)

  • conditions – list of conditions (==, !=, <, >, <=, >=, IN, BETWEEN, CONTAINS, HAS VALUE, HAS NO VALUE)

  • search_bar – value in the rapid search bar

generate_filter(current_project, scans, tags)[source]

Apply the filter to the given list of scans.

Parameters:
  • current_project – Current project.

  • scans – List of scans to apply the filter into.

  • tags – List of tags to search in.

Return (list):

The list of scans matching the filter.

json_format()[source]

Return the filter as a dictionary.

Return (dict):

The filter as a dictionary.