A file is raw data relation + annotation instances eg File.image File.video A file represents the lowest unit of source control data
| 31 | |
| 32 | |
| 33 | class File(Base, Caching): |
| 34 | """ |
| 35 | A file is raw data relation + annotation instances |
| 36 | eg |
| 37 | File.image |
| 38 | File.video |
| 39 | |
| 40 | A file represents the lowest unit of source control data |
| 41 | """ |
| 42 | |
| 43 | __tablename__ = 'file' |
| 44 | |
| 45 | __table_args__ = ( |
| 46 | Index('index__video_parent_file_id__and__frame_number', |
| 47 | "video_parent_file_id", |
| 48 | "frame_number"), |
| 49 | ) |
| 50 | |
| 51 | id = Column(BIGINT, primary_key = True) |
| 52 | created_time = Column(DateTime, default = datetime.datetime.utcnow) |
| 53 | time_last_updated = Column(DateTime, onupdate = datetime.datetime.utcnow) |
| 54 | |
| 55 | count_instances_changed = Column(Integer) |
| 56 | |
| 57 | # Number of instances (Of all types) in the file. |
| 58 | count_instances = Column(Integer, default = None, nullable = True) |
| 59 | |
| 60 | created_by_kind = Column(String) # 'human', 'api' |
| 61 | |
| 62 | time_committed = Column(DateTime) |
| 63 | |
| 64 | job_id = Column(Integer, ForeignKey('job.id')) |
| 65 | job = relationship("Job") |
| 66 | |
| 67 | # Context of say wanting to check if a file is done processing. ie for video job. |
| 68 | # Also could be useful in future to be able to "trace back" a file more easily |
| 69 | # Instead of having to do reverse |
| 70 | # I guess could just do query input id where file_id = file but just feels funny |
| 71 | input_id = Column(Integer, ForeignKey('input.id')) |
| 72 | |
| 73 | member_created_id = Column(Integer, ForeignKey('member.id')) |
| 74 | member_created = relationship("Member", foreign_keys = [member_created_id]) |
| 75 | |
| 76 | member_updated_id = Column(Integer, ForeignKey('member.id')) |
| 77 | member_updated = relationship("Member", foreign_keys = [member_updated_id]) |
| 78 | |
| 79 | # "added", "removed", "changed" |
| 80 | state = Column(String()) # for source control |
| 81 | |
| 82 | committed = Column(Boolean) |
| 83 | |
| 84 | # image, frame, video, label, compound |
| 85 | type = Column(String()) |
| 86 | |
| 87 | # hash_data = [image_id, [instance-list], [n list]] |
| 88 | hash = Column(String()) |
| 89 | |
| 90 | # ann == annotation |
no outgoing calls
no test coverage detected