Updated on 2024-04-03 GMT+08:00

Creating Atomic Metrics

An atomic metric is an abstract set of the statistical logic and specific algorithms. To ensure consistency between definitions and R&D, metric definitions determine the statistical logic (or the computing logic), without using ETLs to perform secondary R&D. This improves R&D efficiency and ensures consistency of statistical results.

Atomic metrics are generated based on dimension tables and fact tables of a multidimensional model. The objects and the finest data granularity of an atomic metric are consistent with those of the multidimensional model.

An atomic metric usually consists of measures and attributes related with measures and business objects, all of which aim to support agile self-service consumption of the metric.

Context

Atomic metrics come from fact tables and dimension tables.

  • An atomic metric is a data component defined for constructing a derivative metric required by application statistical analysis. An atomic metric can be created based on fact table details or dimension tables.
  • A derivative metric does not have a direct source table. It belongs to the source table of the original atomic metrics that are combined into the derivative metric.

Atomic metrics and derivative metrics interact in specific ways.

  • After the computing logic of an atomic metric takes effect, the related derivative metric is updated directly.
  • An atomic metric referenced by any derivative metrics cannot be deleted.
  • The code of an atomic metric referenced by any derivative metrics can be changed.
  • The change of an atomic metric affects related derivative metrics.

Constraints

A maximum of 5,000 atomic metrics can be created in a workspace.

Prerequisites

You have created and published a fact table, and the fact table has been approved. For details, see Creating Fact Tables.

Creating and Publishing an Atomic Metric

  1. On the DataArts Studio console, locate an instance and click Access. On the displayed page, locate a workspace and click DataArts Architecture.
    Figure 1 DataArts Architecture

  2. On the DataArts Architecture page, choose Metrics > Technical Metrics in the left navigation pane. On the displayed page, click the Atomic Metrics tab.
  3. Select a subject from the subject tree on the left and click Create.
  4. On the Create Atomic Metric page, set the parameters described in Table 1 and click Publish.
    Figure 2 Creating an atomic metric
    Table 1 Parameters for creating an atomic metric

    Parameter

    Description

    *Metric Name

    Metric names must start with letters. Only letters, numbers, and underscores (_) are allowed.

    *Metric Code

    Metric codes must start with letters. Only letters, numbers, and underscores (_) are allowed.

    *Data Table

    Select a published fact table from the drop-down list box. If there are many tables, you can enter a table name in the text box to search for the desired fact table. If no fact table is available, create one. See Creating and Publishing a Fact Table.

    *Subject

    The subject to which the atomic metric belongs. After a fact table is selected, the information about the subject to which the fact table belongs is automatically displayed. You can also click Select to select a subject.

    *Set Expression

    Select the required functions and fields and set the expression. For details about the functions, see Functions.

    Description

    A description of the atomic metric to create. Up to 600 characters are supported.

  5. In the dialog box displayed, select a reviewer and click OK.
  6. (Optional) Create and publish other atomic metrics by repeating 3 to 5.
  7. Wait for the reviewer to approve the application.

    After the application is approved, the atomic metric is created.

    Click the name of an atomic metric to view its details, relationship diagram, publishing history, and review history.

    In the relationship diagram, you can view the lineage diagram of the atomic metric.

    In the release history, you can view the differences between historical versions.

Managing an Atomic Metric

  1. On the DataArts Architecture page, choose Metrics > Technical Metrics in the left navigation pane. On the displayed page, click the Atomic Metrics tab.
    Figure 3 Managing an atomic metric
  2. Manage your atomic metrics as required. Refer to the following table for details.
    Table 2 Operations

    Operation

    Helpful Link

    Create

    Creating and Publishing an Atomic Metric

    Edit

    3

    Publish

    4

    View Publish History

    5

    Suspend

    6

    Delete

    7

    Import

    8

    Export

    9

  3. Edit an atomic metric.
    1. Click Edit to the right of the target atomic metric.
    2. On the page displayed, edit the atomic metric as required.
    3. Click Publish. If you do not want to immediately publish the atomic metric that you edited, click Save and you can publish it later.
  4. Publish an atomic metric.
    1. Click Publish to the right of the target atomic metric.
    2. In the Submit for Publication dialog box displayed, select a reviewer from the drop-down list box.
    3. Click OK.
  5. View the publish history.
    1. Select the target atomic metric in the list and choose More > View History.
    2. On the History tab page, you can view the publish history and version comparison information of the metric.
  6. Suspend an atomic metric.
    1. Click Suspend to the right of the target atomic metric.
    2. In the Submit for Suspension dialog box displayed, select a reviewer from the drop-down list box.
    3. Click OK.

      Atomic metrics cannot be suspended or deleted if they are referenced by any derivative metrics.

  7. Delete an atomic metric.
    1. Select the target atomic metric and choose More > Delete in the upper left corner.
    2. In the dialog box displayed, confirm the information and click Yes.
  8. Import

    You can import atomic metrics to the system quickly.

    1. Above the atomic metric list, choose More > Import.
      Figure 4 Importing atomic metrics
    2. Download the atomic metric template, and edit and save it.
    3. Choose whether to update existing data.

      If a code in the template already exists in the system, the data is considered duplicate.

      • No: If the data to be imported already exists in the system, the existing data in the system will not be replaced.
      • Yes: If the data to be imported already exists in the system:
        • If the existing data in the system is in draft state, the data will be replaced and new draft data will be generated.
        • If the existing data in the system is in published state, expanded data will be generated.
    4. Click Select File and select the edited template to import.
    5. Click Upload. When the template is uploaded, the Last Import page is displayed. You can view the imported data.
    6. Click Close.
  9. Export atomic metrics.

    You can export atomic metrics to a local file.

    1. In the atomic metric list, select the metric to be exported.
    2. Above the atomic metric list, choose More > Export.
    • You can export all the atomic metrics of a subject by selecting the subject in the subject list on the left.
    • You can export all the atomic metrics of a workspace, as long as there are no more than 5,000 atomic metrics in the workspace.

Functions

When creating an atomic metric, you need to set an expression based on functions. Table 3 lists some aggregate functions.

Table 3 Aggregate functions

Function

Expression

Description

avg(col)

avg()

Returns the average value.

corr(col1, col2)

corr()

Returns the coefficient of correlation of a pair of numeric columns.

count(*)

count()

Returns the total number of records.

covar_pop(col1, col2)

covar_pop()

Returns the covariance of a pair of numeric columns.

covar_samp(col1, col2)

covar_samp()

Returns the sample covariance of a pair of numeric columns.

max(col)

max()

Returns the maximum value.

min(col)

min()

Returns the minimum value.

stddev_pop(col)

stddev_pop()

Returns the deviation of a specified column.

stddev_samp(col)

stddev_samp()

Returns the sample deviation of a specified column.

sum(col)

sum()

Returns the sum of the values in a column.

var_samp(col)

var_samp()

Returns the sample variance of a specified column.

You can click functions in the Function column next to Set Expression on the Basic Settings page on the Create Atomic Metric page.

Figure 5 Functions