Refine event types and update related models and logic
Standardized event types with stricter validation using `Literal`. Adjusted related data and logic to align with new types, including changes to PGROUP assignments, event timeline increments, and schema updates. Cleaned up unused code and clarified database initialization behavior.
This commit is contained in:
@ -169,6 +169,7 @@ class Sample(Base):
|
||||
puck_id = Column(Integer, ForeignKey("pucks.id"))
|
||||
puck = relationship("Puck", back_populates="samples")
|
||||
events = relationship("SampleEvent", back_populates="sample", lazy="joined")
|
||||
images = relationship("Image", back_populates="sample", lazy="joined")
|
||||
|
||||
@property
|
||||
def mount_count(self) -> int:
|
||||
@ -215,6 +216,7 @@ class SampleEvent(Base):
|
||||
event_type = Column(String(255), nullable=False)
|
||||
timestamp = Column(DateTime, default=datetime.now)
|
||||
|
||||
images = relationship("Image", back_populates="sample_event")
|
||||
sample = relationship("Sample", back_populates="events")
|
||||
|
||||
|
||||
@ -258,6 +260,10 @@ class Image(Base):
|
||||
filepath = Column(String(255), nullable=False)
|
||||
status = Column(String(255), nullable=True)
|
||||
sample_id = Column(Integer, ForeignKey("samples.id"), nullable=False)
|
||||
sample_event_id = Column(Integer, ForeignKey("sample_events.id"), nullable=False)
|
||||
|
||||
sample = relationship("Sample", back_populates="images")
|
||||
sample_event = relationship("SampleEvent", back_populates="images")
|
||||
|
||||
|
||||
class ExperimentParameters(Base):
|
||||
@ -268,12 +274,16 @@ class ExperimentParameters(Base):
|
||||
sample_id = Column(Integer, ForeignKey("samples.id"), nullable=False)
|
||||
|
||||
|
||||
# class Results(Base):
|
||||
# __tablename__ = "results"
|
||||
#
|
||||
# id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
||||
# pgroup = Column(String(255), nullable=False)
|
||||
# sample_id = Column(Integer, ForeignKey("samples.id"), nullable=False)
|
||||
class Results(Base):
|
||||
__tablename__ = "results"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
||||
# pgroup = Column(String(255), nullable=False)
|
||||
result = Column(JSON, nullable=True)
|
||||
result_id = Column(Integer, ForeignKey("experiment_parameters.id"), nullable=False)
|
||||
sample_id = Column(Integer, ForeignKey("samples.id"), nullable=False)
|
||||
|
||||
|
||||
# method = Column(String(255), nullable=False)
|
||||
# #resolution: Column(Float(255), nullable=False)
|
||||
# unit_cell: str
|
||||
|
Reference in New Issue
Block a user