Property Data
albert.collections.property_data.PropertyDataCollection
Bases: BaseCollection
PropertyDataCollection is a collection class for managing Property Data entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_properties_on_inventory |
Returns all the properties of an inventory item. |
add_properties_to_inventory |
Add new properties to an inventory item. |
update_property_on_inventory |
Update a property on an inventory item. |
get_task_block_properties |
Returns all the properties within a Property Task block for a specific inventory item. |
check_for_task_data |
Checks if a task has data. |
check_block_interval_for_data |
Check if a specific block interval has data. |
get_all_task_properties |
Returns all the properties for a specific task. |
update_property_on_task |
Updates a specific property on a task. |
add_properties_to_task |
Add new task properties for a given task. |
update_or_create_task_properties |
Update or create task properties for a given task. |
bulk_load_task_properties |
Bulk load task properties for a given task. WARNING: This will overwrite any existing properties! |
bulk_delete_task_data |
Bulk delete task data for a given task. |
search |
Search for property data with various filtering options. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/property_data.py
get_properties_on_inventory
get_properties_on_inventory(
*, inventory_id: InventoryId
) -> InventoryPropertyData
Returns all the properties of an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to retrieve properties for. |
required |
Returns:
Type | Description |
---|---|
InventoryPropertyData
|
The properties of the inventory item. |
Source code in src/albert/collections/property_data.py
add_properties_to_inventory
add_properties_to_inventory(
*,
inventory_id: InventoryId,
properties: list[InventoryDataColumn],
) -> list[InventoryPropertyDataCreate]
Add new properties to an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to add properties to. |
required |
properties
|
list[InventoryDataColumn]
|
The properties to add. |
required |
Returns:
Type | Description |
---|---|
list[InventoryPropertyDataCreate]
|
The registered properties. |
Source code in src/albert/collections/property_data.py
update_property_on_inventory
update_property_on_inventory(
*,
inventory_id: InventoryId,
property_data: InventoryDataColumn,
) -> InventoryPropertyData
Update a property on an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to update the property on. |
required |
property_data
|
InventoryDataColumn
|
The updated property data. |
required |
Returns:
Type | Description |
---|---|
InventoryPropertyData
|
The updated property data as returned by the server. |
Source code in src/albert/collections/property_data.py
get_task_block_properties
get_task_block_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
) -> TaskPropertyData
Returns all the properties within a Property Task block for a specific inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The Property task ID. |
required |
block_id
|
BlockId
|
The Block ID of the block to retrieve properties for. |
required |
lot_id
|
LotId | None
|
The specific Lot of the inventory Item to retrieve lots for, by default None |
None
|
Returns:
Type | Description |
---|---|
TaskPropertyData
|
The properties of the inventory item within the block. |
Source code in src/albert/collections/property_data.py
check_for_task_data
check_for_task_data(
*, task_id: TaskId
) -> list[CheckPropertyData]
Checks if a task has data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to check for data. |
required |
Returns:
Type | Description |
---|---|
list[CheckPropertyData]
|
A list of CheckPropertyData objects representing the data status of each block + inventory item of the task. |
Source code in src/albert/collections/property_data.py
check_block_interval_for_data
check_block_interval_for_data(
*,
block_id: BlockId,
task_id: TaskId,
interval_id: IntervalId,
) -> CheckPropertyData
Check if a specific block interval has data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
block_id
|
BlockId
|
The ID of the block. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
interval_id
|
IntervalId
|
The ID of the interval. |
required |
Returns:
Type | Description |
---|---|
CheckPropertyData
|
description |
Source code in src/albert/collections/property_data.py
get_all_task_properties
get_all_task_properties(
*, task_id: TaskId
) -> list[TaskPropertyData]
Returns all the properties for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to retrieve properties for. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
A list of TaskPropertyData objects representing the properties within the task. |
Source code in src/albert/collections/property_data.py
update_property_on_task
update_property_on_task(
*,
task_id: TaskId,
patch_payload: list[PropertyDataPatchDatum],
) -> list[TaskPropertyData]
Updates a specific property on a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task. |
required |
patch_payload
|
list[PropertyDataPatchDatum]
|
The specific patch to make to update the property. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
A list of TaskPropertyData objects representing the properties within the task. |
Source code in src/albert/collections/property_data.py
add_properties_to_task
add_properties_to_task(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
properties: list[TaskPropertyCreate],
)
Add new task properties for a given task.
This method only works for new values. If a trial number is provided in the TaskPropertyCreate, it must relate to an existing trial. New trials must be added with no trial number provided. Do not try to create multiple new trials in one call as this will lead to unexpected behavior. Build out new trials in a loop if many new trials are needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
properties
|
list[TaskPropertyCreate]
|
A list of TaskPropertyCreate objects representing the properties to add. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The newly created task properties. |
Source code in src/albert/collections/property_data.py
update_or_create_task_properties
update_or_create_task_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
properties: list[TaskPropertyCreate],
) -> list[TaskPropertyData]
Update or create task properties for a given task.
If a trial number is provided in the TaskPropertyCreate, it must relate to an existing trial. New trials must be added with no trial number provided. Do not try to create multiple new trials in one call as this will lead to unexpected behavior. Build out new trials in a loop if many new trials are needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
properties
|
list[TaskPropertyCreate]
|
A list of TaskPropertyCreate objects representing the properties to update or create. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The updated or newly created task properties. |
Source code in src/albert/collections/property_data.py
bulk_load_task_properties
bulk_load_task_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
property_data: BulkPropertyData,
interval="default",
lot_id: LotId = None,
) -> list[TaskPropertyData]
Bulk load task properties for a given task. WARNING: This will overwrite any existing properties! BulkPropertyData column names must exactly match the names of the data columns (Case Sensitive).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
interval
|
str
|
The interval to use for the properties, by default "default". Can be obtained using Workflow.get_interval_id(). |
'default'
|
property_data
|
BulkPropertyData
|
A list of columnwise data containing all your rows of data for a single interval. Can be created using BulkPropertyData.from_dataframe(). |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The updated or newly created task properties. |
Example
from albert.resources.property_data import BulkPropertyData
data = BulkPropertyData.from_dataframe(df=my_dataframe)
res = client.property_data.bulk_load_task_properties(
block_id="BLK1",
inventory_id="INVEXP102748-042",
property_data=data,
task_id="TASFOR291760",
)
[TaskPropertyData(id="TASFOR291760", ...)]
Source code in src/albert/collections/property_data.py
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 527 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 |
|
bulk_delete_task_data
bulk_delete_task_data(
*,
task_id: TaskId,
block_id: BlockId,
inventory_id: InventoryId,
lot_id: LotId | None = None,
interval_id=None,
) -> None
Bulk delete task data for a given task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
interval_id
|
IntervalId
|
The ID of the interval, by default None. If provided, will delete data for this specific interval. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/property_data.py
search
search(
*,
limit: int = 100,
result: str | None = None,
text: str | None = None,
order: OrderBy | None = None,
sort_by: str | None = None,
inventory_ids: list[SearchInventoryId]
| SearchInventoryId
| None = None,
project_ids: list[SearchProjectId]
| SearchProjectId
| None = None,
lot_ids: list[LotId] | LotId | None = None,
data_template_ids: DataTemplateId
| list[DataTemplateId]
| None = None,
data_column_ids: DataColumnId
| list[DataColumnId]
| None = None,
category: list[DataEntity] | DataEntity | None = None,
data_templates: list[str] | str | None = None,
data_columns: list[str] | str | None = None,
parameters: list[str] | str | None = None,
parameter_group: list[str] | str | None = None,
unit: list[str] | str | None = None,
created_by: list[UserId] | UserId | None = None,
task_created_by: list[UserId] | UserId | None = None,
return_fields: list[str] | str | None = None,
return_facets: list[str] | str | None = None,
) -> Iterator[PropertyDataSearchItem]
Search for property data with various filtering options.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Maximum number of results to return. |
100
|
result
|
str
|
Find results using search syntax. e.g. to find all results with viscosity < 200 at a temperature of 25 we would do result=viscosity(<200)@temperature(25) |
None
|
text
|
str
|
Free text search across all searchable fields. |
None
|
order
|
OrderBy
|
Sort order (ascending/descending). |
None
|
sort_by
|
str
|
Field to sort results by. |
None
|
inventory_ids
|
SearchInventoryIdType or list of SearchInventoryIdType
|
Filter by inventory IDs. |
None
|
project_ids
|
ProjectIdType or list of ProjectIdType
|
Filter by project IDs. |
None
|
lot_ids
|
LotIdType or list of LotIdType
|
Filter by lot IDs. |
None
|
data_template_ids
|
DataTemplateId or list of DataTemplateId
|
Filter by data template IDs. |
None
|
data_column_ids
|
DataColumnId | list[DataColumnId] | None
|
Filter by data column IDs. |
None
|
category
|
DataEntity or list of DataEntity
|
Filter by data entity categories. |
None
|
data_templates
|
str or list of str (exact match)
|
Filter by data template names. |
None
|
data_columns
|
str or list of str (exact match)
|
Filter by data column names (currently non-functional). |
None
|
parameters
|
str or list of str (exact match)
|
Filter by parameter names. |
None
|
parameter_group
|
str or list of str (exact match)
|
Filter by parameter group names. |
None
|
unit
|
str or list of str (exact match)
|
Filter by unit names. |
None
|
created_by
|
UserIdType or list of UserIdType
|
Filter by creator user IDs. |
None
|
task_created_by
|
UserIdType or list of UserIdType
|
Filter by task creator user IDs. |
None
|
return_fields
|
str or list of str
|
Specific fields to include in results. If None, returns all fields. |
None
|
return_facets
|
str or list of str
|
Specific facets to include in results. |
None
|
Returns:
Type | Description |
---|---|
dict
|
Search results matching the specified criteria. |
Source code in src/albert/collections/property_data.py
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 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|