Skip to content

[Feature] Support multi-status filtering in record search #89

@JonnyTran

Description

@JonnyTran

Description

Support multi-status filtering in record search to improve the user experience by allowing users to view records with different statuses together. This enhancement leverages workspace schema configuration to provide intelligent filtering across multi-stage document extraction workflows.

Problem

  • Users can only filter records by a single status at a time (e.g., only "pending" or only "completed")
  • No way to view a combination of status-based records (e.g., both "pending" and "draft" records)
  • Limited filtering flexibility for different annotation workflows
  • Current implementation doesn't consider multi-stage extraction workflows where different statuses may be relevant

Proposed Solution

  1. Enhance Backend API: Modify record search to accept arrays of status values with workspace context
  2. Leverage Workspace Configuration: Use workspace schema configuration to provide intelligent status filtering
  3. Improve Frontend UI: Create multi-select filtering controls with workflow awareness
  4. Document-Centric Filtering: Enable filtering that considers document-level status across schemas

Implementation Details

Dependencies

  • Workspace schema configuration infrastructure should be available for optimal implementation
  • SchemaService should provide workflow context for status filtering
  • Document-centric APIs would enhance the filtering experience

Backend Changes

  1. Update search API to support multiple statuses:

    async def search_dataset_records(
        *,
        statuses: Optional[List[RecordStatus]] = Query(None),
        workspace_aware: bool = Query(False),
        # other parameters...
    ):
        if workspace_aware and statuses:
            schema_service = SchemaService(workspace_id, db)
            # Apply workspace-specific status logic
            filtered_statuses = schema_service.filter_relevant_statuses(statuses, dataset_id)
        # ... rest of implementation
  2. Enhance search engine queries to handle multiple status values efficiently:

    filters = [
        {"terms": {"status": statuses}} if statuses else None
    ]
  3. Add workspace context to status filtering for multi-stage workflows:

    • Consider document-level status across related datasets
    • Provide smart defaults based on workflow stage
    • Enable cross-dataset status filtering

Frontend Changes

  1. Update RecordCriteria model to support multiple statuses:

    export class RecordCriteria {
        statuses: RecordStatus[];
        workspaceAware: boolean;
        // existing properties...
    }
  2. Create enhanced status filter UI:

    • Multi-select checkboxes for status selection
    • Workflow-aware grouping of statuses
    • Smart presets based on workspace configuration
    • Visual indicators for document-level status
  3. Integrate with workspace schema configuration:

    • Load available statuses from workspace config
    • Show status relevance for current workflow stage
    • Provide workflow-specific filtering suggestions

Related Files

  • extralit/argilla-server/src/argilla_server/services/SchemaService.py - Workspace-aware status logic
  • extralit/argilla-server/src/argilla_server/api/handlers/v1/datasets/records.py - Enhanced search API
  • extralit/argilla-server/src/argilla_server/api/schemas/v1/records.py - Updated schema definitions
  • extralit/argilla-frontend/v1/domain/entities/record/RecordCriteria.ts - Updated criteria model
  • extralit/argilla-frontend/components/features/status-filter/ - Enhanced filter components

Acceptance Criteria

  • Backend API accepts and correctly processes multiple status values
  • Workspace schema configuration influences status filtering options
  • Frontend UI provides intuitive multi-select controls for record status filtering
  • Users can filter records by any combination of available statuses
  • Status filtering considers document-level context in multi-stage workflows
  • API responses correctly filter records based on multiple selected statuses
  • UI clearly indicates which status filters are currently active
  • Performance is maintained with multiple status filtering
  • Integration tests verify multi-status filtering behavior
  • Workspace-aware filtering provides relevant status suggestions

Related Issues

This is part of the strategic workspace-level schema management enhancement:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions