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 logic
extralit/argilla-server/src/argilla_server/api/handlers/v1/workspaces.py - Schema ordering endpoint
extralit/argilla-server/src/argilla_server/api/handlers/v1/datasets/records.py - Enhanced record sorting
extralit/argilla-frontend/v1/domain/entities/workspace/ - Workspace schema entities
extralit/argilla-frontend/components/features/schema-ordering/ - Ordering components
Acceptance Criteria
Related Issues
This is part of the strategic workspace-level schema management enhancement:
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
Proposed Solution
Implementation Details
Dependencies
Backend Changes
Enhance SchemaService with ordering capabilities:
Update record APIs to include schema ordering information:
Add workspace schema ordering endpoint:
Frontend Changes
Fetch schema ordering from workspace configuration:
Update record display components:
Enhance navigation:
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 componentsAcceptance Criteria
Related Issues
This is part of the strategic workspace-level schema management enhancement: