Recognize Posology Pipeline

Description

This pipeline detects drugs, dosage, form, frequency, duration, route, and drug strength in text.

Predicted Entities

DRUG, STRENGTH, DURATION, FREQUENCY, FORM, DOSAGE, ROUTE.

Live Demo Open in Colab Copy S3 URI

How to use

from sparknlp.pretrained import PretrainedPipeline

pipeline = PretrainedPipeline('recognize_entities_posology', 'en', 'clinical/models')

annotations =  pipeline.fullAnnotate("""The patient was perscriped 50MG penicilin for is headache""")[0]

annotations.keys()


val pipeline = new PretrainedPipeline("recognize_entities_posology", "en", "clinical/models")
val result = pipeline.fullAnnotate("""The patient was perscriped 50MG penicilin for is headache""")(0)

import nlu

result_df = nlu.load('ner.posology').predict("""The patient was perscriped 50MG penicilin for is headache""")
result_df

Results

+-----------------------------------------+
|result                                   |
+-----------------------------------------+
|[O, O, O, O, B-Strength, B-Drug, O, O, O]|
+-----------------------------------------+

+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|ner                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|[[named_entity, 0, 2, O, [word -> The, confidence -> 1.0], []], [named_entity, 4, 10, O, [word -> patient, confidence -> 0.9993], []], [named_entity, 12, 14, O, [word -> was, confidence -> 1.0], []], [named_entity, 16, 25, O, [word -> perscriped, confidence -> 0.9985], []], [named_entity, 27, 30, B-Strength, [word -> 50MG, confidence -> 0.9966], []], [named_entity, 32, 40, B-Drug, [word -> penicilin, confidence -> 0.9934], []], [named_entity, 42, 44, O, [word -> for, confidence -> 0.9999], []], [named_entity, 46, 47, O, [word -> is, confidence -> 0.9468], []], [named_entity, 49, 56, O, [word -> headache, confidence -> 0.9805], []]]|
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Model Information

Model Name: recognize_entities_posology
Type: pipeline
Compatibility: Spark NLP for Healthcare 3.0.0+
License: Licensed
Edition: Official
Language: en

Included Models

  • DocumentAssembler
  • SentenceDetector
  • TokenizerModel
  • WordEmbeddingsModel
  • NerDLModel
  • NerConverter