Skip to content

SOFA[source]

The eds.sofa component extracts Sequential Organ Failure Assessment (SOFA) scores, used to track a person's status during the stay in an intensive care unit to determine the extent of a person's organ function or rate failure.

Examples

import edsnlp, edsnlp.pipes as eds

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

text = """
SOFA (à 24H) : 12.
OMS:
"""

doc = nlp(text)
doc.ents
# Out: (SOFA (à 24H) : 12,)

Extensions

Each extraction exposes 3 extensions:

ent = doc.ents[0]

ent._.score_name
# Out: 'sofa'

ent._.score_value
# Out: 12

ent._.score_method
# Out: '24H'

Score method can here be "24H", "Maximum", "A l'admission" or "Non précisée"

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object

TYPE: PipelineProtocol

name

The name of the component

TYPE: Optional[str] DEFAULT: 'sofa'

regex

A list of regexes to identify the SOFA score

TYPE: List[str] DEFAULT: regex

attr

Whether to match on the text ('TEXT') or on the normalized text ('CUSTOM_NORM')

TYPE: str DEFAULT: 'NORM'

value_extract

Regex to extract the score value

TYPE: Dict[str, str] DEFAULT: value_extract

score_normalization

Function that takes the "raw" value extracted from the value_extract regex, and should return - None if no score could be extracted - The desired score value else

TYPE: Callable[[Union[str, None]], Any] DEFAULT: score_normalization_str

window

Number of token to include after the score's mention to find the score's value

TYPE: int DEFAULT: 10

ignore_excluded

Whether to ignore excluded spans

TYPE: bool DEFAULT: False

ignore_space_tokens

Whether to ignore space tokens

TYPE: bool DEFAULT: False

flags

Flags to pass to the regex

TYPE: Union[RegexFlag, int] DEFAULT: 0

label

Label name to use for the Span object and the extension

TYPE: str DEFAULT: 'sofa'

span_setter

How to set matches on the doc

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