Skip to content

Scopes

from qdl import Scope

Scope

Scopes represent a long-running research initiative (where multiple (sub)projects can spawn from).

They can be created and managed by scope admins. Members add resources like datasets to scopes. Scopes can be restricted or unrestricted. When a scope is unrestricted, non-members have read access, but are not allowed to modify anything. If restricted, non-members have no access at all.

Parameters:

Name Type Description Default
uid UID

UID of the scope.

required
name NonEmptyString256

Name of the scope.

required
Notes

Creating and modifying scope objects in QDL requires scope admin privileges.

add_default_schema

Add a default schema to the local scope.

Parameters:

Name Type Description Default
default_schema Union[Schema, UID]

UID of a schema in QDL as a string, or a local Schema instance.

required

Raises:

Type Description
QdlSdkException

HTTP error code with description.

Notes

Only after updating the scope, is the default schema added to the scope in QDL.

See Also

SDK documentation for the different validation methods for datasets against a schema.

create

Create the local scope in QDL.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

default_schema property writable

The schema the dataset is validated against.

description property writable

Description of the scope.

exists classmethod

Check if the scope with the given UID exists in QDL.

Parameters:

Name Type Description Default
uid UID

UID of the scope.

required

Returns:

Type Description
bool

True when scope exists, otherwise False.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

get classmethod

Get the scope with the given UID from QDL.

An error is raised when the scope does not exist.

Parameters:

Name Type Description Default
uid UID

UID of the scope.

required

Returns:

Type Description
Scope

Created scope object from QDL.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

is_archived property writable

Flag that tells if the scope is archived.

is_restricted property writable

Flag that tells if the scope is restricted.

list classmethod

Get the scope(s) from QDL.

Optionally, add additional filters as keyword arguments.

Other Parameters:

Name Type Description
uid str

UID of the scope.

name str

Name of the scope(s).

is_restricted bool

Restricted scope(s).

is_archived bool

Archived scope(s).

owner str

Owner of the scope(s).

Returns:

Type Description
List[Scope]

List with the (filtered) scope instance(s) from QDL. Returns an empty list when no matches are found.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

list_attributes classmethod

Retrieve a list of attribute(s) with the given scope UID.

Possible additional filters are the attribute key, attribute value, or dataset UID.

Parameters:

Name Type Description Default
uid UID

UID of the scope.

required
key Optional[NonEmptyString64]

Key of the attribute.

None
value Optional[NonEmptyString256]

A value that is part of the attribute key(s).

None
dataset_uid Optional[UID]

UID of a dataset.

None

Returns:

Type Description
List[Attribute]

List with the (filtered) attribute instance(s) from QDL. Returns an empty list if no matching

List[Attribute]

attributes are found.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

Retrieve a list of all other attributes from the datasets which contain the given attribute(s).

When multiple key-value pairs are given, the dataset must contain all of these attributes (AND-relation). When more than one value is given for a single key, the dataset must contain one of them (OR-relation).

Parameters:

Name Type Description Default
uid UID

UID of the scope.

required
kwargs Any

The attribute key as a parameter and its value(s) as a string or a list of strings, for example: a_key=["a_value_1", "a_value_2"], b_key="b_value".

{}

Returns:

Type Description
List[Attribute]

List of attribute instances, or an empty list if no matching datasets are found, or if the matched datasets do not contain other attributes.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

name property writable

Name of the scope.

readme property writable

Information about the scope.

remove_default_schema

Remove the default schema from the local scope.

Notes

Only after updating the scope, is the default schema removed from the scope in QDL.

schema_validation_level property writable

Field that specifies the level of validation for datasets against the default schema.

See Also

SDK documentation for the different validation methods for datasets against a schema.

uid property writable

UID of the scope.

update

Update the scope in QDL with the changes from the local scope.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

Notes - An error is raised when the scope does not yet exist in QDL. - The UID of the scope cannot be updated.