Description
This pipeline, identifies drug strength entities in clinical text. It recognizes dosage patterns including mg, mcg, g, ml, IU, units, and various numeric formats.
How to use
from sparknlp.pretrained import PretrainedPipeline
pipeline = PretrainedPipeline("drug_strength_parser_pipeline", "en", "clinical/models")
sample_text = """ Patient was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily. Ibuprofen 200mg PRN for pain. Vitamin D 1000 IU daily was also recommended."""
result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))
from johnsnowlabs import nlp, medical
pipeline = nlp.PretrainedPipeline("drug_strength_parser_pipeline", "en", "clinical/models")
sample_text = """ Patient was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily. Ibuprofen 200mg PRN for pain. Vitamin D 1000 IU daily was also recommended."""
result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
val pipeline = PretrainedPipeline("drug_strength_parser_pipeline", "en", "clinical/models")
val sample_text = """ Patient was prescribed Metformin 500mg twice daily and Lisinopril 10mg once daily. Ibuprofen 200mg PRN for pain. Vitamin D 1000 IU daily was also recommended."""
val result = pipeline.transform(spark.createDataFrame([[sample_text]]).toDF("text"))
Results
| chunk | begin | end | label |
|--------:|--------:|------:|:--------------|
| 500mg | 33 | 37 | DRUG_STRENGTH |
| 10mg | 66 | 69 | DRUG_STRENGTH |
| 200mg | 93 | 97 | DRUG_STRENGTH |
| 1000 IU | 123 | 129 | DRUG_STRENGTH |
Model Information
| Model Name: | drug_strength_parser_pipeline |
| Type: | pipeline |
| Compatibility: | Healthcare NLP 6.3.0+ |
| License: | Licensed |
| Edition: | Official |
| Language: | en |
| Size: | 401.8 KB |
Included Models
- DocumentAssembler
- SentenceDetectorDLModel
- TokenizerModel
- ContextualParserModel
- ChunkConverter