Class: MetricStrategyBuilder

MetricStrategyBuilder()

Builder class for creating metric computation strategies. Builder which handles the construction of metric processing pipelines including transformations and unit conversions.

Constructor

new MetricStrategyBuilder()

Create a new MetricStrategyBuilder instance. Create a new MetricStrategyBuilder instance, initalizing all strategy components to null requiring them to be specified later.
Source:

Methods

add()

Add the configured strategy to the strategies collection.
Source:
Throws:
If any required component is null.
Type
string

build() → {Object}

Build and return the complete strategies object.
Source:
Returns:
The strategies object containing all added strategies.
Type
Object

setMetric(metric)

Set the metric name for the strategy.
Parameters:
Name Type Description
metric string The metric name (e.g., 'sales', 'emissions').
Source:

setStrategy(strategy)

Set the core computation strategy.
Parameters:
Name Type Description
strategy function The function that implements the core metric computation.
Source:

setSubmetric(submetric)

Set the submetric name for the strategy.
Parameters:
Name Type Description
submetric string The submetric name (e.g., 'all', 'import').
Source:

setTransformation(transformation)

Set the transformation to apply after the core strategy.
Parameters:
Name Type Description
transformation function The function that transforms the strategy output.
Source:

setUnits(units)

Set the units for the strategy output.
Parameters:
Name Type Description
units string The units specification (e.g., 'MtCO2e / yr').
Source: