Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
In unstructured Electronic Health Record (EHR) progress notes, discharge summaries, and radiology reports, the majority of mentioned medical conditions are pertinent negatives—documented explicitly to record what a patient does not have (for example, ”Patient denies chest pain, dyspnea, or orthopnea; chest radiograph shows no pneumothorax or pleural effusion”). A naive clinical natural language processing (cNLP) pipeline that performs dictionary matching without assertion classification will falsely label that patient with five acute cardiopulmonary conditions. The NegEx algorithm (Chapman et al., 2001) and its direct successors—ConText (Harkema et al., 2009) and NegBio (Peng et al., 2018)—form the algorithmic foundation for negation detection in clinical notes.
Ask CASRAI · free to tryQuestion about this guide? Ask CASRAI answers with linked sources. 2 free questions a day, no account.
How Does the Chapman et al. (2001) NegEx Algorithm Detect Negated Clinical Findings?
Published by Wendy W. Chapman and colleagues in the Journal of Biomedical Informatics (2001), NegEx is a fast, deterministic regular-expression and token-window algorithm designed to determine whether a UMLS clinical concept indexed inside a sentence is Affirmed or Negated. NegEx operates by scanning the sentence for four curated lexical trigger classes around each target clinical entity:
| NegEx Trigger Tag | Direction & Scope Window | Representative Trigger Phrases | Clinical Sentence Trace Example |
|---|---|---|---|
[PREN] (Pre-Negation Trigger) |
Scans forward (left-to-right) up to 5–6 tokens after the trigger (or until a termination token). | no, denies, denied, without, absence of, negative for, ruled out, free of |
”Patient [PREN: denies] any chest pain, palpitations, or syncope.” → All 3 underlined concepts are marked Negated. |
[POST] (Post-Negation Trigger) |
Scans backward (right-to-left) up to 5–6 tokens preceding the trigger. | was ruled out, is unlikely, not demonstrated, never developed, absent |
”Pulmonary embolism [POST: was ruled out] by CT angiography.” → Pulmonary embolism is marked Negated. |
[PSEU] (Pseudo-Negation Trigger) |
Overrides and blocks a matching `[PREN]` substring from initiating a negation scope. | no increase, no change, no suspicious change, not rule out, not only, gram negative |
”Chest CT shows [PSEU: no change] in the pulmonary nodule.” → Pulmonary nodule remains Affirmed (still present). |
[CONJ] (Termination / Conjunction Token) |
Immediately terminates an active forward `[PREN]` or backward `[POST]` negation scope before the 6-token window expires. | but, however, except, aside from, although, secondary to, cause of |
”[PREN: No] fever or chills, [CONJ: but] reports severe pleuritic pain.” → Fever and chills are Negated; scope stops at but, leaving pleuritic pain Affirmed. |
How Does the ConText Algorithm Extend NegEx to Temporality and Experiencer (Family History)?
Even when a clinical condition in an EHR note is not negated, it may still not represent an active diagnosis in the patient—for instance, a resolved childhood surgery or a malignancy in a first-degree relative. To solve this for EHR phenotyping, Henk Harkema, Wendy Chapman, and colleagues (JBI, 2009) generalized NegEx’s trigger-and-termination architecture into the ConText clinical NLP algorithm, which evaluates three orthogonal contextual dimensions simultaneously:
- Negation Status (
Affirmedvs.Negated): Preserves NegEx’s forward, backward, pseudo-negation, and termination trigger rules. - Temporality Status (
Recentvs.Historicalvs.Hypothetical):- Historical Triggers: Phrases such as
history of,h/o,status post,s/p,in 2018, orpreviously hadshift the concept’s temporality from `Recent` to `Historical` (terminated by tokens like `now presenting with` or `currently`). - Hypothetical / Conditional Triggers: Phrases used in return-precaution instructions or differential plans—such as
if you develop,return to ED for,at risk for,prophylaxis against, orrule out—mark the concept as `Hypothetical` so discharge instructions (”Return to the emergency room if you experience shortness of breath or stroke symptoms”) are never coded as active events.
- Historical Triggers: Phrases such as
- Experiencer Status (
Patientvs.Other): Family history triggers—such asmother,father,sister,brother,family history of, orFH:—assign `Experiencer = Other` across the clause scope, preventing a relative’s condition from polluting the patient’s active problem list.
Today, the ConText algorithm is the default assertion engine inside Python’s medspaCy (`medspacy_context`) and Java’s Apache cTAKES.
How Does NegBio Use Universal Dependency Graphs to Improve Negation and Uncertainty Extraction?
While surface token-window algorithms (NegEx and ConText) perform well on short, simple clinical clauses, they break down on complex syntactic constructions common in radiology and pathology reports—such as long prepositional modifiers or coordinate noun phrases that exceed a fixed 6-word window. To overcome this limitation while building the NIH ChestX-ray14 and MIMIC-CXR benchmarks, Yifan Peng, Zhiyong Lu, and colleagues at the National Center for Biotechnology Information (NCBI) developed NegBio (AMIA, 2018):
- Replacing Fixed Word Windows with Universal Dependencies (UD) Graph Traversal: Instead of counting surface words to the right of a trigger, NegBio parses each sentence into a syntactic Universal Dependencies directed graph (where nodes are words/lemmas with part-of-speech tags and directed edges represent grammatical relations such as `conj:or`, `amod`, `nmod`, `nsubj`, and `advmod`).
- Subgraph Pattern Matching (`Semgrex`-Style Rules): NegBio defines declarative graph patterns over the dependency tree. For example, in the radiology sentence ”The lungs are clear of focal consolidation, pleural effusion, or pneumothorax”, the word
pneumothoraxis 9 words away fromclear of(beyond a 5-word window), yet in the Universal Dependencies graph it is directly connected toconsolidationvia a `conj:or` dependency edge. Conversely, in ”No pneumothorax is seen; small bilateral pleural effusions are present”, the dependency tree isolatesNoto the first independent clause’s subgraph without leaking across the semicolon. - Empirical Precision and F1 Gains in Radiology NLP (CheXpert & NegBio): Evaluated across multiple clinical radiology corpora (BioScope, Indiana University Chest X-Rays, and NIH ChestX-ray14), NegBio’s dependency-graph rules improved negation and uncertainty F1 scores by 5.1% to 9.5% over standard NegEx, and inspired the rule architecture of Stanford’s CheXpert labeler (`No Finding`, `Positive`, `Negative`, `Uncertain`).
Frequently Asked Questions
How does the Chapman et al. (2001) NegEx algorithm detect negated clinical findings?
The NegEx algorithm scans sentences around extracted UMLS medical concepts using four regular-expression trigger lists: pre-negation triggers ([PREN] like ”denies” or ”no”) that negate concepts up to 5–6 tokens forward, post-negation triggers ([POST] like ”was ruled out”) that negate concepts backward, pseudo-negation triggers ([PSEU] like ”no change” or ”gram negative”) that block false negation, and conjunction/termination tokens ([CONJ] like ”but”, ”however”, or ”except”) that immediately halt the active negation window.
How does the ConText algorithm extend NegEx to temporality and experiencer (family history)?
Developed by Harkema et al. (2009), ConText generalizes NegEx’s trigger-and-termination architecture across three clinical dimensions: Negation (`Affirmed` vs. `Negated`), Temporality (`Recent`, `Historical` triggered by ”history of” or ”status post”, and `Hypothetical` triggered by ”if you develop” or ”rule out”), and Experiencer (`Patient` vs. `Other` triggered by family terms like ”mother”, ”father”, or ”family history”).
How does NegBio use universal dependency graphs to improve negation and uncertainty extraction?
Developed at NIH NCBI by Peng et al. (2018), NegBio replaces NegEx’s fixed surface-word window with syntactic parsing using Universal Dependencies (UD) graphs. By matching `Semgrex`-style subgraph rules along grammatical dependency edges (such as `conj:or` and `nmod`), NegBio accurately propagates negation and uncertainty across long coordinate lists while preventing false-positive negation leakage across subordinate clauses.







