Getting started
EDS-NLP provides a set of spaCy components that are used to extract information from clinical notes written in French.
If it's your first time with spaCy, we recommend you familiarise yourself with some of their key concepts by looking at the "spaCy 101" page.
Quick start
Installation
You can install EDS-NLP via pip
:
We recommend pinning the library version in your projects, or use a strict package manager like Poetry.
pip install edsnlp==0.6.0
A first pipeline
Once you've installed the library, let's begin with a very simple example that extracts mentions of COVID19 in a text, and detects whether they are negated.
import spacy
nlp = spacy.blank("fr") # (1)
terms = dict(
covid=["covid", "coronavirus"], # (2)
)
# Sentencizer component, needed for negation detection
nlp.add_pipe("eds.sentences") # (3)
# Matcher component
nlp.add_pipe("eds.matcher", config=dict(terms=terms)) # (4)
# Negation detection
nlp.add_pipe("eds.negation")
# Process your text in one call !
doc = nlp("Le patient est atteint de covid")
doc.ents # (5)
# Out: (covid,)
doc.ents[0]._.negation # (6)
# Out: False
- We only need spaCy's French tokenizer.
- This example terminology provides a very simple, and by no means exhaustive, list of synonyms for COVID19.
- In spaCy, pipelines are added via the
nlp.add_pipe
method. EDS-NLP pipelines are automatically discovered by spaCy. - See the matching tutorial for mode details.
- spaCy stores extracted entities in the
Doc.ents
attribute. - The
eds.negation
pipeline has added anegation
custom attribute.
This example is complete, it should run as-is. Check out the spaCy 101 page if you're not familiar with spaCy.
Available pipeline components
Pipeline | Description |
---|---|
eds.normalizer |
Non-destructive input text normalisation |
eds.sentences |
Better sentence boundary detection |
eds.matcher |
A simple yet powerful entity extractor |
eds.terminology |
A simple yet powerful terminology matcher |
eds.advanced-matcher |
A conditional entity extractor |
eds.endlines |
An unsupervised model to classify each end line |
Pipeline | Description |
---|---|
eds.negation |
Rule-based negation detection |
eds.family |
Rule-based family context detection |
eds.hypothesis |
Rule-based speculation detection |
eds.reported_speech |
Rule-based reported speech detection |
eds.history |
Rule-based medical history detection |
Pipeline | Description |
---|---|
eds.dates |
Date extraction and normalisation |
eds.measurements |
Measure extraction and normalisation |
eds.sections |
Section detection |
eds.reason |
Rule-based hospitalisation reason detection |
Pipeline | Description |
---|---|
eds.covid |
A COVID mentions detector |
eds.charlson |
A Charlson score extractor |
eds.sofa |
A SOFA score extractor |
eds.emergency.priority |
A priority score extractor |
eds.emergency.ccmu |
A CCMU score extractor |
eds.emergency.gemsa |
A GEMSA score extractor |
eds.TNM |
A TNM score extractor |
eds.cim10 |
A CIM10 terminology matcher |
eds.drugs |
A Drug mentions extractor |
Disclaimer
The performances of an extraction pipeline may depend on the population and documents that are considered.
Contributing to EDS-NLP
We welcome contributions ! Fork the project and propose a pull request. Take a look at the dedicated page for detail.
Citation
If you use EDS-NLP, please cite us as below.
@misc{edsnlp,
author = {Dura, Basile and Wajsburt, Perceval and Petit-Jean, Thomas and Cohen, Ariel and Jean, Charline and Bey, Romain},
doi = {10.5281/zenodo.6424993},
title = {EDS-NLP: efficient information extraction from French clinical notes},
url = {http://aphp.github.io/edsnlp}
}