Skip to content

Items

Item

Bases: Entry, HasOwner, HasRevisionControl, IsCollectable, HasBlocks, ABC

The generic model for data types that will be exposed with their own named endpoints.

Attributes:

Name Type Description
blocks_obj dict[str, DataBlockResponse]

A mapping from block ID to block data.

collections list[Collection]

Inlined info for the collections associated with this item.

creator_ids list[PyObjectId]

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

creators list[Person] | None

Inlined info for the people associated with this item.

date IsoformatDateTime | None

A relevant 'creation' timestamp for the entry (e.g., purchase date, synthesis date).

description str | None

A description of the item, either in plain-text or a markup language.

display_order list[str]

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

file_ObjectIds list[PyObjectId]

Links to object IDs of files stored within the database.

files list[File] | None

Any files attached to this sample.

group_ids list[PyObjectId]

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

groups list[Group] | None

Inlined info for the groups with access to this item.

immutable_id PyObjectId

The immutable database ID of the entry.

item_id HumanReadableIdentifier

A locally unique, human-readable identifier for the entry. This ID is mutable.

last_modified IsoformatDateTime | None

The timestamp at which the entry was last modified.

name str | None

An optional human-readable/usable name for the entry.

refcode Refcode

A globally unique immutable ID comprised of the deployment prefix (e.g., grey)

relationships list[TypedRelationship] | None

A list of related entries and their types.

revision int

The revision number of the entry.

revisions dict[int, Any] | None

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

status str | None

The status of the item, with allowed values defined by the specific item class.

type str

The resource type of the entry.

version int

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

blocks_obj

blocks_obj: dict[str, DataBlockResponse] = Field({})

A mapping from block ID to block data.

collections

collections: list[Collection] = Field([])

Inlined info for the collections associated with this item.

creator_ids

creator_ids: list[PyObjectId] = Field([])

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

creators

creators: list[Person] | None = Field(None)

Inlined info for the people associated with this item.

date

date: IsoformatDateTime | None

A relevant 'creation' timestamp for the entry (e.g., purchase date, synthesis date).

description

description: str | None

A description of the item, either in plain-text or a markup language.

display_order

display_order: list[str] = Field([])

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

file_ObjectIds

file_ObjectIds: list[PyObjectId] = Field([])

Links to object IDs of files stored within the database.

files

files: list[File] | None

Any files attached to this sample.

group_ids

group_ids: list[PyObjectId] = Field([])

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

groups

groups: list[Group] | None = Field(None)

Inlined info for the groups with access to this item.

immutable_id

immutable_id: PyObjectId = Field(None, title='Immutable ID', alias='_id', format='uuid')

The immutable database ID of the entry.

item_id

item_id: HumanReadableIdentifier

A locally unique, human-readable identifier for the entry. This ID is mutable.

last_modified

last_modified: IsoformatDateTime | None = None

The timestamp at which the entry was last modified.

name

name: str | None

An optional human-readable/usable name for the entry.

refcode

refcode: Refcode = None

A globally unique immutable ID comprised of the deployment prefix (e.g., grey) and a locally unique string, ideally created with some consistent scheme.

relationships

relationships: list[TypedRelationship] | None = None

A list of related entries and their types.

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.

status

status: str | None

The status of the item, with allowed values defined by the specific item class.

type

type: str

The resource type of the entry.

version

version: int = 1

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

add_missing_collection_relationships

add_missing_collection_relationships(values)

check_id_names

check_id_names(values)

Slightly upsetting hack: this case should be covered by the pydantic setting for populating fields by alias names.

refcode_validator

refcode_validator(v)

Generate a refcode if not provided.

to_reference

to_reference(additional_fields: list[str] | None = None) -> EntryReference

Populate an EntryReference model from this entry, selecting additional fields to inline.

Parameters:

Name Type Description Default
additional_fields list[str] | None

A list of fields to inline in the reference.

None