Alcohol consumption
The eds.alcohol
pipeline component extracts mentions of alcohol consumption. It won't match occasional consumption, nor acute intoxication.
Details of the used patterns
# fmt: off
default_patterns = dict(
source="alcohol",
regex=[
r"\balco[ol]",
r"\bethyl",
r"(?<!(25.?)|(sevrage)).?\boh\b",
r"exogenose",
r"delirium.tremens",
],
exclude=[
dict(
regex=[
"occasion",
"episod",
"festi",
"rare",
"libre", # OH-libres
"aigu",
],
window=(-3, 5),
),
dict(
regex=["pansement", "compress"],
window=-3,
),
],
regex_attr="NORM",
assign=[
dict(
name="stopped",
regex=r"(?<!non )(?<!pas )(sevr|arret|stop|ancien)",
window=(-3, 5),
),
dict(
name="zero_after",
regex=r"(?=^[a-z]*\s*:?[\s-]*(0|oui|non(?! sevr)))",
window=6,
),
],
)
# fmt: on
Extensions
On each span span
that match, the following attributes are available:
span._.detailed_status
: set to either"PRESENT"
"ABSTINENCE"
if the patient stopped its consumption"ABSENT"
if the patient has no alcohol dependence
Examples
import edsnlp
nlp = edsnlp.blank("eds")
nlp.add_pipe("eds.sentences")
nlp.add_pipe(
"eds.normalizer",
config=dict(
accents=True,
lowercase=True,
quotes=True,
spaces=True,
pollution=dict(
information=True,
bars=True,
biology=True,
doctors=True,
web=True,
coding=True,
footer=True,
),
),
)
nlp.add_pipe(f"eds.alcohol")
Below are a few examples:
text = "Patient alcoolique."
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [alcoolique]
text = "OH chronique."
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [OH]
text = "Prise d'alcool occasionnelle"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: []
text = "Application d'un pansement alcoolisé"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: []
text = "Alcoolisme sevré"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [Alcoolisme sevré]
span = spans[0]
span._.detailed_status
# Out: ABSTINENCE
span._.assigned
# Out: {'stopped': [sevré]}
text = "Alcoolisme non sevré"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [Alcoolisme]
text = "Alcool: 0"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [Alcool: 0]
span = spans[0]
span._.detailed_status
# Out: ABSENT
span._.assigned
# Out: {'zero_after': [0]}
text = "Le patient est en cours de sevrage éthylotabagique"
doc = nlp(text)
spans = doc.spans["alcohol"]
spans
# Out: [sevrage éthylotabagique]
span = spans[0]
span._.detailed_status
# Out: ABSTINENCE
span._.assigned
# Out: {'stopped': [sevrage]}
Parameters
PARAMETER | DESCRIPTION |
---|---|
nlp | The pipeline object TYPE: |
name | The name of the component TYPE: |
patterns | The patterns to use for matching TYPE: |
label | The label to use for the TYPE: |
span_setter | How to set matches on the doc TYPE: |
Authors and citation
The eds.alcohol
component was developed by AP-HP's Data Science team with a team of medical experts. A paper describing in details the development of those components is being drafted and will soon be available.