CPIA Module 7, Section 2: Rule Authoring Tools and Libraries
MODULE 7: Building & Maintaining Clinical Decision Support (CDS) Rules

Section 7.2: Rule Authoring Tools and Libraries

An exploration of the informatics workbench. We’ll get hands-on with the typical user interfaces, logic libraries, and data objects used to construct rules within a modern EHR.

SECTION 7.2

Rule Authoring Tools and Libraries

Inside the Digital Workshop: From Blueprint to Build.

7.2.1 The “Why”: The Informatics Workbench

In the previous section, you learned the art of translation—deconstructing a clinical guideline into the pure, abstract logic of a pseudo-code blueprint. That blueprint is the soul of your Clinical Decision Support (CDS) rule. However, a blueprint alone cannot build a bridge. To turn that elegant logic into a functional, life-saving reality within the Electronic Health Record (EHR), you must become a master of the tools in the digital workshop. This is where the theoretical meets the tangible, and where your skill as an informaticist truly takes shape.

Every major EHR vendor (Epic, Cerner, MEDITECH, etc.) provides a suite of proprietary tools for building and managing CDS. While the specific button clicks and screen layouts may differ, the core concepts, components, and challenges are remarkably universal. This section is designed to be your guided tour of this “informatics workbench.” We will move beyond the “what” and “why” of CDS logic and dive deep into the “how.” You will learn to navigate the typical rule authoring interface, understand the structure of the underlying data libraries that feed your rules, and appreciate the critical importance of standardized terminologies.

Think of this as your transition from being an architect who designs the blueprint to being the master craftsperson who selects the right materials (data objects), uses the power tools (rule editor), and understands the building codes (terminologies) to construct the bridge precisely to specification. This practical, hands-on knowledge is what separates a clinical expert who has ideas about CDS from a pharmacy informaticist who can actually build, implement, and maintain it. It is an essential skill set for transforming your clinical expertise into a scalable, automated force for patient safety.

Retail Pharmacist Analogy: Becoming a Pharmacy System “Super User”

In your retail pharmacy, you started as a basic user of the pharmacy management system (e.g., EnterpriseRx, NexGen). You knew how to enter prescriptions, process refills, and run basic reports. Over time, however, you became a “super user.” You learned the system’s deeper capabilities.

You discovered the custom report builder. Instead of just running the canned “Top 200 Drugs” report, you learned you could combine different data objects: link the `Patient.Prescriber` object to the `Drug.NDC` object and filter by the `Fill.Date` to create a report of all controlled substances written by a specific doctor in the last 30 days. This custom report is a form of decision support.

You found the custom Drug Utilization Review (DUR) settings. You realized you could create your own local, store-level alerts. You built a rule that said: “IF `Patient.Age` is > 75 AND `New_Rx.DrugClass` is ‘Anticholinergic’, THEN display a custom warning message during verification.” This is a custom CDS rule.

The interface you used—with its drop-down menus to select data fields, text boxes to enter values, and checkboxes to link conditions—is a rule authoring tool. The list of available fields like `Patient.Age`, `Drug.NDC`, and `Prescriber.DEA_Number` is the system’s data library. Your journey from a basic user to a super user who could manipulate the system’s core logic to meet your specific clinical and operational needs is the exact same journey you are now taking as a pharmacy informaticist, but with the entire EHR as your new, more powerful system.

7.2.2 The Anatomy of a Rule Editor User Interface (UI)

The rule editor is your primary workbench. It is a graphical user interface (GUI) designed to allow clinicians with informatics training to build complex logic without needing to be expert software programmers. While layouts vary, they almost all contain the same fundamental components. We will construct a conceptual model of a typical rule editor to familiarize you with the landscape.

Conceptual EHR Rule Editor Interface

1. Rule Metadata
2. Logic Builder
IF (Trigger) New Medication Order is Signed
AND

Order.Medication IN ValueSet(‘Fluoroquinolones’)

AND Patient.Calculated_CrCl < 50

AND NOT Patient.Status IN (‘On Dialysis’)

3. Action Configuration
THEN

Action Type: Interruptive Alert

Alert Text: “Patient CrCl is [Patient.CrCl]. Consider renal dose adjustment.”

Suggested Order: Button -> “Change to 500 mg Q48H”

Let’s dissect each of these conceptual components in detail.

1. Rule Metadata: The Rule’s Identity Card

