Clinical Rules Engine
Vorian Connect's Clinical Rules Engine lets labs define, test, and deploy auto-verification rules through a visual builder. Rules can reference any field in an HL7 message — OBX results, patient demographics, specimen conditions, sending application, and priority — using boolean expression trees with comparison operators. An AI-assisted generator converts natural language into draft rules, and a five-stage lifecycle with simulation and validation exports ensures every rule is proven before it touches a live result.
How It Works
The Rules Engine is the fourth and final stage of Vorian's auto-verification pipeline. After the emergency brake, physiological range check, and delta check run, the engine evaluates every enabled rule against the parsed HL7 message:
- Rules are loaded per tenant from the
rulestable, ordered by priority (highest first). Each rule has a name, a boolean condition tree, an action (auto_verify,flag, orreject), and optional clinical triggers - Clinical triggers scope the rule to specific sending applications, message types, or analytes — a rule can fire only when the message matches the trigger, avoiding unnecessary evaluation
- Source scope binds the rule to a set of instruments. Every rule is either all sources (evaluated for every active source in the tenant) or selected sources (evaluated only for its bound instruments). A selected-source rule never fires for traffic from an unbound analyzer
- First match wins. Rules are evaluated in priority order and stop on the first match. If no rule matches, the message is left as
pendingfor manual review - Every evaluation is audited. The matched rule ID, action, and a human-readable explanation are written to the message's verification notes and visible in the Trace Inspector
Rule Builder
The dashboard provides two paths for creating rules:
- Clinical Rule Wizard: A seven-step guided builder that walks through trigger scope, condition logic, action selection, review, manual test cases, validation assertions, and activation. The wizard produces rules using predefined clinical facts — source, patient, specimen, test, order, QC, delta, and routing — so the condition language stays coherent across the tenant. AI-generated rules from natural language prompts land here as disabled drafts
- Monaco JSON editor: A full code editor for power users who prefer writing rule conditions directly in JSON. The editor includes syntax highlighting, auto-completion, and a test panel that evaluates the rule against a sample HL7 message with instant match/no-match feedback
Every new rule requires an explicit source-scope choice before it can be saved — all sources or a named set of selected sources. A rule cannot be created with a blank or implied scope.
Rule Lifecycle
Every rule moves through a five-stage lifecycle that enforces safe activation:
- Draft — The rule is saved but not evaluated against live traffic. AI-generated rules always start here
- In Validation — The rule is being tested. Simulation runs against historical messages, and manual test cases are documented. A validation reason is required when entering this state
- Live — The rule is active and evaluated against every incoming message. High-risk actions (auto_verify, reject, reflex orders) require additional confirmation
- Disabled — The rule is deactivated but preserved. It can be re-enabled with a change reason
- Retired — The rule is permanently archived. Its history is preserved for audit but it cannot be reactivated
Versioning is live-pointer based. Each rule pins a live version, and evaluation always runs against that pinned version so a given message produces the same disposition every time. Editing a rule creates an unpromoted draft; promoting the draft advances the live pointer and pins that version for evaluation. Equal-priority rules evaluate in a deterministic order (priority, then rule identity), and every firing records the rule version, action, and contributed disposition for validation evidence.
Rules created before source scoping shipped retain their prior tenant-wide behavior as all sources, but are marked unreviewed until a manager confirms the scope is intentional. Unreviewed rules surface in a source-scope review queue, where a manager can mark the scope reviewed or narrow the rule to selected sources.
Rule Simulation
Before a rule goes live, the simulation engine validates it against real data:
- Historical message replay: The rule is evaluated against a sample of recent messages from the tenant's own traffic, respecting source scopes so source-limited users only test against instruments they can see
- Manual test cases: Operators define explicit HL7 snippets with expected match/no-match outcomes. Up to 20 cases per simulation run, each with a maximum 240-character description
- Assertion summary: The simulation reports total messages tested, matched count, and per-action breakdown (auto_verified, flagged, rejected). Failed assertions are flagged with the specific HL7 field that caused the mismatch
- Validation export: Simulation results can be exported as structured evidence for CAP/CLIA validation binders, including rule inventory, simulation run metadata, and a pass/fail summary
AI-Assisted Rule Generation
Operators can describe a rule in plain language — for example, "flag potassium results above 6.0 mmol/L from the main chemistry line" — and the AI generator produces a structured rule proposal:
- The natural language prompt is sent to a configured AI service with a laboratory-specific system prompt that understands HL7 field paths, comparison operators, and clinical context
- Generated rules are always saved as disabled drafts — the AI output cannot be activated directly. A human must review, test, simulate, and approve before the rule reaches live status
- Prompts are capped at 4,000 characters. Generation times out after 30 seconds and returns operator-safe fallback guidance if the AI service is unavailable
Supported Conditions
Rules can reference any of these HL7 field paths:
- OBX results:
OBX.<code>.value,.flag,.status,.units,.instrument_id— the numeric result, abnormal flag, status, units, and instrument identity for any analyte by test code - MSH metadata:
MSH.sending_app,MSH.message_type— the sending instrument and HL7 message type - PID demographics:
PID.age_years,PID.sex— calculated patient age and biological sex - PV1 visit data:
PV1.location.facility,PV1.location.ward— patient facility and ward - SPM specimen:
SPM.specimen_type,SPM.specimen_fluid_type,SPM.specimen_condition— specimen type, fluid, and normalized condition (hemolyzed, icteric, lipemic, clotted, short sample) - OBR order:
OBR.priority— order priority when present
Supported operators: = (equality), !=, >, >=, <, <=, between (inclusive range), in (set membership). Conditions combine with and, or, and not to arbitrary depth.
Where It Fits
The Rules Engine runs in the cloud gateway as part of the auto-verification pipeline, after the HL7 message is parsed and persisted. It is not on the critical path for instrument ACKs — the instrument receives its ACK from the edge agent before the message reaches the gateway. Rule evaluation performance never impacts instrument throughput.
Rule results flow into the delivery subsystem: destinations can filter by verification status, routing only auto-verified results to the LIS while holding flagged results for operator review in the Worklist. Rule-fired notes appear in the Worklist and Trace Inspector with PHI-safe prefixes (rule auto_verify, rule flagged, rule rejected) — observed values are hidden until the operator opens an audited PHI troubleshooting surface.
Permissions
- rules:view — Read access to the rules list, versions, and simulation results. Required to see the Rules page
- rules:manage — Create, edit, clone, enable, disable, and retire rules. Required to promote a rule through the lifecycle
- message:phi:view — Required to see observed values in rule-fired notes (PHI Troubleshooter role)