Asset Utils#

OpenFactory Assets helper functions.

class openfactory.assets.utils.AssetAttribute(value, type, tag, timestamp=<factory>)[source]#

Bases: object

Represents a single attribute of an asset, including its value, type, tag, and timestamp.

value#

The actual value of the attribute. Can be a string or float.

Type:

Union[str, float]

type#

The category/type of the attribute, must be one of the allowed literal strings.

Type:

Literal[‘Samples’, ‘Condition’, ‘Events’, ‘Method’, ‘OpenFactory’, ‘UNAVAILABLE’]

tag#

The tag or identifier associated with this attribute.

Type:

str

timestamp#

Timestamp when the attribute was recorded, in OpenFactory format. Defaults to the current timestamp if not provided.

Type:

str

__init__(value, type, tag, timestamp=<factory>)#
openfactory.assets.utils.current_timestamp()[source]#

Returns the current timestamp in OpenFactory format.

The format is ISO 8601 with milliseconds precision and a ‘Z’ to indicate UTC time, e.g., ‘2025-05-04T12:34:56.789Z’.

Return type:

str

Returns:

str – The current UTC timestamp formatted in OpenFactory style.