medmodels.medrecord.medrecord
process_nodes_dataframe
def process_nodes_dataframe(nodes: pd.DataFrame) -> PolarsNodeDataFrameInput
Converts a pandas DataFrame of nodes to a Polars DataFrame with an index column.
Ensures the DataFrame has an Index and returns a tuple containing the converted Polars DataFrame and the name of the index column.
Arguments:
nodes
pd.DataFrame - A DataFrame representing nodes, must have an Index.
Returns:
PolarsNodeDataFrameInput
- A tuple of the Polars DataFrame and index column name.
process_edges_dataframe
def process_edges_dataframe(edges: pd.DataFrame) -> PolarsEdgeDataFrameInput
Converts a pandas DataFrame of edges to a Polars DataFrame with index columns.
Ensures the DataFrame has a MultiIndex with exactly 2 levels and returns a tuple containing the converted Polars DataFrame and names of the index columns.
Arguments:
edges
pd.DataFrame - A DataFrame representing edges, must have a MultiIndex.
Returns:
PolarsEdgeDataFrameInput
- A tuple of the Polars DataFrame, source index, and target index column names.
MedRecord Objects
class MedRecord()
A class to manage medical records with node and edge data structures.
Provides methods to create instances from different data formats, manage node and edge attributes, and perform operations like adding or removing nodes and edges.
__init__
def __init__() -> None
Initializes a new MedRecord instance with an underlying PyMedRecord object.
from_tuples
@classmethod
def from_tuples(
cls,
nodes: List[tuple[NodeIndex, Attributes]],
edges: Optional[List[tuple[NodeIndex, NodeIndex, Attributes]]] = None
) -> MedRecord
Creates a MedRecord instance from lists of node and edge tuples.
Nodes and edges are specified as lists of tuples. Each node tuple contains a node index and attributes. Each edge tuple includes indices of the source and target nodes and edge attributes.
Arguments:
nodes
List[tuple[NodeIndex, Attributes]] - List of node tuples.edges
Optional[List[tuple[NodeIndex, NodeIndex, Attributes]]] - List of edge tuples, defaults to an empty list.
Returns:
MedRecord
- A new instance created from the provided tuples.
from_pandas
@classmethod
def from_pandas(
cls,
nodes: Union[pd.DataFrame, List[pd.DataFrame]],
edges: Optional[Union[pd.DataFrame,
List[pd.DataFrame]]] = None) -> MedRecord
Creates a MedRecord instance from pandas DataFrames of nodes and edges.
Accepts single DataFrames or lists of DataFrames for nodes and edges. Each node DataFrame must have an Index, and each edge DataFrame must have a MultiIndex with 2 levels.
Arguments:
nodes
Union[pd.DataFrame, List[pd.DataFrame]] - Nodes DataFrame(s). edges (Optional[Union[pd.DataFrame, List[pd.DataFrame]]]): Edges DataFrame(s).
Returns:
MedRecord
- A new instance from the provided DataFrames.
from_polars
@classmethod
def from_polars(
cls,
nodes: Union[PolarsNodeDataFrameInput, List[PolarsNodeDataFrameInput]],
edges: Optional[Union[PolarsEdgeDataFrameInput,
List[PolarsEdgeDataFrameInput]]] = None
) -> MedRecord
Creates a MedRecord from Polars DataFrames of nodes and optionally edges.
Accepts a tuple or a list of tuples for nodes and edges. Each node tuple consists of a Polars DataFrame and an index column. Edge tuples include a DataFrame and index columns for source and target nodes.
Arguments:
nodes (Union[PolarsNodeDataFrameInput, List[PolarsNodeDataFrameInput]]): Node data. edges (Optional[Union[PolarsEdgeDataFrameInput, List[PolarsEdgeDataFrameInput]]]): Edge data, optional.
Returns:
MedRecord
- A new instance from the provided Polars DataFrames.
from_ron
@classmethod
def from_ron(cls, path: str) -> MedRecord
Creates a MedRecord instance from a RON file.
Reads node and edge data from a RON file specified by the path and creates a new MedRecord instance using this data.
Arguments:
path
str - Path to the RON file.
Returns:
MedRecord
- A new instance created from the RON file.
to_ron
def to_ron(path: str) -> None
Writes the MedRecord instance to a RON file.
Serializes the MedRecord instance to a RON file at the specified path.
Arguments:
path
str - Path where the RON file will be written.
Returns:
None
nodes
@property
def nodes() -> List[NodeIndex]
Lists the node indices in the MedRecord instance.
Returns a list of all node indices currently managed by the MedRecord instance.
Returns:
List[NodeIndex]
- A list of node indices.
node
@property
def node() -> NodeIndexer
Provides access to node attributes within the MedRecord instance via an indexer.
Facilitates querying, accessing, manipulating, and setting node attributes using various indexing methods. Supports conditions and ranges for more complex queries.
Returns:
NodeIndexer
- An object for manipulating and querying node attributes.
edges
@property
def edges() -> List[EdgeIndex]
Lists the edge indices in the MedRecord instance.
Returns a list of all edge indices currently managed by the MedRecord instance.
Returns:
List[EdgeIndex]
- A list of edge indices.
edge
@property
def edge() -> EdgeIndexer
Provides access to edge attributes within the MedRecord instance via an indexer.
Facilitates querying, accessing, manipulating, and setting edge attributes using various indexing methods. Supports conditions and ranges for more complex queries.
Returns:
EdgeIndexer
- An object for manipulating and querying edge attributes.
groups
@property
def groups() -> List[Group]
Lists the groups in the MedRecord instance.
Returns a list of all groups currently defined within the MedRecord instance.
Returns:
List[Group]
- A list of groups.
group
def group(
group: Union[Group, List[Group]]
) -> Union[List[NodeIndex], Dict[Group, List[NodeIndex]]]
Returns the node indices associated with the specified group(s) in the MedRecord.
If a single group is specified, returns a list of node indices for that group. If multiple groups are specified, returns a dictionary with each group name mapping to its list of node indices.
Arguments:
group
Union[Group, List[Group]] - One or more group names.
Returns:
Union[List[NodeIndex], Dict[Group, List[NodeIndex]]]: Node indices for each specified group.
outgoing_edges
def outgoing_edges(
node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]]
Lists the outgoing edges of the specified node(s) in the MedRecord.
If a single node index is provided, returns a list of its outgoing edge indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of outgoing edge indices.
Arguments:
node
Union[NodeIndex, List[NodeIndex], NodeOperation] - One or more node indices.
Returns:
Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]]: Outgoing edge indices for each specified node.
incoming_edges
def incoming_edges(
node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]]
Lists the incoming edges of the specified node(s) in the MedRecord.
If a single node index is provided, returns a list of its incoming edge indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of incoming edge indices.
Arguments:
node
Union[NodeIndex, List[NodeIndex], NodeOperation] - One or more node indices.
Returns:
Union[List[EdgeIndex], Dict[NodeIndex, List[EdgeIndex]]]: Incoming edge indices for each specified node.
edge_endpoints
def edge_endpoints(
edge: Union[EdgeIndex, List[EdgeIndex], EdgeOperation]
) -> Union[tuple[NodeIndex, NodeIndex], Dict[EdgeIndex, tuple[NodeIndex,
NodeIndex]]]
Retrieves the source and target nodes of the specified edge(s) in the MedRecord.
If a single edge index is provided, returns a tuple of node indices (source, target). If multiple edges are specified, returns a dictionary mapping each edge index to its tuple of node indices.
Arguments:
edge
Union[EdgeIndex, List[EdgeIndex], EdgeOperation] - One or more edge indices.
Returns:
Union[tuple[NodeIndex, NodeIndex], Dict[EdgeIndex, tuple[NodeIndex, NodeIndex]]]: Tuple of node indices or a dictionary mapping each edge to its node indices.
edges_connecting
def edges_connecting(
source_node: Union[NodeIndex, List[NodeIndex], NodeOperation],
target_node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> List[EdgeIndex]
Retrieves the edges connecting the specified source and target nodes in the MedRecord.
If a NodeOperation is provided for either the source or target nodes, it is first evaluated to obtain the corresponding node indices. The method then returns a list of edge indices that connect the specified source and target nodes.
Arguments:
source_node (Union[NodeIndex, List[NodeIndex], NodeOperation]): The index or indices of the source node(s), or a NodeOperation to select source nodes. target_node (Union[NodeIndex, List[NodeIndex], NodeOperation]): The index or indices of the target node(s), or a NodeOperation to select target nodes.
Returns:
List[EdgeIndex]
- A list of edge indices connecting the specified source and target nodes.
add_node
def add_node(node: NodeIndex, attributes: Attributes) -> None
Adds a node with specified attributes to the MedRecord instance.
Arguments:
node
NodeIndex - The index of the node to add.attributes
Attributes - A dictionary of the node's attributes.
Returns:
None
remove_node
def remove_node(
node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> Union[Attributes, Dict[NodeIndex, Attributes]]
Removes a node or multiple nodes from the MedRecord and returns their attributes.
If a single node index is provided, returns the attributes of the removed node. If multiple node indices are specified, returns a dictionary mapping each node index to its attributes.
Arguments:
node
Union[NodeIndex, List[NodeIndex], NodeOperation] - Node index or indices.
Returns:
Union[Attributes, Dict[NodeIndex, Attributes]]: Attributes of the removed node(s).
add_nodes
def add_nodes(
nodes: Union[
List[tuple[NodeIndex, Attributes]],
pd.DataFrame,
List[pd.DataFrame],
PolarsNodeDataFrameInput,
List[PolarsNodeDataFrameInput],
]
) -> None
Adds multiple nodes to the MedRecord from different data formats.
Accepts a list of tuples, DataFrame(s), or PolarsNodeDataFrameInput(s) to add nodes. If a DataFrame or list of DataFrames is used, the add_nodes_pandas method is called. If PolarsNodeDataFrameInput(s) are provided, each tuple must include a DataFrame and the index column.
Arguments:
nodes (Union[List[tuple[NodeIndex, Attributes]], pd.DataFrame, List[pd.DataFrame], PolarsNodeDataFrameInput,
List[PolarsNodeDataFrameInput]])
- Data representing nodes in various formats.
Returns:
None
add_nodes_pandas
def add_nodes_pandas(nodes: Union[pd.DataFrame, List[pd.DataFrame]]) -> None
Adds nodes to the MedRecord instance from one or more pandas DataFrames.
Each DataFrame is converted to a Polars DataFrame, and then nodes are added to the MedRecord instance. Each DataFrame must have an Index.
Arguments:
nodes
Union[pd.DataFrame, List[pd.DataFrame]] - DataFrame(s) representing nodes.
Returns:
None
add_nodes_polars
def add_nodes_polars(
nodes: Union[PolarsNodeDataFrameInput, List[PolarsNodeDataFrameInput]]
) -> None
Adds nodes to the MedRecord instance from one or more Polars DataFrames.
This method accepts either a single tuple or a list of tuples, where each tuple consists of a Polars DataFrame and an index column string.
Arguments:
nodes
Union[NodeDataFrameInput, List[NodeDataFrameInput]] - A tuple or list of tuples, each with a DataFrame and index column.
Returns:
None
add_edge
def add_edge(source_node: NodeIndex, target_node: NodeIndex,
attributes: Attributes) -> EdgeIndex
Adds an edge between two specified nodes with given attributes.
Arguments:
source_node
NodeIndex - Index of the source node.target_node
NodeIndex - Index of the target node.attributes
Attributes - Dictionary of edge attributes.
Returns:
EdgeIndex
- The index of the added edge.
remove_edge
def remove_edge(
edge: Union[EdgeIndex, List[EdgeIndex], EdgeOperation]
) -> Union[Attributes, Dict[EdgeIndex, Attributes]]
Removes an edge or multiple edges from the MedRecord and returns their attributes.
If a single edge index is provided, returns the attributes of the removed edge. If multiple edge indices are specified, returns a dictionary mapping each edge index to its attributes.
Arguments:
edge
Union[EdgeIndex, List[EdgeIndex], EdgeOperation] - Edge index or indices.
Returns:
Union[Attributes, Dict[EdgeIndex, Attributes]]: Attributes of the removed edge(s).
add_edges
def add_edges(
edges: Union[
List[tuple[NodeIndex, NodeIndex, Attributes]],
pd.DataFrame,
List[pd.DataFrame],
PolarsEdgeDataFrameInput,
List[PolarsEdgeDataFrameInput],
]
) -> List[EdgeIndex]
Adds edges to the MedRecord instance from various data formats.
Accepts lists of tuples, DataFrame(s), or EdgeDataFrameInput(s) to add edges. Each tuple must have indices for source and target nodes and a dictionary of attributes. If a DataFrame or list of DataFrames is used, the add_edges_dataframe method is invoked.
Arguments:
edges (Union[List[tuple[NodeIndex, NodeIndex, Attributes]], pd.DataFrame, List[pd.DataFrame], PolarsEdgeDataFrameInput, List[PolarsEdgeDataFrameInput]]): Data representing edges in several formats.
Returns:
List[EdgeIndex]
- A list of edge indices that were added.
add_edges_pandas
def add_edges_pandas(
edges: Union[pd.DataFrame, List[pd.DataFrame]]) -> List[EdgeIndex]
Adds edges to the MedRecord from one or more pandas DataFrames.
Each DataFrame is converted to a Polars DataFrame, and then edges are added using add_edges_polars. Each DataFrame must have a MultiIndex with two levels for source and target nodes.
Arguments:
edges
Union[pd.DataFrame, List[pd.DataFrame]] - DataFrame(s) representing edges.
Returns:
List[EdgeIndex]
- A list of the edge indices added.
add_edges_polars
def add_edges_polars(
edges: Union[PolarsEdgeDataFrameInput, List[PolarsEdgeDataFrameInput]]
) -> List[EdgeIndex]
Adds edges to the MedRecord from one or more Polars DataFrames.
This method accepts either a single PolarsEdgeDataFrameInput tuple or a list of such tuples, each including a DataFrame and index columns for the source and target nodes.
Arguments:
edges (Union[PolarsEdgeDataFrameInput, List[PolarsEdgeDataFrameInput]]): A tuple or list of tuples, each including a DataFrame and index columns for source and target nodes.
Returns:
List[EdgeIndex]
- A list of the edge indices added.
add_group
def add_group(
group: Group,
node: Optional[Union[NodeIndex, List[NodeIndex], NodeOperation]] = None
) -> None
Adds a group to the MedRecord instance with an optional list of node indices.
If node indices are specified, they are added to the group. If no nodes are specified, the group is created without any nodes.
Arguments:
group
Group - The name of the group to add. node (Optional[Union[NodeIndex, List[NodeIndex], NodeOperation]]): Node index or indices to add to the group, optional.
Returns:
None
remove_group
def remove_group(group: Union[Group, List[Group]]) -> None
Removes one or more groups from the MedRecord instance.
Arguments:
group
Union[Group, List[Group]] - One or more group names to remove.
Returns:
None
add_node_to_group
def add_node_to_group(
group: Group, node: Union[NodeIndex, List[NodeIndex],
NodeOperation]) -> None
Adds one or more nodes to a specified group in the MedRecord.
Arguments:
group
Group - The name of the group to add nodes to.node
Union[NodeIndex, List[NodeIndex], NodeOperation] - Node index or indices to add to the group.
Returns:
None
remove_node_from_group
def remove_node_from_group(
group: Group, node: Union[NodeIndex, List[NodeIndex],
NodeOperation]) -> None
Removes one or more nodes from a specified group in the MedRecord.
Arguments:
group
Group - The name of the group from which to remove nodes.node
Union[NodeIndex, List[NodeIndex], NodeOperation] - Node index or indices to remove from the group.
Returns:
None
groups_of_node
def groups_of_node(
node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> Union[List[Group], Dict[NodeIndex, List[Group]]]
Retrieves the groups associated with the specified node(s) in the MedRecord.
If a single node index is provided, returns a list of groups for that node. If multiple nodes are specified, returns a dictionary mapping each node index to its list of groups.
Arguments:
node
Union[NodeIndex, List[NodeIndex], NodeOperation] - Node index or indices.
Returns:
Union[List[Group], Dict[NodeIndex, List[Group]]]: Groups associated with each node.
node_count
def node_count() -> int
Returns the total number of nodes currently managed by the MedRecord.
Returns:
int
- The total number of nodes.
edge_count
def edge_count() -> int
Returns the total number of edges currently managed by the MedRecord.
Returns:
int
- The total number of edges.
group_count
def group_count() -> int
Returns the total number of groups currently defined within the MedRecord.
Returns:
int
- The total number of groups.
contains_node
def contains_node(node: NodeIndex) -> bool
Checks whether a specific node exists in the MedRecord.
Arguments:
node
NodeIndex - The index of the node to check.
Returns:
bool
- True if the node exists, False otherwise.
contains_edge
def contains_edge(edge: EdgeIndex) -> bool
Checks whether a specific edge exists in the MedRecord.
Arguments:
edge
EdgeIndex - The index of the edge to check.
Returns:
bool
- True if the edge exists, False otherwise.
contains_group
def contains_group(group: Group) -> bool
Checks whether a specific group exists in the MedRecord.
Arguments:
group
Group - The name of the group to check.
Returns:
bool
- True if the group exists, False otherwise.
neighbors
def neighbors(
node: Union[NodeIndex, List[NodeIndex], NodeOperation]
) -> Union[List[NodeIndex], Dict[NodeIndex, List[NodeIndex]]]
Retrieves the neighbors of the specified node(s) in the MedRecord.
If a single node index is provided, returns a list of its neighboring node indices. If multiple nodes are specified, returns a dictionary mapping each node index to its list of neighboring nodes.
Arguments:
node
Union[NodeIndex, List[NodeIndex], NodeOperation] - Node index or indices.
Returns:
Union[List[NodeIndex], Dict[NodeIndex, List[NodeIndex]]]: Neighboring nodes.
clear
def clear() -> None
Clears all data from the MedRecord instance.
Removes all nodes, edges, and groups, effectively resetting the instance.
Returns:
None
select_nodes
def select_nodes(operation: NodeOperation) -> List[NodeIndex]
Selects nodes based on a specified operation and returns their indices.
Arguments:
operation
NodeOperation - The operation to apply to select nodes.
Returns:
List[NodeIndex]
- A list of node indices that satisfy the operation.
select_edges
def select_edges(operation: EdgeOperation) -> List[EdgeIndex]
Selects edges based on a specified operation and returns their indices.
Arguments:
operation
EdgeOperation - The operation to apply to select edges.
Returns:
List[EdgeIndex]
- A list of edge indices that satisfy the operation.
__getitem__
def __getitem__(
key: Union[NodeOperation, EdgeOperation]
) -> Union[List[NodeIndex], List[EdgeIndex]]
Allows selection of nodes or edges using operations directly via indexing.
Arguments:
key
Union[NodeOperation, EdgeOperation] - Operation to select nodes or edges.
Returns:
Union[List[NodeIndex], List[EdgeIndex]]: Node or edge indices selected.
medmodels.medrecord.indexers
medmodels.medrecord.querying
NodeOperation Objects
class NodeOperation()
logical_and
def logical_and(operation: NodeOperation) -> NodeOperation
Combines this NodeOperation with another using a logical AND, resulting in a new NodeOperation that is true only if both original operations are true. This method allows for the chaining of conditions to refine queries on nodes.
Arguments:
operation
NodeOperation - Another NodeOperation to be combined with the current one.
Returns:
NodeOperation
- A new NodeOperation representing the logical AND of this operation with another.
logical_or
def logical_or(operation: NodeOperation) -> NodeOperation
Combines this NodeOperation with another using a logical OR, resulting in a new NodeOperation that is true if either of the original operations is true. This method enables the combination of conditions to expand queries on nodes.
Arguments:
operation
NodeOperation - Another NodeOperation to be combined with the current one.
Returns:
NodeOperation
- A new NodeOperation representing the logical OR of this operation with another.
logical_xor
def logical_xor(operation: NodeOperation) -> NodeOperation
Combines this NodeOperation with another using a logical XOR, resulting in a new NodeOperation that is true only if exactly one of the original operations is true. This method is useful for creating conditions that must be exclusively true.
Arguments:
operation
NodeOperation - Another NodeOperation to be combined with the current one.
Returns:
NodeOperation
- A new NodeOperation representing the logical XOR of this operation with another.
logical_not
def logical_not() -> NodeOperation
Creates a new NodeOperation that is the logical NOT of this operation, inversing the current condition. This method is useful for negating a condition to create queries on nodes.
Returns:
NodeOperation
- A new NodeOperation representing the logical NOT of this operation.
EdgeOperation Objects
class EdgeOperation()
logical_and
def logical_and(operation: EdgeOperation) -> EdgeOperation
Combines this EdgeOperation with another using a logical AND, resulting in a new EdgeOperation that is true only if both original operations are true. This method allows for the chaining of conditions to refine queries on nodes.
Arguments:
operation
EdgeOperation - Another EdgeOperation to be combined with the current one.
Returns:
EdgeOperation
- A new EdgeOperation representing the logical AND of this operation with another.
logical_or
def logical_or(operation: EdgeOperation) -> EdgeOperation
Combines this EdgeOperation with another using a logical OR, resulting in a new EdgeOperation that is true if either of the original operations is true. This method enables the combination of conditions to expand queries on nodes.
Arguments:
operation
EdgeOperation - Another EdgeOperation to be combined with the current one.
Returns:
EdgeOperation
- A new EdgeOperation representing the logical OR of this operation with another.
logical_xor
def logical_xor(operation: EdgeOperation) -> EdgeOperation
Combines this EdgeOperation with another using a logical XOR, resulting in a new EdgeOperation that is true only if exactly one of the original operations is true. This method is useful for creating conditions that must be exclusively true.
Arguments:
operation
EdgeOperation - Another EdgeOperation to be combined with the current one.
Returns:
EdgeOperation
- A new EdgeOperation representing the logical XOR of this operation with another.
logical_not
def logical_not() -> EdgeOperation
Creates a new EdgeOperation that is the logical NOT of this operation, inversing the current condition. This method is useful for negating a condition to create queries on nodes.
Returns:
EdgeOperation
- A new EdgeOperation representing the logical NOT of this operation.
NodeAttributeOperand Objects
class NodeAttributeOperand()
greater
def greater(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is greater than the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
NodeOperation
- A NodeOperation representing the greater-than comparison.
less
def less(operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is less than the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
NodeOperation
- A NodeOperation representing the less-than comparison.
greater_or_equal
def greater_or_equal(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is greater than or equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
NodeOperation
- A NodeOperation representing the greater-than-or-equal-to comparison.
less_or_equal
def less_or_equal(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is less than or equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
NodeOperation
- A NodeOperation representing the less-than-or-equal-to comparison.
equal
def equal(operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.y
Returns:
NodeOperation
- A NodeOperation representing the equality comparison.
not_equal
def not_equal(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is not equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
NodeOperation
- A NodeOperation representing the not-equal comparison.
is_in
def is_in(values: List[MedRecordValue]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is found within the specified list of values.
Arguments:
values
List[MedRecordValue] - The list of values to check the attribute against.
Returns:
NodeOperation
- A NodeOperation representing the is-in comparison.
not_in
def not_in(values: List[MedRecordValue]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand is not found within the specified list of values.
Arguments:
values
List[MedRecordValue] - The list of values to check the attribute against.
Returns:
NodeOperation
- A NodeOperation representing the not-in comparison.
starts_with
def starts_with(operand: ValueOperand) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand starts with the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare the starting sequence against.
Returns:
NodeOperation
- A NodeOperation representing the starts-with condition.
ends_with
def ends_with(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand ends with the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare the ending sequence against.
Returns:
NodeOperation
- A NodeOperation representing the ends-with condition.
contains
def contains(
operand: Union[ValueOperand, NodeAttributeOperand]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the attribute represented by this operand contains the specified value or operand within it.
Arguments:
operand
ValueOperand - The value or operand to check for containment.
Returns:
NodeOperation
- A NodeOperation representing the contains condition.
add
def add(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the sum of the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to add to the attribute's value.
Returns:
ValueOperand
- The result of the addition operation.
sub
def sub(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the difference between the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to subtract from the attribute's value.
Returns:
ValueOperand
- The result of the subtraction operation.
mul
def mul(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the product of the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to multiply the attribute's value by.
Returns:
ValueOperand
- The result of the multiplication operation.
div
def div(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the division of the attribute's value by the specified value.
Arguments:
value
MedRecordValue - The value to divide the attribute's value by.
Returns:
ValueOperand
- The result of the division operation.
pow
def pow(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the result of raising the attribute's value to the power of the specified value.
Arguments:
value
MedRecordValue - The value to raise the attribute's value to.
Returns:
ValueOperand
- The result of the exponentiation operation.
mod
def mod(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the remainder of dividing the attribute's value by the specified value.
Arguments:
value
MedRecordValue - The value to divide the attribute's value by.
Returns:
ValueOperand
- The result of the modulo operation.
round
def round() -> ValueOperand
Creates a new ValueOperand representing the result of rounding the attribute's value.
Returns:
ValueOperand
- The result of the rounding operation.
ceil
def ceil() -> ValueOperand
Creates a new ValueOperand representing the result of applying the ceiling function to the attribute's value, effectively rounding it up to the nearest whole number.
Returns:
ValueOperand
- The result of the ceiling operation.
floor
def floor() -> ValueOperand
Creates a new ValueOperand representing the result of applying the floor function to the attribute's value, effectively rounding it down to the nearest whole number.
Returns:
ValueOperand
- The result of the floor operation.
abs
def abs() -> ValueOperand
Creates a new ValueOperand representing the absolute value of the attribute's value.
Returns:
ValueOperand
- The absolute value of the attribute's value.
sqrt
def sqrt() -> ValueOperand
Creates a new ValueOperand representing the square root of the attribute's value.
Returns:
ValueOperand
- The square root of the attribute's value.
trim
def trim() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from both ends of the attribute's value.
Returns:
ValueOperand
- The attribute's value with leading and trailing whitespace removed.
trim_start
def trim_start() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from the start (left side) of the attribute's value.
Returns:
ValueOperand
- The attribute's value with leading whitespace removed.
trim_end
def trim_end() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from the end (right side) of the attribute's value.
Returns:
ValueOperand
- The attribute's value with trailing whitespace removed.
lowercase
def lowercase() -> ValueOperand
Creates a new ValueOperand representing the result of converting all characters in the attribute's value to lowercase.
Returns:
ValueOperand
- The attribute's value in lowercase letters.
uppercase
def uppercase() -> ValueOperand
Creates a new ValueOperand representing the result of converting all characters in the attribute's value to uppercase.
Returns:
ValueOperand
- The attribute's value in uppercase letters.
slice
def slice(start: int, end: int) -> ValueOperand
Creates a new ValueOperand representing the result of slicing the attribute's value using the specified start and end indices.
Arguments:
start
int - The index at which to start the slice.end
int - The index at which to end the slice.
Returns:
ValueOperand
- The attribute's value with the specified slice applied.
EdgeAttributeOperand Objects
class EdgeAttributeOperand()
greater
def greater(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is greater than the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the greater-than comparison.
less
def less(operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is less than the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the less-than comparison.
greater_or_equal
def greater_or_equal(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is greater than or equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the greater-than-or-equal-to comparison.
less_or_equal
def less_or_equal(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is less than or equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the less-than-or-equal-to comparison.
equal
def equal(operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the equality comparison.
not_equal
def not_equal(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is not equal to the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the not-equal comparison.
is_in
def is_in(values: List[MedRecordValue]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is found within the specified list of values.
Arguments:
values
List[MedRecordValue] - The list of values to check the attribute against.
Returns:
EdgeOperation
- A EdgeOperation representing the is-in comparison.
not_in
def not_in(values: List[MedRecordValue]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand is not found within the specified list of values.
Arguments:
values
List[MedRecordValue] - The list of values to check the attribute against.
Returns:
EdgeOperation
- A EdgeOperation representing the not-in comparison.
starts_with
def starts_with(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand starts with the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare the starting sequence against.
Returns:
EdgeOperation
- A EdgeOperation representing the starts-with condition.
ends_with
def ends_with(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand ends with the specified value or operand.
Arguments:
operand
ValueOperand - The value or operand to compare the ending sequence against.
Returns:
EdgeOperation
- A EdgeOperation representing the ends-with condition.
contains
def contains(
operand: Union[ValueOperand, EdgeAttributeOperand]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the attribute represented by this operand contains the specified value or operand within it.
Arguments:
operand
ValueOperand - The value or operand to check for containment.
Returns:
EdgeOperation
- A EdgeOperation representing the contains condition.
add
def add(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the sum of the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to add to the attribute's value.
Returns:
ValueOperand
- The result of the addition operation.
sub
def sub(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the difference between the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to subtract from the attribute's value.
Returns:
ValueOperand
- The result of the subtraction operation.
mul
def mul(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the product of the attribute's value and the specified value.
Arguments:
value
MedRecordValue - The value to multiply the attribute's value by.
Returns:
ValueOperand
- The result of the multiplication operation.
div
def div(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the division of the attribute's value by the specified value.
Arguments:
value
MedRecordValue - The value to divide the attribute's value by.
Returns:
ValueOperand
- The result of the division operation.
pow
def pow(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the result of raising the attribute's value to the power of the specified value.
Arguments:
value
MedRecordValue - The value to raise the attribute's value to.
Returns:
ValueOperand
- The result of the exponentiation operation.
mod
def mod(value: MedRecordValue) -> ValueOperand
Creates a new ValueOperand representing the remainder of dividing the attribute's value by the specified value.
Arguments:
value
MedRecordValue - The value to divide the attribute's value by.
Returns:
ValueOperand
- The result of the modulo operation.
round
def round() -> ValueOperand
Creates a new ValueOperand representing the result of rounding the attribute's value.
Returns:
ValueOperand
- The result of the rounding operation.
ceil
def ceil() -> ValueOperand
Creates a new ValueOperand representing the result of applying the ceiling function to the attribute's value, effectively rounding it up to the nearest whole number.
Returns:
ValueOperand
- The result of the ceiling operation.
floor
def floor() -> ValueOperand
Creates a new ValueOperand representing the result of applying the floor function to the attribute's value, effectively rounding it down to the nearest whole number.
Returns:
ValueOperand
- The result of the floor operation.
abs
def abs() -> ValueOperand
Creates a new ValueOperand representing the absolute value of the attribute's value.
Returns:
ValueOperand
- The absolute value of the attribute's value.
sqrt
def sqrt() -> ValueOperand
Creates a new ValueOperand representing the square root of the attribute's value.
Returns:
ValueOperand
- The square root of the attribute's value.
trim
def trim() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from both ends of the attribute's value.
Returns:
ValueOperand
- The attribute's value with leading and trailing whitespace removed.
trim_start
def trim_start() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from the start (left side) of the attribute's value.
Returns:
ValueOperand
- The attribute's value with leading whitespace removed.
trim_end
def trim_end() -> ValueOperand
Creates a new ValueOperand representing the result of trimming whitespace from the end (right side) of the attribute's value.
Returns:
ValueOperand
- The attribute's value with trailing whitespace removed.
lowercase
def lowercase() -> ValueOperand
Creates a new ValueOperand representing the result of converting all characters in the attribute's value to lowercase.
Returns:
ValueOperand
- The attribute's value in lowercase letters.
uppercase
def uppercase() -> ValueOperand
Creates a new ValueOperand representing the result of converting all characters in the attribute's value to uppercase.
Returns:
ValueOperand
- The attribute's value in uppercase letters.
slice
def slice(start: int, end: int) -> ValueOperand
Creates a new ValueOperand representing the result of slicing the attribute's value using the specified start and end indices.
Arguments:
start
int - The index at which to start the slice.end
int - The index at which to end the slice.
Returns:
ValueOperand
- The attribute's value with the specified slice applied.
NodeIndexOperand Objects
class NodeIndexOperand()
greater
def greater(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is greater than the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the greater-than comparison.
less
def less(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is less than the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the less-than comparison.
greater_or_equal
def greater_or_equal(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is greater than or equal to the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the greater-than-or-equal-to comparison.
less_or_equal
def less_or_equal(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is less than or equal to the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the less-than-or-equal-to comparison.
equal
def equal(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is equal to the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the equality comparison.
not_equal
def not_equal(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is not equal to the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the not-equal comparison.
is_in
def is_in(values: List[NodeIndex]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is found within the list of indices.
Arguments:
values
List[NodeIndex] - The list of indices to check the node index against.
Returns:
NodeOperation
- A NodeOperation representing the is-in comparison.
not_in
def not_in(values: List[NodeIndex]) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index is not found within the list of indices.
Arguments:
values
List[NodeIndex] - The list of indices to check the node index against.
Returns:
NodeOperation
- A NodeOperation representing the not-in comparison.
starts_with
def starts_with(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index starts with the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the starts-with condition.
ends_with
def ends_with(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index ends with the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the ends-with condition.
contains
def contains(operand: NodeIndex) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node index contains the specified index.
Arguments:
operand
NodeIndex - The index to compare against.
Returns:
NodeOperation
- A NodeOperation representing the contains condition.
EdgeIndexOperand Objects
class EdgeIndexOperand()
greater
def greater(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is greater than the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the greater-than comparison.
less
def less(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is less than the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the less-than comparison.
greater_or_equal
def greater_or_equal(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is greater than or equal to the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the greater-than-or-equal-to comparison.
less_or_equal
def less_or_equal(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is less than or equal to the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the less-than-or-equal-to comparison.
equal
def equal(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is equal to the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the equality comparison.
not_equal
def not_equal(operand: EdgeIndex) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is not equal to the specified index.
Arguments:
operand
EdgeIndex - The index to compare against.
Returns:
EdgeOperation
- A EdgeOperation representing the not-equal comparison.
is_in
def is_in(values: List[EdgeIndex]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is found within the list of indices.
Arguments:
values
List[EdgeIndex] - The list of indices to check the edge index against.
Returns:
EdgeOperation
- A EdgeOperation representing the is-in comparison.
not_in
def not_in(values: List[EdgeIndex]) -> EdgeOperation
Creates a EdgeOperation that evaluates to true if the edge index is not found within the list of indices.
Arguments:
values
List[EdgeIndex] - The list of indices to check the edge index against.
Returns:
EdgeOperation
- A EdgeOperation representing the not-in comparison.
NodeOperand Objects
class NodeOperand()
in_group
def in_group(operand: Group) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node is part of the specified group.
Arguments:
operand
Group - The group to check the node against.
Returns:
NodeOperation
- A NodeOperation indicating if the node is part of the specified group.
has_attribute
def has_attribute(operand: MedRecordAttribute) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node has the specified attribute.
Arguments:
operand
MedRecordAttribute - The attribute to check on the node.
Returns:
NodeOperation
- A NodeOperation indicating if the node has the specified attribute.
has_outgoing_edge_with
def has_outgoing_edge_with(operation: EdgeOperation) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node has an outgoing edge that satisfies the specified EdgeOperation.
Arguments:
operation
EdgeOperation - An EdgeOperation to evaluate against outgoing edges.
Returns:
NodeOperation
- A NodeOperation indicating if the node has an outgoing edge satisfying the specified operation.
has_incoming_edge_with
def has_incoming_edge_with(operation: EdgeOperation) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node has an incoming edge that satisfies the specified EdgeOperation.
Arguments:
operation
EdgeOperation - An EdgeOperation to evaluate against incoming edges.
Returns:
NodeOperation
- A NodeOperation indicating if the node has an incoming edge satisfying the specified operation.
has_edge_with
def has_edge_with(operation: EdgeOperation) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node has any edge (incoming or outgoing) that satisfies the specified EdgeOperation.
Arguments:
operation
EdgeOperation - An EdgeOperation to evaluate against edges connected to the node.
Returns:
NodeOperation
- A NodeOperation indicating if the node has any edge satisfying the specified operation.
has_neighbor_with
def has_neighbor_with(operation: NodeOperation) -> NodeOperation
Creates a NodeOperation that evaluates to true if the node has a neighboring node that satisfies the specified NodeOperation.
Arguments:
operation
NodeOperation - A NodeOperation to evaluate against neighboring nodes.
Returns:
NodeOperation
- A NodeOperation indicating if the node has a neighboring node satisfying the specified operation.
attribute
def attribute(attribute: MedRecordAttribute) -> NodeAttributeOperand
Accesses an NodeAttributeOperand for the specified attribute, allowing for the creation of operations based on node attributes.
Arguments:
attribute
MedRecordAttribute - The attribute of the node to perform operations on.
Returns:
NodeAttributeOperand
- An operand that represents the specified node attribute, enabling further operations such as comparisons and arithmetic operations.
index
def index() -> NodeIndexOperand
Accesses an NodeIndexOperand, allowing for the creation of operations based on the node index.
Returns:
NodeIndexOperand
- An operand that represents the specified node index, enabling further operations such as comparisons and arithmetic operations.
node
def node() -> NodeOperand
Factory function to create and return a new NodeOperand instance.
Returns:
NodeOperand
- An instance of NodeOperand for constructing node-based operations.
EdgeOperand Objects
class EdgeOperand()
connected_target
def connected_target(operand: NodeIndex) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge is connected to a target node with the specified index.
Arguments:
operand
NodeIndex - The index of the target node to check for a connection.
Returns:
EdgeOperation
- An EdgeOperation indicating if the edge is connected to the specified target node.
connected_source
def connected_source(operand: NodeIndex) -> EdgeOperation
Generates an EdgeOperation that evaluates to true if the edge originates from a source node with the given index.
Arguments:
operand
NodeIndex - The index of the source node to check for a connection.
Returns:
EdgeOperation
- An EdgeOperation indicating if the edge is connected from the specified source node.
connected
def connected(operand: NodeIndex) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge is connected to or from a node with the specified index.
Arguments:
operand
NodeIndex - The index of the node to check for a connection.
Returns:
EdgeOperation
- An EdgeOperation indicating if the edge is connected to the specified node.
has_attribute
def has_attribute(operand: MedRecordAttribute) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge has the specified attribute.
Arguments:
operand
MedRecordAttribute - The attribute to check on the edge.
Returns:
EdgeOperation
- An EdgeOperation indicating if the edge has the specified attribute.
connected_source_with
def connected_source_with(operation: NodeOperation) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge originates from a source node that satisfies the specified NodeOperation.
Arguments:
operation
NodeOperation - A NodeOperation to evaluate against the source node.
Returns:
EdgeOperation
- An EdgeOperation indicating if the source node of the edge satisfies the specified operation.
connected_target_with
def connected_target_with(operation: NodeOperation) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge is connected to a target node that satisfies the specified NodeOperation.
Arguments:
operation
NodeOperation - A NodeOperation to evaluate against the target node.
Returns:
EdgeOperation
- An EdgeOperation indicating if the target node of the edge satisfies the specified operation.
connected_with
def connected_with(operation: NodeOperation) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if the edge is connected to or from a node that satisfies the specified NodeOperation.
Arguments:
operation
NodeOperation - A NodeOperation to evaluate against the connected node.
Returns:
EdgeOperation
- An EdgeOperation indicating if either the source or target node of the edge satisfies the specified operation.
has_parallel_edges_with
def has_parallel_edges_with(operation: EdgeOperation) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if there are parallel edges that satisfy the specified EdgeOperation.
Arguments:
operation
EdgeOperation - An EdgeOperation to evaluate against parallel edges.
Returns:
EdgeOperation
- An EdgeOperation indicating if there are parallel edges satisfying the specified operation.
has_parallel_edges_with_self_comparison
def has_parallel_edges_with_self_comparison(
operation: EdgeOperation) -> EdgeOperation
Creates an EdgeOperation that evaluates to true if there are parallel edges that satisfy the specified EdgeOperation.
Using edge().attribute(...)
in the operation will compare to the attribute of
this edge, not the parallel edge.
Arguments:
operation
EdgeOperation - An EdgeOperation to evaluate against parallel edges.
Returns:
EdgeOperation
- An EdgeOperation indicating if there are parallel edges satisfying the specified operation.
attribute
def attribute(attribute: MedRecordAttribute) -> EdgeAttributeOperand
Accesses an EdgeAttributeOperand for the specified attribute, allowing for the creation of operations based on edge attributes.
Arguments:
attribute
MedRecordAttribute - The attribute of the edge to perform operations on.
Returns:
EdgeAttributeOperand
- An operand that represents the specified edge attribute, enabling further operations such as comparisons and arithmetic operations.
index
def index() -> EdgeIndexOperand
Accesses an EdgeIndexOperand, allowing for the creation of operations based on the edge index.
Returns:
EdgeIndexOperand
- An operand that represents the specified edge index, enabling further operations such as comparisons and arithmetic operations.
edge
def edge() -> EdgeOperand
Factory function to create and return a new EdgeOperand instance.
Returns:
EdgeOperand
- An instance of EdgeOperand for constructing edge-based operations.