Clinical NLP that knows pneumonia isn't always pneumonia
A spaCy toolkit for medical text that handles negation, uncertainty, and section headers without training a new model from scratch.

What it does
medSpaCy wraps spaCy with clinical-specific pipeline components: sentence splitting tuned for medical text, rule-based concept extraction, section detection (“Past Medical History” vs “Assessment”), and post-processing filters. It also bundles a fork of QuickUMLS for mapping extracted terms to UMLS concepts. Everything plugs into spaCy’s standard nlp.pipe() workflow.
The interesting bit
The standout is the context module, which implements the ConText algorithm to detect semantic modifiers. It can flag that “no evidence of pneumonia” negates the diagnosis, or that “possible diabetes” marks uncertainty — all with hand-curated rules rather than black-box classification. This is the kind of boring-but-critical logic that determines whether an NLP pipeline is clinically usable or dangerously misleading.
Key highlights
- Modular pipeline components that can be mixed, matched, or used standalone
- ConText-based negation and uncertainty detection via rule matching
- Section detection to scope clinical reasoning to relevant document regions
- QuickUMLS integration for concept normalization against the UMLS metathesaurus
- Multi-language structure exists, but rule coverage varies wildly: English is complete, French and Dutch have partial ConText rules, most others are essentially empty shells
Caveats
- Still in beta after several years; pre-trained clinical models are listed as future work
- Non-English support is largely aspirational — the README explicitly warns that several languages have zero rules
- Python 3.6 and 3.7 support was recently dropped, though spaCy 3.8.2 is now supported
Verdict
Worth a look if you’re building rule-based clinical NLP and need negation detection or section parsing without retraining spaCy models. Skip it if you need mature multilingual support or production-grade stability — the beta label and uneven language coverage are real constraints.
Frequently asked
- What is medspacy/medspacy?
- A spaCy toolkit for medical text that handles negation, uncertainty, and section headers without training a new model from scratch.
- Is medspacy open source?
- Yes — medspacy/medspacy is open source, released under the MIT license.
- What language is medspacy written in?
- medspacy/medspacy is primarily written in Jupyter Notebook.
- How popular is medspacy?
- medspacy/medspacy has 670 stars on GitHub.
- Where can I find medspacy?
- medspacy/medspacy is on GitHub at https://github.com/medspacy/medspacy.