seismometer.configuration.config.ConfigProvider

class seismometer.configuration.config.ConfigProvider(config_config, *, usage_config=None, info_dir=None, data_dir=None, template_notebook=None, definitions=None, output_path=None)

The base configuration provider.

The configuration provider is a layer between the configuration data model and the consuming class. It is responsible for loading the config files, template notebook, and data and streamlining the access across multiple files.

Parameters:
  • config_config (str | Path) – Specifies the path to the primary configuration file with a top level key of “other_info”. The primary configuration file is largely focused on describing where to find other pieces and includes several file names and paths.

  • usage_config (Optional[str] | Path, optional) – Specifies the path to the usage configuration file with a top level key of “data_usage”, by default None; it uses usage_config from the primary config file, which specifies details about what kind of data is used and how it should be used.

  • info_dir (Optional[str | Path], optional) – Specifies the path to the information directory. Not used, by default None; Configured in the primary config file

  • data_dir (Optional[str | Path], optional) – Specifies the path to the data directory, by default None; it uses data_dir from the primary config file, which is where data dictionaries are written/read.

  • template_notebook (Optional[object], optional) – Unused.

  • definitions (Optional[dict], optional) – A dictionary of definitions to use instead of loading those specified by configuration, by default None.

  • output_path (Optional[str | Path], optional) – Specifies the path to the output directory or file, by default None; if a directory, the template notebook will be used with the prefix gen.

__init__(config_config, *, usage_config=None, info_dir=None, data_dir=None, template_notebook=None, definitions=None, output_path=None)
Parameters:
  • config_config (str | Path)

  • usage_config (str | Path | None)

  • info_dir (str | Path | None)

  • data_dir (str | Path | None)

  • template_notebook (object | None)

  • definitions (dict | None)

  • output_path (str | Path | None)

Methods

__init__(config_config, *[, usage_config, ...])

event_group(usage_group)

Returns a dictionary of events indexed by column name and restricted to the specified usage group

event_types()

List of all event types referenced in usage configuration.

set_output(output[, nb_prefix])

Resolves the location of the outputs based on config and specified values.

Attributes

censor_min_count

The minimum count needed for a cohort to be included in analysis.

cohorts

List of cohort objects to use during analysis.

comparison_time

The column name of the timestamp to use as reference for comparison across events.

config

The configuration definition.

context_id

Accessor for the context_id key.

data_dir

The parent directory for data files.

entity_id

Accessor for the entity_id key.

entity_keys

List of entity and context ids.

ev_time

The time column in the event table.

ev_type

The type column in the event table.

ev_value

The value column in the event table.

event_defs

The dictionary for event data.

event_path

The path to the event data file.

events

Dictionary of all event objects indexed by column name.

features

An explicit list of features to use in analysis.

info_dir

The directory for output information.

interventions

Dictionary of events to use as interventions, keyed off of event name.

metadata_path

The path to the metadata json.

outcomes

Dictionary of events to use as outcomes, keyed off of event name.

output

The primary output of the model.

output_dir

The directory for output files.

output_list

The list of all columns to consider as outputs.

output_notebook

The name of the output notebook.

predict_time

The time column for predictions.

prediction_columns

List of all columns referenced in usage configuration.

prediction_defs

The dictionary for data in the prediction frame.

prediction_path

The path to the prediction data file.

target

The primary target to use during evaluation.

targets

Dictionary of events to use as targets, keyed off of event name.

template

The template used for building a model-specific seismograph notebook.

usage

The configuration on data usage.