Draft: feat(annotation): implemented new annotations system
feat(annotation): implemented new annotations system
Description
This MR introduces a comprehensive annotation system to the Corpus Server, enabling flexible and secure storage and management of annotations on records. The system supports multiple annotation types including peer reviews and story annotations with role-based access control (RBAC).
Highlights
- New Core Components: Implemented complete annotation functionality with models, schemas, services, and API endpoints
- Flexible Annotation Types: Supports predefined types (peer-review, story-annotation) with extensibility for custom types
- Role-Based Access Control: Implemented RBAC with different permissions for admins, reviewers, and users
- Data Validation: Added comprehensive validation for annotation types, confidence scores, and text content
- API Endpoints: Full CRUD operations with filtering and pagination support
Changes
- Added app/models/annotation.py with SQLAlchemy model definition
- Added app/schemas/annotation.py with validation schemas for different annotation types
- Added app/services/annotation_service.py with business logic implementation
- Added app/api/v1/endpoints/annotations.py with complete API endpoints
- Implemented text content validation to prevent security issues
- Added comprehensive field validation for annotation types and confidence scores
Testing Considerations
- Test CRUD operations with different user roles
- Verify RBAC restrictions work correctly
- Validate annotation data validation rules
- Test pagination and filtering functionality
Checklist
-
The feature has been fully implemented. -
Tests for the new feature are included and passing. -
User documentation/guides have been updated (if applicable). -
Impact on existing functionality has been considered.
Related Issue(s)
Closes #85 (closed)