Skip to content

edsnlp.pipes.ner.frailty.polypharmacy_status.factory

create_component = registry.factory.register('eds.polypharmacy_status', assigns=['doc.ents', 'doc.spans'])(PolypharmacyStatusMatcher) module-attribute [source]

The eds.polypharmacy_status pipeline component extracts mentions of polymedication. It is best used in conjuction with the eds.drugs components, since those explicit mentions are relatively rare.

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

altered = dict(
    source="altered",
    regex=[
        "iatrogenie",
        "polymediqu",
        "polymedication",
    ],
    regex_attr="NORM",
)
other = dict(
    source="other",
    regex=[
        r"conciliation[\s]+medicament",
    ],
    regex_attr="NORM",
)

default_patterns = normalize_space_characters([altered, other])

# fmt: on

Extensions

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

  • span._.polypharmacy_status: set to None.

It will specify the severity of the mention regarding the polymedication 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.polypharmacy_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: polypharmacy_status

patterns

The patterns to use for matching

TYPE: FullConfig DEFAULT: [{'source': 'altered', 'regex': ['iatrogenie', ...

label

The label to use for the Span object and the extension

TYPE: str DEFAULT: polypharmacy_status

span_setter

How to set matches on the doc

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