vantage6.client.subclients.store.algorithm.AlgorithmSubClient#

class AlgorithmSubClient(parent)#

Bases: SubClient

Subclient for the algorithms from the algorithm store.

__init__(parent)#

Methods

__init__(parent)

create(name, description, image, ...[, ...])

Add an algorithm to the algorithm store

delete(id_)

Delete an algorithm from the algorithm store

get(id_)

Get an algorithm by its id.

invalidate(id_)

Invalidate an algorithm in the algorithm store.

list([name, description, image, ...])

List algorithms.

update(id_[, name, description, image, ...])

Update an algorithm in the algorithm store

create(name, description, image, partitioning, vantage6_version, code_url, functions, documentation_url=None)#

Add an algorithm to the algorithm store

Parameters:
  • name (str) – Name of the algorithm

  • description (str) – Description of the algorithm

  • image (str) – Docker image of the algorithm

  • partitioning (str) – Partitioning of the algorithm (horizontal or vertical)

  • vantage6_version (str) – Vantage6 version of the algorithm

  • code_url (str) – URL to the repository containing the algorithm code

  • functions (list[dict]) –

    List of functions of the algorithm. Each function is a dict with the following keys: - name: str

    Name of the function

    • description: str, optional

      Description of the function

    • type: string

      Type of the function (central or federated)

    • databases: list[dict]

      List of databases of the function. Each database is a dict with the following keys: - name: str

      Name of the database

      • description: str, optional

        Description of the database

    • arguments: list[dict]

      List of arguments of the function. Each argument is a dict with the following keys: - name: str

      Name of the argument

      • description: str, optional

        Description of the argument

      • type: str

        Type of the argument. Can be ‘string’, ‘integer’, ‘float’, ‘boolean’, ‘json’, ‘column’, ‘organization’ or ‘organizations’

    • ui_visualizations: list[dict]

      List of UI visualizations of the function. Each visualization is a dict with the following keys: - name: str

      Name of the visualization

      • description: str, optional

        Description of the visualization

      • type: str

        Type of the visualization. Can be ‘table’

      • schema: dict, optional

        Visualization details. For example, for a table, the schema could be a dict with the following keys: - location: list[str]

        Where data to be visualized are stored in the results. For example, if the data is stored in the ‘data’ key of the results, the location would be [‘data’].

        • columns: list[str]

          List of column names to visualize

  • documentation_url (str, optional) – URL to the documentation of the algorithm

  • field (str, optional) – Which data field to keep in the returned dict. For instance, “field=’name’” will only return the name of the algorithm. Default is None.

  • fields (list[str], optional) – Which data fields to keep in the returned dict. For instance, “fields=[‘name’, ‘id’]” will only return the name and id of the algorithm.

Returns:

The created algorithm

Return type:

dict

delete(id_)#

Delete an algorithm from the algorithm store

Parameters:

id (int) – Id of the algorithm

Return type:

None

get(id_)#

Get an algorithm by its id.

Parameters:
  • id (int) – The id of the algorithm.

  • field (str, optional) – Which data field to keep in the result. For instance, “field=’name’” will only return the name of the algorithm. Default is None.

  • fields (list[str], optional) – Which data fields to keep in the result. For instance, “fields=[‘name’, ‘id’]” will only return the name and id of the algorithm. Default is None.

Returns:

The algorithm.

Return type:

dict

invalidate(id_)#

Invalidate an algorithm in the algorithm store. An invalidated algorithm is marked as outdated but is not deleted - you can therefore still view it and link that to the results of executed analyses.

Parameters:
  • id (int) – Id of the algorithm

  • field (str, optional) – Which data field to keep in the returned dict. For instance, “field=’name’” will only return the name of the algorithm. Default is None.

  • fields (list[str], optional) – Which data fields to keep in the returned dict. For instance, “fields=[‘name’, ‘id’]” will only return the name and id of the algorithm.

Returns:

The invalidated algorithm

Return type:

dict

list(name=None, description=None, image=None, partitioning=None, v6_version=None, awaiting_reviewer_assignment=None, under_review=None, in_review_process=None, invalidated=None, page=1, per_page=10)#

