Properties
-
dataset_version_id
UUID of the DatasetVersion of this campaign -
name
Deprecated property
Methods
delete
delete()
Description
Delete a campaign.
⚠️ DANGER ZONE: Be very careful here!
It will remove this campaign from our database, all tasks and assignments will be removed.
This will not delete annotations, reviews and assets.
Examples
foo_campaign.delete()
add_step
add_step(
name: str, type: Union[CampaignStepType, str], description: Optional[str] = None,
assignees: Optional[list[tuple[Union[Worker, UUID], Union[float, int]]]] = None,
order: Optional[int] = None, sample_rate: Optional[float] = None
)
Description
Add a step on this campaign.
Examples
workers = foo_dataset.list_workers()
# In first step, 2 over 3 annotation task will be assigned to worker 1, third one is going to worker 0
foo_campaign.add_step(
name="annotation-step",
type="ANNOTATION",
description="annotation step",
assignees=[(workers[0], 1.0), (workers[1], 2.0)]
)
# In second step, all review task will be assigned to worker 2
foo_campaign.add_step(
name="review-step",
type="REVIEW",
description="review step",
assignees=[(workers[2], 1)]
)
Arguments
-
name (str) : name of the step
-
type (str or CampaignStepType) : Type of the step: can be ANNOTATION or REVIEW
-
description (str, optional) : Description of the step. Defaults to None.
-
assignees (list of tuple of (worker or UUID), float, optional) : Can be used to assign workers to this step.
Defaults to None. -
order (int, optional) : Index where to insert the step in the workflow, the step will be appended at the end
if nothing is specified. Defaults to None. -
sample_rate (float, optional) : sample rate of this step. Defaults to None.
Returns
dict, data of this step
list_steps
list_steps()
Description
List all the steps of this campaign.
Returns
a list of steps of this campaign as python dict
update
update(
name: Optional[str] = None, description: Optional[str] = None,
instructions_object_name: Optional[str] = None,
instructions_text: Optional[str] = None, end_date: Optional[date] = None,
auto_add_new_assets: Optional[bool] = None,
auto_close_on_completion: Optional[bool] = None,
default_entry_step: Optional[AnnotationCampaignStep] = None,
annotated_entry_step: Optional[AnnotationCampaignStep] = None
)
Description
Update this campaign parameters
Examples
foo_campaign.update(description="Yet another campaign")
Arguments
-
name (str, optional) : deprecated.
-
description (str, optional) : Description of the campaign. Defaults to None.
-
instructions_object_name (str, optional) : Instructions file object name stored on S3. Defaults to None.
-
instructions_text (str, optional) : Instructions text. Defaults to None.
-
end_date (date, optional) : End date of the campaign. Defaults to None.
-
default_entry_step (Step, optional) : Step where tasks will be created for items that have no annotations.
-
annotated_entry_step (Step, optional) : Step where tasks will be created for items already containing annotations
auto_add_new_assets (bool, optional):
If true, new assets of this dataset will be added as a task in the campaign. Defaults to None.
auto_close_on_completion (bool, optional):
If true, campaign will be close when all tasks will be done. Defaults to None.
upload_instructions_file
upload_instructions_file(
path: str
)
Description
Upload instructions for this campaign
Examples
foo_campaign.upload_instructions_file("/path/to/file.pdf")
Arguments
- path (str) : Path of instructions file
launch
launch(
existing_annotations_step_id: Union[str, UUID, None] = None
)
Description
This method is deprecated. self.sync_assets() should be used instead
Launch this campaign, creating assignments on steps you have created before.
Examples
workers = foo_dataset.list_workers()
foo_campaign = foo_dataset_version.create_campaign()
foo_campaign.add_step(
name="annotation-step",
type="ANNOTATION",
assignees=[(workers[0], 1.0), (workers[1], 2.0)]
)
review_step = foo_campaign.add_step(
name="review-step",
type="REVIEW",
assignees=[(workers[2], 1)]
)
foo_campaign.launch(existing_annotations_step_id=review_step["id"])
Arguments
existing_annotations_step_id (UUID or str, optional):
If given, will create assignments for existing annotations on given step_id.
You also can give "DONE" in this field, it will create assignments in DONE last step. Defaults to None.
Returns
a Job, that you can wait for.
sync_assets
sync_assets(
existing_annotations_step_id: Union[str, UUID, None] = None
)
Description
This will create tasks and assignments for assets that are not in the campaign yet.
By default, your already annotated assets will be synced to the annotated_entry_step in your campaign settings.
Using existing_annotations_step_id here will override this setting once.
Arguments
existing_annotations_step_id (UUID or str, optional):
If given, will create assignments for existing annotations on given step_id.
You also can give "DONE" in this field, it will create assignments in DONE last step. Defaults to None.
Returns
a Job, that you can wait for.