Result Table Templates
result_table_templates
Result table templates module for the Kaleidoscope API client.
Result table templates are reusable record-view configurations that can be linked to one or more experiment types (operation definitions). When linked, each experiment of that type gets a record view created from the template's field/filter/sort configuration.
This module provides a dedicated ResultTableTemplate model so templates
remain conceptually separate from regular record views (which are scoped to
a specific operation or workspace context).
Classes:
| Name | Description |
|---|---|
ResultTableTemplate |
Data model for a result table template. |
ResultTableTemplatesService |
Service for CRUD operations on templates, plus linking templates to experiment types. |
Example
# List all templates
templates = client.result_table_templates.get_templates()
# Create a template on an entity slice with two fields
template = client.result_table_templates.create_template(
view_name="Compound results",
entity_slice_id="slice-uuid",
data_field_ids=["field-uuid-1", "field-uuid-2"],
template_name="Standard compound results",
)
# Link the template to an experiment type
view = client.result_table_templates.link_to_operation_definition(
template.id,
operation_definition_id="definition-uuid",
)
ResultTableTemplate
Bases: RecordView
A reusable record-view configuration that can be linked to experiment types.
Same data shape as RecordView (templates ARE record views server-side,
distinguished by is_template=True), exposed as its own type for
clarity at call sites. Templates are not bound to a specific operation
or read-only context — they're blueprints that experiment types
instantiate when linked.
Inherits all of RecordView's fields, including template_name and
is_template (always True for instances of this class).
ResultTableTemplatesService
ResultTableTemplatesService(client: KaleidoscopeClient)
Service for managing result table templates.
Provides CRUD methods for templates and helpers for linking templates to experiment types (operation definitions).
Methods:
| Name | Description |
|---|---|
get_templates |
Retrieve all result table templates in the workspace. |
get_template_by_id |
Retrieve a single template by ID. |
create_template |
Create a new result table template from scratch. |
save_view_as_template |
Save an existing record view as a template. |
update_template |
Update an existing template. |
delete_template |
Soft-delete a template. |
duplicate_template |
Create a copy of an existing template. |
promote_view_to_template |
Promote an existing record view to a template, linked to the same definition. |
link_to_operation_definition |
Link a template to an experiment type (operation definition). |
unlink_from_operation_definition |
Remove a single template link from an experiment type. |
bulk_link_to_operation_definitions |
Link a template to multiple experiment types at once. |
bulk_unlink_from_operation_definitions |
Remove all instances of a template from multiple experiment types. |
Source code in kalbio/result_table_templates.py
76 77 | |
get_templates
cached
get_templates() -> list[ResultTableTemplate]
Retrieve all result table templates in the workspace.
This method caches its results.
Returns:
| Type | Description |
|---|---|
list[ResultTableTemplate]
|
A list of ResultTableTemplate objects. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
get_template_by_id
get_template_by_id(template_id: str) -> ResultTableTemplate | None
Retrieve a single template by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
UUID of the template to fetch. |
required |
Returns:
| Type | Description |
|---|---|
ResultTableTemplate | None
|
The ResultTableTemplate if found, otherwise None. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
create_template
create_template(*, view_name: str, entity_slice_id: str, template_name: str | None = None, program_ids: list[str] | None = None, view_field_ids: list[str] | None = None, data_field_ids: list[str] | None = None, lookup_field_ids: list[str] | None = None, plot_field_ids: list[str] | None = None, filters: list[RecordViewFilter] | None = None, sorts: list[RecordViewSort] | None = None, color_filters: list[RecordViewColorFilter] | None = None, record_set_ids_filter: list[str] | None = None, sort_order: str | None = None, sort_descending: bool | None = None, view_mode: str | None = None, group_by_mode: str | None = None, group_by_field_id: str | None = None) -> ResultTableTemplate
Create a new result table template from scratch.
For each optional argument, pass None (default) to omit it from the
request — the server applies its own defaults (typically empty lists).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
Display name for the view this template produces. |
required |
entity_slice_id
|
str
|
UUID of the entity slice the template targets. |
required |
template_name
|
str | None
|
Optional human-readable template label. |
None
|
program_ids
|
list[str] | None
|
Programs to associate with the template. |
None
|
view_field_ids
|
list[str] | None
|
Existing view-field UUIDs to copy into the template. |
None
|
data_field_ids
|
list[str] | None
|
Data field UUIDs to add as view fields. |
None
|
lookup_field_ids
|
list[str] | None
|
Lookup field UUIDs to add as view fields. |
None
|
plot_field_ids
|
list[str] | None
|
Plot field UUIDs to add as view fields. |
None
|
filters
|
list[RecordViewFilter] | None
|
View filters (each entry follows the server filter shape). |
None
|
sorts
|
list[RecordViewSort] | None
|
View sorts. |
None
|
color_filters
|
list[RecordViewColorFilter] | None
|
Color-filter configurations. |
None
|
record_set_ids_filter
|
list[str] | None
|
Record set UUIDs to restrict the view to. |
None
|
sort_order
|
str | None
|
|
None
|
sort_descending
|
bool | None
|
Sort direction. |
None
|
view_mode
|
str | None
|
Display mode (e.g. |
None
|
group_by_mode
|
str | None
|
Grouping mode. |
None
|
group_by_field_id
|
str | None
|
Group-by field UUID. |
None
|
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The newly created ResultTableTemplate. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Example
template = client.result_table_templates.create_template(
view_name="Compound results",
entity_slice_id="slice-uuid",
data_field_ids=["field-uuid-1", "field-uuid-2"],
template_name="Standard compound results",
)
Source code in kalbio/result_table_templates.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
save_view_as_template
save_view_as_template(*, source_view_id: str, view_name: str, template_name: str | None = None) -> ResultTableTemplate
Save an existing record view as a template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_view_id
|
str
|
UUID of the record view to copy. |
required |
view_name
|
str
|
Display name for the new template's view. |
required |
template_name
|
str | None
|
Optional human-readable template label. |
None
|
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The newly created ResultTableTemplate. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
update_template
update_template(template_id: str, *, view_name: str | None = None, template_name: str | None = None, program_ids: list[str] | None = None, save_view_field_ids: list[str] | None = None, remove_view_field_ids: list[str] | None = None, reorder_view_field_ids: list[str] | None = None, filters: list[RecordViewFilter] | None = None, sorts: list[RecordViewSort] | None = None, color_filters: list[RecordViewColorFilter] | None = None, record_set_ids_filter: list[str] | None = None, is_archived: bool | None = None, sort_order: str | None = None, sort_descending: bool | None = None, view_mode: str | None = None, group_by_mode: str | None = None, group_by_field_id: str | None = None) -> ResultTableTemplate
Update an existing template.
Only arguments with a non-None value are sent to the server —
omitted fields (or fields passed as None) are left unchanged.
There's no way to explicitly clear a nullable field through this
method; use client._put directly if you need to send null.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
UUID of the template to update. |
required |
view_name
|
str | None
|
New display name. |
None
|
template_name
|
str | None
|
New template label. |
None
|
program_ids
|
list[str] | None
|
Replace the associated programs. |
None
|
save_view_field_ids
|
list[str] | None
|
View-field UUIDs to add/save. |
None
|
remove_view_field_ids
|
list[str] | None
|
View-field UUIDs to remove. |
None
|
reorder_view_field_ids
|
list[str] | None
|
New order of view-field UUIDs. |
None
|
filters, sorts, color_filters
|
Replace these configurations wholesale with the provided list. |
required | |
record_set_ids_filter
|
list[str] | None
|
Replace record set filter. |
None
|
is_archived
|
bool | None
|
Set archived state. |
None
|
sort_order, sort_descending, view_mode
|
View-level config. |
required | |
group_by_mode, group_by_field_id
|
Grouping config. |
required |
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The updated ResultTableTemplate. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
delete_template
delete_template(template_id: str) -> None
Soft-delete a template.
Any experiment types linked to the template will have their template pointers cleared.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
UUID of the template to delete. |
required |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
duplicate_template
duplicate_template(template_id: str) -> ResultTableTemplate
Create a copy of an existing template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
UUID of the template to duplicate. |
required |
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The newly created ResultTableTemplate copy. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
promote_view_to_template
promote_view_to_template(*, source_view_id: str, operation_definition_id: str, view_name: str, position_index: int | None = None) -> ResultTableTemplate
Promote an existing record view to a template, linked to the same definition.
Atomically saves the view as a template, links the template to the operation definition at the same position the original view occupied, and removes the original view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_view_id
|
str
|
UUID of the record view to promote. |
required |
operation_definition_id
|
str
|
UUID of the operation definition the view currently belongs to. |
required |
view_name
|
str
|
Display name for the resulting template's view. |
required |
position_index
|
int | None
|
Optional layout position for the new linked view. |
None
|
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The newly created ResultTableTemplate. |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
link_to_operation_definition
link_to_operation_definition(template_view_id: str, *, operation_definition_id: str, position_index: int | None = None) -> ResultTableTemplate
Link a template to an experiment type (operation definition).
Adds the definition's id to the template's operation_definition_ids
so the template appears in that experiment type's content layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_view_id
|
str
|
UUID of the template to link. |
required |
operation_definition_id
|
str
|
UUID of the operation definition. |
required |
position_index
|
int | None
|
Optional layout position. |
None
|
Returns:
| Type | Description |
|---|---|
ResultTableTemplate
|
The updated template (now linked to the operation definition). |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
unlink_from_operation_definition
unlink_from_operation_definition(template_id: str, *, operation_definition_id: str, content_layout_id: str) -> None
Remove a single template link from an experiment type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_id
|
str
|
UUID of the template that's linked. |
required |
operation_definition_id
|
str
|
UUID of the operation definition. |
required |
content_layout_id
|
str
|
UUID of the content layout item to remove. |
required |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
bulk_link_to_operation_definitions
bulk_link_to_operation_definitions(template_view_id: str, *, operation_definition_ids: list[str]) -> None
Link a template to multiple experiment types at once.
The template is appended to the bottom of each definition's content layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_view_id
|
str
|
UUID of the template. |
required |
operation_definition_ids
|
list[str]
|
UUIDs of operation definitions to link to. Must contain at least one ID. |
required |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
bulk_unlink_from_operation_definitions
bulk_unlink_from_operation_definitions(template_view_id: str, *, operation_definition_ids: list[str]) -> None
Remove all instances of a template from multiple experiment types.
Clears any registration configurations referencing the template on those definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_view_id
|
str
|
UUID of the template. |
required |
operation_definition_ids
|
list[str]
|
UUIDs of operation definitions to unlink from. Must contain at least one ID. |
required |
Raises:
| Type | Description |
|---|---|
KalbioAPIError
|
If the API request fails. |
Source code in kalbio/result_table_templates.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |