# Lab: IGC: Create custom rules for data analysis

Information Server enables users to better understand their data. It uses pre-built and custom rules that will apply meaning and quality measurements, which are available for users of the data and interested parties.

This lab, will give you hands-on experience using Information Server's rule capabilities. In this lab, you will learn the following:

* How to create a data rule
* Apply the rule to a data set
* View data that does not apply to the rule

This section is comprised of the following steps:

* [1. Import and view the data](#1-import-and-view-the-data)
* [2. Create a data rule](#2-create-a-data-rule)
* [3. Re-analyze and view results](#3-re-analyze-and-view-results)

## 1. Import and view the data

Launch Firefox and click on the `Launchpad` bookmark. When the Information Server launchpad shows up click on the `Information Governance Catalog New` tile.

![1-iis-launchpad-new](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fba9b7df59e8179d1cbde43798e748d77ba7f5c3d.png?generation=1597931061624094\&alt=media)

Log in with the username `isadmin` and password `inf0Xerver`.

![2-gc-login](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F5fd27a2e66b2d003307acc3ea6c64c192702cdf8.png?generation=1597931065363538\&alt=media)

The overview page will appear.

![3-gc-landing](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fd2c67f1e683e7ab7d5a52ad1180ec39955b70256.png?generation=1597931057687503\&alt=media)

Click on the `Connections` tab and ensure the connection `JK_ORD` appears and the host is `IIS-SERVER.IBM.DEMO`. This connection is pre-established for convenience and was imported to the `JK Orders` workspace, let's take a look at it.

![4-connections](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe71fe4d1cc5dc26be1a5878d19cdda99515bd38c.png?generation=1597931064439139\&alt=media)

To find the `JK Orders` workspace, go to `Quality` tab and click on the right tile.

![5-workspaces](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F1f0660cf7514222b996a9a9b46690859011c5727.png?generation=1597931057196552\&alt=media)

The workspace overview will load. Take a few moments to browse the graphics on the page and click on the `Data sets` link to view the data in this exercise.

![6-workspace-overview](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fd86abeaba4782f45d35b4d36a82912f46f17f166.png?generation=1597931056590262\&alt=media)

Before we create new rules let's look at the two data sets that will be used in this example. Take a look at the `Sales` data set first.

![7-data-sets](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fa13614736b19c06f0c69dbb843351a236524bd3a.png?generation=1597931062331259\&alt=media)

Click on the `Columns` tab to view findings from the analyzer. It found many things when the data was imported, like maximum and minimum values, distinct values, format, and uniqueness.

![8-sales](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fcd12cba169faff43239ffde4f1ed7720973459c3.png?generation=1597931058016943\&alt=media)

Repeat the same for the `CUSTOMERS` data set.

![9-customers](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F43011a7e35d1a6790aeb7af37ca790801eed897b.png?generation=1597931030255606\&alt=media)

We're now ready to create our first data rule!

## 2. Create a data rule

From the `JK Orders` workspace click on the `Data rules` tab.

![10-data-rules](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Ff02d1547bb1c16d5b8bf0123dccf45e32ef4618f.png?generation=1597931057334514\&alt=media)

Expand the `Published Rules` section, then the `01 Personal Identity` section, and then the `Age` section to reveal the `AdultInRangeNumeric` rule.

Navigate to the right to show the `⋯` menu. Choose the `Manage in workspace` option from the menu.

![11-manage-rule](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fae905b4cc0e47301f901e422ebd553368f7c09a3.png?generation=1597931058329419\&alt=media)

The rule should now appear under the `All` section. Navigate to the right to show the `⋯` menu. Choose the `Edit` option from the menu.

![12-edit-rule](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe14e318188e5092307dea38cda204800855ec18b.png?generation=1597931060910809\&alt=media)

Now we're going to edit the rule so that it flags ages that are under 18 or over 120. To do that, edit the text boxes to the right that show `minage` and `maxage` and update them with `18` and `120` respectively. The formula at the bottom should read:

```
age >= 18 and age < 120
```

Save the rule.

![13-rule-logic](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F6b91d4a2f6a790d1a03d1b65b9c000daf16bcca0.png?generation=1597931033280914\&alt=media)

When you are brought back to the `Data rules` tab you'll notice that the new rule has an error. We need to publish the rule. To do so navigate to the right to show the `⋯` menu. Choose the `Publish` option from the menu.

![14-publish](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe9c165aa6b01160d8822b323fef2f90d6fa782ac.png?generation=1597931021527923\&alt=media)

Confirm the publish action.

![15-publish-confirm](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F351fd21342ffa7be033e2ba66cdd8ed23fb137d0.png?generation=1597931059053357\&alt=media)

## 3. Re-analyze and view results

Go back to the `JK Orders` workspace and click on the `Data sets` links

![16-data-sets](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Ff2da97f3880f48c18264a92bd4916b37f7e016f5.png?generation=1597931067913044\&alt=media)

Click on the `SALES` data set.

![17-sales](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F665a1b598a28d12299320dd4bc33f2f513570268.png?generation=1597931063600424\&alt=media)

We can now apply the rule by clicking the `+ Add rule` button.

![18-rules](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F1d438cf99afeaa454349f042191c5c8e51e3fedb.png?generation=1597931052515289\&alt=media)

Choose the `AdultInRangeNumeric` rule and click `Next`.

![19-select-rule](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F82fe3a5fc107ae093c5b60760402127b76a31b0f.png?generation=1597931066829010\&alt=media)

We now have to bind the rule to a specific column in our data set. Click on the `age` variable name on the left, this is the rule. And click on the `AGE` column name on the right, this is our data source. Click on the `Bind` button and once bound you can click `Next`.

![20-bind](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fd6f38af71cfe54705d63774c6c31526a698b6f35.png?generation=1597931063177397\&alt=media)

We don't need to test the rule this time, we can just click on `Save`.

![21-test](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Faf2966413038adeef48d02950965aa2e0afd716b.png?generation=1597931051356497\&alt=media)

You should now see the rule in the data set view. Click on the `Analyze` button to restart the analysis with the new rule.

![22-analyze](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F6d4fe6f52ea510ee70a60a975b19f4270bfbe4ec.png?generation=1597931037294242\&alt=media)

Confirm to start the analysis.

![23-analyze-confirm](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe1477fd3955521161bcade61281d749adb1f675f.png?generation=1597931059622940\&alt=media)

You may need to refresh your browser a few times for this step. It will take a few minutes. You'll see the state go to `Running` to `Successful` when done.

![24-running](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F60c3844f0b3b8d8de46d9fe8712b4b771d523efe.png?generation=1597931066175950\&alt=media)

Once complete, go to the `Data quality` tab. You'll see that the new rule has one finding. Click on the findings to view the exception.

![25-findings](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F9cc35a9fa0a12983998e75eeebd0ef2f3dbfca45.png?generation=1597931032162917\&alt=media)

Scrolling to the right you'll see that there is one entry whos age is 17, this is less than the required 18 for our rule!

![26-findings-view](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F52ecdd36ea65f66f0823b807f66277a4a19a813e.png?generation=1597931025299607\&alt=media)

**CONGRATULATIONS!!** You have completed this lab!
