Charlson
The eds.charlson
component extracts the Charlson Comorbidity Index.
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.charlson())
text = """
Charlson à l'admission: 7.
Charlson:
OMS:
"""
doc = nlp(text)
doc.ents
# Out: (Charlson à l'admission: 7,)
We can see that only one occurrence was extracted. The second mention of Charlson in the text doesn't contain any numerical value, so it isn't extracted.
Extensions
Each extraction exposes 2 extensions:
ent = doc.ents[0]
ent._.score_name
# Out: 'charlson'
ent._.score_value
# Out: 7
Parameters
PARAMETER | DESCRIPTION |
---|---|
nlp | The pipeline object TYPE: |
name | Name of the component TYPE: |
regex | A list of regexes to identify the score TYPE: |
attr | Whether to match on the text ('TEXT') or on the normalized text ('NORM') TYPE: |
value_extract | Regex with capturing group to get the score value TYPE: |
score_normalization | Function that takes the "raw" value extracted from the
TYPE: |
window | Number of token to include after the score's mention to find the score's value TYPE: |
ignore_excluded | Whether to ignore excluded spans when matching TYPE: |
ignore_space_tokens | Whether to ignore space tokens when matching TYPE: |
flags | Regex flags to use when matching TYPE: |
label | Label name to use for the TYPE: |
span_setter | How to set matches on the doc TYPE: |
RETURNS | DESCRIPTION |
---|---|
SimpleScoreMatcher | |