This is the administrative heart of the rule. Neglecting metadata is a common novice mistake that leads to unmanageable and dangerous CDS libraries down the road. Every rule must have a clear, well-documented identity.

  • Rule Naming Convention: This is critical for organization. A good convention includes the responsible service, the clinical domain, and the specific subject. For example, `[PHA] Renal Dosing – Fluoroquinolones` is infinitely better than `FQ_alert`. The `[PHA]` prefix allows the entire informatics team to know at a glance that this rule is owned and maintained by the pharmacy department.
  • Description: This field should contain a concise summary of the rule’s purpose, the guideline it’s based on, and its intended effect. It should be clear enough that a new team member could read it and understand the rule’s function without having to dissect the logic.
  • Status (Active, Test, Inactive): This controls the rule’s state in the system. Rules are built in a “Test” status, where they can be validated against test patients. Only after successful validation and approval is the status changed to “Active” to be deployed in the live production environment. “Inactive” is used to retire a rule without deleting it, preserving its history.
  • Governance Link: This is a non-negotiable best practice. This field should contain a direct link or reference to the official P&T, Antimicrobial Stewardship, or other committee meeting minutes where the rule’s logic and implementation were approved. This creates an audit trail and anchors the technical build to a clinical decision.
2. The Logic Builder: The Visual Programming Canvas

This is the interactive core of the editor where you translate your pseudo-code into a machine-readable format. Most modern systems use a visual, block-based approach.

  • Trigger Selection: This is almost always the first step. It’s typically a drop-down list of the available system events (On Order Sign, On Lab Result, etc.) that we discussed in the previous section.
  • Criteria Blocks: The editor will provide a palette of data objects (`Patient`, `Medication`, `Lab`, etc.). You will drag these objects onto the canvas. Once there, you can select specific attributes (e.g., `Patient.Age`), choose an operator from a list (e.g., `>`, `<`, `=`, `IN`), and provide a value to check against (e.g., `65`).
  • Boolean Grouping: A key feature is the ability to group criteria. You can create an “AND” block and drag multiple criteria inside it, signifying that all of them must be true. You can similarly create an “OR” block. Critically, you can nest these blocks (e.g., an “OR” block inside an “AND” block) to create highly complex and specific logic.
3. Action Configuration: Defining the Intervention

After the logic is built, you define what happens when the logic is true. This section allows you to configure the “THEN” part of your statement.

  • Action Type Selection: A radio button or drop-down list lets you choose from the available actions: Interruptive Alert, Non-Interruptive Reminder, Send Task, etc.
  • Text Editor: This is a rich text field where you compose the message that the end-user will see. A powerful feature of modern editors is the ability to embed data objects directly into the text. For example, writing “Patient’s CrCl is [Patient.Calculated_CrCl.Value] mL/min” will dynamically pull the calculated value into the alert text, making it far more informative and useful.
  • Response Options: For interruptive alerts, this is where you configure the buttons the user can click. This can range from a simple “Acknowledge” button to more advanced options like “Suggest Alternative” buttons that can modify the original order, or a required field where the user must select an override reason from a pre-defined list.

7.2.3 A Masterclass in the Data Object Library

The logic you can build is entirely dependent on the data available to you. The “data object library” is the EHR’s structured repository of patient information that your CDS rules can query. As a pharmacy informaticist, you must develop an encyclopedic knowledge of this library, including not just what data is available, but its source, its timeliness, and its potential for being inaccurate or missing. Your rules are only as smart as the data that feeds them.

We will now conduct a deep dive into the most critical data objects for pharmacy-related CDS.

The Patient Object

This object contains information inherent to the patient themselves. It is the foundation upon which most other data is linked.

