Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The package contains classes representing Splicer specific functionality for resolving splicing and desplicing directives within each parsed rule context. The Objects sub-package contains implementation of splicing and desplicing directives and regions.

TM1DirectiveContainer (class in TM1DirectiveContainer.py)

This class stores all directives that apply to a single TM1 rule or a feeder command. It also contains convert helper method to provide support when splicing dimensional elements of the TM1 rule.

...

Method

Usage

append_directive

Adds a directive to list of directives.

get_dimensions

Returns a list of all dimensions extracted from all directives.

get_directives_by_dimension

Returns a list of directives related to a specified dimension.

get_elements

Returns a list of directives related to a specified dimension or empty list if dimension is not within scope of any directive.

get_mdx_splicing_rule_applies

Returns flag indicating the specified directive targets entire dimension regardless regular expression filter.

convert

Returns a list of elements spliced by all directives that apply either by regular expression or to entire dimension. The list of elements is created by running Query associated with each splicing directive as defined in fpm.json configuration file.

TM1DirectiveResolver (class in TM1DirectiveResolver.py)

The class is implementing mechanism to select a list of directives applying to certain TM1 rule command or a feeder command out of all available directives in the TM1 rule file. The mechanism is using region membership (scope) of each rule or feeder to select proper list of directives. The directives are selected according to priority given by distance of the rule or feeder command from each region start.

The class defines following attributes:

Attribute

Type

Usage

splice_executor

TM1SpliceExecutor

Link to an instance of TM1SpliceExecutor.

directives_by_scope

Dict[str, List[TM1Directive]]

Dictionary of directives applying to region, indexed by region name.

The class exposes following methods:

Method

Usage

append_directive

Adds a directive to dictionary of directives directives_by_scope.

consume_directive

Called by parser whenever a directive is found during parsing of the TM1 rule file. Creates a new directive and appends it to the internal dictionary.

resolve_directives

Returns a new instance of TM1DirectiveContainer that has been added all applying directives according to region membership.

apply_directives

Resolves and applies directives to an area statement of a TM1 rule or feeder command.

deregister

Functionality was removed, originally served to store last splicing results in a file to be able to rollback to previous rule state.

TM1RegionContainer (class in TM1RegionContainer.py)

The class is used to store global list of regions defined throughout the TM1 rule file. Regions play important role when calculating scope of splicing directives to certain TM1 rule or feeder command.

The class defines following attributes:

Attribute

Type

Usage

regions

Dict[str, TM1RegionStore]

Dictionary of all available regions defined in the TM1 rule file indexed by region name. The value is TM1RegionStore object containing pointers to all instances of the region in the file.

The class exposes following methods:

Method

Usage

add_region

Adds a region to internal regions store.

update_region_start

Creates a new region and sets its start index (by characters counted from beginning of the file) according to parser.

update_region_end

Creates a new region and sets its end index or if the region already exists, updates its end index. Index is counted by number of characters from beginning of the file.

get_regions

Returns a list of regions that enclose specified string area by start and end indices if supplied. If not supplied, returns a list of all regions defined in the rule file. The list of regions is ordered by distance of the region start index to the string area.

get_region

Returns a list of all TM1Region instances based on supplied region_name.

get_region_start

Returns lowest available start index of all TM1Region instances based on supplied region_name.

get_region_end

Returns highest available end index of all TM1Region instances based on supplied region_name.

TM1RegionStore (class in TM1RegionContainer.py)

This class stores all instances of a region in the TM1 rule file.

The class defines following attributes:

Attribute

Type

Usage

region

str

Name of the region.

regions

List[TM1Region]

List of all instances of the region within the entire TM1 rule file.

The class exposes following methods:

Method

Usage

add_region

Adds a region instance into the internal regions store.

get_last_region

Returns last instance of a TM1Region from the regions store, this corresponds with last physical region instance in the rule file.

get_regions

Returns all contained TM1Region instances.

get_region_name

Returns region name.

TM1ReverseDirectiveContainer (class in TM1ReverseDirectiveContainer.py, derived from TM1DirectiveContainer)

This class stores all reverse directives that apply to a single TM1 rule or a feeder command. It contains redefined convert helper method for reverse splicing of rules.

The class exposes following methods:

Method

Usage

convert

Returns a list of elements spliced by all directives that apply either by regular expression or to entire dimension. The list of elements is created by running QueryRollback associated with each splicing directive as defined in fpm.json configuration file.

TM1SpliceConfigContainer (class in TM1SpliceConfigContainer.py)

