# Policy Labels UI

## **1. Permissions**

Access to Policy Labels functionality is controlled by the corresponding permissions settings.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-43201999b47c10dd5f3aaeb2c6672938331f65ef%2F0.png?alt=media" alt=""><figcaption></figcaption></figure>

## **2. Authoring Policy Labels**

### **2.1 Policy Labels view**

Users can review the list of existing labels and their statuses in the corresponding section of Guardian UI.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-b0c1552f145ca940d6fe65c4a604c3625977de41%2F1%20\(1\).png?alt=media)

### **2.2 Authoring**

A new Policy Label definition can be created by clicking on the ‘Create New’ button on the Policy Labels page.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-fbf4425146a3a84e7b67de37d6608512cb6df9b4%2F2.png?alt=media)

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-78bfa3071f1d766abebb98e8aef634ab02aac270%2F3.png?alt=media)

### **2.3 Configuration**

After the initial creation, Policy Label definitions must be configured further to be usable.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-371653599953923520f7d601ef019dac95499365%2F4.png?alt=media)

#### **2.3.1 Generic configuration**

Generic configuration of Policy Label definitions consists of name and description field. Label authors should configure meaningful names and descriptions for their labels as these are the attributes label users would rely on to understand the applicability of labels to their specific use-cases.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-4860d0a8da7384dbc4432556279cbb4fa7ec261e%2F5.png?alt=media)

#### **2.3.2 Imports**

To include other published label definitions and statistics into the definition of a label being configured, these structural components must be imported into the context of the current label. Import operation links a parent label with the imported elements, which makes them available to the Label author in the side menu of the UI.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-2d9aa7c69d3fc5c1da521cd9cc2ee48d58584989%2F6.png?alt=media" alt=""><figcaption></figcaption></figure>

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-1237bbf4bdf4570a8027508bb5dd7db85194e893%2F7.png?alt=media)

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-5049cddfe10f1d04b40249dc21a94d79a3f03163%2F8.png?alt=media)

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-cc1f2ef3ffdf18e369ccfd95137cc61156492ca0%2F9.png?alt=media)

#### **2.3.3 Creating rules**

Label configurator consists of 3 sections

1\. Side menu, for displaying components which can be dragged-and-dropped into the label editor.

2\. Label editor, which hosts the components where they can be arranged into a hierarchical structure representing the evaluation logic.

3\. Component properties, which define specifics of the behavior of the individual components.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-56e9d28d7e1284d543db7de569c23080fb62d073%2F10.png?alt=media)

**2.3.3.1 Components: Groups**

Groups are components which define the general structure of Labels. Each group has its own name (title) in the navigation panel and represents a specific namespace in which components have access to each other's variables. Groups define sufficient validity conditions for the target documents.

**Configuration**

* **Tag** – the name of the namespace
* **Title** – title in the navigation panel
* **Rule** – defines the principle by which the group will be evaluated
  * **At least one** – the group is considered valid if at least 1 of the direct (immediate) child components is valid
  * **Every** – the group is considered valid if all direct (immediate) child components are valid

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-48556eb6f04aace308423e975061f0029cdd465b%2F11.png?alt=media)

**2.3.3.2 Components: Rules**

Rules are defined in terms of variables, scores, formulas and conditions.

A Rule is considered ‘valid’ if all its conditions successfully verify for the set of provided data.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-34c670c2e3327e26f2b3519c08230d59ae00bb59%2F12.png?alt=media)

**Configuration**

* **Tag** – name of the namespace
* **Title** – title in the navigation panel

For components which are members of the same group, each component that is positioned below another component (i.e. ‘follows’ the prior component) has access to the variables of the previous component via its Tag.\\

**2.3.3.2.1 Editing Rules**

Rules can be edited in the corresponding area of the UI:

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-b517673f48006a8ba760d0e62c487b749e44fad4%2F13.png?alt=media)

**Rules editor consists of 2 sections:**

1\. Schema hierarchy and content (fields) display, which allows users to find and select specific fields in schemas for use in the Label calculation/evaluation (see more detailed description in the Statistics documentation section) **.**

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-bea5f31aaef8c39bb20b8517d2a8f65f82cdc37f%2F14.png?alt=media)

2\. Formula and Rules configurator (see more detailed description in the Statistics and Schema Rules documentation sections).