Masterclass Table: The Patient Data Object
Attribute Data Type Example Value Clinical Use Case & Informatics Gotchas
Patient.Age Integer (Years) 68 Use Case: The core of all age-based dosing (pediatric, geriatric). Used in Beers Criteria alerts, pediatric weight-based dosing calculations.
Gotcha: Be aware of age at time of event. A rule checking `Patient.Age` for an order placed 3 months ago might use the patient’s current age, not their age when the order was written. Most systems have options for “Age at Encounter” vs. “Current Age.”
Patient.Weight Decimal (kg) 85.5 Use Case: Essential for weight-based dosing (e.g., vancomycin, heparin) and for CrCl calculation.
Gotcha: This is the most dangerous attribute in the EHR. Which weight is it? Documented, Stated, Ideal, Adjusted, Dry? Is it from today’s admission or from an outpatient visit 6 months ago? A robust rule must check the `Weight.Timestamp` and should only use weights documented within a recent, clinically appropriate timeframe (e.g., last 24-72 hours for inpatients). Building a rule on a stale weight can be lethal.
Patient.Allergies List of Objects [ {Substance: ‘Penicillin’, Reaction: ‘Hives’}, {Substance: ‘Codeine’, Reaction: ‘Nausea’} ] Use Case: The basis for all allergy alerts. Checks for specific substances or cross-reactivities between classes.
Gotcha: Free-text vs. coded allergies. If a user types “PCN” instead of selecting “Penicillin” from the database, the rule may not recognize it. Furthermore, a “reaction” of nausea is an intolerance, not a true allergy. Sophisticated CDS can differentiate and fire a less severe alert for intolerances vs. anaphylaxis. This requires a well-structured allergy module.
Patient.ProblemList List of Codes [‘I10’ (Hypertension), ‘E11.9’ (Type 2 DM)] Use Case: Checking for disease-drug contraindications (e.g., NSAID in heart failure) or guideline-based therapy suggestions (e.g., ACEI for DM).
Gotcha: An outdated or “messy” problem list is a common issue. A patient may have “Acute Kidney Injury” on their list from an admission two years ago. Good rules often target problems added or updated during the current encounter to ensure relevance.

The Medication Object

This is your domain. Understanding the nuances of how medications are stored and classified in the EHR is paramount.

Masterclass Table: The Medication Data Object
Attribute Data Type Example Value Clinical Use Case & Informatics Gotchas
Medication.GenericName String ‘Lisinopril’ Use Case: The most common way to identify a drug in a rule.
Gotcha: Prone to errors if your drug database (formulary) is not standardized. It’s almost always better to check against a drug class or value set than against a single string.
Medication.RxNorm Code ‘318465’ (Lisinopril 10 MG Oral Tablet) Use Case: The gold standard for medication identification. RxNorm is a national standard terminology that provides unique codes for ingredients, brand names, and specific dose forms. Using RxNorm codes makes your rules unambiguous and interoperable.
Gotcha: Requires your EHR’s formulary to be meticulously mapped to the RxNorm terminology. This is a significant undertaking but is a hallmark of a mature informatics program.
Medication.TherapeuticClass String / Code ‘ACE Inhibitors’ Use Case: Essential for building class-wide rules, such as therapeutic duplication (“Patient is already on an ACE Inhibitor”) or class-based contraindications. This is far more robust than checking for every individual ACEI by name.
Gotcha: The quality of this data depends entirely on how your pharmacy team has built and maintained your formulary database. Inconsistent classification will lead to rules failing.
Order.Dose Decimal 20 Use Case: Dose range checking (min/max dose), checking for appropriate renal/hepatic adjustments.
Gotcha: Dose without units is meaningless. The logic must always check `Order.Dose` AND `Order.Units` (e.g., ‘mg’, ‘mcg’, ‘units’). A rule looking for high-dose heparin that only checks the number and not the units is incredibly dangerous.
Order.IsActive Boolean True Use Case: Absolutely critical for therapeutic duplication rules. You need to check for other active orders in the same class, not discontinued or expired ones.
Gotcha: Defining “active” can be complex. What about a PRN order that hasn’t been given in 3 days? Or a home medication that the patient is still taking but hasn’t been officially reconciled? Rules often need to query both the active inpatient MAR and the documented medication history.
The Single Source of Truth: Why RxNorm is King

Imagine building a therapeutic duplication alert for ACE Inhibitors. You could write: `IF NewOrder IN (‘Lisinopril’, ‘Ramipril’, ‘Enalapril’, …)` and list all ten ACEIs. This is brittle. If a new ACEI comes to market, you have to find and update this rule. The superior method is to use a standardized terminology. The rule becomes `IF NewOrder.TherapeuticClass = ‘ACE Inhibitors’`. Even better is to use a nationally recognized standard like RxNorm: `IF NewOrder.RxNorm_Ingredient IN ValueSet(‘RxNorm_ACE_Inhibitors’)`. This makes your rule robust, scalable, and easy to maintain. Your job as an informaticist is to constantly push your organization towards using coded, standardized data over simple free-text strings.