Documentation / Profiler

Quality rules

Built-in rules, custom rules and the failure matrix.

Quality rules
Quality rules
  1. Tabs – Profile, Custom, Built-in and Failing rules.
  2. Create a custom rule – Form to define a rule (see the topic for examples).

The page has four tabs: Profile (create rules from a FHIR® profile), Custom (your own rules and the rules created from profiles), Built-in (the shipped rules) and Failing (the failing rules by resource type).

Custom rules: create, filter, see their profile

The Custom tab holds the form for a new rule and the table of custom rules. The column Profile names the profile a rule was created from (hover for its address and the element it comes from); rules you made yourself show a dash. The table can be filtered by resource type and by profile (the profile filter appears when at least one rule has a profile; No profile shows the manual rules). Rules stay linked to their profile by address and version, and the number of rules per profile is shown in Administration → Profiles.

Create a custom rule

Type
Resource type the rule applies to.
Element path
Path like name[].family; suggestions come from the profile.
Check
Element is present, Element is absent (not allowed), Element is present when parent is present (the element, for example address[].city, must exist in every occurrence of its parent address[]; resources without the parent are not applicable), Every value is one of a ValueSet (parameter: the ValueSet, chosen from a pulldown of the ValueSets that are stored in the vault; the codes are read from the ValueSet and its code systems in the vault each time the rule runs), Extension with a given URL is present (path of the element that holds the extensions, e.g. extension; parameter: the extension URL), Every value matches a regular expression, Every numeric value is within a range, Every value is one of a list, Every text value has a length within limits, Every date is not in the future, Value is unique across resources.
Parameter fields
Appear according to the check: pattern, min / max, list separated by commas, min / max length.
Rule name
Shown in results.
Dimension
completeness, validity, consistency, uniqueness, integrity, timeliness.
Severity
low, medium, high.
Description
Free text.
ExamplePostal code pattern

Type Patient · element address[].postalCode · check matches a regular expression · pattern ^[0-9]{4} ?[A-Z]{2}$ · name Dutch postal code · dimension validity · severity medium.

ExampleAllowed status values

Type Encounter · element status · is one of a list · planned,in-progress,finished,cancelled.

ExamplePlausible heart rate

Type Observation · element valueQuantity.value · within a range · min 20 max 250.

ExampleOne record per national number

Type Patient · element identifier[].value · is unique across resources.

Rules apply the next time a type is profiled. Values are checked for every occurrence; resources lacking the element are not applicable, except for present.

Create rules from a FHIR profile (Profile tab)

The Profile tab lists the uploaded profiles (name, resource type, version, who uploaded it and when, and how many rules were created from it) with a Preview rules button. Profiles you upload or fetch here are added to that list and kept, so you can come back to them later; they can be deleted in Administration → Profiles. When the list is long, the filter stays as you typed it while you preview a profile.

Rules from a FHIR profile
Rules from a FHIR profile
  1. Upload – Choose a StructureDefinition, or a Bundle with its value sets (JSON).
  2. Simplifier – Fetch the profiles of the configured simplifier.net package (hl7.fhir.eu.base-r5).
  3. Preview rules – Shows the rules this profile would create.

