Data Templates
albert.collections.data_templates.DataTemplateCollection
Bases: BaseCollection
Manage Data Templates in the Albert platform.
A Data Template (DAT, IDs formatted DAT...) defines what a test captures. It
has two parts:
data_column_values: the measured RESULTS of the test (its data columns, also called "direct variables"). SeeDataColumnValueandDataColumn.parameter_values: the CONDITIONS under which the test is run (also called "indirect variables"). SeeParameterValueand the Parameter collection.
A Data Template does not itself store measured values; those live as Property Data. When a Data Template is paired with a Workflow inside a Block, only its parameters (not its result columns) flow into the Workflow's setpoints.
This collection is accessed as client.data_templates.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for data template requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new data template, including its data columns and parameters. |
get_by_id |
Get a single fully populated template by its ID. |
get_by_ids |
Get many templates by their IDs in batches. |
get_by_name |
Get a single template by exact (case-insensitive) name, or None. |
search |
Fast, lightweight search returning partial items (best for lookups/counts). |
get_all |
Same filters as search, but returns fully populated templates (slower). |
add_data_columns |
Attach result data columns to an existing template. |
add_parameters |
Attach condition parameters to an existing template. |
update |
Update an existing template. |
delete |
Delete a template by its ID. |
set_curve_example |
Set the example row for a curve data column (shown on the details page). |
set_image_example |
Set the example row for an image data column (shown on the details page). |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/data_templates.py
create
create(*, data_template: DataTemplate) -> DataTemplate
Create a new data template.
Creates the template along with its result data columns
(data_column_values) and condition parameters (parameter_values).
Parameters are attached in a follow-up request after the template itself is
created.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template
|
DataTemplate
|
The template to create. |
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The newly created template, populated with its assigned Data Template ID. |
Source code in src/albert/collections/data_templates.py
get_by_id
get_by_id(*, id: DataTemplateId) -> DataTemplate
Get a single, fully populated data template by its ID.
For retrieving many templates at once, use get_by_ids. To find
templates without knowing their IDs, use search or get_all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DataTemplateId
|
The Data Template ID (format |
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The fully populated template. |
Source code in src/albert/collections/data_templates.py
get_by_ids
get_by_ids(
*, ids: list[DataTemplateId]
) -> list[DataTemplate]
Get multiple fully populated data templates by their IDs.
Requests are automatically split into batches, so arbitrarily long ID lists are supported.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[DataTemplateId]
|
The Data Template IDs to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
list[DataTemplate]
|
The matching templates. |
Source code in src/albert/collections/data_templates.py
get_by_name
get_by_name(*, name: str) -> DataTemplate | None
Get a single, fully populated data template by its exact name.
The match is case-insensitive. If multiple templates share the name, the first match is returned. Returns None when no template matches.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The exact name of the data template to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
DataTemplate or None
|
The matching template, or None if not found. |
Source code in src/albert/collections/data_templates.py
add_data_columns
add_data_columns(
*,
data_template_id: DataTemplateId,
data_columns: list[DataColumnValue],
) -> DataTemplate
Add result data columns to an existing data template.
Data columns are the measured results the test captures (its "direct variables"). Any enum validations declared on the columns are created as part of this call.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template_id
|
DataTemplateId
|
The Data Template ID to add the columns to (format |
required |
data_columns
|
list[DataColumnValue]
|
The result columns to add. See
|
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The updated template, re-fetched with the new columns. |
Source code in src/albert/collections/data_templates.py
add_parameters
add_parameters(
*,
data_template_id: DataTemplateId,
parameters: list[ParameterValue],
) -> DataTemplate
Add condition parameters to an existing data template.
Parameters are the conditions under which the test is run (its "indirect variables"), and are what flow into a Workflow's setpoints when the template is used in a Block. Any enum validations declared on the parameters are created as part of this call.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template_id
|
DataTemplateId
|
The Data Template ID to add the parameters to (format |
required |
parameters
|
list[ParameterValue]
|
The parameters to add. See
|
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The updated template, re-fetched with the new parameters. |
Source code in src/albert/collections/data_templates.py
search
search(
*,
name: str | None = None,
user_id: UserId | None = None,
owner: str | list[str] | None = None,
tags: str | list[str] | None = None,
data_columns: str | list[str] | None = None,
standard_organization: str | list[str] | None = None,
additional_field: str | list[str] | None = None,
created_by: str | list[str] | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
metadata_filters: dict[str, Any] | None = None,
is_drop_down: bool | None = None,
sort_by: str | None = None,
facet_text: str | None = None,
facet_field: str | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
search_field: list[str] | None = None,
search_query_string: str | None = None,
custom_fields: dict[str, Any] | None = None,
source_field: list[str] | None = None,
order_by: OrderBy = DESCENDING,
max_items: int | None = None,
offset: int | None = 0,
) -> Iterator[DataTemplateSearchItem]
Search for data templates matching the given filters.
This is the fast path: it returns partial (unhydrated)
DataTemplateSearchItem entities and is
best for lookups, counts, and pulling IDs. To retrieve fully populated
templates, use get_all instead. Results are returned lazily as an
iterator that pages through the API on demand.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Filter by data template name (text match). |
None
|
user_id
|
UserId
|
Filter by the ID of an associated user. |
None
|
owner
|
str or list[str]
|
Filter by owner name(s). |
None
|
tags
|
str or list[str]
|
Filter by tag name(s). |
None
|
data_columns
|
str or list[str]
|
Filter by data column name(s). |
None
|
standard_organization
|
str or list[str]
|
Filter by standards organization name(s). |
None
|
additional_field
|
str or list[str]
|
Additional fields to include on each returned item. If omitted, a default set of fields is requested. |
None
|
created_by
|
str or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
from_created_at
|
str
|
Only include templates created on or after this date (ISO 8601). |
None
|
to_created_at
|
str
|
Only include templates created on or before this date (ISO 8601). |
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the template. Accepts UserId(s)
only (e.g. |
None
|
from_updated_at
|
str
|
Only include templates updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include templates updated on or before this date (ISO 8601). |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. |
None
|
is_drop_down
|
bool
|
When True, apply smart dropdown search behavior. |
None
|
sort_by
|
str
|
Attribute to sort results by. |
None
|
facet_text
|
str
|
Text to match within a facet search. |
None
|
facet_field
|
str
|
Field to search within for facet filtering. |
None
|
contains_field
|
str or list[str]
|
Field(s) to apply a "contains" search to. |
None
|
contains_text
|
str or list[str]
|
Text value(s) for the "contains" search. |
None
|
search_field
|
list[str]
|
Restrict which fields the name query searches. |
None
|
search_query_string
|
str
|
Filter by custom field query string. |
None
|
custom_fields
|
dict[str, Any]
|
Filter by custom field values. |
None
|
source_field
|
list[str]
|
Restrict which fields are returned in search results. |
None
|
order_by
|
OrderBy
|
The order in which to sort results. Default is |
DESCENDING
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matching items. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[DataTemplateSearchItem]
|
A lazy iterator of matching partial templates. Call
|
Source code in src/albert/collections/data_templates.py
369 370 371 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 407 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 433 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 459 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 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
update
update(*, data_template: DataTemplate) -> DataTemplate
Update an existing data template.
Only the fields listed in Notes are applied. New data columns and parameters present on the supplied template (including their enum validations) are created as part of this call.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template
|
DataTemplate
|
The template to update. Its |
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The updated template. |
Notes
The following fields can be updated: name, description, and
metadata on the template itself, and per-parameter value, unit,
required, and validation.
Warnings
Only scalar data column values (text, number, dropdown) can be updated with
this method. Use set_curve_example or set_image_example to set
example values for curve and image data column types.
Source code in src/albert/collections/data_templates.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
delete
delete(*, id: DataTemplateId) -> None
Delete a data template by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DataTemplateId
|
The Data Template ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/data_templates.py
get_all
get_all(
*,
name: str | None = None,
user_id: UserId | None = None,
owner: str | list[str] | None = None,
tags: str | list[str] | None = None,
data_columns: str | list[str] | None = None,
standard_organization: str | list[str] | None = None,
additional_field: str | list[str] | None = None,
created_by: str | list[str] | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
metadata_filters: dict[str, Any] | None = None,
is_drop_down: bool | None = None,
sort_by: str | None = None,
facet_text: str | None = None,
facet_field: str | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
search_field: list[str] | None = None,
search_query_string: str | None = None,
custom_fields: dict[str, Any] | None = None,
source_field: list[str] | None = None,
order_by: OrderBy = DESCENDING,
max_items: int | None = None,
offset: int | None = 0,
) -> Iterator[DataTemplate]
Get fully populated data templates matching the given filters.
This mirrors search but hydrates each match into a complete
DataTemplate (via get_by_ids), so it is slower. Use
search when you only need lightweight, partial entities. Results are
returned lazily as an iterator that pages through the API on demand.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Filter by data template name (text match). |
None
|
user_id
|
UserId
|
Filter by the ID of an associated user. |
None
|
owner
|
str or list[str]
|
Filter by owner name(s). |
None
|
tags
|
str or list[str]
|
Filter by tag name(s). |
None
|
data_columns
|
str or list[str]
|
Filter by data column name(s). |
None
|
standard_organization
|
str or list[str]
|
Filter by standards organization name(s). |
None
|
additional_field
|
str or list[str]
|
Additional fields to include on each returned item. If omitted, a default set of fields is requested. |
None
|
created_by
|
str or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
from_created_at
|
str
|
Only include templates created on or after this date (ISO 8601). |
None
|
to_created_at
|
str
|
Only include templates created on or before this date (ISO 8601). |
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the template. Accepts UserId(s)
only (e.g. |
None
|
from_updated_at
|
str
|
Only include templates updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include templates updated on or before this date (ISO 8601). |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. |
None
|
is_drop_down
|
bool
|
When True, apply smart dropdown search behavior. |
None
|
sort_by
|
str
|
Attribute to sort results by. |
None
|
facet_text
|
str
|
Text to match within a facet search. |
None
|
facet_field
|
str
|
Field to search within for facet filtering. |
None
|
contains_field
|
str or list[str]
|
Field(s) to apply a "contains" search to. |
None
|
contains_text
|
str or list[str]
|
Text value(s) for the "contains" search. |
None
|
search_field
|
list[str]
|
Restrict which fields the name query searches. |
None
|
search_query_string
|
str
|
Filter by custom field query string. |
None
|
custom_fields
|
dict[str, Any]
|
Filter by custom field values. |
None
|
source_field
|
list[str]
|
Restrict which fields are returned in search results. |
None
|
order_by
|
OrderBy
|
The order in which to sort results. Default is |
DESCENDING
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matching items. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[DataTemplate]
|
A lazy iterator over fully populated templates. Preserves |
Source code in src/albert/collections/data_templates.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | |
set_curve_example
set_curve_example(
*,
data_template_id: DataTemplateId,
data_column_id: DataColumnId | None = None,
data_column_name: str | None = None,
example: CurveExample,
) -> DataTemplate
Set the example row for a curve data column.
An example row is a sample value displayed only on the Data Template details
page (it is not shown in tasks and is not measured Property Data). Curve
columns get a dedicated helper because a curve is a complex type sourced from a
CSV file or an existing attachment. Identify the target column by exactly one
of data_column_id or data_column_name.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template_id
|
DataTemplateId
|
The Data Template ID that owns the column (format |
required |
data_column_id
|
DataColumnId
|
The target curve column's ID. Provide exactly one of |
None
|
data_column_name
|
str
|
The target curve column's name. Provide exactly one of |
None
|
example
|
CurveExample
|
The curve example to apply. See
|
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The updated template, re-fetched after the example is applied. |
Source code in src/albert/collections/data_templates.py
set_image_example
set_image_example(
*,
data_template_id: DataTemplateId,
data_column_id: DataColumnId | None = None,
data_column_name: str | None = None,
example: ImageExample,
) -> DataTemplate
Set the example row for an image data column.
An example row is a sample value displayed only on the Data Template details
page (it is not shown in tasks and is not measured Property Data). Image
columns get a dedicated helper because an image is a complex type sourced from
a local file. Identify the target column by exactly one of data_column_id
or data_column_name.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_template_id
|
DataTemplateId
|
The Data Template ID that owns the column (format |
required |
data_column_id
|
DataColumnId
|
The target image column's ID. Provide exactly one of |
None
|
data_column_name
|
str
|
The target image column's name. Provide exactly one of |
None
|
example
|
ImageExample
|
The image example to apply. See
|
required |
Returns:
| Type | Description |
|---|---|
DataTemplate
|
The updated template, re-fetched after the example is applied. |