Skip to content

Traits

The item models in datalab are assembled from traits: small mixin models that each contribute a related group of fields. Rather than every item type redeclaring who owns it or which collections it belongs to, it inherits the corresponding trait.

HasBlocks

Bases: BaseModel

Trait mixin for models that can have data blocks attached to them.

blocks_obj

blocks_obj: dict[str, DataBlockResponse] = {}

A mapping from block ID to block data.

display_order

display_order: list[str] = []

The order in which to display block data in the UI.

HasFiles

Bases: BaseModel

Trait mixin for models that can have files attached to them.

file_ObjectIds

file_ObjectIds: list[PyObjectId] = []

Links to object IDs of files stored within the database.

files

files: list[File] | None = None

Any files attached to this item.

HasOwner

Bases: BaseModel

Trait mixin for models that record who created them and which groups can access them.

creator_ids

creator_ids: list[PyObjectId] = []

The database IDs of the user(s) who created the item.

creators

creators: list[Person] | None = None

Inlined info for the people associated with this item.

group_ids

group_ids: list[PyObjectId] = []

The database IDs of the group(s) that have read-access to this item.

groups

groups: list[Group] | None = None

Inlined info for the groups with access to this item.

HasRevisionControl

Bases: BaseModel

Trait mixin for models that track a revision history of their own state.

revision

revision: int = 1

The revision number of the entry.

revisions

revisions: dict[int, Any] | None = None

An optional mapping from old revision numbers to the model state at that revision.

version

version: int = 1

The version number used by the version control system for tracking snapshots.

HasSubstanceInfo

Bases: BaseModel

Trait mixin for models that have substance information.

CAS

CAS: str | None

The CAS Registry Number for the substance described by this entry.

GHS_codes

GHS_codes: str | None

A string describing any GHS hazard codes associated with this item. See pubchem.ncbi.nlm.nih.gov/ghs/ for code definitions.

chemform

chemform: str | None

A string representation of the chemical formula or composition associated with this sample.

The representation is relatively free-form; clients are expected parse and interpret HTML markup for subscripts and accept unicode characters for greek letters.

inchi

inchi: str | None = None

An International Chemical Identifier (InChI) string representation of chemicals/molecules associated with this sample.

inchi_key

inchi_key: str | None = None

A unique key derived from the InChI.

molar_mass

molar_mass: float | None

Mass per formula unit, in g/mol.

smiles

smiles: str | None = None

A SMILES string representation of the chemical structure associated with this sample.

HasSynthesisInfo

Bases: BaseModel

Trait mixin for models that have synthesis information.

synthesis_constituents

synthesis_constituents: list[Constituent] = []

A list of references to constituent materials giving the amount and relevant inlined details of consituent items.

synthesis_description

synthesis_description: str | None = None

Free-text details of the procedure applied to synthesise the sample

IsCollectable

Bases: BaseModel

Trait mixin for models that can be added to collections.

collections

collections: list[Collection] = []

Inlined info for the collections associated with this item.