Skip to content

feat: ROOT-43: Prediction results filter #8112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 100 commits into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
b4dbb77
feat: ROOT-45: Filter by annotator prototype
matt-bernstein Jun 17, 2025
b0fcde4
model changes
matt-bernstein Jun 17, 2025
e3ff613
migration
matt-bernstein Jun 17, 2025
21be28f
update migration
matt-bernstein Jun 17, 2025
57e79b4
Revert "update migration"
matt-bernstein Jun 17, 2025
ae7a9a7
async migration
matt-bernstein Jun 17, 2025
035677f
give up on index
matt-bernstein Jun 17, 2025
ba8e2f7
omit parent when appropriate
matt-bernstein Jun 17, 2025
8abe888
wip FE for child filters
matt-bernstein Jun 18, 2025
91331c0
allow parent index instead of parent id
matt-bernstein Jun 18, 2025
2b47439
use parent_index
matt-bernstein Jun 18, 2025
45230c6
ff
matt-bernstein Jun 18, 2025
cea1fe1
bugfix
matt-bernstein Jun 18, 2025
fccf130
filter counter bugfix
matt-bernstein Jun 18, 2025
89e09b7
don't double-display child filters
matt-bernstein Jun 18, 2025
50dda51
apply child filters correctly
matt-bernstein Jun 18, 2025
a43ab3d
Apply pre-commit linters
matt-bernstein Jun 18, 2025
30c3b2d
extend pydantic data model
matt-bernstein Jun 18, 2025
0918f2a
fix child filter persistence
matt-bernstein Jun 18, 2025
8804d78
wip persist from db
matt-bernstein Jun 18, 2025
1b11cd2
wip persist from db
matt-bernstein Jun 18, 2025
c781a49
wip remove parent_index from BE
matt-bernstein Jun 19, 2025
f34ed29
fix test
matt-bernstein Jun 19, 2025
addbecd
fix serializers
matt-bernstein Jun 20, 2025
7fff391
remove parent_index in favor of parent, id
matt-bernstein Jun 20, 2025
a38c17a
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jun 23, 2025
a567d62
Sync Follow Merge dependencies
matt-bernstein Jun 23, 2025
7a610b0
hierarchical filters FE
matt-bernstein Jun 23, 2025
cd11f3b
badge styling
matt-bernstein Jun 23, 2025
d141f0c
unstack child filters when applying them to queryset
matt-bernstein Jun 23, 2025
03bd71b
Merge branch 'develop' into fb-ROOT-45
jombooth Jun 23, 2025
f194fc8
consolidate serializing logic
matt-bernstein Jun 23, 2025
aaf1908
Merge branch 'fb-ROOT-45' of github.com:HumanSignal/label-studio into…
jombooth Jun 24, 2025
a1f6656
reduce queries in FilterGroupSerializer, reduce duplication in filter…
jombooth Jun 24, 2025
51978e4
put the index back
jombooth Jun 24, 2025
b76cb68
test POST and PATCH on the views API - effectively covering view dupl…
jombooth Jun 24, 2025
22b8f72
fix broken tests
jombooth Jun 24, 2025
7fbadb6
allowlist completed_by
jombooth Jun 24, 2025
2f060ea
Refactor Filter components for improved layout and styling
ricardoantoniocm Jun 24, 2025
f4707f0
Merge branch 'fb-ROOT-45' of https://github.com/heartexlabs/label-stu…
ricardoantoniocm Jun 24, 2025
33d38ef
Improves spacing.
ricardoantoniocm Jun 24, 2025
d5f0022
Fixes spacing on sidebar.
ricardoantoniocm Jun 24, 2025
3146e62
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jun 24, 2025
c99793a
revert guards
matt-bernstein Jun 24, 2025
c2141dc
fix guards
matt-bernstein Jun 24, 2025
be3874f
Revert "fix broken tests"
matt-bernstein Jun 24, 2025
5ebd6af
Revert "fix test"
matt-bernstein Jun 24, 2025
0dacb8b
wip
matt-bernstein Jun 24, 2025
e99264b
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jun 25, 2025
1a97b27
Sync Follow Merge dependencies
matt-bernstein Jun 25, 2025
2eb8e78
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jul 1, 2025
dfdbd8d
merge migrations
matt-bernstein Jul 1, 2025
4b4b431
syntax
matt-bernstein Jul 1, 2025
5da40be
Sync Follow Merge dependencies
matt-bernstein Jul 1, 2025
9aeb2af
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jul 2, 2025
8384838
Sync Follow Merge dependencies
matt-bernstein Jul 2, 2025
efb8440
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jul 2, 2025
abd53a7
add back views
matt-bernstein Jul 2, 2025
1ff201d
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Jul 24, 2025
4f6b370
Apply pre-commit linters
matt-bernstein Jul 24, 2025
261a260
Sync Follow Merge dependencies
matt-bernstein Jul 24, 2025
b532fc6
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 1, 2025
1fa4cc7
Sync Follow Merge dependencies
matt-bernstein Aug 1, 2025
294d128
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 1, 2025
1453390
fix partial child filter saving
matt-bernstein Aug 1, 2025
bcaa4d4
fix style
matt-bernstein Aug 1, 2025
763172f
Sync Follow Merge dependencies
matt-bernstein Aug 1, 2025
4848515
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 4, 2025
8ff38d9
handle annotator filter in child
matt-bernstein Aug 4, 2025
68baec5
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 4, 2025
efd83d5
join_filters -> child_filter
matt-bernstein Aug 4, 2025
e562d14
remove debug logs
matt-bernstein Aug 4, 2025
aec1cc4
make ChildFilterSerializer into a model serializer so that it Spectac…
jombooth Aug 4, 2025
08048a3
Sync Follow Merge dependencies
robot-ci-heartex Aug 4, 2025
bba2023
Merge branch 'develop' into 'fb-ROOT-45'
robot-ci-heartex Aug 4, 2025
8995ef2
fix cutoff connector text
matt-bernstein Aug 5, 2025
0142662
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 5, 2025
fd2ac8a
fix remove button
matt-bernstein Aug 5, 2025
9187272
revert style change
matt-bernstein Aug 5, 2025
24c8961
use update_fields
matt-bernstein Aug 5, 2025
afd65d5
fix margin
matt-bernstein Aug 5, 2025
184bffe
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 5, 2025
301865a
Merge remote-tracking branch 'origin/develop' into fb-ROOT-45
matt-bernstein Aug 6, 2025
198d9db
feat: ROOT-43: Prediction results filter
matt-bernstein Aug 6, 2025
c066ca6
add GIN index on predictions
matt-bernstein Aug 7, 2025
54eaeaa
don't display in FE
matt-bernstein Aug 7, 2025
8e434b1
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 8, 2025
14ccd17
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 8, 2025
6d0aaf2
nonatomic migration
matt-bernstein Aug 8, 2025
561bdf5
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 8, 2025
054e443
Merge remote-tracking branch 'origin/develop' into fb-ROOT-43
matt-bernstein Aug 11, 2025
5a1056e
fix lockfiles
matt-bernstein Aug 11, 2025
1c4e899
fix multiselect behavior
matt-bernstein Aug 12, 2025
83a5aed
rename
matt-bernstein Aug 12, 2025
6b904b5
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 12, 2025
113a106
Merge remote-tracking branch 'origin/develop' into fb-ROOT-43
matt-bernstein Aug 13, 2025
3008165
revert list default multiple change
matt-bernstein Aug 13, 2025
066ea73
move bugfix to separate PR
matt-bernstein Aug 13, 2025
ebdd0ac
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 13, 2025
8da0bef
Merge branch 'develop' into 'fb-ROOT-43'
matt-bernstein Aug 14, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Generated by Django 5.1.10 on 2025-08-07 16:14

