Skip to content

Using Modules

Note

This document has been machine translated.

Installed modules can be used by sending a request in Python as follows. Modules are not limited to Python, but can be used by sending a request via http(s).
Please refer to the documentation of each module for details on usage.

Parameters for requesting via Python client

When making a request via the Python client, specify parameters in the following format.

params = dict(
    module="fed-avg-module",
    method="fed_avg_aggregate",
    token="a",
    input={
        "input_model_set": {
            "model_store_ddc": "ddc:test_model",
            "query": {"=": ["model_state", 20]},
        }
    },
    output={
        "output_model": {
            "model_store_ddc": "ddc:test_model",
            "model_kind": "a",
            "model_description": "b",
        }
    },
    params={},
)
- module: the name of the module you want to run. - method: The name of the script defined in the definition.json file. - token: not implemented - input: parameter to be added to the input value defined in the definition.json scripts. - output: parameter to be added to the value of output defined in the definition.json scripts. - params: Not implemented.

input parameter

Specify if you want to add a parameter to the input value defined in the definition.json scripts.
The input key must match the input key value defined in the definition.json scripts.
There are also required parameters depending on the operation. The required parameters are as follows.

  • Required parameters when you want to retrieve a model from the model store

    • model_store_ddc: the name of the DDC from which you want to retrieve models (in the format ddc:xxxxxx)
    • query: JsonLogic condition for retrieving the model.
  • Required parameters for retrieving data from DDC in CSV format.

    • data_ddc: Name of the DDC from which to retrieve data (in the format ddc:xxxxxx).

output parameter

Specify if you want to add a parameter to the output value defined in the definition.json scripts.
The input key must match the output key value defined in the definition.json scripts.
There are also required parameters depending on the operation. The required parameters are as follows

  • Required parameters when you want to store models in the model store

    • model_store_ddc: Name of the DDC where you want to store the model (in the format ddc:xxxxxx)
  • Required parameter when saving data from CSV to DDC.

    • data_ddc: Name of the DDC where you want to store the data (in the format ddc:xxxxxx).

Condition columns that can be specified in query

  • start_datetime(timestamp with time zone)
  • end_datetime(timestamp with time zone)
  • tenant_id(varchar)
  • model_id(varchar)
  • model_kind(varchar)
  • model_description(varchar)
  • model_state(integer)
  • model_hash(varchar)
  • model_size(bigint)
  • round(integer)
  • hop_count(integer)

Example queries can be assembled as follows

query example 1

{"=": ["model_state", 20]}

query example 2

{
    "and": [
        {"=": ["model_state", 20]},
        {">": ["model_size", 400]}
    ]
}