ParameterSchema

A parameter group instance attached to a step.

Usage

Source

ParameterSchema()

Mirrors the structure of ~recap.schemas.resource.PropertySchema but scoped to a process step rather than a resource. Parameter values record what settings were used when executing a step (e.g. transfer volumes, imaging exposure times).

Parameter values are accessed via the step.parameters.<group_slug> shortcut::

step.parameters.transfer.volume.value   # 100
step.parameters.transfer.volume = 50    # mutate in-place

Attributes: template: The ~recap.schemas.attribute.AttributeGroupTemplateSchema that defines the parameters in this group. values: A dynamically-generated Pydantic model whose fields are the attribute slugs, each holding an ~recap.schemas.attribute.AttributeValueSchema.

Methods

Name Description
__getattr__() Proxy attribute access to values for convenience.
__getitem__() Bracket read: param["attr_name"] — accepts slug or original name.
__setattr__() Proxy attribute assignment to values, preserving units.
__setitem__() Bracket write: param["attr_name"] = v — unit-preserving, accepts slug or original name.
coerce_and_reject_unknown() Validate that all keys in a raw values dict are known template attributes.
coerce_from_orm() Translate a SQLAlchemy Parameter ORM object into the expected dict shape.
get() Dict-style get: param.get("attr_name") — accepts slug or original name.
items() Yield (original_name, AttributeValueSchema) pairs for all attributes.
validate_and_coerce_values() Type-coerce all stored parameter values against the attribute templates.

__getattr__()

Proxy attribute access to values for convenience.

Usage

Source

__getattr__(name)

Called only when normal attribute resolution fails. Allows param.batch as a shortcut for param.values.batch.

Raises

AttributeError

If name is neither a field on this model nor an attribute of values.


__getitem__()

Bracket read: param["attr_name"] — accepts slug or original name.

Usage

Source

__getitem__(name)

__setattr__()

Proxy attribute assignment to values, preserving units.

Usage

Source

__setattr__(name, value)

Pydantic internals and real model fields are handled normally. Unknown names are forwarded to values, mutating .value in-place on the ~recap.schemas.attribute.AttributeValueSchema so that the stored unit is preserved.


__setitem__()

Bracket write: param["attr_name"] = v — unit-preserving, accepts slug or original name.

Usage

Source

__setitem__(name, value)

coerce_and_reject_unknown()

Validate that all keys in a raw values dict are known template attributes.

Usage

Source

coerce_and_reject_unknown(data)

When data is a dict with both template and values set, checks that every key in values matches an attribute name in the template. Raises ValueError for unrecognised keys and constructs the dynamic values model for recognised ones.


coerce_from_orm()

Translate a SQLAlchemy Parameter ORM object into the expected dict shape.

Usage

Source

coerce_from_orm(data)

Reads template and _values from the ORM object and builds the dynamic values model keyed by attribute name.


get()

Dict-style get: param.get("attr_name") — accepts slug or original name.

Usage

Source

get(name, default=None)

items()

Yield (original_name, AttributeValueSchema) pairs for all attributes.

Usage

Source

items()

validate_and_coerce_values()

Type-coerce all stored parameter values against the attribute templates.

Usage

Source

validate_and_coerce_values()

Iterates over every attribute in template.attribute_templates, runs the value through ~recap.schemas.attribute.AttributeTemplateValidator, and rebuilds values with the coerced results. Raises ValueError if any unknown keys are present.