URLs

Helpers that build links to pages in the Ionworks web app (https://app.ionworks.com).

Frontend URL helpers for the Ionworks web app.

UrlsClient methods take a resource ID plus its route’s parent IDs; project_id defaults to the client’s (IONWORKS_PROJECT_ID). The host follows the client’s api_url (api.ionworks.com → app.ionworks.com, stage-api.ionworks.com → stage.ionworks.com). Set IONWORKS_APP_URL locally, where the frontend’s port cannot be derived from the API’s.

class ionworks.api.urls.UrlsClient(client: Client)[source]

Bases: object

Build links to pages in the Ionworks web app from ids, without a request.

A fallback: prefer client.<resource>.get(id).url, which the server builds from the record. Returned URLs point at the environment the client is configured for, derived from its api_url (override with IONWORKS_APP_URL).

project(project_id: str | None = None) → str[source]

Build a link to a project’s landing page.

The web app has no bare project route; opening a project lands on its studies page (/projects/{p}/studies), so this returns that URL.

Parameters:

project_id (str | None, optional) – The project ID. Defaults to the project_id set on the Ionworks client (resolved from the IONWORKS_PROJECT_ID env var if not passed to the client).

Returns:

URL of the project’s studies landing page.

Return type:

str

model(model_id: str, project_id: str | None = None) → str[source]

Build a link to a model detail page.

Parameters:
  • model_id (str) – The model ID.

  • project_id (str | None, optional) – The project ID the model belongs to. Defaults to the client’s project_id.

Returns:

URL of the model detail page.

Return type:

str

parameterized_model(parameterized_model_id: str, project_id: str | None = None) → str[source]

Build a link to a parameterized model detail page.

Parameters:
  • parameterized_model_id (str) – The parameterized model ID.

  • project_id (str | None, optional) – The project ID the parameterized model belongs to. Defaults to the client’s project_id.

Returns:

URL of the parameterized model detail page.

Return type:

str

optimization(optimization_id: str, project_id: str | None = None) → str[source]

Build a link to an optimization detail page.

Parameters:
  • optimization_id (str) – The optimization ID.

  • project_id (str | None, optional) – The project ID the optimization belongs to. Defaults to the client’s project_id.

Returns:

URL of the optimization detail page.

Return type:

str

pipeline(pipeline_id: str, project_id: str | None = None) → str[source]

Build a link to a pipeline detail page.

Parameters:
  • pipeline_id (str) – The pipeline ID.

  • project_id (str | None, optional) – The project ID the pipeline belongs to. Defaults to the client’s project_id.

Returns:

URL of the pipeline detail page.

Return type:

str

study(study_id: str, project_id: str | None = None) → str[source]

Build a link to a study detail page.

Parameters:
  • study_id (str) – The study ID.

  • project_id (str | None, optional) – The project ID the study belongs to. Defaults to the client’s project_id.

Returns:

URL of the study detail page.

Return type:

str

simulation(simulation_id: str, parameterized_model_id: str | None = None, project_id: str | None = None) → str[source]

Build a link to a simulation detail page (parameterized-model view).

A simulation’s natural owner is its parameterized model — the simulation row carries a parameterized_model_id (one per simulation), so this method builds the parameterized-model-nested route. When parameterized_model_id is not supplied, the simulation is fetched and the url it carries is returned.

Parameters:
  • simulation_id (str) – The simulation ID.

  • parameterized_model_id (str | None, optional) – The parameterized model the simulation belongs to. When omitted, it is derived by fetching the simulation (one network call).

  • project_id (str | None, optional) – The project ID the simulation belongs to. Defaults to the client’s project_id.

Returns:

URL of the simulation detail page nested under its parameterized model.

Return type:

str

Raises:

ValueError – If parameterized_model_id is not supplied and the fetched simulation has no parameterized_model_id (e.g. a study-only simulation). Pass parameterized_model_id explicitly in that case.

protocol(protocol_id: str, project_id: str | None = None) → str[source]

Build a link to a protocol detail page.

Parameters:
  • protocol_id (str) – The protocol (template) ID.

  • project_id (str | None, optional) – The project ID the protocol belongs to. Defaults to the client’s project_id.

Returns:

URL of the protocol detail page.

Return type:

str

material(material_id: str, project_id: str | None = None) → str[source]

Build a link to a material detail page.

Parameters:
  • material_id (str) – The material ID.

  • project_id (str | None, optional) – The project ID the material belongs to. Defaults to the client’s project_id.

Returns:

URL of the material detail page.

Return type:

str

cell_specs(project_id: str | None = None) → str[source]

Build a link to the cell specifications list page.

This is the project’s Cells page, which lists its cell specifications.

Parameters:

project_id (str | None, optional) – The project ID. Defaults to the client’s project_id.

Returns:

URL of the cell specifications list page.

Return type:

str

cell_instances(spec_id: str, project_id: str | None = None) → str[source]

Build a link to the cell instances list page for a specification.

Cell instances have no standalone detail route in the web app; this links to their cell specification’s page, which lists them.

Parameters:
  • spec_id (str) – The cell specification ID the instances belong to.

  • project_id (str | None, optional) – The project ID. Defaults to the client’s project_id.

Returns:

URL of the cell instances list page.

Return type:

str

measurement(measurement_id: str, project_id: str | None = None) → str[source]

Build a link to a cell measurement detail page.

Parameters:
  • measurement_id (str) – The cell measurement ID.

  • project_id (str | None, optional) – The project ID the measurement belongs to. Defaults to the project_id set on the Ionworks client (resolved from the IONWORKS_PROJECT_ID env var if not passed to the client).

Returns:

URL of the measurement detail page on https://app.ionworks.com.

Return type:

str