diff --git a/CHANGELOG.md b/CHANGELOG.md index 7657bbc..f1a5ef4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). (added NOT NULL constraints and table-level collation, neither was picked up automatically). +### Added + +* A class for 'aliquot' table is added to ml warehouse ORM. + ## [2.4.0] - 2024-10-17 ### Added diff --git a/lang_qc/db/mlwh_schema.py b/lang_qc/db/mlwh_schema.py index 40762dd..12826b5 100644 --- a/lang_qc/db/mlwh_schema.py +++ b/lang_qc/db/mlwh_schema.py @@ -18,9 +18,12 @@ # @author mgcam import datetime +import decimal from typing import List, Optional from sqlalchemy import ( + DECIMAL, + BigInteger, Computed, DateTime, Float, @@ -33,6 +36,7 @@ from sqlalchemy.dialects.mysql import ( BIGINT, CHAR, + DATETIME, INTEGER, SMALLINT, TEXT, @@ -190,6 +194,71 @@ class Sample(Base): ) +class Aliquot(Base): + __tablename__ = "aliquot" + __table_args__ = ({"mysql_collate": "utf8_unicode_ci"},) + + id: Mapped[int] = mapped_column(BigInteger, primary_key=True) + id_lims: Mapped[str] = mapped_column( + VARCHAR(255), + nullable=False, + comment="The LIMS system that the aliquot was created in", + ) + aliquot_uuid: Mapped[str] = mapped_column( + VARCHAR(255), + nullable=False, + comment="The UUID of the aliquot in the LIMS system", + ) + aliquot_type: Mapped[str] = mapped_column( + VARCHAR(255), nullable=False, comment="The type of the aliquot" + ) + source_type: Mapped[str] = mapped_column( + VARCHAR(255), nullable=False, comment="The type of the source of the aliquot" + ) + source_barcode: Mapped[str] = mapped_column( + VARCHAR(255), nullable=False, comment="The barcode of the source of the aliquot" + ) + sample_name: Mapped[str] = mapped_column( + VARCHAR(255), + nullable=False, + comment="The name of the sample that the aliquot was created from", + ) + used_by_type: Mapped[str] = mapped_column( + VARCHAR(255), + nullable=False, + comment="The type of the entity that the aliquot is used by", + ) + used_by_barcode: Mapped[str] = mapped_column( + VARCHAR(255), + nullable=False, + comment="The barcode of the entity that the aliquot is used by", + ) + volume: Mapped[decimal.Decimal] = mapped_column( + DECIMAL(10, 2), comment="The volume of the aliquot (uL)" + ) + last_updated: Mapped[datetime.datetime] = mapped_column( + DATETIME(fsp=6), + nullable=False, + comment="The date and time that the aliquot was last updated", + ) + recorded_at: Mapped[datetime.datetime] = mapped_column( + DATETIME(fsp=6), + nullable=False, + comment="The date and time that the aliquot was recorded", + ) + created_at: Mapped[datetime.datetime] = mapped_column( + DATETIME(fsp=6), + nullable=False, + comment="The date and time that this record was created", + ) + concentration: Mapped[Optional[decimal.Decimal]] = mapped_column( + DECIMAL(10, 2), comment="The concentration of the aliquot (ng/ul)" + ) + insert_size: Mapped[Optional[int]] = mapped_column( + Integer, comment="The size of the insert in base pairs" + ) + + class Study(Base): __tablename__ = "study" __table_args__ = (