Skip to content

Pain Status[source]

The eds.pain_status pipeline component extracts mentions of the pain status.

Details of the used patterns
# fmt: off
from ..utils import make_assign_regex, make_status_assign, normalize_space_characters

other = dict(
    source="other",
    regex=[
        "(?:sur le )?plan antalgique",
    ],
    regex_attr="NORM",
)
healthy = dict(
    source="healthy",
    regex=[r"indolores?"],
    regex_attr="NORM",
    exclude=dict(regex=make_assign_regex(["abdominale?s?", "abdomen"]), window=(-4, 2)),
)

altered = dict(
    source="altered",
    regex=[
        "douleurs?",
        r"douleurs? (?:\b\w+\b\s){0,5}mecaniques?",
        r"douloureu(?:x|ses?)",
        r"(?:traitements? )?antalgiques?",
        "souffrances?",
        "neuropathie",
        r"\balgique",
        "antalgie",
    ],
    regex_attr="NORM",
    exclude=dict(
        regex=make_assign_regex(["abdominale?s?", "aigue?s?"]), window=(-4, 2)
    ),
)
mild = dict(source="mild", regex=[r"pall?iers? (?:1|2|i(?:i)?)"], regex_attr="NORM")

severe = dict(
    source="severe",
    regex=["hyperalgie", "etat de souffrance", r"pall?iers? (?:3|iii)"],
    regex_attr="NORM",
)

status = dict(
    source="other_status",
    regex=["etat (?:ant)?algique", "statut (?:ant)?algique"],
    regex_attr="NORM",
    assign=make_status_assign(),
)

default_patterns = normalize_space_characters(
    [other, healthy, altered, mild, severe, status]
)

# fmt: on

Extensions

On each span span that match, the following attribute is available:

  • span._.pain_status: set to None.

It will specify the severity of the mention regarding the pain status of the patient.

Possible values are:

  • healthy : this span suggests the patient is well regarding that domain.
  • altered_nondescript : this span suggests the patient is not well, but it is not yet possible to ascertain the degree of alteration.
  • altered_mild : this span suggests a light alteration regarding this domain.
  • altered_severe : this span suggests a severe alteration regarding this domain.
  • other : this span is not indicative of the level of alteration regarding this domain. Still, it hints that this domain has been evaluated.

Examples

import edsnlp, edsnlp.pipes as eds

nlp = edsnlp.blank("eds")
nlp.add_pipe(eds.sentences())
nlp.add_pipe(eds.normalizer())
nlp.add_pipe(f"eds.pain_status")

Below are a few examples:

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline

TYPE: Optional[PipelineProtocol]

name

The name of the component

TYPE: Optional[str] DEFAULT: pain_status

patterns

The patterns to use for matching

TYPE: FullConfig DEFAULT: [{'source': 'other', 'regex': ['(?:sur\\s{1,3}l...

label

The label to use for the Span object and the extension

TYPE: str DEFAULT: pain_status

span_setter

How to set matches on the doc

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