medkit.core._prov_graph#

Classes#

Module Contents#

class medkit.core._prov_graph.ProvNode#
data_item_id: str#
operation_id: str | None#
source_ids: list[str]#
derived_ids: list[str]#
to_dict() dict[str, Any]#
class medkit.core._prov_graph.ProvGraph(nodes: list[ProvNode] | None = None, sub_graphs_by_op_id: dict[str, ProvGraph] | None = None)#
_nodes_by_id: dict[str, ProvNode]#
_sub_graphs_by_op_id: dict[str, ProvGraph]#
get_nodes() list[ProvNode]#
get_node(data_item_id: str) ProvNode#
add_node(data_item_id: str, operation_id: str, source_ids: list[str])#

Create a node describing how a data item was created.

Parameters:
data_item_id: str

Identifier of the data item that was created.

operation_id: str

Identifier of the operation that created the data item.

source_ids: list of str

Identifier of pre-existing data items from which the data item was derived (if any). If these source data items don’t have corresponding nodes, “stub” nodes (nodes with no operation_id and no source_ids) are created. It allows us to know how a data item was used even if we don’t know how it was created.

has_node(data_item_id: str) bool#
get_sub_graphs() list[ProvGraph]#
has_sub_graph(operation_id: str) bool#
get_sub_graph(operation_id: str) ProvGraph#
add_sub_graph(operation_id: str, sub_graph: ProvGraph)#
_merge(other_graph: ProvGraph) ProvGraph#
check_sanity()#
to_dict() dict[str, Any]#