20.1.10. Rule Filter (Advanced Scoping)
The Rule Filter field on the Challenge Detail (Editor) editor lets you narrow which observations count toward a challenge beyond what scope and HCP type filter already do. It is optional – leave it blank and all observations in scope are counted.
20.1.10.1. Why use it
Scopes answer who; the rule filter answers what counts. Examples of the kinds of question it can answer that scope alone cannot:
“Before-Patient and After-Patient only – ignore aseptic/body-fluid/surroundings moments.”
“RNs and LPNs only for this challenge, everyone else for the next one.”
“Pre-procedure moments only.”
20.1.10.2. Syntax
The field stores a small key=value expression. Two formats are accepted interchangeably:
Simple form (recommended):
key1=value1;key2=value2
JSON form:
{"key1":"value1","key2":"value2"}
Both parsers are lenient. Whitespace is trimmed. Unknown keys are ignored silently.
20.1.10.3. Supported keys
Key |
Value |
Effect |
|---|---|---|
|
Comma list of integers 1-5 |
Restricts observations to the named hand-hygiene moments. |
|
Comma list of integer HCP type IDs |
Restricts observations to the listed HCP types. Ignored when the challenge’s scope is already HCP Type (would be redundant). |
20.1.10.4. Examples
“Before-patient and after-patient only”:
moments=1,2
“RN (5) and LPN (6) only”:
hcptypes=5,6
“Pre-procedure moments, RNs only”:
moments=1,3;hcptypes=5
Same as JSON:
{"moments":"1,3","hcptypes":"5"}
20.1.10.5. How it’s applied
The filter is combined into the observation WHERE clause at every computation:
momentsbecomesAND (d.befpat=1 OR d.aftpat=1 OR ...)across the selected flags.hcptypesbecomesAND d.hcptype IN (5,6).
Because the filter is applied during Compute it affects every metric equally – the
observation count, compliance %, improvement delta baseline, and streak all narrow to the
filtered window.
20.1.10.6. Safety
All inputs are sanitised to integers server-side before being inlined into SQL. Any non-numeric token in the comma list is silently dropped, so stray quotes, brackets, or semicolons in the rule field cannot cause SQL injection. The worst that can happen is a rule that matches fewer observations than intended.
20.1.10.7. Limitations
This is a minimal rule engine. It deliberately does not support:
Boolean combinations beyond the implicit AND between keys.
Arithmetic (e.g. “at least 2 of the 5 moments”).
Free-form SQL.
If you need richer logic, create multiple challenges with different rules and compare the leaderboards. Richer operators are a future enhancement.