An individual annotation instance
| 12 | |
| 13 | |
| 14 | class Instance(Base): |
| 15 | """ |
| 16 | An individual annotation instance |
| 17 | |
| 18 | """ |
| 19 | __tablename__ = 'instance' |
| 20 | |
| 21 | id = Column(BIGINT, primary_key = True) |
| 22 | previous_id = Column(BIGINT) |
| 23 | next_id = Column(BIGINT) |
| 24 | root_id = Column(BIGINT, index = True) |
| 25 | version = Column(Integer, default = 0) |
| 26 | |
| 27 | created_time = Column(DateTime, default = datetime.datetime.utcnow) |
| 28 | last_updated_time = Column(DateTime, onupdate = datetime.datetime.utcnow) |
| 29 | client_created_time = Column(DateTime, nullable = True) |
| 30 | deleted_time = Column(DateTime, nullable = True) |
| 31 | |
| 32 | # Used to explain why the instance was deleted, currently 2 cases: |
| 33 | # system: means that the instance was deleted by the version control system, any type of edit trigger this type. |
| 34 | # user: means that the user purposefully deleted the instance |
| 35 | # null: usually this value is on the "most recent" instance version ie, no delete actions after it. |
| 36 | deletion_type = Column(String, nullable = True) |
| 37 | |
| 38 | # For defining the type of action that happened to the instance when it changed (edited, deleted, created, etc) |
| 39 | action_type = Column(String, nullable = True) |
| 40 | |
| 41 | # For knowing the source of the update (SDK/Frontend, Third Party, ectc) |
| 42 | change_source = Column(String, nullable = True) |
| 43 | |
| 44 | project_id = Column(Integer, ForeignKey('project.id')) |
| 45 | project = relationship("Project") |
| 46 | |
| 47 | model_id = Column(Integer, ForeignKey('model.id')) |
| 48 | model = relationship(Model) |
| 49 | |
| 50 | model_run_id = Column(Integer, ForeignKey('model_run.id')) |
| 51 | model_run = relationship(ModelRun) |
| 52 | |
| 53 | task_id = Column(Integer, ForeignKey('task.id')) |
| 54 | task = relationship("Task", foreign_keys = [task_id]) |
| 55 | |
| 56 | type = Column(String()) # "box", "polygon", "tag", "text_token" ... |
| 57 | hash = Column(String()) |
| 58 | |
| 59 | # TODO clarify what status was for |
| 60 | status = Column(String()) |
| 61 | |
| 62 | start_sentence = Column(Integer()) |
| 63 | end_sentence = Column(Integer()) |
| 64 | |
| 65 | start_token = Column(Integer()) |
| 66 | end_token = Column(Integer()) |
| 67 | |
| 68 | start_char = Column(Integer()) |
| 69 | end_char = Column(Integer()) |
| 70 | sentence = Column(Integer()) |
| 71 |
no outgoing calls
no test coverage detected