Skip to content

InstrumentOperations

Access via client.instruments.

crucible.resources.instruments.InstrumentOperations

Instrument-related API operations.

Access via: client.instruments.get(), client.instruments.list(), etc.

list(include_metadata=False, limit=DEFAULT_LIMIT, offset=0)

List all available instruments.

Parameters:

Name Type Description Default
include_metadata bool

Include scientific metadata in results

False
limit int

Maximum number of results to return

DEFAULT_LIMIT
offset int

Starting position in the full result set (default: 0)

0

Returns:

Type Description
List[Dict]

List[Dict]: Instrument objects with specifications and metadata

get(instrument_name=None, instrument_id=None, include_metadata=False)

Get instrument information by name or ID.

Parameters:

Name Type Description Default
instrument_name str

Name of the instrument

None
instrument_id str

Unique ID of the instrument

None
include_metadata bool

Whether to include scientific metadata

False

Returns:

Type Description
Dict

Dict or None: Instrument information if found, None otherwise

Raises:

Type Description
ValueError

If neither parameter is provided

create(instrument, scientific_metadata=None)

Create a new instrument, returning the existing one if it already exists.

Requires admin permissions.

Parameters:

Name Type Description Default
instrument

Instrument model or dict with instrument details. Required fields: instrument_name, owner, location.

required
scientific_metadata Dict

Scientific metadata to attach after creation.

None

Returns:

Name Type Description
Dict Dict

Created (or existing) instrument object

update(unique_id, **kwargs)

Partially update an instrument record.

Requires admin permissions.

Parameters:

Name Type Description Default
unique_id str

Instrument unique identifier (MFID)

required
**kwargs

Fields to update. Accepted: instrument_name, owner, location, manufacturer, model, instrument_type, description.

{}

Returns:

Name Type Description
Dict Dict

Updated instrument object