Anatomy of a Measure

A measure is the result of applying business rules and optionally, a scope, to one or more source data sets. The measure supplements the rules with metadata that provides additional context. After the factory processes the measure, the measure results can be used in the output data set on a DivePort page or for ad hoc ProDiver analysis.

Sample measure:

measures {

category "Outpatients" {

measure "Total Outpatient Visits" `count()` filter=`value("Outpatient Account") = true` format="#,#" {

scope "Discharges"

}

}

}

Each measure must be listed within a category tag and usually has one scope tag. The scope directs the measure to the correct data set and can include filter and alias tags that allow you to further refine the data that is returned.

Sample scope:

  scope "Discharges" data-set="Accounts" {
    filter `value("Date") != null and value("Date") <= current_date()`
    alias "Date" "Discharge Date"
  }

Defining a Measure:

Name the measure and define a calculation and optional filter or format by using Spectre expressions. For example:

measure "Total Outpatient Visits" `count()` filter=`value("Outpatient Account") = true` format="#,#"

In this example, the measure is named Total Outpatient Visits and it counts the number of records based on the filter being true. The Outpatient Account reference in the filter expression is not to a source rule (column in the data set), so you need to create the Outpatient Account by using a calc rule in the Accounts data set. For example:

calc-rule "Outpatient Account" `not value("Inpatient Account")`

The Inpatient Account reference in the expression is not a source rule either, so you need to create the Inpatient Account using a calc rule in the Accounts data set. For example:

calc-rule "Inpatient Account" `value("Admit Date") !=null and value("Patient Type") = "Inpatient"`

The references to Admit Date and Patient Type in the expression are to source rules, so no further rule definition is required.