Detect Drug Entities - Pipeline

Description

This pipeline, combines dosage, strength, form, and route into a single entity: Drug.

Copy S3 URI

How to use


from sparknlp.pretrained import PretrainedPipeline

pipeline = PretrainedPipeline("ner_drugs_large_v2_pipeline", "en", "clinical/models")

sample_text = """ 
The patient is a 40-year-old white male who presents with a chief complaint of 'chest pain'.
The patient is diabetic and has a prior history of coronary artery disease.
The patient presents today stating that his chest pain started yesterday evening and has been somewhat intermittent.
He has been advised Aspirin 81 milligrams QDay.
Humulin N. insulin 50 units in a.m.
HCTZ 50 mg QDay. Nitroglycerin 1/150 sublingually PRN chest pain.
"""

result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))


from johnsnowlabs import nlp, medical

pipeline = nlp.PretrainedPipeline("ner_drugs_large_v2_pipeline", "en", "clinical/models")

sample_text = """ 
The patient is a 40-year-old white male who presents with a chief complaint of 'chest pain'.
The patient is diabetic and has a prior history of coronary artery disease.
The patient presents today stating that his chest pain started yesterday evening and has been somewhat intermittent.
He has been advised Aspirin 81 milligrams QDay.
Humulin N. insulin 50 units in a.m.
HCTZ 50 mg QDay. Nitroglycerin 1/150 sublingually PRN chest pain.
"""

result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))


import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline

val pipeline = PretrainedPipeline("ner_drugs_large_v2_pipeline", "en", "clinical/models")

val sample_text = """ 
The patient is a 40-year-old white male who presents with a chief complaint of 'chest pain'.
The patient is diabetic and has a prior history of coronary artery disease.
The patient presents today stating that his chest pain started yesterday evening and has been somewhat intermittent.
He has been advised Aspirin 81 milligrams QDay.
Humulin N. insulin 50 units in a.m.
HCTZ 50 mg QDay. Nitroglycerin 1/150 sublingually PRN chest pain.
"""

val result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))

Results


| chunk         | begin | end | ner_label |
| :------------ | ----: | --: | :-------- |
| Aspirin       |   307 | 313 | DRUG      |
| Humulin N     |   335 | 343 | DRUG      |
| insulin       |   346 | 352 | DRUG      |
| HCTZ          |   371 | 374 | DRUG      |
| Nitroglycerin |   388 | 400 | DRUG      |

Model Information

Model Name: ner_drugs_large_v2_pipeline
Type: pipeline
Compatibility: Healthcare NLP 6.3.0+
License: Licensed
Edition: Official
Language: en
Size: 2.0 GB

Included Models

  • DocumentAssembler
  • SentenceDetectorDLModel
  • TokenizerModel
  • WordEmbeddingsModel
  • MedicalNerModel
  • NerConverterInternalModel