Pipeline to Detect Medication Entities

Description

A pretrained pipeline to detect medication entities. It was built on the top of ner_posology, ner_jsl and drug_matcher models. Predicted entities: DRUG, DOSAGE, FREQUENCY, ROUTE and STRENGTH.

Predicted Entities

DRUG

Copy S3 URI

How to use


from sparknlp.pretrained import PretrainedPipeline

ner_pipeline = PretrainedPipeline("ner_medication_pipeline", "en", "clinical/models")

result = ner_pipeline.annotate("""John Smith, a 55-year-old male with a medical history of hypertension, Type 2 Diabetes Mellitus, Hyperlipidemia, Gastroesophageal Reflux Disease (GERD), and chronic constipation, presented with persistent epigastric pain, heartburn, and infrequent bowel movements. He described the epigastric pain as burning and worsening after meals, often accompanied by heartburn and regurgitation, particularly when lying down. Additionally, he reported discomfort and bloating associated with infrequent bowel movements. In response, his doctor prescribed a regimen tailored to his conditions: Thiamine 100 mg q.day , Folic acid 1 mg q.day , multivitamins q.day , Calcium carbonate plus Vitamin D 250 mg t.i.d. , Heparin 5000 units subcutaneously b.i.d. , Prilosec 20 mg q.day , Senna two tabs qhs . The patient was advised to follow a low-fat diet, avoid spicy and acidic foods, and elevate the head of the bed to alleviate GERD symptoms. Lifestyle modifications including regular exercise, smoking cessation, and moderation in alcohol consumption were recommended to manage his chronic conditions effectively. A follow-up appointment in two weeks was scheduled.""")


import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline

val ner_pipeline = PretrainedPipeline("ner_medication_pipeline", "en", "clinical/models")

val result = ner_pipeline.annotate("""John Smith, a 55-year-old male with a medical history of hypertension, Type 2 Diabetes Mellitus, Hyperlipidemia, Gastroesophageal Reflux Disease (GERD), and chronic constipation, presented with persistent epigastric pain, heartburn, and infrequent bowel movements. He described the epigastric pain as burning and worsening after meals, often accompanied by heartburn and regurgitation, particularly when lying down. Additionally, he reported discomfort and bloating associated with infrequent bowel movements. In response, his doctor prescribed a regimen tailored to his conditions: Thiamine 100 mg q.day , Folic acid 1 mg q.day , multivitamins q.day , Calcium carbonate plus Vitamin D 250 mg t.i.d. , Heparin 5000 units subcutaneously b.i.d. , Prilosec 20 mg q.day , Senna two tabs qhs . The patient was advised to follow a low-fat diet, avoid spicy and acidic foods, and elevate the head of the bed to alleviate GERD symptoms. Lifestyle modifications including regular exercise, smoking cessation, and moderation in alcohol consumption were recommended to manage his chronic conditions effectively. A follow-up appointment in two weeks was scheduled.""")

Results


+-----------------+---------+
| medication_chunk|ner_label|
+-----------------+---------+
|         Thiamine|     DRUG|
|           100 mg| STRENGTH|
|            q.day|FREQUENCY|
|       Folic acid|     DRUG|
|             1 mg| STRENGTH|
|            q.day|FREQUENCY|
|    multivitamins|     DRUG|
|            q.day|FREQUENCY|
|Calcium carbonate|     DRUG|
|        Vitamin D|     DRUG|
|           250 mg| STRENGTH|
|            t.i.d|FREQUENCY|
|          Heparin|     DRUG|
|       5000 units|   DOSAGE|
|   subcutaneously|    ROUTE|
|            b.i.d|FREQUENCY|
|         Prilosec|     DRUG|
|            20 mg| STRENGTH|
|            q.day|FREQUENCY|
|            Senna|     DRUG|
|              two|   DOSAGE|
|             tabs|     FORM|
|              qhs|FREQUENCY|
+-----------------+---------+

Model Information

Model Name: ner_medication_pipeline
Type: pipeline
Compatibility: Healthcare NLP 5.3.0+
License: Licensed
Edition: Official
Language: en
Size: 1.7 GB

Included Models

  • DocumentAssembler
  • SentenceDetectorDLModel
  • TokenizerModel
  • WordEmbeddingsModel
  • MedicalNerModel
  • NerConverterInternalModel
  • MedicalNerModel
  • NerConverterInternalModel
  • TextMatcherInternalModel
  • ChunkMergeModel