Interface MetricDefinition

A set of parameters that define a given metric (name, data source, thresholds, etc.). This definition can be passed to the Metric constructor to create a Metric or included in the definitions for a MetricCatalog to create a catalog of metrics.

All parameters are optional and should be omitted if default values are okay.

The definition is specified using pure JSON types so that it could be read from a file or CMS.

Hierarchy

  • MetricDefinition

Properties

categorySetId?: string

References a set of categories that this metric should use for grading / categorizing values (e.g. "vaccine-categories"). The available CategorySet definitions are defined when constructing the MetricCatalog via categorySets.

Use with either categoryThresholds or categoryValues.

categoryThresholds?: number[]

Thresholds used for grading the metric. These correspond to the categories specified by categorySetId and there should be one fewer threshold than there are categories.

Example

  // Assuming categories are [low, medium, high]
categoryThresholds: [10, 20]
// then <=10 is low, 10.1-20 is medium, and >20 is high.

// Thresholds can be descending as well.
categoryThresholds: [20, 10]
// then >=20 is low, 10-19.9 is medium, and <10 is high.
categoryValues?: unknown[]

A list of discrete metric values to be used for categorizing this metric's values (e.g. value 0 should be categorized as "fail" category, 1 categorized as "pass" category).

Example

  // Assuming categories are [fail, pass]
categoryValues: [0, 1]
dataReference?: MetricDataReference

Specifies how to fetch data for this metric. See MetricDataReference and MetricDataProvider

extendedName?: string

A longer name for the metric used when space is not a concern (e.g. "Cases per 100k population")

extra?: Record<string, unknown>

Arbitrary extra metadata related to the metric. This is not used by any bultin

Actnowcoalition

packages but can be used for custom application metadata that's useful to tie to the metric.

formatOptions?: NumberFormatOptions

Specifies options used to format the metric value when it is displayed.

id: string

A unique ID that can be used to reference this metric (e.g. "cases_per_100k").

maxValue?: number

Maximum possible value for the given metric.

minValue?: number

Minimum possible value for the given metric.

name?: string

The default user-facing display name of the metric (e.g. "Cases per 100k").

Generated using TypeDoc