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, 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.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: |
name | The name of the component TYPE: |
patterns | The patterns to use for matching DEFAULT: |
label | The label to use for the TYPE: |
span_setter | How to set matches on the doc TYPE: |
Authors and citation
The eds.liver_disease
component was developed by AP-HP's Data Science team with a team of medical experts, following the insights of the algorithm proposed by Petit-Jean et al., 2024.
Petit-Jean T., Gérardin C., Berthelot E., Chatellier G., Frank M., Tannier X., Kempf E. and Bey R., 2024. Collaborative and privacy-enhancing workflows on a clinical data warehouse: an example developing natural language processing pipelines to detect medical conditions. Journal of the American Medical Informatics Association. 31, pp.1280-1290. 10.1093/jamia/ocae069