Scopes Tags

The scopes block defines the summary scopes on data sets used in the factory. Scopes provide efficiency by limiting which portion of the data set to act upon. A factory can have multiple scopes defined. Different scopes can reference the same data set. Each measure block can use one scope tag.

In the following example, the individual scope blocks are collapsed:

scopes {
  scope "Adjustments" {
  scope "Admissions" data-set="Accounts" {
  scope "Census Capacity" {
  scope "Procedures" {
}

Scopes Tags

Tags Examples Notes
scopes

scopes {

scope "Discharges" data-set="Accounts" { 

...

}

scope "Diagnoses" {

...

}

...

}

Defines the container block for scope tags.

scope

scope "Discharges" data-set="Accounts" {

filter `value("Date") != null and value("Date") <= current_date()`

alias "Date" "Discharge Date"

alias "Day of Week" "Discharge Day of Week"

}

Defines an abstraction layer into the data set. Use of the data-set tag is optional if using a single factory configuration. When using multiple files, the scope name must match the data set name, or a data-set tag is required to point to the appropriate data set.

NOTE: Each data set defined in the data-sets block must be used in at least one scope defined within the scopes block for the factory to process properly.

file scope "Admissions" file="scopes/Admissions.factory-scope" Supporting tag for scope when using separate factory-scope files along with the main cfg.factory. See Multiple Configuration Files.

filter

filter `value("Date") != null and value("Date") <= current_date()` Defines a filter on the data for this scope.

alias

alias "Date" "Discharge Date"

alias "Day of Week" "Discharge Day of Week"

Defines an alias for a date column in this scope so the name is more meaningful.

NOTE:

  • Spectre (currently) only allows you to alias dimensions. If you have a rule that you would like to alias, you must first make it a dimension, and then you can apply the alias. See Dimensions Tags.
  • Date-rollup dimensions cannot be aliased.

See also Anatomy of a Measure.