Skip to content

Peptic ulcer disease

The eds.peptic_ulcer_disease pipeline component extracts mentions of peptic ulcer disease.

Details of the used patterns
# fmt: off
main_pattern = dict(
    source="main",
    regex=[
        r"ulcere.{1,10}gastr",
        r"ulcere.{1,10}duoden",
        r"ulcere.{1,10}antra",
        r"ulcere.{1,10}pept",
        r"ulcere.{1,10}estomac",
        r"ulcere.{1,10}curling",
        r"ulcere.{1,10}bulb",
        r"(œ|oe)sophagites.{1,5}pepti.{1,10}ulcer",
        r"gastrite.{1,20}ulcer",
        r"antrite.{1,5}ulcer",
    ],
    regex_attr="NORM",
)

acronym = dict(
    source="acronym",
    regex=[
        r"\bUGD\b",
    ],
    regex_attr="TEXT",
)

generic = dict(
    source="generic",
    regex=r"ulcere",
    regex_attr="NORM",
    assign=dict(
        name="is_peptic",
        regex=r"\b(gastr|digest)",
        window=(-20, 20),
        limit_to_sentence=False,
    ),
)

default_patterns = [
    main_pattern,
    acronym,
    generic,
]
# fmt: on

Extensions

On each span span that matches, the following attributes are available:

  • span._.detailed_status: set to "PRESENT"

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.peptic_ulcer_disease")

Below are a few examples:

text = "Beaucoup d'ulcères gastriques"
doc = nlp(text)
spans = doc.spans["peptic_ulcer_disease"]

spans
# Out: [ulcères gastriques]
text = "Présence d'UGD"
doc = nlp(text)
spans = doc.spans["peptic_ulcer_disease"]

spans
# Out: [UGD]
text = "La patient à des ulcères"
doc = nlp(text)
spans = doc.spans["peptic_ulcer_disease"]

spans
# Out: []
text = "Au niveau gastrique: blabla blabla blabla blabla blabla quelques ulcères"
doc = nlp(text)
spans = doc.spans["peptic_ulcer_disease"]

spans
# Out: [ulcères]

span = spans[0]

span._.assigned
# Out: {'is_peptic': [gastrique]}

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object

TYPE: Optional[PipelineProtocol]

name

The name of the component

TYPE: Optional[str]

patterns

The patterns to use for matching

DEFAULT: [{'source': 'main', 'regex': ['ulcere.{1,10}gas...

label

The label to use for the Span object and the extension

TYPE: str DEFAULT: peptic_ulcer_disease

span_setter

How to set matches on the doc

TYPE: SpanSetterArg DEFAULT: {'ents': True, 'peptic_ulcer_disease': True}

Authors and citation

The eds.peptic_ulcer_disease 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.