URLs#
Helpers that build links to pages in the Ionworks web app
(https://app.ionworks.com).
Frontend URL helpers for the Ionworks web app.
This module provides the UrlsClient, which builds links to pages in
the Ionworks web app without requiring callers to hand-construct URLs from
entity IDs.
Every method takes the resource’s own ID plus whatever parent IDs the route
requires, with project_id resolved from the explicit argument, else the
project_id configured on the Ionworks client (which itself
comes from the IONWORKS_PROJECT_ID env var).
The web-app host is derived from the client’s api_url so links point at the
same environment the client talks to (api.ionworks.com →
app.ionworks.com, stage-api.ionworks.com → stage.ionworks.com,
etc.). Set IONWORKS_APP_URL to override — needed for local development,
where the frontend runs on a different port than the API and so cannot be
derived.
- class ionworks.urls.UrlsClient(client)[source]#
Bases:
objectBuild links to pages in the Ionworks web app.
Returned URLs point at the environment the client is configured for, derived from its
api_url(override withIONWORKS_APP_URL).- Parameters:
client (Ionworks)
- project(project_id=None)[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 (
/dashboard/projects/{p}/studies), so this returns that URL.
- parameterized_model(parameterized_model_id, project_id=None)[source]#
Build a link to a parameterized model detail page.
- optimization(optimization_id, project_id=None)[source]#
Build a link to an optimization detail page.
- simulation(simulation_id, parameterized_model_id=None, project_id=None)[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. Whenparameterized_model_idis not supplied, it is fetched from the simulation viaclient.simulation.get(simulation_id).- 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:
- Raises:
ValueError – If
parameterized_model_idis not supplied and the fetched simulation has noparameterized_model_id(e.g. a study-only simulation). Passparameterized_model_idexplicitly in that case.
- cell_specs(project_id=None)[source]#
Build a link to the cell specifications list page.
Cell specifications have no standalone detail route in the web app; this links to their list page within the project’s data section.
- cell_instances(spec_id, project_id=None)[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 the instances list nested under their cell specification.