Database updates, scraping samples from excel sheets
This commit is contained in:
@@ -3,15 +3,16 @@ from sqlalchemy import Column, String, TIMESTAMP, text, JSON, INTEGER, ForeignKe
|
||||
from sqlalchemy.orm import relationship, relationships
|
||||
|
||||
|
||||
class Sample(Base):
|
||||
class WWSample(Base):
|
||||
|
||||
__tablename__ = "_ww_samples"
|
||||
|
||||
id = Column(INTEGER, primary_key=True) #: primary key
|
||||
ww_processing_num = Column(String(64))
|
||||
ww_sample_full_id = Column(String(64))
|
||||
ww_sample_full_id = Column(String(64), nullable=False)
|
||||
rsl_number = Column(String(64))
|
||||
rsl_plate = relationship("Wastewater", back_populates="samples")
|
||||
rsl_plate_id = Column(INTEGER, ForeignKey("_submissions.id", ondelete="SET NULL", name="fk_WWS_sample_id"))
|
||||
collection_date = Column(TIMESTAMP) #: Date submission received
|
||||
testing_type = Column(String(64))
|
||||
site_status = Column(String(64))
|
||||
@@ -21,7 +22,35 @@ class Sample(Base):
|
||||
seq_submitted = Column(BOOLEAN())
|
||||
ww_seq_run_id = Column(String(64))
|
||||
sample_type = Column(String(8))
|
||||
well_number = Column(String(8))
|
||||
|
||||
def to_string(self):
|
||||
return f"{self.well_number}: {self.ww_sample_full_id}"
|
||||
|
||||
def to_sub_dict(self):
|
||||
return {
|
||||
"well": self.well_number,
|
||||
"name": self.ww_sample_full_id,
|
||||
}
|
||||
|
||||
|
||||
class BCSample(Base):
|
||||
|
||||
__tablename__ = "_bc_samples"
|
||||
|
||||
id = Column(INTEGER, primary_key=True) #: primary key
|
||||
well_number = Column(String(8))
|
||||
sample_id = Column(String(64), nullable=False)
|
||||
organism = Column(String(64))
|
||||
concentration = Column(String(16))
|
||||
rsl_plate_id = Column(INTEGER, ForeignKey("_submissions.id", ondelete="SET NULL", name="fk_BCS_sample_id"))
|
||||
rsl_plate = relationship("BacterialCulture", back_populates="samples")
|
||||
|
||||
def to_string(self):
|
||||
return f"{self.well_number}: {self.sample_id} - {self.organism}"
|
||||
|
||||
def to_sub_dict(self):
|
||||
return {
|
||||
"well": self.well_number,
|
||||
"name": f"{self.sample_id} - ({self.organism})",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user