Mapping Abbreviations and Acronyms of Medical Regulatory Activities with Their Definitions

Description

This pretrained model maps abbreviations and acronyms of medical regulatory activities with their definition.

Predicted Entities

definition

Open in Colab Download

How to use

document_assembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")

sentence_detector = SentenceDetector()\
.setInputCols(["document"])\
.setOutputCol("sentence")

tokenizer = Tokenizer()\
.setInputCols("sentence")\
.setOutputCol("token")

word_embeddings = WordEmbeddingsModel.pretrained("embeddings_clinical", "en", "clinical/models")\
.setInputCols(["sentence", "token"])\
.setOutputCol("embeddings")

#NER model to detect abbreviations in the text
abbr_ner = MedicalNerModel.pretrained("ner_abbreviation_clinical", "en", "clinical/models") \
.setInputCols(["sentence", "token", "embeddings"]) \
.setOutputCol("abbr_ner")

abbr_converter = NerConverter() \
.setInputCols(["sentence", "token", "abbr_ner"]) \
.setOutputCol("abbr_ner_chunk")\

chunkerMapper = ChunkMapperModel.pretrained("abbreviation_mapper", "en", "clinical/models")\
.setInputCols(["abbr_ner_chunk"])\
.setOutputCol("mappings")\
.setRel("definition") 

pipeline = Pipeline().setStages([document_assembler,
sentence_detector,
tokenizer, 
word_embeddings,
abbr_ner, 
abbr_converter, 
chunkerMapper])


text = ["""Gravid with estimated fetal weight of 6-6/12 pounds.
LABORATORY DATA: Laboratory tests include a CBC which is normal. 
HIV: Negative. One-Hour Glucose: 117. Group B strep has not been done as yet."""]


data = spark.createDataFrame([text]).toDF("text")
result = pipeline.fit(data).transform(data)
val document_assembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")

val sentence_detector = new SentenceDetector()
.setInputCols(Array("document"))
.setOutputCol("sentence")

val tokenizer = new Tokenizer()
.setInputCols("sentence")
.setOutputCol("token")

val word_embeddings = WordEmbeddingsModel.pretrained("embeddings_clinical", "en", "clinical/models")
.setInputCols(Array("sentence", "token"))
.setOutputCol("embeddings")

val abbr_ner = MedicalNerModel.pretrained("ner_abbreviation_clinical", "en", "clinical/models") 
.setInputCols(Array("sentence", "token", "embeddings")) 
.setOutputCol("abbr_ner")

val abbr_converter = NerConverter() 
.setInputCols(Array("sentence", "token", "abbr_ner")) 
.setOutputCol("abbr_ner_chunk")

val chunkerMapper = ChunkMapperModel.pretrained("abbreviation_mapper", "en", "clinical/models")
.setInputCols(Array("abbr_ner_chunk"))
.setOutputCol("mappings")
.setRel("definition") 


val pipeline = new Pipeline().setStages(Array(
				 document_assembler,
sentence_detector,
tokenizer, 
word_embeddings,
abbr_ner, 
abbr_converter, 
chunkerMapper))


val test_sentence = """Gravid with estimated fetal weight of 6-6/12 pounds.
LABORATORY DATA: Laboratory tests include a CBC which is normal. 
HIV: Negative. One-Hour Glucose: 117. Group B strep has not been done as yet.""" 


val data = Seq(test_sentence).toDS.toDF("text")

val result= pipeline.fit(data).transform(data)
import nlu
nlu.load("en.map_entity.abbreviation_to_definition").predict("""Gravid with estimated fetal weight of 6-6/12 pounds.
LABORATORY DATA: Laboratory tests include a CBC which is normal. 
HIV: Negative. One-Hour Glucose: 117. Group B strep has not been done as yet.""")

Results

+----------+------------------------------+
|ner_chunk |mapping_result                |
+----------+------------------------------+
|CBC       |complete blood count          |
|HIV       |human immunodeficiency virus  |
+----------+------------------------------+

Model Information

Model Name: abbreviation_mapper
Compatibility: Healthcare NLP 3.5.1+
License: Licensed
Edition: Official
Input Labels: [abbr_ner_chunk]
Output Labels: [mappings]
Language: en
Size: 214.8 KB

References

https://www.johnsnowlabs.com/marketplace/list-of-abbreviations-and-acronyms-for-medical-regulatory-activities/