import logging

from django.conf import settings
from django.db import migrations

from core.redis import start_job_async_or_sync
from core.models import AsyncMigrationStatus
from core.utils.common import btree_gin_migration_operations

logger = logging.getLogger(__name__)

IS_SQLITE = settings.DJANGO_DB == settings.DJANGO_DB_SQLITE

migration_name = "0056_prediction_result_proj_gin_idx_async"

SQL_CREATE_INDEX = (
"CREATE INDEX CONCURRENTLY IF NOT EXISTS tasks_predictions_result_proj_gin "
"ON prediction USING GIN (project_id, CAST(result AS text) gin_trgm_ops);"
)

SQL_DROP_INDEX = "DROP INDEX CONCURRENTLY IF EXISTS tasks_predictions_result_proj_gin;"

def _forward(migration_name: str):
"""Create the GIN index inside a dedicated job."""
# If the migration has already been executed, do nothing
migration, created = AsyncMigrationStatus.objects.get_or_create(
name=migration_name,
defaults={"status": AsyncMigrationStatus.STATUS_STARTED},
)
if not created:
logger.info("Migration %s already executed", migration_name)
return

logger.info("Starting async migration %s", migration_name)
from django.db import connection

with connection.cursor() as cursor:
cursor.execute(SQL_CREATE_INDEX)
migration.status = AsyncMigrationStatus.STATUS_FINISHED
migration.save()
logger.info("Async migration %s complete", migration_name)


def _backward(migration_name: str):
"""Revert the GIN index creation."""
migration = AsyncMigrationStatus.objects.create(
name=migration_name,
status=AsyncMigrationStatus.STATUS_STARTED,
)
logger.info("Reverting async migration %s", migration_name)
from django.db import connection

with connection.cursor() as cursor:
cursor.execute(SQL_DROP_INDEX)
migration.status = AsyncMigrationStatus.STATUS_FINISHED
migration.save()
logger.info("Revert of async migration %s complete", migration_name)


def forwards(apps, schema_editor):
if IS_SQLITE:
logger.info("SQLite detected; skipping GIN index creation")
return

# Only run on PostgreSQL
if not schema_editor.connection.vendor.startswith("postgres"):
logger.info("Database vendor: %s. Skipping index creation", schema_editor.connection.vendor)
return

start_job_async_or_sync(_forward, migration_name=migration_name)


def backwards(apps, schema_editor):
if IS_SQLITE:
logger.info("SQLite detected; skipping GIN index drop")
return

if not schema_editor.connection.vendor.startswith("postgres"):
logger.info("Database vendor: %s. Skipping index drop", schema_editor.connection.vendor)
return

start_job_async_or_sync(_backward, migration_name=migration_name)



class Migration(migrations.Migration):
atomic = False

dependencies = [
("tasks", "0055_task_proj_octlen_idx_async"),
]

operations = btree_gin_migration_operations(migrations.RunPython(forwards, backwards))
3 changes: 2 additions & 1 deletion web/libs/datamanager/src/stores/Tabs/tab_column.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ export const TabColumn = types

get isAnnotationResultsFilterColumn() {
// these columns are not visible in the column selector, but are used for filtering
return self.id.includes("annotations_results_json.") || self.id.endsWith(":annotations_results_json");
const hidden_column_ids = ["annotations_results_json", "predictions_results_json"];
return hidden_column_ids.some((id) => self.id.includes(`${id}.`) || self.id.endsWith(`:${id}`));
},
}))
.actions((self) => ({
Expand Down
Loading