Model Transform

A ModelTransformConfig runs a secondary model to produce input data for the parent model.

ModelTransformConfig — data source backed by a secondary modelling-language model.

class ModelTransformConfig(file_key, file_name, debug_file=False)[source]

Data source that runs a secondary model and feeds its outputs back into the parent.

Inputs to the secondary model are registered via the add_*_input methods.

Parameters:
  • file_key (str) – Storage key identifying the secondary-model file.

  • file_name (str) – Display-facing file name for the secondary model.

  • debug_file (bool) – Emit a debug copy of the transform inputs/outputs.

add_dynamic_values(timezone_key)[source]

Inject current-time/date variants as inputs.

Parameters:

timezone_key (Parameter | Calculation | None) – Optional model named value of type STRING supplying an IANA timezone for non-UTC time variants.

Return type:

ModelTransformConfig

add_datastore_input(data_store_key, tables, model_filter=None, direct_data_pull=False)[source]

Register a data-store input feeding the secondary model.

Return type:

ModelTransformConfig

add_datastore_interface_input(data_store_key, tables, model_filter=None, direct_data_pull=False)[source]

Register a data-store-interface input feeding the secondary model.

Return type:

ModelTransformConfig

add_direct_upload_input(tables, missing_header_severity=ValidationSeverity.ERROR, unexpected_header_severity=ValidationSeverity.ERROR)[source]

Register a direct-upload (CSV) input feeding the secondary model.

missing_header_severity and unexpected_header_severity control how header mismatches at upload time are surfaced; both default to ValidationSeverity.ERROR.

Return type:

ModelTransformConfig

property type: DataSourceType

The DataSourceType discriminator for this configuration.

ModelTransform — wraps a sub-model used by ModelTransformConfig.

class ModelTransform(model_builder)[source]

Sub-model that produces output tables consumed by a ModelTransformConfig.

Parameters:

model_builder (ModelBuilder) – The sub-model whose tables are mapped onto target-model tables via add_output_table().

add_output_table(sub_model_table, model_table, field_mapping=None)[source]

Route rows from sub_model_table into model_table.

Parameters:
  • sub_model_table (Table) – Source table inside the sub-model.

  • model_table (Table) – Destination table in the parent model.

  • field_mapping (dict[str, str] | None) – Map of sub-model field id to parent-model field id. When omitted, fields with matching ids are auto-paired (data and combo fields only).

Return type:

ModelTransform

build()[source]

Serialise to a JSON-compatible dict including the embedded sub-model.

Return type:

dict[str, Any]

Input subclasses for ModelTransformConfig.

Each subclass corresponds to a DataInputSourceType and emits the appropriate sourceType discriminator on serialisation.

class ModelTransformInput[source]

Abstract base for an input feeding a ModelTransformConfig.

abstract property source_type: DataInputSourceType

The DataInputSourceType discriminator.

build()[source]

Serialise to a JSON-compatible dict with a leading sourceType key.

Return type:

dict[str, Any]

class DynamicValuesInput(timezone_key)[source]

Injects current-time/date values, optionally localised to timezone_key.

property source_type: DataInputSourceType

The DataInputSourceType discriminator.

class DataStoreInput(data_store_key, tables, model_filter, direct_data_pull)[source]

Reads rows directly from a data store.

property source_type: DataInputSourceType

The DataInputSourceType discriminator.

class DataStoreInterfaceInput(data_store_key, tables, model_filter, direct_data_pull)[source]

Reads rows through a data-store interface layer.

property source_type: DataInputSourceType

The DataInputSourceType discriminator.

class DirectUploadInput(tables, missing_header_severity=ValidationSeverity.ERROR, unexpected_header_severity=ValidationSeverity.ERROR)[source]

Reads rows from a directly-uploaded CSV (or ZIP of CSVs).

Two header-validation severity controls are applied at upload time:

  • missing_header_severity — how to surface a header that the input expects but the uploaded data does not provide.

  • unexpected_header_severity — how to surface a header present in the uploaded data that the input does not expect.

Both default to ValidationSeverity.ERROR, matching the platform Java default. Use ValidationSeverity.WARNING to allow the upload to proceed while still displaying the issue, or ValidationSeverity.IGNORE to suppress it entirely.

property source_type: DataInputSourceType

The DataInputSourceType discriminator.

DataInputSourceType discriminator enum for ModelTransformInput.

class DataInputSourceType(*values)[source]

Identifies the source of one input to a ModelTransformConfig.

Values:

DATA_STORE: Rows pulled directly from a data store. DATA_STORE_INTERFACE: Rows pulled via a data-store interface. DYNAMIC_VALUES: Computed values such as the current time. DIRECT_UPLOAD: Rows from a CSV or zipped CSV upload.

DATA_STORE = 'DATA_STORE'
DATA_STORE_INTERFACE = 'DATA_STORE_INTERFACE'
DYNAMIC_VALUES = 'DYNAMIC_VALUES'
DIRECT_UPLOAD = 'DIRECT_UPLOAD'