HumanSignal / HumanSignal/label-studio

Get tasks by data fields

Open
#986 0 comments 3 reactions 1 assignee Claimed by @makseq View on GitHub
backend feature SDK
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Is your feature request related to a problem? Please describe.**
My Label Studio tasks map closely to instances in my database and my data changes quickly (e.g. when I clean it some more, change preprocessing, add fields, etc.). Synchronising my database to Label Studio is tricky since interacting with the API requires knowing every tasks' ID. I could get all tasks using the `GET /api/projects//tasks/` endpoint, but that's tedious and just inefficient for large datasets.

**Describe the solution you'd like**
Getting a task by a data field rather than its primary id would solve this (mostly). To make this efficient, you will probably need to index the field in question, but that's up to you.
Specifically, the endpoint I would like is `GET /api/tasks?data.internal_id=my-db-id`. If you want to support indexing certain fields to make this fast in large datasets, a complementary endpoint might be `POST /api/projects/indices?field=data.internal_id` (with a corresponding `DELETE` and maybe a `GET` to see if the index is installed).

**Describe alternatives you've considered**
Keeping my own index of task ids to internal ids is possible, but mixes concerns and is tedious to maintain. Just iterating all tasks every time is slow.

**Additional context**
This was previously discussed in the Slack channel and I was prompted to suggest it here as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.