---
title: "Drools: Open Source rule engine and applications in clinical decision support"
description: "Drools 4.0 (July 2007), the move under JBoss/Red Hat, Mark Proctor's Rete-OO algorithm, DRL and DSL. The role as a general-purpose rule engine reusable for CDS systems in healthcare."
url: "https://www.noze.it/en/insights/drools-clinical-rules/"
lang: "en"
alternate: "https://www.noze.it/insights/drools-regole-clinica/"
published: "2007-09-25"
author: "noze S.r.l."
keywords: "Digital Health, R&D, Open Source, Drools, JBoss, Rule Engine, Rete, CDS, Clinical Decision Support"
---

# Drools: Open Source rule engine and applications in clinical decision support

Drools 4.0 (July 2007), the move under JBoss/Red Hat, Mark Proctor's Rete-OO algorithm, DRL and DSL. The role as a general-purpose rule engine reusable for CDS systems in healthcare.

25 September 2007

## A _general-purpose_ rule engine

Work on languages and rule engines born inside the healthcare domain — **Arden Syntax**, **GELLO**, GLIF, PROforma, Asbru — has produced technically ambitious specifications but with operational uptake limited by ecosystem factors: fragmented runtimes, difficult authoring, non-trivial integration with record systems. In parallel, the general IT industry has developed domain-agnostic rule engines with a much wider user base and mature tooling.

The most widespread in the Open Source world is **Drools** — Java project started in **2001** by **Bob McWhirter** and later absorbed by the **JBoss** community in **2005** (with the temporary branding _JBoss Rules_). With Red Hat’s acquisition of **JBoss** in 2006, Drools officially enters the enterprise Open Source offering of a top-tier vendor.

## Drools 4

**Drools 4.0**, released in **July 2007** and still stable in the 4.0.x series, is the project’s biggest evolutionary leap since inception. The new features:

- **Rete-OO** — rewrite of the Rete algorithm (Forgy, 1974) with _object-oriented_ adaptation, developed by **Mark Proctor** (current project lead). Preserves sub-linear average complexity with respect to the number of facts, with efficiency improvements on common patterns
- **DRL** (_Drools Rule Language_) — declarative language for rules, with more readable syntax than version 3
- **DSL** (_Domain Specific Language_) — mechanism to define domain-specific declarative languages on top of DRL, writable by business analysts (or by clinicians, in the healthcare domain)
- **Decision Tables** — tabular representation of rule families in Excel or OpenDocument, useful to model decision matrices
- **Drools Flow** — _ruleflow_ workflow engine describing sequences of rule invocations as processes
- **Drools Solver** — constraint optimisation problem solver, an extension that will become an independent sub-project in coming years
- **Drools Guvnor** — web-based rule repository, _business rules management system_ (BRMS) for artefact lifecycle

The licence is **Apache 2.0**. The code is hosted in the JBoss public repository.

## The rule model

A Drools rule in DRL has the form:

```
rule "Warfarin and aspirin interaction"
    when
        $patient : Patient()
        $warfarin : ActiveMedication(drug == "warfarin", patient == $patient)
        $aspirin  : ActiveMedication(drug == "aspirin",  patient == $patient)
    then
        insert(new Alert(
            $patient,
            "Interaction: warfarin + aspirin — bleeding risk",
            AlertLevel.HIGH
        ));
end
```

The **when** block (also called _LHS_, Left-Hand Side) is a sequence of patterns the engine tries to _match_ against the _working memory_ — the set of facts injected by the calling application. The **then** block (_RHS_) executes actions — create new facts, modify existing ones, call external services.

The **Rete** algorithm implemented by Drools builds a discrimination network across rule conditions, in which facts are propagated and filtered incrementally: adding or removing a fact does not require re-evaluating every rule from scratch, only the affected part of the network. This incrementality is what makes Rete suited to scenarios with many rules and frequent working-memory updates — the case of an active clinical record.

## Why it matters to healthcare

Drools is not designed for healthcare. But the combination of its characteristics makes it attractive for CDS scenarios:

- **Performance** — Rete-OO handles thousands of rules over working memories of tens of thousands of facts with sub-second response times
- **Open licence** — Apache 2.0 allows any use, including embedding in products certified as medical devices (with the qualification work that entails)
- **Enterprise ecosystem** — natural integration with Java stacks (JBoss AS, Spring), JTA transactional support, execution in J2EE containers
- **DSL** — ability to build domain-specific declarative languages for clinicians, with syntax readable by non-programmers
- **Authoring tools** — Drools Guvnor, Eclipse plugin, while Arden MLM authoring remains mostly textual editors

