External Model Configuration

ExternalModelConfiguration and helpers for plugging an external evaluator into a model.

Use these mappings to declare which model tables, fields, and named values feed the external evaluator’s input entities and where its outputs should land.

class ParameterMapping(parameter_name, named_value)[source]

Map a model Parameter or Calculation to an external evaluator parameter name.

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]

class ColumnMapping(property_name, column)[source]

Map an external-entity property name to a specific Field.

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]

class InputDataMapping(entity_name, table, column_mappings=None)[source]

Map a model Table to an external-evaluator input entity.

Add per-column property mappings via add_column_mapping().

add_column_mapping(property_name, column)[source]

Append a ColumnMapping linking property_name to column.

Return type:

InputDataMapping

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]

class OutputDataMapping(entity_name, table, column_mappings=None, key_column=None, preserve_order=False, clear_existing=True)[source]

Extension of InputDataMapping that controls how outputs are written back.

Parameters:
  • key_column (str | None) – Optional column on the target table used to match incoming rows; absent matches are inserted.

  • preserve_order (bool) – Keep the row order produced by the evaluator.

  • clear_existing (bool) – Clear the target table before writing outputs.

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]

class ExternalModelConfiguration(requires_reload=True)[source]

All input, parameter, and output mappings used by an external evaluator.

Parameters:

requires_reload (bool) – Whether the evaluator should be reloaded between runs.

add_input_data_mapping(mapping)[source]

Register an InputDataMapping.

Return type:

ExternalModelConfiguration

add_parameter_mapping(mapping)[source]

Register a ParameterMapping.

Return type:

ExternalModelConfiguration

add_output_data_mapping(mapping)[source]

Register an OutputDataMapping.

Return type:

ExternalModelConfiguration

build()[source]

Serialise to a JSON-compatible dict.

Return type:

dict[str, Any]