-
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Implement schema topological ordering in record display based on workspace schema configuration to ensure that records are displayed in a logical order based on their dependencies. This leverages the SchemaService to provide consistent, dependency-aware ordering.
Problem
- Schemas are not displayed in a consistent, dependency-based order
- Tables with references to other tables may appear before their referenced tables
- No mechanism exists to determine the logical order of related schemas
- Current implementation doesn't leverage workspace schema configuration for ordering
Proposed Solution
- Use Workspace Schema Configuration: Leverage the schema relationships defined in workspace configuration
- Integrate with SchemaService: Use SchemaService to compute topological ordering automatically
- Enhance Record Display: Update frontend to respect schema ordering from workspace configuration
- Maintain Consistency: Ensure ordering is consistent across all application components
Implementation Details
Dependencies
- Workspace schema configuration infrastructure must be implemented first
- SchemaService must provide topological ordering methods
- Schema relationship definitions must be available in workspace config
Backend Changes
-
Enhance SchemaService with ordering capabilities:
class SchemaService: def get_schema_ordering(self, workspace_id: UUID) -> List[str]: """Get topological ordering based on workspace schema config""" pass def get_schema_dependencies(self, workspace_id: UUID) -> Dict[str, List[str]]: """Get schema dependency mapping""" pass
-
Update record APIs to include schema ordering information:
- Add schema order metadata to record responses
- Sort records according to schema topological order
- Provide schema dependency information for frontend
-
Add workspace schema ordering endpoint:
@router.get("/workspaces/{workspace_id}/schema-ordering") async def get_workspace_schema_ordering(workspace_id: UUID): schema_service = SchemaService(workspace_id, db) return schema_service.get_schema_ordering()
Frontend Changes
-
Fetch schema ordering from workspace configuration:
- Load schema ordering when workspace/dataset is accessed
- Cache ordering information for performance
- Use ordering for all record display operations
-
Update record display components:
- Sort records according to schema ordering
- Display schema context and relationships
- Provide visual indicators for schema dependencies
-
Enhance navigation:
- Enable navigation based on schema order
- Show progress through schema workflow
- Highlight next logical steps in extraction process
Related Files
extralit/argilla-server/src/argilla_server/services/SchemaService.py- Core ordering logicextralit/argilla-server/src/argilla_server/api/handlers/v1/workspaces.py- Schema ordering endpointextralit/argilla-server/src/argilla_server/api/handlers/v1/datasets/records.py- Enhanced record sortingextralit/argilla-frontend/v1/domain/entities/workspace/- Workspace schema entitiesextralit/argilla-frontend/components/features/schema-ordering/- Ordering components
Acceptance Criteria
- SchemaService provides reliable topological ordering based on workspace configuration
- Backend APIs include schema ordering information in responses
- Frontend consistently applies schema ordering across all record displays
- Tables with references are displayed after the tables they reference
- Schema ordering is derived from workspace configuration, not hardcoded
- Visual indicators show schema relationships and dependencies
- Performance is optimized with appropriate caching
- Integration tests verify correct ordering behavior
- The ordering algorithm handles circular dependencies gracefully
Related Issues
This is part of the strategic workspace-level schema management enhancement:
- Depends on: Workspace Schema Configuration Infrastructure
- Related to: [Refactor] Group records by reference in annotation queue #87 (Record grouping), [Feature] Support multi-status filtering in record search #89 (Multi-status filtering)
- Part of: [Refactor] Phase 1: Improve record grouping, ordering, and filtering #95 (Phase 1 improvements)
- Enhances: Document-centric API layer development
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request