Skip to content

Commit

Permalink
A class for aliquot table is added to mlwh ORM.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcam committed Dec 20, 2024
1 parent 0204e04 commit 23d4556
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
69 changes: 69 additions & 0 deletions lang_qc/db/mlwh_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# @author mgcam <[email protected]>

import datetime
import decimal
from typing import List, Optional

from sqlalchemy import (
DECIMAL,
BigInteger,
Computed,
DateTime,
Float,
Expand All @@ -33,6 +36,7 @@
from sqlalchemy.dialects.mysql import (
BIGINT,
CHAR,
DATETIME,
INTEGER,
SMALLINT,
TEXT,
Expand Down Expand Up @@ -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__ = (
Expand Down

0 comments on commit 23d4556

Please sign in to comment.