Data Model

Data model classes definition used throughout FarmVibes.AI.

class vibe_core.datamodel.Message(message, id=None, location=None)

Bases: object

Dataclass that represents an API message.

class vibe_core.datamodel.MetricsDict

Bases: TypedDict

Type definition for metrics dictionary.

class vibe_core.datamodel.MonitoredWorkflowRun(workflow, name, id, status, task_details)

Bases: object

Dataclass that represents the monitored workflow run information.

class vibe_core.datamodel.Region(name, geojson=<factory>)

Bases: object

Dataclass that represents a region.

class vibe_core.datamodel.RunBase(name, workflow, parameters)

Bases: object

Base dataclass for a run.

class vibe_core.datamodel.RunConfig(name, workflow, parameters, user_input, id, details, task_details, spatio_temporal_json, output='', history_compacted=False)

Bases: RunConfigInput

Dataclass that represents a run config.

set_output(value)

Set the output of the run config.

Parameters:

value (Dict[str, List[Dict[str, Any]] | Dict[str, Any]]) – The value to set the output to.

class vibe_core.datamodel.RunConfigInput(name, workflow, parameters, user_input)

Bases: RunBase

Dataclass that represents a run config input.

class vibe_core.datamodel.RunConfigUser(name, workflow, parameters, user_input, id, details, task_details, spatio_temporal_json, output='', history_compacted=False)

Bases: RunConfig

Dataclass that represents a run config for the user.

static finished(status)

Check if a run has finished.

This method checks if a given status is either vibe_core.datamodel.RunStatus.done, vibe_core.datamodel.RunStatus.cancelled, or vibe_core.datamodel.RunStatus.failed.

Parameters:

status (RunStatus) – The status to check.

Returns:

Whether the run has finished.

classmethod from_runconfig(run_config)

Create a RunConfigUser from a RunConfig.

Parameters:

run_config (RunConfig) – The run config to create the user run config from.

Returns:

The user run config.

class vibe_core.datamodel.RunDetails(start_time=None, submission_time=None, end_time=None, reason=None, status=RunStatus.pending, subtasks=None)

Bases: object

Dataclass that encapsulates the details of a run.

class vibe_core.datamodel.RunStatus(*values)

Bases: StrEnum

Enum that represents the status of a run.

static finished(status)

Check if a run has finished.

This method checks if a run status is either vibe_core.datamodel.RunStatus.done, vibe_core.datamodel.RunStatus.cancelled, or vibe_core.datamodel.RunStatus.failed.

Parameters:

status (RunStatus) – The status to check.

Returns:

Whether the run has finished.

class vibe_core.datamodel.SpatioTemporalJson(start_date, end_date, geojson)

Bases: object

Dataclass that represents a spatio temporal json.

class vibe_core.datamodel.TaskDescription(inputs=<factory>, outputs=<factory>, parameters=<factory>, task_descriptions=<factory>, short_description='', long_description='')

Bases: object

Dataclass that represents a task description.

class vibe_core.datamodel.WorkflowRun

Bases: ABC

An abstract base class for workflow runs.

abstract property output: List[ForwardRef('BaseVibe')]]

Get the output of the workflow run.

Returns:

The output of the workflow run as a vibe_core.data.BaseVibeDict.

Raises:

NotImplementedError – If the method is not implemented by a subclass.

abstract property status: str

Get the status of the workflow run.

Returns:

The status of the workflow run as a string.

Raises:

NotImplementedError – If the method is not implemented by a subclass.

vibe_core.datamodel.decode(data)

Decode the given data using zlib and base64 encodings.

Parameters:

data (str) – The string to decode.

Returns:

The decoded string.

Return type:

str

vibe_core.datamodel.encode(data)

Encode a string using zlib and base64 encoding.

This function compresses the data string with zlib and then encodes it into a base64 string.

Parameters:

data (str) – The string to be encoded.

Returns:

The encoded string.

Return type:

str