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.
CollectionReference
¶
Bases: BaseModel
A reference to a collection, used for inlining collection info within other models.
Config:
extra:allowpopulate_by_name:True
HasLocation
¶
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.
HasRevisionControl
¶
Bases: BaseModel
Trait mixin for models that track a revision history of their own state.
revisions
¶
An optional mapping from old revision numbers to the model state at that revision.
HasSubstanceInfo
¶
Bases: BaseModel
Trait mixin for models that have substance information.
GHS_codes
¶
GHS_codes: str | None = 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 = 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.
HasSynthesisInfo
¶
HasTags
¶
Bases: BaseModel
Trait mixin for models that can be annotated with tags.
Note: this mixin only provides the stored tags field and its coercion.
Inlining current tag names for display (and dropping references to deleted
tags) is a read-time concern handled by
pydatalab.mongo.resolve_tags_for_docs, which each entity's read path must
call explicitly on the docs it returns.
IsCollectable
¶
Bases: BaseModel
Trait mixin for models that can be added to collections.
collections
¶
collections: list[CollectionReference]
Inlined info for the collections associated with this item.