Skip to content

Module Usage

Note

This document has been machine translated.

Modules that have been installed can be invoked by sending a request in Python as shown below.
The modules are not limited to Python; they can be accessed by sending an HTTP(S) request.
For detailed usage, refer to the documentation of each module.

Parameters for Requests via Python Client

When making a request through the Python client, parameters are specified 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 – Name of the module to execute
  • method – Script name defined in definition.json → scripts
  • token – Unimplemented
  • input – Parameters added to the input value defined in definition.json → scripts
  • output – Parameters added to the output value defined in definition.json → scripts
  • params – Unimplemented

Input Parameters

Specify when adding parameters to the input value defined in definition.json → scripts.
The key of input must match the key defined in definition.json → scripts.
Certain operations require mandatory parameters, which are listed below.

  • When retrieving a model from the model store
  • model_store_ddc – DDC name from which to retrieve the model (ddc:xxxxx format)
  • query – Retrieval conditions expressed in JsonLogic

  • When extracting data from a DDC in CSV format

  • data_ddc – DDC name from which to retrieve the data (ddc:xxxxx format)

Output Parameters

Specify when adding parameters to the output value defined in definition.json → scripts.
The key of output must match the key defined in definition.json → scripts.
Certain operations require mandatory parameters, which are listed below.

  • When saving a model to the model store
  • model_store_ddc – DDC name in which to save the model (ddc:xxxxx format)

  • When saving data from CSV to a DDC

  • data_ddc – DDC name in which to save the data (ddc:xxxxx format)

Query‑able Condition Columns

  • 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 are constructed as follows.

Query Example 1

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

Query Example 2

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