getMostRelevantSeriesMeasurementErrors
Calculates the average severity of each measurement error across a complete measurement series, filters insignificant errors, and generates a prioritized list for configuration-driven result and feedback screens.
getMostRelevantSeriesMeasurementErrors()
Purpose
Identifies the most relevant measurement errors across an entire measurement series by aggregating and averaging error contributions from all measurements. The resulting list can be used to display the most significant factors that affected the overall measurement quality and provide targeted feedback to the user.
Unlike getMostRelevantMeasurementErrors(), which evaluates a single measurement, this function analyzes the complete measurement series and highlights error types that consistently contributed to reduced measurement quality.
Location
src/app/services/genericStages/generic-stages.service.ts
Signature
getMostRelevantSeriesMeasurementErrors(
pipelineConfig: PipelineStageConfig
): OperatorFunction<StatusObject, Observable<any>>
Parameters
| Parameter | Type | Description |
|---|---|---|
pipelineConfig |
PipelineStageConfig |
Current pipeline stage configuration containing measurement results, state, and event targets. |
Returns
OperatorFunction<StatusObject, Observable<any>>
RxJS operator which aggregates, filters, and ranks measurement errors from a complete measurement series.
Configuration
Optional Parameters
| Parameter | Default Value | Description |
|---|---|---|
resKey |
mostRelevantMeasurementErrors |
State key where the result will be stored |
resGroup |
temp |
State group where the result will be written |
Constants
Error Threshold
const errorThreshold = 0.2;
Only averaged errors greater than this threshold are included in the final result.
Input Data
Preferred Source
state.temp.result.series_errors
Expected structure:
[
{
movement: { error: 0.8 },
pressureTooLow: { error: 0.3 }
},
{
movement: { error: 0.6 },
unevenContact: { error: 0.5 }
}
]
Fallback Source
If no series data is available:
state.temp.resultAox.measurement_errors
will be converted into a single-entry measurement series.
Workflow
Read series_errors
↓
Fallback to measurement_errors if needed
↓
Aggregate errors by name
↓
Calculate average error values
↓
Apply error threshold
↓
Sort by severity
↓
Generate ranked result object
↓
Store result in state
↓
Execute onSuccess
Aggregation Logic
For every measurement in the series:
- Iterate through all error entries.
- Ignore
total_error. - Ignore invalid or zero-value errors.
- Sum error values by error name.
Example:
Input
[
{
movement: { error: 0.8 }
},
{
movement: { error: 0.4 }
},
{
movement: { error: 0.7 }
}
]
Aggregated Sum
{
movement: 1.9
}
Average
{
movement: 0.633
}
Filtering
After averaging, only errors exceeding the configured threshold are retained:
error > 0.2
This prevents minor or insignificant error sources from being displayed to the user.
Example Result
{
error1: "movement",
error1Value: 0.74,
error2: "pressureTooLow",
error2Value: 0.51,
error3: "unevenContact",
error3Value: 0.33
}
Errors are always ordered by descending severity.
State Dependencies
Reads
Preferred:
state.temp.result.series_errors
Fallback:
state.temp.resultAox.measurement_errors
Writes
state[resGroup][resKey]
Default:
state.temp.mostRelevantMeasurementErrors
Success Behaviour
On successful execution:
- Errors from all measurements are aggregated.
- Average error severities are calculated.
- Insignificant errors are removed.
- Remaining errors are ranked by severity.
- The result is stored in the configured state location.
- The configured
onSuccessevent target is executed.
pipelineConfig.executeStage(
pipelineConfig.stageConfig.eventTargets?.onSuccess,
'onSuccess',
pipelineConfig.stage
);
Failure Behaviour
The stage fails when:
- No series error data is available.
- No valid measurement errors are found.
- All error values are zero or invalid.
In this case:
pipelineConfig.executeStage(
pipelineConfig.stageConfig.eventTargets?.onFail,
'onFail',
pipelineConfig.stage
);
is executed.
Example Configuration
{
"resKey": "mostRelevantMeasurementErrors",
"resGroup": "temp"
}
Related Functions
getMostRelevantMeasurementErrors()
Analyzes a single measurement and returns the most relevant errors for that measurement only.
getMostRelevantSeriesMeasurementErrors()
Analyzes all measurements in a series and returns the error types that had the greatest overall impact across the complete measurement process.
Notes
- Designed for post-processing after a complete measurement series has finished.
- Error severities are averaged across all measurements in the series.
- The special field
total_erroris ignored during evaluation. - Only errors above the configured threshold are returned.
- The resulting structure is optimized for configuration-driven UI rendering and user feedback screens.
- If no series data is available, the function automatically falls back to single-measurement error data.