resources.VidigiResource

resources.VidigiResource(id_attribute=None, **kwargs)

A simple resource class with an ID attribute for use in VidigiStore and VidigiPriorityStore.

This represents a resource that can be stored and retrieved from a store, with an identifier for tracking which specific unit of a pool an entity used.

Parameters

Name Type Description Default
id_attribute any Identifier for this resource, usually a small per-pool integer. Written to the resource_id column when you log resource use. populate() / populate_store() set it to 1..capacity. None
**kwargs Any further keyword arguments are set as attributes on the instance (VidigiResource(id_attribute=1, staff_type="nurse") -> resource.staff_type). To do this for a whole pool built by populate_store / VidigiStore / VidigiPriorityStore, pass their extra_attributes= instead of building the pool by hand. Pools built with label= additionally carry label and unique_id_attribute (f"{label}_{id_attribute}"), the latter unique across pools. {}

Notes

id is a read-write alias of id_attribute, and unique_id of unique_id_attribute - reading or setting either name of a pair affects the same value, at construction (VidigiResource(id=3)) or after. The _attribute names keep working unchanged. unique_id is only present when the pool was built with label=, exactly like unique_id_attribute. Passing both names of a pair with different values raises ValueError.

Attributes

Name Description
id Alias of id_attribute - see the class docstring.
unique_id Alias of unique_id_attribute - see the class docstring.
Back to top