Extract relations between problem, test, and findings in reports


Find relations between diagnosis, tests and imaging findings in radiology reports.

Predicted Entities

1 : The two entities are related. 0 : The two entities are not related

Live Demo Open in Colab Download

How to use

ner_tagger = sparknlp.annotators.NerDLModel()\
    .setInputCols("sentences", "tokens", "embeddings")\

re_model = RelationExtractionModel()\
    .pretrained("re_test_problem_finding", "en", 'clinical/models')\
    .setInputCols(["embeddings", "pos_tags", "ner_chunks", "dependencies"])\
    .setMaxSyntacticDistance(4)\ #default: 0
    .setPredictionThreshold(0.9)\ #default: 0.5
    .setRelationPairs(["procedure-symptom"]) # Possible relation pairs. Default: All Relations.

nlp_pipeline = Pipeline(stages=[ documenter, sentencer,tokenizer, words_embedder, pos_tagger,  clinical_ner_tagger,ner_chunker, dependency_parser,re_model])

light_pipeline = LightPipeline(nlp_pipeline.fit(spark.createDataFrame([['']]).toDF("text")))

annotations = light_pipeline.fullAnnotate(''''Targeted biopsy of this lesion for histological correlation should be considered.'')


| index | relations    | entity1      | chunk1              | entity2      |  chunk2 |
| 0     | 1            | PROCEDURE    | biopsy              | SYMPTOM      |  lesion | 

Model Information

Model Name: re_test_problem_finding
Type: re
Compatibility: Spark NLP for Healthcare 2.7.1+
License: Licensed
Edition: Official
Input Labels: [embeddings, pos_tags, train_ner_chunks, dependencies]
Output Labels: [relations]
Language: en

Data Source

Trained on internal datasets.