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, include_owner=False, status=None)
¶
List instruments, defaulting to the active lifecycle state.
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
|
include_owner
|
bool
|
Resolve owner_orcid into a public-safe user object |
False
|
status
|
str
|
Filter by active, maintenance, or decommissioned. When omitted, the API defaults to active. |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict]
|
List[Dict]: Instrument objects with specifications and metadata |
get(instrument_ref=None, instrument_id=None, include_metadata=False, include_owner=True, *, instrument_mfid=None, instrument_name=None)
¶
Get an instrument by canonical MFID or human-readable slug.
instrument_id explicitly selects the human-readable API identifier.
An MFID-shaped value remains temporarily compatible with its former
meaning and emits a deprecation warning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrument_ref
|
str
|
Instrument MFID or slug |
None
|
instrument_id
|
str
|
Explicit instrument slug |
None
|
include_metadata
|
bool
|
Whether to include scientific metadata |
False
|
include_owner
|
bool
|
Resolve owner_orcid into a public-safe user object (default: True) |
True
|
instrument_mfid
|
str
|
Explicit instrument MFID |
None
|
instrument_name
|
str
|
Deprecated display-name lookup |
None
|
Returns:
| Type | Description |
|---|---|
Dict
|
Dict or None: Instrument information if found, None otherwise |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no reference or multiple references are provided |
create(instrument, scientific_metadata=None)
¶
Create a new instrument as an authenticated human caller.
Service accounts cannot create instruments. If the instrument already exists, this method returns the existing record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrument
|
Instrument model or dict with instrument details. Required fields: instrument_id, instrument_name, and location. Owner defaults to the authenticated identity. |
required | |
scientific_metadata
|
Dict
|
Scientific metadata to attach after creation. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
Created (or existing) instrument object |
Raises:
| Type | Description |
|---|---|
ValueError
|
If instrument_id is missing |
update(unique_id, **kwargs)
¶
Partially update an instrument record.
Requires editor permission.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_id
|
str
|
Instrument unique identifier (MFID) |
required |
**kwargs
|
Fields to update. Accepted: instrument_id, instrument_name, location, manufacturer, model, instrument_type, description, other_id, other_id_source. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
Updated instrument object |