Data Sources

A data source describes how external data lands in a model. Every concrete data-source config inherits from DataSourceConfig and is registered on a ConfigurationBuilder via the matching add_* method.

Data source wrapper

DataSource — wraps a DataSourceConfig with metadata (display name, visibility, behaviour flags).

class DataSource(name, config)[source]

Wraps a DataSourceConfig with display metadata and behaviour flags.

ConfigurationBuilder.add_* methods construct this wrapper for you and return it so you can chain set_* methods to customise behaviour.

set_hidden(hidden)[source]

Hide this data source from the UI’s data menu.

Return type:

DataSource

set_post_optimise(post_optimise)[source]

The data source will run automatically after optimisation has completed.

Return type:

DataSource

set_notify_on_new_data(notify_on_new_data)[source]

Send a UI notification when new data arrives.

Return type:

DataSource

set_update_new_data(update_new_data)[source]

Auto-apply incoming updates without operator confirmation.

Return type:

DataSource

Base configuration

Abstract DataSourceConfig base class for typed data-source configurations.

Each concrete subclass corresponds to a DataSourceType value and is serialised with a type discriminator key.

class DataSourceConfig(track_changes_supported=False)[source]

Abstract base for typed data-source configurations.

Parameters:

track_changes_supported (bool) – Whether the data source supports change-detection between imports.

abstract property type: DataSourceType

The DataSourceType discriminator for this configuration.

build()[source]

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

Return type:

dict[str, Any]

DataSourceType discriminator enum for DataSourceConfig.

class DataSourceType(*values)[source]

Identifies the kind of data source emitted in the JSON output.

Values:

GEOLOCATION: Geocoding of address rows. DISTANCE_MATRIX: Computed distance/duration matrix. EXCEL_TRANSFORM: Spreadsheet-driven transform. DATA_STORE: External or internal data store. SET_FEATURES: Feature-flag toggles. BATCHED_DATA_SOURCE: Group of other data sources run together. RUN_REPORT: Run a report. Useful to batch reports with other data sources. MODEL_TRANSFORM: Secondary model used to transform data. RUN_EXTERNAL_MODEL: Run the model’s configured external evaluator.

GEOLOCATION = 'GEOLOCATION'
DISTANCE_MATRIX = 'DISTANCE_MATRIX'
EXCEL_TRANSFORM = 'EXCEL_TRANSFORM'
DATA_STORE = 'DATA_STORE'
SET_FEATURES = 'SET_FEATURES'
BATCHED_DATA_SOURCE = 'BATCHED_DATA_SOURCE'
RUN_REPORT = 'RUN_REPORT'
MODEL_TRANSFORM = 'MODEL_TRANSFORM'
RUN_EXTERNAL_MODEL = 'RUN_EXTERNAL_MODEL'