Bulk Transcriptions v2
The goal is to add a new endpoint to create transcriptions on a element in bulk, but adding sub elements. It will be set under api/v1/element/<uuid:pk>/transcriptions/bulk/
to ease the serializer integration (instead of using the ElementTranscriptions
existing endpoint.
This endpoint should only be available as a POST
to create new elements & transcriptions.
Its serializer has those fields:
-
type
: anElementType
used to create sub elements. Only one type is allowed per request -
source
: aDataSource
id or slug, unique per request too. It cannot be set tomanual
-
transcriptions
: a list of transcriptions with the following fields:-
zone
: a Polygon describing where the transcription is set on the parent's image -
transcription
: the transcription's value
-
The endpoint should have the following general logic:
- list the ascending paths for the target (top) element
- list all the requested zones, and find any existing ones on the target image
- if any existing zones is found, find any element with the corresponding requested type & existing zones
- bulk create the missing zones. We should have a list of all the zones in memory by now
- bulk create the missing elements linked to their zone. We should have a list of all the elements in memory by now
- bulk create the element paths for the new elements
- bulk create the transcription linked to the elements
The bulk create operations should be set in a transaction.