ochra.common.storage package

consumable

pydantic model ochra.common.storage.consumable.Consumable

Bases: DataModel

Data model for laboratory consumables (e.g., caps, needles).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field quantity: int [Required]

Available quantity in inventory.

field type: str [Required]

Consumable category or name.

change_quantity(quantity)

Change the quantity of the consumable.

Parameters:

quantity (int) – The new quantity to set.

Return type:

None

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

container

pydantic model ochra.common.storage.container.Container

Bases: DataModel

Abstract base class for a storage container that can hold other containers or reagents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field is_used: bool = False

Flag indicating if the container is in use. Defaults to False.

field max_capacity: int | float [Required]

Maximum capacity of the container.

field physical_id: int = None

Unique physical identifier for the container. Defaults to None.

field type: str [Required]

Type of the container (e.g., rack, vial, jar).

get_available_capacity()

Get the available capacity of the container.

Returns:

The available capacity of the container.

Return type:

float | int

get_used_capacity()

Get the used capacity of the container.

Returns:

The used capacity of the container.

Return type:

float | int

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

holder

pydantic model ochra.common.storage.holder.Holder

Bases: Container

Represents a container capable of holding other containers, such as a rack of vials.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field containers: List[Type[Container]] [Optional]

List of containers currently held by this holder. Defaults to an empty list.

add_container(container)

Add a container to the holder.

Parameters:

container (Type[Container]) – The container to be added.

Return type:

None

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

remove_container(container)

Remove a container from the holder.

Parameters:

container (Type[Container]) – The container to be removed.

Return type:

None

inventory

pydantic model ochra.common.storage.inventory.Inventory

Bases: DataModel

Inventory model representing a collection of containers and consumables. An inventory is typically associated with a station or device in the framework.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field consumables: List[Consumable] [Optional]

List of consumable items in the inventory.

field containers: List[Type[Container]] [Optional]

List of container instances in the inventory.

field containers_max_capacity: int [Required]

Maximum number of containers allowed.

field owner: DataModel [Required]

Reference to the entity that owns the inventory.

add_consumable(consumable)

Add a consumable to the inventory.

Parameters:

consumable (Consumable) – The consumable to be added.

Return type:

None

add_container(container)

Add a container to the inventory.

Parameters:

container (Type[Container]) – The container to be added.

Return type:

None

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

remove_consumable(consumable)

Remove a consumable from the inventory.

Parameters:

consumable (Consumable) – The consumable to be removed.

Return type:

None

remove_container(container)

Remove a container from the inventory.

Parameters:

container (Type[Container]) – The container to be removed.

Return type:

None

reagent

pydantic model ochra.common.storage.reagent.Reagent

Bases: DataModel

Represents a chemical reagent with associated metadata.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field amount: float [Required]

Quantity of the reagent.

field name: str [Required]

Name of the reagent.

field physical_state: PhysicalState = PhysicalState.UNKNOWN

Physical state of the reagent (solid, liquid, gas, etc.). Defaults to UNKNOWN.

field properties: Dict[str, Any] [Optional]

Additional properties and metadata for the reagent.

field unit: str [Required]

Unit of measurement for the amount (e.g., g, mL).

add_property(property_name, property_value)

Add a property to the reagent.

Parameters:
  • property_name (str) – The name of the property to add.

  • property_value (Any) – The value of the property to add.

Returns:

True if the property was added successfully

Return type:

bool

change_amount(amount)

Change the amount of the reagent.

Parameters:

amount (float) – The new amount to set.

Returns:

True if the amount was changed successfully

Return type:

bool

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

remove_property(property)

Remove a property from the reagent.

Parameters:

property (str) – The name of the property to remove.

Returns:

True if the property was removed successfully

Return type:

bool

vessel

pydantic model ochra.common.storage.vessel.Vessel

Bases: Container

Represents a specialized container designed to store chemical reagents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field capacity_unit: str [Required]

Unit of measurement for the vessel’s capacity (e.g., ‘mL’, ‘L’).

field reagents: List[Reagent] [Optional]

Collection of reagents currently held in the vessel.

add_reagent(reagent)

Add a reagent to the vessel.

Parameters:

reagent (Reagent) – The reagent to be added.

Return type:

None

model_post_init(context, /)

We need to both initialize private attributes and call the user-defined model_post_init method.

Parameters:
  • self (BaseModel)

  • context (Any)

Return type:

None

remove_reagent(reagent)

Remove a reagent from the vessel.

Parameters:

reagent (Reagent) – The reagent to be removed.

Return type:

None