ChecklistBuilder#
- class nominal.experimental.compute_as_code.ChecklistBuilder(*, strict: bool = False)#
Bases:
objectCollect source checks and publish complete checklist revisions.
Adding checks is local. Source and bindings are captured when added.
createpublishes a new checklist;commitreplaces an existing checklist’s definition. Source strings are compiled with nominal-compute and retained for the frontend code editor.- Parameters:
strict – Reject unused input bindings when True. Missing bindings always raise.
Example
check = CheckDefinition( "Overheating", "(temperature > 100).ranges()", priority=Priority.P1, ) builder = ChecklistBuilder() builder.add( check, inputs={"temperature": ChannelBinding("telemetry", "engine.temperature")}, ) checklist = builder.create(client, "Engine acceptance")
- add(check: CheckDefinition, *, inputs: Mapping[str, ChannelBinding]) Self#
Compile and bind a reusable check, capturing its source and channels locally.
- Parameters:
check – Failure condition and metadata. Source must compile to a range series.
inputs – Map expression names to channels. Missing bindings always fail. Unused bindings are omitted, or rejected when the builder has
strict=True.
- Returns:
This builder. A failed addition leaves it unchanged.
- Raises:
TypeError – The expression is not a source string or does not produce a range series.
ValueError – Compilation fails, bindings are missing, strict bindings are unused, a stable key is blank or duplicated, or the event type is UNKNOWN.
Note
Compilation does not resolve live channels or establish streaming compatibility. Alignment, fill, and missing-data behavior follow service defaults. A check’s ranges describe violations; absence of data does not establish a passing result.
- commit(checklist: Checklist, *, commit_message: str) Checklist#
Replace a published checklist’s definition with a new commit on main.
- Parameters:
checklist – Loaded checklist to update, supplying the expected main commit.
commit_message – Description of this revision.
- Returns:
The same checklist, refreshed from the response with its new
commit_id. Save the previous ID before committing if you need to execute the earlier version.- Raises:
ValueError – If no checks have been added or the checklist has no loaded commit ID.
conjure_python_client.ConjureHTTPError – If someone else committed to the checklist since it was loaded. The checklist object is not refreshed in that case.
Note
This replaces all checks and checklist variables, including content authored in the UI. Omitted checks disappear from the new version; earlier versions remain available. Reusing a stable key preserves check lineage through renames and expression changes. Metadata and streaming settings are not changed by this request.
The service rejects stale writes. This method does not refresh or retry a conflict; reconcile your definition with the latest checklist before trying again. Every successful call creates a commit, even if the definition is unchanged.
Committing to main can update running streaming evaluations asynchronously. Returning confirms the commit, not adoption by every asset. No extra reload is issued by the SDK.
- create(client: NominalClient, name: str, *, description: str = '', assignee: User | str | None = None, commit_message: str = '', labels: Sequence[str] = (), properties: Mapping[str, str] | None = None, workspace: Workspace | str | None = None) Checklist#
Create and publish a new checklist without executing it.
- Parameters:
client – Client used for creation.
name – Display name of the checklist.
description – Description of the checklist.
assignee – User or user RID assigned to the checklist. Defaults to the authenticated user.
commit_message – Message on the initial checklist commit.
labels – Labels applied to the checklist.
properties – String properties applied to the checklist.
workspace – Workspace or workspace RID for creation. Defaults to the client’s default workspace.
- Returns:
The published checklist. Use its
executemethod to initiate a data review.- Raises:
ValueError – If no checks have been added.
Note
This creates a new resource on every call; it does not update an existing checklist or consume the builder. Reuse the returned checklist with
commitfor later revisions.