Cell Instance#

Client for managing cell instances.

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.cell_instance.CellInstanceClient(client)[source]#

Bases: object

Client for managing cell instances.

Parameters:

client (Any)

__init__(client)[source]#

Initialize the CellInstanceClient.

Parameters:

client (Any) – The HTTP client instance used for API calls.

Return type:

None

get(cell_instance_id)[source]#

Get a specific cell instance by ID.

Parameters:

cell_instance_id (str)

Return type:

CellInstance

list(cell_spec_id)[source]#

List all cell instances for a specification.

Parameters:

cell_spec_id (str) – The ID of the cell specification.

Returns:

All instances belonging to the specification.

Return type:

list[CellInstance]

update(cell_instance_id, data)[source]#

Update an existing cell instance.

Parameters:
  • cell_instance_id (str) – The ID of the cell instance to update.

  • data (dict[str, Any]) – Dictionary containing the fields to update.

Returns:

The updated cell instance.

Return type:

CellInstance

delete(cell_instance_id)[source]#

Delete a cell instance by ID.

Parameters:

cell_instance_id (str)

Return type:

None

detail(cell_instance_id, include_steps=True, include_cycles=True, include_time_series=True)[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:

CellInstanceDetail

create(cell_spec_id, data)[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.

Returns:

The newly created cell instance.

Return type:

CellInstance

create_or_get(cell_spec_id, data)[source]#

Create a new cell instance or get existing.

Parameters:
  • cell_spec_id (str) – The ID of the parent cell specification.

  • data (dict[str, Any]) – Dictionary containing the cell instance data.

Returns:

The cell instance (newly created or existing).

Return type:

CellInstance