sift_client.resources.annotations
¶
| CLASS | DESCRIPTION |
|---|---|
AnnotationLogsAPIAsync |
High-level API for an annotation's history. |
AnnotationsAPIAsync |
High-level API for interacting with annotations. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
BATCH_LIMIT |
Annotations per call to BatchArchiveAnnotations, per the service.
|
BATCH_LIMIT
module-attribute
¶
Annotations per call to BatchArchiveAnnotations, per the service.
AnnotationLogsAPIAsync
¶
AnnotationLogsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for an annotation's history.
Each log records one event: an assignment, a state change, or a comment.
Reachable as client.annotations.logs.
Initialize the AnnotationLogsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
list_ |
List annotation logs. |
add_comment |
Add a comment to an annotation. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
list_
async
¶
list_(
*,
annotation: str | Annotation,
annotation_logs: list[str | AnnotationLog]
| None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
modified_after: datetime | None = None,
modified_before: datetime | None = None,
created_by: Any | str | None = None,
kind: AnnotationLogKind | None = None,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[AnnotationLog]
List annotation logs.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID whose history to list.
TYPE:
|
annotation_logs
|
Filter to these AnnotationLogs or log IDs.
TYPE:
|
created_after
|
Filter logs created after this datetime.
TYPE:
|
created_before
|
Filter logs created before this datetime.
TYPE:
|
modified_after
|
Filter logs modified after this datetime.
TYPE:
|
modified_before
|
Filter logs modified before this datetime.
TYPE:
|
created_by
|
Filter logs created by this user ID.
TYPE:
|
kind
|
Filter to comments, state updates, or assignments.
TYPE:
|
filter_query
|
Explicit CEL query to filter logs.
TYPE:
|
order_by
|
Field and direction to order results by.
TYPE:
|
limit
|
Maximum number of logs to return. If None, returns all matches.
TYPE:
|
page_size
|
Number of results to fetch per request.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[AnnotationLog]
|
A list of AnnotationLog objects that match the filter criteria. |
add_comment
async
¶
add_comment(
annotation: str | Annotation,
text: str | list[AnnotationCommentElement],
) -> AnnotationLog
Add a comment to an annotation.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID to comment on.
TYPE:
|
text
|
Plain text, or a list of elements to mix text with user mentions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnnotationLog
|
The created AnnotationLog. |
AnnotationsAPIAsync
¶
AnnotationsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with annotations.
An annotation marks a time range on one or more assets. A data review annotation carries a review state and an assignee. A phase annotation marks a segment of a run and carries no state.
Initialize the AnnotationsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
get |
Get an Annotation. |
list_ |
List annotations. |
find |
Find one annotation. Takes the same arguments as |
create |
Create an annotation. |
update |
Update an Annotation. |
archive |
Archive an annotation. |
unarchive |
Unarchive an annotation. |
batch_archive |
Archive many annotations, one call per |
batch_unarchive |
Unarchive many annotations, one call per |
assign_to_user |
Assign an annotation to a user for review. |
set_accepted |
Set the review state to Accepted. |
set_failed |
Set the review state to Failed. |
set_open |
Set the review state to Open. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
logs |
|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
get
async
¶
get(*, annotation_id: str) -> Annotation
Get an Annotation.
| PARAMETER | DESCRIPTION |
|---|---|
annotation_id
|
The ID of the annotation.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The Annotation. |
list_
async
¶
list_(
*,
name: str | Iterable[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
annotation_ids: list[str] | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
modified_after: datetime | None = None,
modified_before: datetime | None = None,
created_by: Any | str | None = None,
modified_by: Any | str | None = None,
tags: list[str] | list[Tag] | None = None,
metadata: dict[str, Any] | None = None,
annotation_type: AnnotationType | None = None,
state: AnnotationState | None = None,
assigned_to: Any | str | None = None,
pending: bool | None = None,
assets: list[Asset] | list[str] | None = None,
runs: list[Run] | list[str] | None = None,
rules: list[str | Rule] | None = None,
reports: list[str | Report] | None = None,
start_time_after: datetime | None = None,
start_time_before: datetime | None = None,
end_time_after: datetime | None = None,
end_time_before: datetime | None = None,
description_contains: str | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[Annotation]
List annotations.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact name, or any iterable of names to match against.
TYPE:
|
name_contains
|
Partial name of the annotation.
TYPE:
|
name_regex
|
Regular expression to filter annotations by name.
TYPE:
|
annotation_ids
|
Filter to annotations with any of these IDs.
TYPE:
|
created_after
|
Filter annotations created after this datetime.
TYPE:
|
created_before
|
Filter annotations created before this datetime.
TYPE:
|
modified_after
|
Filter annotations modified after this datetime.
TYPE:
|
modified_before
|
Filter annotations modified before this datetime.
TYPE:
|
created_by
|
Filter annotations created by this user ID.
TYPE:
|
modified_by
|
Filter annotations last modified by this user ID.
TYPE:
|
tags
|
Filter annotations with any of these Tags or tag names.
TYPE:
|
metadata
|
Filter annotations by metadata criteria.
TYPE:
|
annotation_type
|
Filter to DATA_REVIEW or PHASE annotations.
TYPE:
|
state
|
Filter to a review state.
TYPE:
|
assigned_to
|
Filter to annotations assigned to this user's name.
TYPE:
|
pending
|
Filter to annotations from an ongoing rule violation.
TYPE:
|
rules
|
Filter to annotations created by any of these Rules or rule IDs.
TYPE:
|
reports
|
Filter to annotations in any of these Reports or report IDs.
TYPE:
|
assets
|
Filter annotations on any of these Assets or asset IDs.
TYPE:
|
runs
|
Filter annotations on any of these Runs or run IDs.
TYPE:
|
start_time_after
|
Filter annotations that start after this datetime.
TYPE:
|
start_time_before
|
Filter annotations that start before this datetime.
TYPE:
|
end_time_after
|
Filter annotations that end after this datetime.
TYPE:
|
end_time_before
|
Filter annotations that end before this datetime.
TYPE:
|
description_contains
|
Partial description of the annotation.
TYPE:
|
include_archived
|
If True, include archived annotations in results.
TYPE:
|
filter_query
|
Explicit CEL query to filter annotations.
TYPE:
|
order_by
|
Field and direction to order results by.
TYPE:
|
limit
|
Maximum number of annotations to return. If None, returns all matches.
TYPE:
|
page_size
|
Number of results to fetch per request. Lower this if you hit gRPC message size limits on responses. If None, uses the server default.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Annotation]
|
A list of Annotation objects that match the filter criteria. |
find
async
¶
find(**kwargs) -> Annotation | None
Find one annotation. Takes the same arguments as list_.
Raises if more than one matches.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Keyword arguments to pass to
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation | None
|
The Annotation found or None. |
create
async
¶
create(create: AnnotationCreateBase | dict) -> Annotation
Create an annotation.
Pass an AnnotationCreate for a data review or a PhaseCreate for a phase. A
dict picks the model from its annotation_type, which may be a name or a number.
| PARAMETER | DESCRIPTION |
|---|---|
create
|
The annotation definition.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The created Annotation. |
update
async
¶
update(
annotation: str | Annotation,
update: AnnotationUpdate | dict,
) -> Annotation
Update an Annotation.
tags, linked_channels, and metadata are replaced, not merged.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID to update.
TYPE:
|
update
|
Updates to apply to the Annotation.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated Annotation. |
archive
async
¶
archive(annotation: str | Annotation) -> Annotation
Archive an annotation.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID to archive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The archived Annotation. |
unarchive
async
¶
unarchive(annotation: str | Annotation) -> Annotation
Unarchive an annotation.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID to unarchive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The unarchived Annotation. |
batch_archive
async
¶
batch_archive(
annotations: list[str | Annotation],
) -> list[Annotation]
Archive many annotations, one call per BATCH_LIMIT of them.
| PARAMETER | DESCRIPTION |
|---|---|
annotations
|
The Annotations or annotation IDs to archive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Annotation]
|
The archived Annotations. |
batch_unarchive
async
¶
batch_unarchive(
annotations: list[str | Annotation],
) -> list[Annotation]
Unarchive many annotations, one call per BATCH_LIMIT of them.
| PARAMETER | DESCRIPTION |
|---|---|
annotations
|
The Annotations or annotation IDs to unarchive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Annotation]
|
The unarchived Annotations. |
assign_to_user
async
¶
assign_to_user(
annotation: str | Annotation, user: str | User
) -> Annotation
Assign an annotation to a user for review.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID to assign.
TYPE:
|
user
|
The User or user ID to assign to.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated Annotation. |
set_accepted
async
¶
set_accepted(annotation: str | Annotation) -> Annotation
Set the review state to Accepted.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated Annotation. |
set_failed
async
¶
set_failed(annotation: str | Annotation) -> Annotation
Set the review state to Failed.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated Annotation. |
set_open
async
¶
set_open(annotation: str | Annotation) -> Annotation
Set the review state to Open.
| PARAMETER | DESCRIPTION |
|---|---|
annotation
|
The Annotation or annotation ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated Annotation. |