sdk.algorithm_config.create()

elements.sdk.api.algorithm_config

Create an Algorithm Configuration.

Creates a configuration of the specified Algorithm Version, including concrete values for all of the Algorithm parameters. This configuration is stored in the system and the Algorithm Config is returned to the user.

Parameters

  • algorithm_version_id (str) - algorithm version id for which to create a new config
  • algorithm_config (AlgorithmConfiguration) - Algorithm Config
  • name (str) - name of the Algorithm Config
  • description (str) - description of the Algorithm Config
👍

Algorithm Builder

See the Algorithm Builder section for more details on how to construct an Algorithm Config.

Returns

AlgorithmConfig

Example(s)

from elements.sdk.builders.algorithm_builder import AlgorithmConfiguration, DataType, DataSource

# Initialize algorithm config
dv_algo_config = AlgorithmConfiguration()

# Add data source
dv_algo_config.add_data_source(data_type=DataType.PINGS.value, data_source=DataSource.ADSBX)

# Add parameters
dv_algo_config.add_algorithm_parameter(key="look_back_time", value=24)
dv_algo_config.add_algorithm_parameter(key="look_forward_time", value=24)

# Set result grouping frequency
dv_algo_config.grouping_frequency(frequency="WEEKLY", value=1)

# Create algorithm config
await sdk.algorithm_config.create(
  algorithm_version_id="5ee03b8e-ab45-4553-b5f4-a5029254a9de",
  name="Device Visits",
  description="Produces an initial list of AOI visits per device",
  algorithm_config=dv_algo_config)

# Output (AlgorithmConfig)
{
    "algorithm": {
        "author": "[email protected]",
        "displayName": "Device Visits",
        "id": "7691e490-5fb2-4e8d-9859-2006c6dd1b14",
        "name": "device_visits-368af4d3"
    },
    "algorithmVersion": {
        "createdOn": "2022-10-26T19:14:03.884602Z",
        "id": "5ee03b8e-ab45-4553-b5f4-a5029254a9de",
        "manifest": {
            "container_parameters": {
                "command": [
                    "python",
                    "/orbital/base/algorithms/device_visits/src/py/device_visits/device_visits.py"
                ],
                "image": "orbitalinsight/device_visits:ff1cf7c9",
                "resource_request": {
                    "cpu_millicore": 200.0,
                    "gpu": 0.0,
                    "memory_gb": 5.0
                }
            },
            "inputs": [
                {
                    "data_type_name": "pings",
                    "max_count": 1.0,
                    "min_count": 1.0
                }
            ],
            "interface": {
                "interface_type": "FILESYSTEM_TASK_WORKER"
            },
            "manifest_version": "0.1.0",
            "metadata": {
                "description": "Produce a list of AOI visits per device, based on geolocation device pings.",
                "tags": [
                    "device_visits"
                ],
                "version": "0.0.5"
            },
            "outputs": {
                "observation_value_columns": [
                    "device_visits"
                ],
                "output_data_types": [
                    "device_visits"
                ]
            },
            "parameters": [
                {
                    "default": 24.0,
                    "description": "Number of hours to look back before the first recorded ping for each device, to analyze device movements.",
                    "max": 720.0,
                    "min": 0.0,
                    "name": "look_back_time",
                    "type": "integer",
                    "units": "hours"
                },
                {
                    "default": 24.0,
                    "description": "Number of hours to look forward after the last recorded ping for each device, to analyze device movements.",
                    "max": 720.0,
                    "min": 0.0,
                    "name": "look_forward_time",
                    "type": "integer",
                    "units": "hours"
                },
                {
                    "default": false,
                    "description": "If enabled, set the look back and look forward timestamp to be equal to the start and end of the given observation for all devices.",
                    "name": "override_visit_time",
                    "type": "boolean"
                }
            ]
        },
        "version": "0.0.5"
    },
    "config": {
        "data_sources": [
            {
                "data_source_ids": [
                    "adsbx_pings"
                ],
                "data_type_name": "pings"
            }
        ],
        "grouping": {
            "frequency": "WEEKLY",
            "value": 1.0
        },
        "parameters": {
            "look_back_time": 24.0,
            "look_forward_time": 24.0,
            "override_visit_time": false
        }
    },
    "createdOn": "2022-10-27T22:26:15.693781Z",
    "description": "Produces an initial list of AOI visits per device",
    "id": "a551c228-f283-42d4-899c-aefa2fa1e52d",
    "name": "Device Visits"
}