This class is used to consolidate content of all Splicer config files (fpm.json, connection.json and kpi_template.json) into a single object. Access to the config files content is provided through various methods the class exposes.

The class defines following attributes:

Attribute

Type

Usage

log

Logger

Return logger object configured for the Splicer instance.

rule_config_file

str

Complete path and filename pointing to fpm.json. The file contains catalog of MDX queries associated to each splicing directive, list of cubes which are spliced and list of cubes requiring splicing of KPIs.

server_config_file

str

Complete path and filename pointing to connection.json. The file contains connection and credentials information in TM1Py dictionary format for the target TM1 instance.

kpi_config_file

str

Complete path and filename pointing to kpi_template.json. The file contains templates for KPI calculations that can be injected into cubes requiring splicing of KPIs.

paths_config_file

str

Unused.

dimensions

List[str]

List of dimension names to achieve reduction in scope of splicing to necessary minimum. If supplied the splicing will be reduced to cubes containing the dimensions contained in the list.

no_preprocess

bool

If set, the splicer won’t call any TI processes before commencing splicing.

no_postprocess

bool

If set, the splicer won’t call any TI processes after splicing was finished successfully.

rule_config_data

Dict[str, Union(Dict, List)]

Internal store for data loaded from fpm.json config file.

server_config_data

Dict[str, Dict[str, str]]

Internal store for data loaded from connection.json config file.

results_data

Dict[str, Dict]

Internal store for data returned by running Query or QueryRollback for each directive.

temp_results_data

Dict[str, Dict]

Internal store for data returned by running Query or QueryRollback for each directive.

kpi_config_data

Dict[str, Union(Dict, List)]

Internal store for data loaded from kpi_template.json config file.

paths_config_data

Dict[str, str]

Paths used to store rule proposals and backups.

The class exposes following methods:

Method

Usage

load_paths_config

Unused.

load_rule_config

Load rule_config_file into rule_config_data internal store.

save_rule_config

Save rule_config_data into rule_config_file.

load_server_config

Load server_config_file into server_config_data internal store.

writeback_results

Store splicing results in results_data internal store for current splicing.

writeback_prior_results

Store splicing results in results_data internal store for prior splicing.

register_results

Store splicing results in temp_results_data internal store for current splicing.

historize_prior_results

Fill temp_results_data with current results_data.

get_rule_config_data

Exposes rule_config_data internal store properties.

get_rollback_mdx_query

Exposes QueryRollback node from rule_config_data store (fpm.json) for given splicing directive and dimension. The rollback query is used to construct list of elements for reverse splicing directives when desplicing rules.

get_mdx_query

Exposes Query node from rule_config_data store (fpm.json) for given splicing directive and dimension. The query is used to construct list of elements for splicing directives when splicing rules.

get_on_empty_set

Exposes On_Empty_Set node from rule_config_data store (fpm.json) for given splicing directive and dimension. The node can either contain an MDX query or @Error tag that will generate exception and terminate splicing.

get_mdx_results

Exposes prior or current MDX query results for given splicing directive and dimension.

get_dimensions

Returns a list of dimensions for which the splicing was required.

get_cubes

Returns a list of cubes from Cubes node in rule_config_data store (fpm.json)

get_kpi_only_cubes

Returns a list of cubes from KPI_Only_Cubes node in rule_config_data store (fpm.json)

load_kpi_config

Load kpi_config_file into kpi_config_data internal store.

get_kpi_code_template

Returns code templates stored in code_template node of kpi_config_data (kpi_template.json). The templates are used to generate the KPI calculation rule.

get_kpi_suppress_gen

Returns a list of KPI calculation formulas excluded from KPI rule code generation from suppress_gen node of kpi_config_data (kpi_template.json). The list is used for calculations that can be provided with a simple rollup rather than a calculation formula to optimize KPI calculations.

get_kpi_db_template

Returns a template used to generate entire DB statement for a KPI formula. The templates are retrieved from DB_template node of kpi_config_data (kpi_template.json).

get_kpi_preprocess_ti

Returns a list of processes to run before splicing or desplicing from preprocess_TI node of kpi_config_data (kpi_template.json).

get_kpi_postprocess_ti

Returns a list of processes to run after splicing or desplicing from postprocess_TI node of kpi_config_data (kpi_template.json).

get_path_rule_backup

Returns a path for rule backups. Backups are provided before any rule modifications.

get_path_rule_proposals

Returns a path for rule proposals. Rule proposals are saved before patching a cube with spliced rule, these might be used to troubleshoot any splicing issues resulting in syntax errors happening during patch attempt of the spliced cube rule.