training fix. add global settings
This commit is contained in:
21
backend/models/AnnotationProjectMapping.py
Normal file
21
backend/models/AnnotationProjectMapping.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from database.database import db
|
||||
|
||||
class AnnotationProjectMapping(db.Model):
|
||||
"""Mapping between training project details and label studio projects (3NF)"""
|
||||
__tablename__ = 'annotation_project_mapping'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
project_details_id = db.Column(db.Integer, db.ForeignKey('training_project_details.id', ondelete='CASCADE'), nullable=False)
|
||||
label_studio_project_id = db.Column(db.Integer, db.ForeignKey('label_studio_project.project_id', ondelete='CASCADE'), nullable=False)
|
||||
|
||||
# Unique constraint: each label studio project can only be mapped once per training project details
|
||||
__table_args__ = (
|
||||
db.UniqueConstraint('project_details_id', 'label_studio_project_id', name='uq_annotation_mapping'),
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'project_details_id': self.project_details_id,
|
||||
'label_studio_project_id': self.label_studio_project_id
|
||||
}
|
||||
Reference in New Issue
Block a user