Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ Example of a single dicom task object

### Common

APIs for update and delete are same over all tasks.
APIs for update and delete and count are same over all tasks.

#### Update Task

Expand Down Expand Up @@ -1916,6 +1916,15 @@ client.delete_task_annotations(task_id="YOUR_TASK_ID")
id_name_map = client.get_task_id_name_map(project="YOUR_PROJECT_SLUG")
```

#### Count Task
```python
task_count = client.count_tasks(
project="YOUR_PROJECT_SLUG",
status="approved", # status can be 'pending', 'registered', 'completed', 'skipped', 'reviewed' 'sent_back', 'approved', 'declined'
tags=["tag1", "tag2"] # up to 10 tags
)
```

#### Create Task from S3

Task creation from S3.
Expand Down
28 changes: 28 additions & 0 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,34 @@ def find_history(self, history_id: str) -> dict:

# Task Get

def count_tasks(
self,
project: str,
status: str = None,
external_status: str = None,
tags: list = None,
) -> int:
"""
Returns task count.

project is slug of your project (Required).
status can be 'registered', 'completed', 'skipped',
'reviewed', 'sent_back', 'approved', 'declined'. (Optional)
external_status can be 'registered', 'completed', 'skipped',
'reviewed', 'sent_back', 'approved', 'declined',
'customer_declined' (Optional).
tags is a list of tag (Optional).
"""
endpoint = "tasks/count"
params = {"project": project}
if status:
params["status"] = status
if external_status:
params["externalStatus"] = external_status
if tags:
params["tags"] = tags
return self.api.get_request(endpoint, params=params)

def get_image_tasks(
self,
project: str,
Expand Down