Some concrete adoption directions:

- **Clinical trial eligibility** — rules on inclusion/exclusion criteria expressed as Drools rules, with automatic evaluation at enrolment
- **Drug-drug interaction** — interaction databases expressed as rules, with matching at prescription time
- **Order set appropriateness** — verification of the appropriateness of a clinical order set against a primary diagnosis
- **Preventive reminders** — temporal rules on screenings, vaccinations, follow-ups
- **Pathway compliance** — monitoring of adherence to diagnostic-therapeutic pathways for chronic conditions (diabetes, hypertension, heart failure)

Some academic projects — NHS in the UK, Veterans Affairs in the US, European e-Health groups — are experimenting with Drools as an **execution engine** for clinical guidelines encoded in more abstract models (GLIF, PROforma); in these cases Drools does not replace Arden/GELLO but is the engine that runs them.

## The data binding issue

The recurring CDS question — how the rule engine accesses patient data — resurfaces with Drools. Unlike Arden (which prescribes a specific `data` slot), Drools is entirely agnostic: facts in working memory are plain Java objects (_POJOs_), which the calling application must populate from clinical sources.

Patterns used in experimental projects include:

- **HL7 vMR virtual model** (_virtual Medical Record_) — standard Java objects representing patient demographics, active medications, diagnoses, lab results. The adapter populates the vMR from the record
- **Record database binding** via JPA/Hibernate — record entities directly become Drools facts
- **FHIR as intermediate format** — here the medical informatics world starts looking at HL7’s early discussions of a new standard oriented to resources and REST APIs, under incubation in international working groups

The problem is technically solvable but requires a coherent architecture — which cannot be delegated entirely to the rule engine.

## Commercialisation and support

Red Hat offers **JBoss BRMS** (Business Rule Management System) as a commercial product, with support subscriptions on top of Open Source Drools. The model is the typical Red Hat one: identical code to the open version, plus certifications, QA, patch backports, phone and on-site support. For clients with enterprise production needs (large hospitals, pharmaceutical companies with regulatory applications) this model provides a stability anchor that the pure Open Source version may not offer.

## Italian adoption

In Italy, in 2007, Drools is known in enterprise Java contexts — banks, telco, public administration — but its uptake in healthcare is still exploratory. Some research groups (Universities of Pavia, Milan, Pisa, Messina) explore Drools for experimental CDS projects. Integration with Italian commercial clinical records is a non-trivial topic — requires custom adapters — and the record vendor business model does not always incentivise such integration.

From the public administration perspective, the Red Hat/JBoss model with enterprise support is already present in tenders for application stacks; extending it to healthcare CDS scenarios is a plausible but not yet activated trajectory.

## Alternatives

Drools is not the only rule engine available:

- **Jess** — Sandia National Labs, Rete algorithm in Java, historically academic. No longer under intensive active development
- **IBM ILOG JRules** — commercial, de facto standard in banking-insurance
- **OpenRules** — commercial Decision Table engine with a reduced free version
- **Prova** — reactive rule engine with event support, academic
- **ClassicJade** — CLIPS-derived expert systems

In the Open Source ecosystem, Drools is the dominant JVM choice. For other languages, the ecosystem is fragmented (NRules for .NET, pyke/rete-py for Python, various Ruby DSLs).

## Outlook

Drools development directions in the coming years will include:

- **Complex Event Processing** (CEP) — handling of temporal event streams, with operators over sliding windows. Extremely relevant in clinical contexts (vital sign time series, continuous monitoring)
- **Integration with BPMN 2.0** — the new _business process modelling_ standard published by OMG in 2007 — via jBPM
- **Expansion of Drools Guvnor** towards a full BRMS with versioning, approval flows, release policies
- **Integration with standardised data models** — HL7 vMR, prospectively the models that will emerge from HL7’s new post-CDA discussions

Drools’ role in healthcare in coming years will be determined by: availability of shared clinical rule libraries (the good most lacking in the CDS ecosystem); maturity of adapters to real clinical records; emergence of a truly adopted exchange standard for communication between record and external CDS service. Drools is technically ready; the other pieces are starting to move.

---

_References: Drools 4.0 (July 2007), JBoss Rules / Red Hat ([www.jboss.org/drools](http://www.jboss.org/drools)). Rete algorithm (Charles Forgy, 1974). Rete-OO (Mark Proctor). Apache 2.0 licence. HL7 vMR — virtual Medical Record. OMG BPMN 2.0 (2007)._