Instead of typing rules one by one, you can read them from a FHIR profile (a StructureDefinition, for example from a national implementation guide). The section Create rules from a FHIR profile at the bottom of this page needs the permission profiler:rules.manage.

  1. Load the profile. Upload profile… takes JSON files: one StructureDefinition, or a Bundle, or several files that also hold the ValueSets and CodeSystems it uses. Select from simplifier.net… offers one fixed package, by default hl7.fhir.eu.base-r5 2.0.1 (the European R5 base profiles), not the whole of simplifier.net. Fetch profiles and artifacts downloads that package with its value sets and code systems and lists its profiles. An administrator can change the package with the setting SIMPLIFIER_PACKAGE (name#version).
  2. Choose the profile from the list of uploaded profiles and press Preview rules (a single new profile is previewed at once).
  3. Review the preview. Every rule is shown with element, check, parameters, severity, the reason (which constraint it comes from) and a status.
  4. Select and create. Tick the rules you want (Select all new, Select none) and press Create. The rules appear under Custom rules with the flag profile and are used the next time the type is profiled; the Viewer tab Profiler of a resource uses them at once.
Preview of the rules a profile creates
Preview of the rules a profile creates
  1. Select – Tick the rules to create; untick the ones you do not want.
  2. Override – A conflicting rule is kept unless you tick this.
  3. Create – Creates all selected rules.

What becomes a rule

In the profileRule
Cardinality min ≥ 1Element is present when all parent elements are mandatory too; when a parent is optional, Element is present when parent is present, so optional structures do not produce false failures
Cardinality max = 0Element is absent
maxLengthLength within limits
minValue / maxValueWithin a range
Fixed value of a primitive type (code, string, number, boolean); fixed or pattern Coding: its codeIs one of a list with that single value
Required binding to a value setIs one of a list with the codes of the value set (only if the value set is in the loaded artifacts and its codes can be listed)
Required extension (a slice with min ≥ 1 of type Extension with a profile URL)Extension with a given URL is present
Regular expression in the regex extension of the element typeMatches a regular expression

What is not converted

Listed under constraints not converted with the reason: FHIRPath invariants, other pattern[x] values, slicing, choice elements with several types, extensible/preferred bindings, value sets that need a terminology server (filters, exclusions, external code systems) and everything else the Profiler cannot evaluate. By default only constraints the profile itself adds are shown; tick include constraints inherited from the base resource to also see those of the base definition. Codes are compared without their code system.

Value sets and extensions that are not loaded

A required binding can only become a rule when the codes of the value set are known, and a required extension needs its definition. When they are not part of the loaded artifacts, the constraint is listed under constraints not converted with a button next to it: Load value set from hl7.org or Load extension from hl7.org. The button downloads the artifact from hl7.org (for value sets also the code systems and value sets it refers to), and the preview is rebuilt. A downloaded ValueSet (and the CodeSystems it needs) is also stored in the vault as an ordinary FHIR resource (server hl7.org, record source profiler:hl7.org), so you can browse it in the Viewer; this needs access to the resource types ValueSet and CodeSystem, otherwise the message next to the button says that it was not stored. The next time a profile needs a value set or code system that is already in the vault, the Profiler uses that copy and does not download it again (the preview says so): the new rule appears in the list, selected, and your other selections are kept. If the value set still cannot be expanded (it is defined by filters, or its codes come from a code system such as SNOMED CT® or LOINC® that needs a terminology server), the constraint stays in the list with the new reason. The buttons appear only for artifacts whose canonical URL is on hl7.org/fhir or terminology.hl7.org; the Suite contacts no other site, and only when you press the button.

Conflicts and override

A rule conflicts when a custom rule already exists for the same type, element and kind (or with the same id, which happens when you import the same profile again). Conflicting rules are not selected by default; the status says whether the existing rule is identical or how it differs. Tick Override existing rule to replace it. Nothing is changed before you press Create.

ExampleCheck a national profile

Fetch the package, choose the Patient profile, untick the rules you consider too strict, press Create. Then open A resource: Profiler on a Patient to see which rules it fails.

The Simplifier connection needs outbound access to packages.simplifier.net (or the server in SIMPLIFIER_PACKAGES_URL). Without it, upload the files instead.

Built-in rules (Built-in tab)

The list of built-in rules can be filtered by resource type (the selection shows the rules that apply to that type, including the rules for all types) and every rule has a checkbox in the column On to disable or enable it. A disabled rule is greyed out, is no longer evaluated when a type is profiled and does not appear in the quality score or on the Profiler tab of a resource in the Viewer; results that were calculated earlier stay until the type is profiled again. The choice is stored in the database and applies to all users; changing it needs the permission profiler:rules.manage.

ExampleA rule for the ValueSet of the vault

Load the ValueSet AdministrativeGender from hl7.org (see above) so that it is in the vault. Then create a rule: type Patient · element gender · Every value is one of a ValueSet · ValueSet AdministrativeGender. If the ValueSet cannot be expanded (it is not in the vault any more, or it is defined by filters) the rule shows an error instead of a result.

Tables

Custom rules can be deleted. Built-in rules lists the shipped rules (61, of which 17 are present when parent is present rules such as address.city when address exists, identifier.value when identifier exists, or code.coding.system when coding exists) with dimension, severity and applicable types. Failing rules by resource type is a matrix: rows are types, columns are rules that fail somewhere, cells show the failed count.