medmodels.medrecord.indexers#

Indexers for MedRecord nodes and edges.

Classes

EdgeIndexer(medrecord)

Indexer for MedRecord edges.

NodeIndexer(medrecord)

Indexer for MedRecord nodes.

class EdgeIndexer(medrecord)[source]#

Bases: object

Indexer for MedRecord edges.

__delitem__(key)[source]#

Deletes the specified edge attributes.

Parameters:

key (Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The edges from which to delete the attributes.

Raises:

ValueError – If the key is a slice, but not “:” is provided.

Return type:

None

__getitem__(key)[source]#

Gets the edge attributes for the specified key.

Parameters:

key (Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice, Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The edges to get attributes for.

Return type:

Union[MedRecordValue, Attributes, Dict[EdgeIndex, Attributes], Dict[EdgeIndex, MedRecordValue]]

Returns:

Union[MedRecordValue, Attributes, Dict[EdgeIndex, Attributes], Dict[EdgeIndex, MedRecordValue]] – The edge attributes to be extracted.

Raises:

ValueError – If the key is a slice, but not “:” is provided.

__setitem__(key, value)[source]#

Sets the edge attributes for the specified key.

Parameters:
  • key (Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice, Tuple[Union[EdgeIndex, EdgeIndexInputList, EdgeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The edges to which the attributes should be set.

  • value (Union[AttributesInput, MedRecordValue]) – The values to set as attributes.

Raises:

ValueError – If there is a wrong value type or the key is a slice, but no “:” is provided.

Return type:

None

class NodeIndexer(medrecord)[source]#

Bases: object

Indexer for MedRecord nodes.

__delitem__(key)[source]#

Deletes the specified node attributes.

Parameters:

key (Tuple[Union[NodeIndex, NodeIndexInputList, NodeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The key to delete.

Raises:

ValueError – If the key is a slice, but not “:” is provided.

Return type:

None

__getitem__(key)[source]#

Gets the node attributes for the specified key.

Parameters:

key (Union[NodeIndex, NodeIndexInputList, NodeQuery, slice, Tuple[Union[NodeIndex, NodeIndexInputList, NodeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The nodes to get attributes for.

Return type:

Union[MedRecordValue, Attributes, Dict[NodeIndex, Attributes], Dict[NodeIndex, MedRecordValue]]

Returns:

Union[MedRecordValue, Attributes, Dict[NodeIndex, Attributes], Dict[NodeIndex, MedRecordValue]] – The node attributes to be extracted.

Raises:

ValueError – If the key is a slice, but not “:” is provided.

__setitem__(key, value)[source]#

Sets the specified node attributes.

Parameters:
  • key (Union[NodeIndex, NodeIndexInputList, NodeQuery, slice, Tuple[Union[NodeIndex, NodeIndexInputList, NodeQuery, slice], Union[MedRecordAttribute, MedRecordAttributeInputList, slice]]) – The nodes to set attributes for.

  • value (Union[AttributesInput, MedRecordValue]) – The values to set.

Raises:

ValueError – If there is a wrong value type or the key is a slice, but no “:” is provided.

Return type:

None