Skip to content
Snippets Groups Projects

CreateTranscriptions endpoint

Merged Erwan Rouchet requested to merge create-transcriptions into master
All threads resolved!
3 files
+ 60
23
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 11
15
@@ -3,8 +3,8 @@ from django.db import transaction
from django.db.models import Q, Count
from rest_framework import status
from rest_framework.generics import (
GenericAPIView, ListAPIView, ListCreateAPIView,
CreateAPIView, UpdateAPIView, RetrieveDestroyAPIView, RetrieveUpdateDestroyAPIView
GenericAPIView, ListAPIView, ListCreateAPIView, CreateAPIView,
RetrieveDestroyAPIView, RetrieveUpdateDestroyAPIView
)
from rest_framework.exceptions import PermissionDenied, ValidationError
from rest_framework.response import Response
@@ -13,9 +13,10 @@ from arkindex.documents.models import \
from arkindex_common.ml_tool import MLToolType
from arkindex.documents.serializers.ml import (
ClassificationsSerializer, ClassificationCreateSerializer, ClassificationSerializer,
TranscriptionSerializer, TranscriptionCreateSerializer, ElementTranscriptionsBulkSerializer,
DataSourceStatsSerializer, ClassificationsSelectionSerializer, ClassificationMode,
CountMLClassSerializer, AnnotatedElementSerializer
ClassificationsSelectionSerializer, ClassificationMode,
TranscriptionSerializer, TranscriptionCreateSerializer, TranscriptionBulkSerializer,
ElementTranscriptionsBulkSerializer, AnnotatedElementSerializer,
DataSourceStatsSerializer, CountMLClassSerializer
)
from arkindex.images.models import Zone
from arkindex.project.filters import SafeSearchFilter
@@ -292,21 +293,16 @@ class ElementTranscriptionsBulk(CreateAPIView):
return annotations
class TranscriptionBulk(DeprecatedMixin, CreateAPIView, UpdateAPIView):
class TranscriptionBulk(CreateAPIView):
'''
Create multiple transcriptions at once, all linked to the same page
and to the same recognizer.
Create multiple transcriptions at once on existing elements
'''
# Force DRF to ignore PATCH
http_method_names = ['post', 'put', 'head', 'options', 'trace']
openapi_overrides = {
'operationId': 'CreateTranscriptions',
'tags': ['transcriptions'],
}
deprecation_message = (
'Creating or updating transcriptions with their own zones is now deprecated. '
'Please use CreateElementTranscriptions to push transcriptions in bulk '
'attached to sub-elements.'
)
permission_classes = (IsVerified, )
serializer_class = TranscriptionBulkSerializer
class CorpusMLClassList(CorpusACLMixin, ListCreateAPIView):
Loading