Dismantle entities
https://redmine.teklia.com/issues/11004
Requires #1919 (closed), #1920 (closed), #1921 (closed)
Model changes
-
The
Entitymodel is removed -
MetaData.entity_idis removed -
MetaData.clean()andMetaData.save()are removed -
The
Transcription.entitiesM2M is removed -
TranscriptionEntity.entityis removed -
TranscriptionEntity.typeis a new foreign key toEntityType. It is required, withon_deleteset toDO_NOTHINGto require us to write optimized queries to delete an EntityType. -
A
unique_transcription_entityconstraint should ensure uniqueness on(transcription_id, type_id, offset, length, worker_run_id) -
A data migration should update all existing
TranscriptionEntitywith the type of their entity
Search changes
- The
entity_*fields are renamed totranscriptionentity_*, which will requirereindex --drop - The
Indexerprefetches transcription entities through transcriptions, instead of entities through both transcriptions and metadata -
Indexer.build_entitiesbecomesIndexer.build_transcription_entities
API changes
-
The
entity_worker_runandentity_worker_versionfilters are removed fromListTranscriptionEntities -
BaseEntitySerializeris removed -
TranscriptionEntityCreateSerializeris removed -
TranscriptionEntitySerializeris updated:-
entityis replaced by a read-onlyEntityTypeLightSerializernamedtype - A new
type_idwrite-only field points to anEntityType, which replacesTranscriptionEntityCreateSerializer. This will replaceentitywithtype_idinCreateTranscriptionEntity
-
-
entitiesis renamed totranscription_entitiesinTranscriptionEntityBulkSerializer, which affectsCreateTranscriptionEntities -
entity_idis replaced withtype_idinTranscriptionEntityBulkItemSerializer, which affectsCreateTranscriptionEntities -
CreateTranscriptionEntityshould ensure that no TranscriptionEntity on the same transcription has the same type, offset, length and worker run before creating -
CreateTranscriptionEntitiesshould:- ensure that no TranscriptionEntity on the same transcription has the same type, offset, length and worker run before creating
- Return
{"transcription_entity_ids": [array of UUIDs]}