Cell Instance¶
Client for managing cell instances.
For usage examples and guides, see Data API on docs.ionworks.com.
Cell instance client for managing individual cell records.
This module provides the CellInstanceClient for creating, reading,
updating, and deleting cell instances, which represent individual physical
battery cells linked to a cell specification.
- class ionworks.api.cell_instance.CellInstanceClient(client: Any)[source]¶
Bases:
objectClient for managing cell instances.
- __init__(client: Any) None[source]¶
Initialize the CellInstanceClient.
- Parameters:
client (Any) – The HTTP client instance used for API calls.
- get(cell_instance_id: str) CellInstance[source]¶
Get a specific cell instance by ID.
- list(cell_spec_id: str, limit: int | None = None, offset: int | None = None, *, name: str | None = None, name_exact: str | None = None, created_by_email: str | None = None, created_after: str | None = None, created_before: str | None = None, updated_after: str | None = None, updated_before: str | None = None, order_by: str | None = None, order: str | None = None, batch_id: str | None = None) PaginatedList[CellInstance][source]¶
List cell instances for a specification with optional filtering.
Always returns a
PaginatedListwhich behaves like a regularlist. Uselimitandoffsetto control the page.- Parameters:
cell_spec_id (str) – The ID of the cell specification.
limit (int | None, optional) – Maximum number of instances to return per page.
offset (int | None, optional) – Number of instances to skip for pagination.
name (str | None, optional) – Case-insensitive substring match on instance name.
name_exact (str | None, optional) – Exact match on instance name. Takes precedence over
name.created_by_email (str | None, optional) – Case-insensitive substring match on the creator’s email.
created_after (str | None, optional) – ISO datetime; return instances created after this time.
created_before (str | None, optional) – ISO datetime; return instances created before this time.
updated_after (str | None, optional) – ISO datetime; return instances updated after this time.
updated_before (str | None, optional) – ISO datetime; return instances updated before this time.
order_by (str | None, optional) – Column to sort by (
"name","created_at","updated_at").order (str | None, optional) – Sort direction:
"asc"or"desc".batch_id (str | None, optional) – Return only instances in this cell batch (exact match on
batch_id).
- Returns:
All instances belonging to the specification.
- Return type:
- update(cell_instance_id: str, data: dict[str, Any]) CellInstance[source]¶
Update an existing cell instance.
- Parameters:
- Returns:
The updated cell instance.
- Return type:
- Raises:
ValueError – If
datacontains the removedbatchfield. Nothing is sent.IonworksError – With HTTP 400 if
batch_iddoes not name a batch of this instance’s cell specification.
- detail(cell_instance_id: str, include_steps: bool = True, include_cycles: bool = True, include_time_series: bool = True) CellInstanceDetail[source]¶
Get full details for a cell instance.
Composes flat API endpoints in parallel to build the complete detail view. For each measurement, fetches steps/cycles and time series according to the
include_*flags.- Parameters:
cell_instance_id (str) – The cell instance ID.
include_steps (bool, optional) – Whether to fetch step data for each measurement. Defaults to True.
include_cycles (bool, optional) – Whether to fetch cycle metrics for each measurement. Defaults to True.
include_time_series (bool, optional) – Whether to fetch time series for each measurement. Defaults to True.
- Returns:
Instance metadata, specification foreign key, and a list of measurement details.
- Return type:
- create(cell_spec_id: str, data: dict[str, Any]) CellInstance[source]¶
Create a new cell instance under a specification.
- Parameters:
cell_spec_id (str) – The ID of the parent cell specification.
data (dict[str, Any]) – Dictionary containing the cell instance data.
nameis required. To file the cell under a manufacturing lot, passbatch_id— the id of a batch of the same specification (seeCellBatchClient).
- Returns:
The newly created cell instance.
- Return type:
- Raises:
ValueError – If
datacontains the removedbatchfield. Nothing is sent.IonworksError – With HTTP 400 if
batch_iddoes not name a batch ofcell_spec_id.
- create_or_get(cell_spec_id: str, data: dict[str, Any]) CellInstance[source]¶
Create a new cell instance or get existing.
- Parameters:
- Returns:
The cell instance (newly created or existing).
- Return type:
- Raises:
ValueError – If
datacontains the removedbatchfield. Nothing is sent.