Skip to content

Liver disease

The eds.liver_disease pipeline component extracts mentions of liver disease.

Details of the used patterns
# fmt: off
mild = dict(
    source="mild",
    regex=[
        r"cholangites?.{1,10}(sclero|secondaire)",
        r"fibrose.{1,10}(hepatique|foie)",
        r"hepatite.{1,15}chronique",
        r"hepatopathie",
        r"\bnash\b",
        r"(maladie|sydrome).{1,10}Hanot",
        r"surinfections.{1,5}delta",
        r"\bcbp\b",
        r"\bmaf\b",
        r"(maladie|syndrome).{1,8}hanot",
    ],
    regex_attr="NORM",
    exclude=dict(
        regex="\bdots?\b",
        window=-5,
    ),
)

moderate_severe = dict(
    source="moderate_severe",
    regex=[
        r"cirrhose",
        r"necrose.{1,10}(hepati|foie)",
        r"varice.{1,10}(estomac|oesopha|gastr)",
        r"\bvo\b.{1,5}(stade|grade).(1|2|3|i{1,3})",
        r"hypertension.{1,5}portale",
        r"scleroses.{1,5}hepatoportale",
        r"sydrome.{1,10}hepato.?ren",
        r"insuffisance.{1,5}hepa",
        r"encephalopathie.{1,5}hepa",
        r"\btips\b",
    ],
    regex_attr="NORM",
)

transplant = dict(
    source="transplant",
    regex=[
        r"(?<!pre.?)(greffe|transplant).{1,12}(hepatique|foie)",
    ],
    regex_attr="NORM",
    exclude=dict(
        regex="chc",
        window=(-5, 5),
    ),
)

default_patterns = [
    mild,
    moderate_severe,
    transplant,
]
# fmt: on

Extensions

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

  • span._.detailed_status: set to either
    • "MILD" for mild liver diseases
    • "MODERATE_TO_SEVERE" else

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

Below are a few examples:

text = "Il y a une fibrose hépatique"
doc = nlp(text)
spans = doc.spans["liver_disease"]

spans
# Out: [fibrose hépatique]
text = "Une hépatite B chronique"
doc = nlp(text)
spans = doc.spans["liver_disease"]

spans
# Out: [hépatite B chronique]
text = "Le patient consulte pour une cirrhose"
doc = nlp(text)
spans = doc.spans["liver_disease"]

spans
# Out: [cirrhose]

span = spans[0]

span._.detailed_status
# Out: MODERATE_TO_SEVERE
text = "Greffe hépatique."
doc = nlp(text)
spans = doc.spans["liver_disease"]

spans
# Out: [Greffe hépatique]

span = spans[0]

span._.detailed_status
# Out: MODERATE_TO_SEVERE

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline

TYPE: Optional[PipelineProtocol]

name

The name of the component

TYPE: Optional[str]

patterns

The patterns to use for matching

DEFAULT: [{'source': 'mild', 'regex': ['cholangites?.{1,...

label

The label to use for the Span object and the extension

TYPE: str DEFAULT: liver_disease

span_setter

How to set matches on the doc

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

Authors and citation

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