Tasks: write, change and test a rule
Who does this: a data steward, with the quality-steward policyPolicy A set of permissions an administrator gives an account or a group. The product ships ready-made ones for the usual roles, such as quality-steward and quality-viewer.,
writes rulesRule It applies a pattern to a field; the pattern gives it its dimension and a default severity. The rules that count are the ones on main, the approved version. and takes them to main. Anyone whose policy lets them see the
rules (quality-analyst, quality-viewer, auditor) can open, read and
test them, but not save. The first time through, follow the
tutorial; how a rule is written is in Rule
language and Rule patterns. The
example is the customers datasetDataset One table of a source as Quality Data reads it: a name, its fields and the rules that check them. of Concepts.
Where a dataset’s rules are
Section titled “Where a dataset’s rules are”Each field has its own rules file, named as the field: the rules of Email
are in Email.yaml. What several fields share, such as a list of values or
a check written once, is in the dataset’s Global rules
(Share rules across fields). Only the rules on main,
the approved version, are evaluated.
In the Explorer, under Lake, open the dataset (◆ customers):
each field lists its rules by id, and a field with none is marked no
rules. The ▤ beside the dataset opens its Rules page: every rule
on main in words, with its patternPattern A reusable way of validating (required, format, fresh and eleven more). Each rule is a pattern applied to a field with its condition., dimensionDimension The kind of quality a rule measures (completeness, validity, timeliness…), given by its pattern., severitySeverity A rule's weight in the ICD: blocking 1.0, major 0.6 and minor 0.3. The pattern gives a rule its default severity., what makes it
fail and its file.
To find a rule
Section titled “To find a rule”- Choose ▤ beside the datasetDataset One table of a source as Quality Data reads it: a name, its fields and the rules that check them..
- Type in Search an id, a field or words of what fails, such as
e-mail, or narrow the list with Pattern, Dimension or Severity. - Choose the rule’s Id.
You should see the field’s file in the editor, at that rule, with the file’s name in a tab above it. A file whose rules cannot be read is named at the top of the Rules page, with its errors.
To add a rule to a field
Section titled “To add a rule to a field”-
In the Explorer, open the datasetDataset One table of a source as Quality Data reads it: a name, its fields and the rules that check them. and choose + beside the field (Add a rule to Email).
-
The field’s file opens (new if it had none) with a rule added at the end, ready to change:
- id: Email-01field: Emailcheck: required -
Change the patternPattern A reusable way of validating (required, format, fresh and eleven more). Each rule is a pattern applied to a field with its condition. under
check, add what it needs, and write analert: the sentence whoever fixes the record reads. For example:- id: EML-02field: Emailcheck: formatnamed: emailalert: The e-mail address is not valid -
Read the rule under As read (next section), then test it.
Nothing is saved yet: the tab shows ● and the head says Unsaved changes; Restore takes the file back as it was.
To change a rule
Section titled “To change a rule”Open it from the Explorer or the Rules page, change it, and test it.
Keep its id: results are kept by it from cutCut The dataset's data as it was on one date, copied into the lake so it can be measured again without touching the source. Every figure of a report refers to that moment. to cut, so a new id starts
the rule’s history again. A rule changed today counts from the next cut;
earlier cuts stay as they were evaluated.
What the editor tells you as you type
Section titled “What the editor tells you as you type”The file is checked as you type, without data. A mark on the line shows where something is wrong; beside the editor, four tabs:
- Problems: the errors and warnings, each with its message, its code
(such as
QR003) and its line; choose one to go to it. - Style: how the file is written. Tidy fixes most of it at once, keeping comments and values; Ctrl+Z undoes it.
- As read: each ruleRule It applies a pattern to a field; the pattern gives it its dimension and a default severity. The rules that count are the ones on main, the approved version. in words: what it applies to, when it fails, when it does not apply. Read it every time: it is the quickest way to catch a rule that does not say what you meant.
- Result: the last test (below).
An error blocks saving and deploying; a warning does not.
To test a rule
Section titled “To test a rule”- Put the cursor on the rule, or anywhere outside a rule to test the whole file.
- Choose Test.
It runs the text as it is, unsaved, on the datasetDataset One table of a source as Quality Data reads it: a name, its fields and the rules that check them.’s latest cutCut The dataset's data as it was on one date, copied into the lake so it can be measured again without touching the source. Every figure of a report refers to that moment., and
nothing it finds counts anywhere. It waits for a workerWorker A program that runs on its own beside the application and does the heavy work: listing a source's tables, mapping a table, copying a cut and evaluating it. Mapping and cuts need at least one. first, then shows
in Result, for each rule: Applies, Fails, Passes, Does
not apply and Conformity, then up to 10 records of each outcome, and
the failures grouped by the value’s shape (a digit as 9, a letter as A).
Values come masked; if your policyPolicy A set of permissions an administrator gives an account or a group. The product ships ready-made ones for the usual roles, such as quality-steward and quality-viewer. lets you see personal dataPersonal data Values from a source about a person. They are shown whole only to policies that allow View personal data, such as quality-analyst; anyone else sees them masked, and every whole view is recorded in the audit trail.
(quality-analyst does, quality-steward does not), Show values shows
them whole with a purpose, and every view of whole values is recorded in
the audit trailAudit trail The record of who did what and when: changes, runs, and every view of a source's values. Read with the auditor policy. (To show values
whole). In the Explorer, the rule then shows
✓ if it passed, or how many records failed.
A test’s result is kept for a day: after that, Result says This test’s result is no longer kept (results are kept for a day). Test again., and Test runs it anew.
If a rule fails on most records, read it again before it counts.
To take it to main
Section titled “To take it to main”With quality-steward the button is Deploy: it shows what the linterLinter The checker that reads a rules file as it is typed, without data, and marks its errors, which block saving and deploying, and its warnings.
(the checker) finds, which rulesRule It applies a pattern to a field; the pattern gives it its dimension and a default severity. The rules that count are the ones on main, the approved version. the file adds, removes or changes, and
the change line by line; choose Deploy again to confirm. You should
see Deployed to main: the rules are under their field now. Without the
right to approve, the button is Save as a draft. Both are in Take a
change to main. The rule counts from the next cutCut The dataset's data as it was on one date, copied into the lake so it can be measured again without touching the source. Every figure of a report refers to that moment.: run
one now with Run and schedule cuts.
To remove a rule
Section titled “To remove a rule”- In the Explorer, right-click the rule under its field and choose Delete rule.
- Read the dialog (Delete the rule EML-02): it shows the file without the rule. Choose Deploy.
You should see The rule EML-02 deleted; the field’s history undoes it. It is a deploy like any other, so only whoever may deploy sees Delete rule; the field’s history can bring it back. A rule that a list of fields gives several of cannot be removed from the tree: open its file and take it out there.
Findings you will meet
Section titled “Findings you will meet”| What the editor says | What to do |
|---|---|
The field … is not in the dataset, maybe with Did you mean …? (QR003) |
Write the field’s name exactly as the Explorer shows it. |
Another rule already uses the id … (QR009) |
An id is unique in the whole datasetDataset One table of a source as Quality Data reads it: a name, its fields and the rules that check them.: choose another. |
The parameter … is missing (QR006), The pattern … does not take the parameter … (QR005) |
Look up the patternPattern A reusable way of validating (required, format, fresh and eleven more). Each rule is a pattern applied to a field with its condition. in Rule patterns. |
There is no population named … (QR004), or list, table, reference |
Declare it in the global rules, or fix its name. |
The YAMLYAML Ain't Markup Language A plain-text format, easy for people to read and write, in which rules are written. cannot be read: … (QR001) |
The file’s layout (YAMLYAML Ain't Markup Language A plain-text format, easy for people to read and write, in which rules are written., the format rulesRule It applies a pattern to a field; the pattern gives it its dimension and a default severity. The rules that count are the ones on main, the approved version. are written in) is broken where it says: an indent, a quote left open, a # inside a value. |
The rule has no alert: … (QR021), a warning |
Add an alert. A rule added with + has none until you write it. |
It checks the same as …: each failure would count twice (QR020) |
Remove one of the two. |
The condition never holds: … (QR023) |
Its when or population excludes every record: check it. |
This rule is about …: it goes in its own file, … (QR210) |
Move it to the file named. |
The file has … rules and … lines: … (QR100) |
Over 30 rules or 300 lines: move some to their fields’ files. |
Every code is listed in Lint findings.
Problems
Section titled “Problems”| What you see | What it means and what to do |
|---|---|
| No + beside the fields, and no Deploy or Save as a draft | Your policyPolicy A set of permissions an administrator gives an account or a group. The product ships ready-made ones for the usual roles, such as quality-steward and quality-viewer. lets you read the rulesRule It applies a pattern to a field; the pattern gives it its dimension and a default severity. The rules that count are the ones on main, the approved version., not change them. |
| Deploy greyed, Fix the errors to save. | An error is in Problems: fix it. |
| Fix the errors to test. | The same, before a test. |
| This dataset has no cut extracted yet: extract one in Cuts to test. | Run a cutCut The dataset's data as it was on one date, copied into the lake so it can be measured again without touching the source. Every figure of a report refers to that moment. first (Run and schedule cuts). |
| The test stays on …queued, waiting for a worker to take it… | No workerWorker A program that runs on its own beside the application and does the heavy work: listing a source's tables, mapping a table, copying a cut and evaluating it. Mapping and cuts need at least one. is free. If it lasts, tell your administrator. |
| The file changed on main since you opened it: open it again. | Someone deployed this file meanwhile. Keep a copy of your change, reload the page, and make it again on the file as it is now. |
| EML-02 cannot be deleted from here: …, after Delete rule | The rule is not written alone in its file: open it in the editor. |
Government Data · Guide v0.8.1