models.Context

class Context(json, **kwargs)[source]

A virtual object representing a KE-chain Context.

New in version 3.12.

Construct a service from provided json data.

classmethod list(client: Client, **kwargs) List[Context][source]

List Context objects.

classmethod get(client: Client, **kwargs) Context[source]

Retrieve a single Context object.

edit(name: str | ~pykechain.utils.Empty | None = <pykechain.utils.Empty object>, description: str | ~pykechain.utils.Empty | None = <pykechain.utils.Empty object>, tags: ~typing.List[str | ~pykechain.utils.Empty] | None = <pykechain.utils.Empty object>, context_group: ~pykechain.enums.ContextGroup | ~pykechain.utils.Empty | None = <pykechain.utils.Empty object>, scope: Scope | str | ~uuid.UUID | None = <pykechain.utils.Empty object>, options: dict | None = <pykechain.utils.Empty object>, activities: ~typing.List[Activity] | ~typing.Iterable[str | ~uuid.UUID] | ~typing.KeysView | None = <pykechain.utils.Empty object>, feature_collection: dict | None = <pykechain.utils.Empty object>, start_date: ~datetime.datetime | None = <pykechain.utils.Empty object>, due_date: ~datetime.datetime | None = <pykechain.utils.Empty object>, **kwargs) Context[source]

Edit the Context.

Parameters:
  • name – Name of the Context to be displayed to the end-user.

  • scope – Scope object or Scope Id where the Context is active on.

  • description – (optional) description of the Context

  • activities – (optional) associated list of Activity or activity object ID

  • tags – (optional) tags

  • context_group – (optional) a context context_group of the choices of ContextGroup

  • options – (optional) dictionary with options.

  • feature_collection – (optional) dict with a geojson feature collection to store for a STATIC_LOCATION

  • start_date – (optional) start datetime for a TIME_PERIOD context

  • due_date – (optional) start datetime for a TIME_PERIOD context

Returns:

a created Context Object

Returns:

The updated Context object

Link a context to one or more activities.

Parameters:

activities – optional list of Activities or object Id’s from activities.

Returns:

updated context objects

Unlink a context to one or more activities.

Parameters:

activities – optional list of Activities or object Id’s from activities.

Returns:

updated context objects

delete()[source]

Delete the Context.