How to use#

Input arguments#

Python client example#

To understand the information below, you should be familiar with the vantage6 framework. If you are not, please read the documentation first, especially the part about the Python client.

Let’s say you want to know how many males and females are overweight in different age groups, e.g. something like:

AgeGroup

isOverweight

Male

Female

0-18

True

11

6

0-18

False

30

29

18-65

True

55

44

18-65

False

50

56

65+

True

5

10

65+

False

15

14

Such a result could be obtained by running the following Python client code. Note that AgeGroup, isOverweight, and Gender should be categorical values in your dataset, and that you should replace the values at the top to authenticate with your vantage6 server.

from vantage6.client import Client

server = 'http://localhost'
port = 5000
api_path = '/api'
private_key = None
username = 'root'
password = 'password'

# Create connection with the vantage6 server
client = Client(server, port, api_path)
client.setup_encryption(private_key)
client.authenticate(username, password)

input_ = {
  'method': 'central_crosstab',
  'kwargs': {
      'results_col': 'Gender',
      'group_cols': ["AgeGroup", "isOverweight"]
  }
}

my_task = client.task.create(
    collaboration=1,
    organizations=[1],
    name='Compute contingency table',
    description='Create a contingency table showing the relationship between two or more variables',
    image='harbor2.vantage6.ai/algorithms/v6-crosstab-py:latest',
    input=input_,
    databases=[
        {'label': 'default'}
    ]
)

task_id = my_task.get('id')
results = client.wait_for_results(task_id)