Wiki.js

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.

AI Generated

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:

  1. Iterate through all error entries.
  2. Ignore total_error.
  3. Ignore invalid or zero-value errors.
  4. 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:

  1. Errors from all measurements are aggregated.
  2. Average error severities are calculated.
  3. Insignificant errors are removed.
  4. Remaining errors are ranked by severity.
  5. The result is stored in the configured state location.
  6. The configured onSuccess event target is executed.
pipelineConfig.executeStage(
  pipelineConfig.stageConfig.eventTargets?.onSuccess,
  'onSuccess',
  pipelineConfig.stage
);

Failure Behaviour

The stage fails when:

In this case:

pipelineConfig.executeStage(
  pipelineConfig.stageConfig.eventTargets?.onFail,
  'onFail',
  pipelineConfig.stage
);

is executed.


Example Configuration

{
  "resKey": "mostRelevantMeasurementErrors",
  "resGroup": "temp"
}

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