plexus.dashboard.api.models.graph_node module

GraphNode Model - Python representation of the GraphQL GraphNode type.

Represents a node in the procedure tree structure. Each node belongs to a procedure and can have a parent node (None for root nodes) and child nodes. Nodes track their status information and store metadata as JSON.

The simplified schema stores all data directly on the GraphNode using a metadata field instead of separate code, hypothesis, insight, and value fields.

class plexus.dashboard.api.models.graph_node.GraphNode(id: str, accountId: str, procedureId: str, createdAt: str, updatedAt: str, parentNodeId: str | None = None, name: str | None = None, status: str | None = None, metadata: Dict[str, Any] | None = None, client: ForwardRef('_BaseAPIClient') | None = None)

Bases: BaseModel

__init__(id: str, accountId: str, procedureId: str, createdAt: str, updatedAt: str, parentNodeId: str | None = None, name: str | None = None, status: str | None = None, metadata: Dict[str, Any] | None = None, client: _BaseAPIClient | None = None)
accountId: str
classmethod create(client: _BaseAPIClient, accountId: str, procedureId: str, parentNodeId: str | None = None, name: str | None = None, status: str | None = None, metadata: Dict[str, Any] | None = None) GraphNode

Create a new graph node.

Args:

client: The API client accountId: ID of the account this node belongs to procedureId: ID of the procedure this node belongs to parentNodeId: ID of the parent node (None for root nodes) name: Name of the node (optional) status: Node status (optional) metadata: Metadata as JSON (optional)

Returns:

The created GraphNode instance

create_child(initial_metadata: Dict[str, Any] | None = None, status: str | None = None) GraphNode

Create a child node with initial metadata.

Args:

initial_metadata: Initial metadata (optional, defaults to None) status: Node status (optional)

Returns:

The created child GraphNode

createdAt: str
delete() bool

Delete this graph node.

Returns:

True if deletion was successful

classmethod fields() str

Return the GraphQL fields to query for this model

classmethod from_dict(data: Dict[str, Any], client: _BaseAPIClient) GraphNode

Create an instance from a dictionary of data

get_children(limit: int = 100) List[GraphNode]

Get child nodes for this node.

Args:

limit: Maximum number of children to return

Returns:

List of child GraphNode instances

get_latest_version()
get_parent() GraphNode | None

Get the parent node for this node.

Returns:

The parent GraphNode or None if this is a root node

classmethod list_by_parent(parentNodeId: str, client: _BaseAPIClient, limit: int = 100) List[GraphNode]

List child nodes for a parent node.

Args:

parentNodeId: The parent node ID to filter by client: The API client instance limit: Maximum number of nodes to return

Returns:

List of GraphNode instances that are children of the parent

classmethod list_by_procedure(procedureId: str, client: _BaseAPIClient, limit: int = 100) List[GraphNode]

List nodes for a procedure, ordered by creation time.

Args:

procedureId: The procedure ID to filter by client: The API client instance limit: Maximum number of nodes to return

Returns:

List of GraphNode instances ordered by creation time

metadata: Dict[str, Any] | None
name: str | None
parentNodeId: str | None
procedureId: str
status: str | None
update(status: str | None = None) GraphNode

Update this graph node.

Args:

status: New status

Returns:

Updated GraphNode instance

update_content(status: str | None = None, metadata: Dict[str, Any] | None = None) GraphNode

Update the content of this node.

Args:

status: New status (optional) metadata: New metadata (JSON object, optional)

Returns:

The updated GraphNode

updatedAt: str