List algorithms.

By default, only approved algorithms are returned.

Parameters:
  • name (str) – Filter by name (with LIKE operator).

  • description (str) – Filter by description (with LIKE operator).

  • image (str) – Filter by image (with LIKE operator).

  • partitioning (str) – Filter by partitioning (horizontal or vertical).

  • v6_version (str) – Filter by version (with LIKE operator).

  • awaiting_reviewer_assignment (bool) – Filter by whether the algorithm is awaiting reviewer assignment.

  • under_review (bool) – Filter by whether the algorithm is under review.

  • in_review_process (bool) – Filter by whether the algorithm is in the review process, i.e. either awaiting reviewer assignment or under review.

  • invalidated (bool) – Filter by whether the algorithm is invalidated.

  • field (str, optional) – Which data field to keep in the result. For instance, “field=’name’” will only return the name of the algorithms. Default is None.

  • fields (list[str], optional) – Which data fields to keep in the result. For instance, “fields=[‘name’, ‘id’]” will only return the name and id of the algorithms. Default is None.

  • filter (tuple, optional) – Filter the result on key-value pairs. For instance, “filter_=(‘name’, ‘algorithm1’)” will only return the algorithms with the name ‘algorithm1’. Default is None.

  • filters (list[tuple], optional) – Filter the result on multiple key-value pairs. For instance, “filters=[(‘name’, ‘algorithm1’), (‘id’, 1)]” will only return the algorithms with the name ‘algorithm1’ and id 1. Default is None.

  • page (int, optional) – The page number to retrieve.

  • per_page (int, optional) – The number of items to retrieve per page.

Returns:

List of algorithms

Return type:

list[dict]

update(id_, name=None, description=None, image=None, partitioning=None, vantage6_version=None, code_url=None, documentation_url=None, functions=None, refresh_digest=None)#

Update an algorithm in the algorithm store

Parameters:
  • id (int) – Id of the algorithm

  • name (str) – Name of the algorithm

  • description (str) – Description of the algorithm

  • image (str) – Docker image of the algorithm

  • partitioning (str) – Partitioning of the algorithm (horizontal or vertical)

  • vantage6_version (str) – Vantage6 version of the algorithm

  • code_url (str) – URL to the repository containing the algorithm code

  • documentation_url (str, optional) – URL to the documentation of the algorithm

  • functions (list[dict]) –

    List of functions of the algorithm. Each function is a dict with the following keys: - name: str

    Name of the function

    • description: str, optional

      Description of the function

    • type: string

      Type of the function (central or federated)

    • databases: list[dict]

      List of databases of the function. Each database is a dict with the following keys: - name: str

      Name of the database

      • description: str, optional

        Description of the database

    • arguments: list[dict]

      List of arguments of the function. Each argument is a dict with the following keys: - name: str

      Name of the argument

      • description: str, optional

        Description of the argument

      • type: str

        Type of the argument. Can be ‘string’, ‘integer’, ‘float’, ‘boolean’, ‘json’, ‘column’, ‘organization’ or ‘organizations’

    • ui_visualizations: list[dict]

      List of UI visualizations of the function. Each visualization is a dict with the following keys: - name: str

      Name of the visualization

      • description: str, optional

        Description of the visualization

      • type: str

        Type of the visualization. Can be ‘table’

      • schema: dict, optional

        Visualization details. For example, for a table, the schema could be a dict with the following keys: - location: list[str]

        Where data to be visualized are stored in the results. For example, if the data is stored in the ‘data’ key of the results, the location would be [‘data’].

        • columns: list[str]

          List of column names to visualize

    refresh_digestbool, optional

    Whether to refresh the digest of the algorithm. This is useful when the algorithm image has been updated before the algorithm was in review.

    fieldstr, optional

    Which data field to keep in the returned dict. For instance, “field=’name’” will only return the name of the algorithm. Default is None.

    fieldslist[str], optional

    Which data fields to keep in the returned dict. For instance, “fields=[‘name’, ‘id’]” will only return the name and id of the algorithm. Default is None.

Returns:

The updated algorithm

Return type:

dict