## ParameterSchema


A parameter group instance attached to a step.


Usage

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

------------------------------------------------------------------------


#### \_\_getattr\_\_()


Proxy attribute access to `values` for convenience.


Usage

``` python
__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

``` python
__getitem__(name)
```


------------------------------------------------------------------------


#### \_\_setattr\_\_()


Proxy attribute assignment to `values`, preserving units.


Usage

``` python
__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

``` python
__setitem__(name, value)
```


------------------------------------------------------------------------


#### coerce_and_reject_unknown()


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


Usage

``` python
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

``` python
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

``` python
get(name, default=None)
```


------------------------------------------------------------------------


#### items()


Yield `(original_name, AttributeValueSchema)` pairs for all attributes.


Usage

``` python
items()
```


------------------------------------------------------------------------


#### validate_and_coerce_values()


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


Usage

``` python
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.
