dispel.processing.data_trace module#
A module containing the data trace graph (DTG).
The data trace is a directed acyclic graph that traces the creation of the main data entities:
Level,
It links the creation of each entity with its creators.
- class dispel.processing.data_trace.DataTrace[source]#
Bases:
objectA class representation of the data trace graph.
- add_trace(source, result, step=None, **kwargs)[source]#
Add a single data trace to the graph.
- Parameters:
source (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) – The source entity that led to the creation of the result entity.
result (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) – The result entity created from the source entity.
step – The processing step that has led to the creation of the result if existent.
kwargs – Additional keywords arguments passed to downstream dispatchers.
- Raises:
NotImplementedError – If the source and/or result types are not supported.
- check_data_set_usage()[source]#
Check the usage of the raw data sets inside the data trace graph.
It means checking if all leaf nodes are
dispel.data.measures.MeasureValueand raise warnings if any are found.- Returns:
The list of unused data sets.
- Return type:
List[RawDataSet]
- Warns:
UserWarning – If leaf entities do not correspond to measure values.
- Raises:
ValueError – If a leaf node if neither a measure value nor a raw data set.
- children(entity)[source]#
Get direct successors of an entity.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- Return type:
MultiAdjacencyView
- property entity_count: int#
Get the entity count in the data trace graph.
- Returns:
The number of entities in the data trace graph.
- Return type:
- get_flags(entity)[source]#
Get all flags related to the entity.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) – The entity whose related flags are to be retrieved.
- Returns:
A list of all flags related to the entity.
- Return type:
List[Flag]
- get_measure_flags(entity=None)[source]#
Get all measure flags related to the entity.
If no entity is provided, the default entity is the reading and every measure flag coming from the reading will be returned.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch | None) – An optional entity whose related measure flags are to be retrieved, if
Noneis provided the default entity is the root of the data trace.- Returns:
A list of all measure flags related to the entity. If no entity is provided, all measure flags are returned.
- Return type:
List[Flag]
- has_node(entity)[source]#
Check whether a node exists in the data trace graph.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) – The entity of the node whose existence in the data trace graph is to be checked.
- Returns:
Trueif the corresponding node exists inside the graph.Falseotherwise.- Return type:
- is_leaf(entity)[source]#
Determine whether the entity is a leaf.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- Return type:
- property leaf_count: int#
Get the leaf count of the data trace graph.
- Returns:
The number of leaf nodes in the data trace graph.
- Return type:
- leaves()[source]#
Retrieve all leaves of the data trace graph.
- Returns:
The leaf nodes of the data trace graph.
- Return type:
Iterable[EntityType]
- nodes()[source]#
Retrieve all the nodes inside the data trace graph.
- Returns:
The list of nodes inside the data trace graph.
- Return type:
NodeView
- parents(entity)[source]#
Get direct predecessors of an entity.
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- Return type:
MultiAdjacencyView
- populate(entity)[source]#
- populate(entity)
- populate(entity)
- populate(entity)
- populate(entity)
Populate the data trace with the provided entity.
If the provided entity is a
Readingor aLevel, then the entity and its components are injected as data traces.If the provided entities are processing results, then the associated results are added as data traces and also set inside the corresponding reading.
- Parameters:
entity (Level | Reading | ProcessingResult | ProcessingControlResult | LevelProcessingControlResult) – The entity to injected inside the data trace.
- Returns:
If existent, the list of exceptions to be raised at the end of the processing.
- Return type:
Optional[List[Exception]]
- Raises:
NotImplementedError – If the provided entity type is not supported.
- exception dispel.processing.data_trace.EdgeNotFound[source]#
Bases:
ExceptionException raised when an edge is not found in the data trace.
- Parameters:
source – The entity corresponding to the source node of the edge in question.
result – The entity corresponding to the result node of the edge in question.
- __init__(source, result)[source]#
- Parameters:
source (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
result (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- exception dispel.processing.data_trace.GraphNoCycle[source]#
Bases:
ExceptionException raised if a cycle is to be created in the data trace graph.
- Parameters:
source – The source node that has caused the graph cycle.
result – The result node that has caused the graph cycle.
- __init__(source, result)[source]#
- Parameters:
source (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
result (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- exception dispel.processing.data_trace.MissingSourceNode[source]#
Bases:
ExceptionException raised if the source node of a data trace is missing.
- Parameters:
entity – The entity corresponding to the absent source node.
- __init__(entity)[source]#
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- exception dispel.processing.data_trace.NodeHasMultipleParents[source]#
Bases:
ExceptionException raised if a node is to have multiple parents.
- Parameters:
entity – The entity corresponding to the exception.
- __init__(entity)[source]#
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –
- exception dispel.processing.data_trace.NodeNotFound[source]#
Bases:
ExceptionException raised when a node is not found in the data trace.
- Parameters:
entity – The entity corresponding to the exception.
- __init__(entity)[source]#
- Parameters:
entity (Reading | Level | RawDataSet | MeasureValue | LevelEpoch) –