populse_mia.data_manager.filter

Mia Filter Module

This module provides the Filter class, which encapsulates the logic for handling both rapid and advanced search results in the Mia application.

It enables filtering of scans based on user-defined criteria, including:
  • Rapid search (simple text-based filtering)

  • Advanced search (complex queries with logical operators, conditions, and negations)

The Filter class supports:
  • Combining multiple query lines with logical operators (AND/OR)

  • Applying conditions (e.g., ==, !=, >, <, IN, BETWEEN, CONTAINS)

  • Negating conditions (NOT)

  • Serializing filter configurations to a dictionary for storage or transmission.

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.

Contains:

Methods:

  • generate_filter: apply the filter to the given list of scans

  • json_format: returns the filter as a dictionary

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

__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.

Returns:

(list) The list of scans matching the filter.

json_format()[source]

Return the filter as a dictionary.

Returns:

(dict) The filter as a dictionary.