Skip to content

Congestive heart failure

The eds.congestive_heart_failure pipeline component extracts mentions of congestive heart failure. It will notably match:

  • Mentions of various diseases (see below)
  • Heart transplantation
  • AF (Atrial Fibrillation)
  • Pacemaker
Details of the used patterns
# fmt: off
from ..terms import ASYMPTOMATIC

main_pattern = dict(
    source="main",
    regex=[
        r"defaillance.{1,10}cardi",
        r"(œ|oe)deme.{1,10}pulmon",
        r"(œ|oe)deme.{1,10}poumon",
        r"decompensation.{1,10}card",
        r"choc.{1,30}cardio",
        r"greffe.{1,10}c(œ|oe)ur",
        r"greffe.{1,10}cardia",
        r"transplantation.{1,10}c(œ|oe)ur",
        r"transplantation.{1,10}cardia",
        r"arret.{1,10}cardi",
        r"c(œ|oe)ur pulmo",
        r"foie.card",
        r"pace.?maker",
        r"stimulateur.cardiaque",
        r"valve.{1,30}(meca|artific)",
    ],
    regex_attr="NORM",
)

symptomatic = dict(
    source="symptomatic",
    regex=[
        r"cardiopathi",
        r"cardiomyopathi",
        r"d(i|y)sfonction.{1,15}(ventricul|\bvg|cardiaque)",
        r"valvulopathie",
        r"\bic\b.{1,10}(droite|gauche)",
    ],
    regex_attr="NORM",
    exclude=dict(
        regex=ASYMPTOMATIC + [r"(?<!\bnon.)ischem"],  # Exclusion of ischemic events
        window=5,
    ),
)

with_minimum_severity = dict(
    source="min_severity",
    regex=[
        r"insuffisance.{1,10}(\bcardi|\bdiasto|\bventri|\bmitral|tri.?cusp)",
        r"(retrecissement|stenose).(aortique|mitral)",
        r"\brac\b",
        r"\brm\b",
    ],
    regex_attr="NORM",
    exclude=dict(
        regex=ASYMPTOMATIC + ["minime", "modere", r"non.serre"],
        window=5,
    ),
)

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

AF_main_pattern = dict(
    source="AF_main",
    regex=[
        r"fibrill?ation.{1,3}(atriale|auriculaire|ventriculaire)",
        r"flutter",
        r"brady.?arythmie",
        r"pace.?maker",
    ],
)

AF_acronym = dict(
    source="AF_acronym",
    regex=[
        r"\bFA\b",
        r"\bAC.?FA\b",
    ],
    regex_attr="TEXT",
)

default_patterns = [
    main_pattern,
    symptomatic,
    acronym,
    AF_main_pattern,
    AF_acronym,
    with_minimum_severity,
]
# fmt: on

Usage

import edsnlp, edsnlp.pipes as eds

nlp = edsnlp.blank("eds")
nlp.add_pipe(eds.sentences())
nlp.add_pipe(
    eds.normalizer(
        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(eds.congestive_heart_failure())

Below are a few examples:

text = "Présence d'un oedème pulmonaire"
doc = nlp(text)
spans = doc.spans["congestive_heart_failure"]

spans
# Out: [oedème pulmonaire]
text = "Le patient est équipé d'un pace-maker"
doc = nlp(text)
spans = doc.spans["congestive_heart_failure"]

spans
# Out: [pace-maker]
text = "Un cardiopathie non décompensée"
doc = nlp(text)
spans = doc.spans["congestive_heart_failure"]

spans
# Out: []
text = "Insuffisance cardiaque"
doc = nlp(text)
spans = doc.spans["congestive_heart_failure"]

spans
# Out: [Insuffisance cardiaque]
text = "Insuffisance cardiaque minime"
doc = nlp(text)
spans = doc.spans["congestive_heart_failure"]

spans
# Out: []

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object

TYPE: Optional[PipelineProtocol]

name

The name of the component

TYPE: (str) DEFAULT: 'congestive_heart_failure'

patterns

The patterns to use for matching

TYPE: Optional[Dict[str, Any]] DEFAULT: [{'source': 'main', 'regex': ['defaillance.{1,1...

label

The label to use for the Span object and the extension

TYPE: str DEFAULT: congestive_heart_failure

span_setter

How to set matches on the doc

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

Authors and citation

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