**Variables** (see more detailed description in the [Statistics and Schema Rules](https://guardian.hedera.com/guardian/standard-registry/usage-statistics/statistics) documentation sections).

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-a56dd9f2614f08318b10bda11f421f868f17ae37%2F15.png?alt=media)

**Scores** (see more detailed description in the [Statistics](https://guardian.hedera.com/guardian/standard-registry/usage-statistics/statistics) documentation section).

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-50d86e297bab494b530dec4a2cbbf8cbca795e69%2F16.png?alt=media)

**Formulas (**&#x73;ee more detailed description in the [Statistics](https://guardian.hedera.com/guardian/standard-registry/usage-statistics/statistics) documentation section).

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-9db05a80fd5d8f8d9da17f8d542287438df5e852%2F17.png?alt=media)

**Conditions** Formula and Rules configurator (see more detailed description in the [Schema Rules](https://guardian.hedera.com/guardian/standard-registry/schemas/schema-rules) documentation section).

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-fb8b0d796ec8d48ea9b9cb84a8c2c450cda42789%2F18.png?alt=media)

**2.3.3.3 Components: Statistics**

Existing Statistics can be used as components in Labels. As they don’t contain conditions they are always evaluated as valid when the Label which contains them is evaluated. Therefore, their primary function is to serve as data sources for other components in the Label, as their variables can be accessed directly by other components in the same namespace.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-cc3dc99f4875b21156d3f0c451215732ca532f98%2F19.png?alt=media)

**2.3.3.4 Components: Labels**

Existing labels can be used as components of other (higher order) labels. The internal structure of such embedded labels remains unchanged.

![](https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-e50140ce1238371ef27c0f1945fab17b2943a308%2F20.png?alt=media)

**2.3.4 Saving**

It is recommended to frequently use ‘Save’ button to preserve the current state of the Label being edited.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-2f2c1d58931c5d0f968b7dd1a9b83884e65be2c7%2Fimage%20(2)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

**2.3.5 Preview**

Label authors can preview (i.e. ‘dry run’ test) their Label functioning once its definition is complete by clicking the ‘Preview’ button in the configurator UI. Such test evaluations require manual input of the test data.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-47f7892ecc934ea93f59c81010386965c6da7fc0%2Fimage%20(3)%20(1)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-1ca995b73f358c7cf36249abcef7ea9bd0c356c9%2Fimage%20(4)%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-0c20a2bcddc0677c46e3d2efdef383fe2a4bccb2%2Fimage%20(5)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-0071cf16b6c7a22d3003b2a393b1ab58ef0c52cf%2Fimage%20(6).png?alt=media" alt=""><figcaption></figcaption></figure>

Components which were successfully validated on the provided test data would be marked in green, the unsuccessful results are marked in red.

{% hint style="info" %}
**Note**: Depending on the structure of the Label and the configuration of its rules it is not necessarily required for all Label components to be valid for the Label itself to be successfully validated. Groups can be configured such that some components do not validate, however the main top-level groups can be valid which is the main condition for Labels validity.
{% endhint %}

**2.3.6 Publishing**

To enable other users to find and use the Label it must be published.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-3a033cd3ceb1ce01cbbace8f391b82a644639549%2Fimage%20(7).png?alt=media" alt=""><figcaption></figcaption></figure>

### **2.4 Document Creation**

Once the Label has been published it can be used to create Label documents on specific token data.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-7b34fdaffbe3ff35aa80291721e3449c88876330%2Fimage%20(8).png?alt=media" alt=""><figcaption></figcaption></figure>

**2.4.1 Targets**

The first step in the creation of a Label document is to select the target token (i.e. a VP document linked to the token).

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-288524f0bbdd40d0109b6dae7dc990d8c0a7ee36%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**2.4.2 Label evaluation**

All steps defined in the Label evaluation flow must be followed.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-83a9613b55f2ac083db1cfa2d760a3a509c44c38%2Fimage%20(10)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

**2.4.3 Results**

If a Label is evaluated as valid a corresponding document is created containing all Label information. This document can be published to make it accessible externally.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-c3326ba19769d3f5b46d7f6408ce76c96ef48cdd%2Fimage%20(11)%20(1)%20(2)%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>

### **2.5 Viewing Label documents**

Existing Label documents can be accessed from the corresponding grid.

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-eb3959e608fa678a26a5a0d429c027319129d41b%2Fimage%20(13)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-2a9f6b21c9cc42b0acc5c419e98c366784282b72%2Fimage%20(14).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-83bec33ae99d7b351b1c52270ab4fa690a5c437f%2Fimage%20(15).png?alt=media" alt=""><figcaption></figcaption></figure>

## **3. Labels Import\Export**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-02ae30ce5bac0b931b627c4cfd8b5d864b6b3a31%2Fimage%20(16).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-cbef9aefbcd6207669db3b837cc066a788082d6b%2Fimage%20(17).png?alt=media" alt=""><figcaption></figcaption></figure>

## **4. Indexer view**

### **4.1 Published Labels**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-4fa31baab14e575ed8faa3f60446b1a52093ff24%2Fimage%20(18).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-a34decb4a374be65f87c13b659b35f1bf3547fa8%2Fimage%20(19).png?alt=media" alt=""><figcaption></figcaption></figure>

### **4.2 Published Label documents**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-703655eea6718dd5340cf8ffb0e34c4369ce321a%2Fimage%20(20).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-e410905eb483f1da5eed84caba6790d5736ff5e4%2Fimage%20(21).png?alt=media" alt=""><figcaption></figcaption></figure>

### **4.3 List of the Labels linked to the specific token VP document**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-7f640b0432228d486cc05d2cd5a86b72e57d6f24%2Fimage%20(22).png?alt=media" alt=""><figcaption></figcaption></figure>

### **4.4 List of Labels linked to the specific token**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-e2ec74a352158230c7ea5be572f3e516aed95368%2Fimage%20(23).png?alt=media" alt=""><figcaption></figcaption></figure>

### **4.5 List of Labels linked to the specific NFT**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-edf57ad6d460a34680f7d0b76e4e5ca3ed7c4f92%2Fimage%20(24).png?alt=media" alt=""><figcaption></figcaption></figure>

### **4.6 Viewing Label documents**

<figure><img src="https://1556785885-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNYWPEEAknX9Vki1yV5HY%2Fuploads%2Fgit-blob-e97eb39205b9fc3f9c824272c83cdd7f2f2ab5ac%2Fimage%20(25).png?alt=media" alt=""><figcaption></figcaption></figure>

1. **API**

Post */api/v1/policy-labels/*

Permissions: STATISTICS\_LABEL\_CREATE

Creating new Label definition

Get */api/v1/policy-labels/*

Permissions: STATISTICS\_LABEL\_READ

Retrieve the list of Label definitions

Get */api/v1/policy-labels/:definitionId*

Permissions: STATISTICS\_LABEL\_READ

Retrieve a label definition configuration by ID

Put */api/v1/policy-labels/:definitionId*

Permissions: STATISTICS\_LABEL\_CREATE

Update Label configuration by ID

Delete /api/v1/policy-labels/:definitionId

Permissions: STATISTICS\_LABEL\_CREATE

Delete Label definition by ID

Put /api/v1/policy-labels/:definitionId/publish

Permissions: STATISTICS\_LABEL\_CREATE

Publish Label definition by ID

Put /api/v1/policy-labels/push/:definitionId/publish

Permissions: STATISTICS\_LABEL\_CREATE

Publish Label definition by ID asynchronously

Get /api/v1/policy-labels/:definitionId/relationships

Permissions: STATISTICS\_LABEL\_READ

Retrieve the list of components for Label configuration (schemas, policies, etc)

Post /api/v1/policy-labels/:policyId/import/file

Permissions: STATISTICS\_LABEL\_CREATE

Import Label configuration from a file

Get /api/v1/policy-labels/:definitionId/export/file

Permissions: STATISTICS\_LABEL\_READ

Export Label configuration to a file

Post /api/v1/policy-labels/import/file/preview

Permissions: STATISTICS\_LABEL\_CREATE

Preview of the imported file

Post /api/v1/policy-labels/components

Permissions: STATISTICS\_LABEL\_CREATE

Search for Labels and Statistics for importing into Label configuration

Get /api/v1/policy-labels/:definitionId/tokens

Permissions: STATISTICS\_LABEL\_READ

Retrieve the list of created tokens (VPs) for which a Label document can be created

Get /api/v1/policy-labels/:definitionId/tokens/:documentId

Permissions: STATISTICS\_LABEL\_READ

Retrieve token (VP) and all its dependencies by document ID

Post /api/v1/policy-labels/:definitionId/documents

Permissions: STATISTICS\_LABEL\_CREATE

Create a new Label document for token (VP)

Get /api/v1/policy-labels/:definitionId/documents

Permissions: STATISTICS\_LABEL\_READ

Retrieve a list of created Label documents

Get /api/v1/policy-labels/:definitionId/documents/:documentId

Permissions: STATISTICS\_LABEL\_READ

Retrieve Label document by ID

Get /api/v1/policy-labels/:definitionId/documents/:documentId/relationships

Permissions: STATISTICS\_STATISTIC\_READ

Retrieve linked Label documents by ID
