Description
This pretrained model maps abbreviations and acronyms of medical regulatory activities with their definition
. This is an augmented version of the abbreviation_mapper
model with new abbreviations.
Important Note
: Mappers extract additional information such as extended descriptions and categories related to Concept codes (such as RxNorm, ICD10, CPT, MESH, NDC, UMLS, etc.). They generally take Concept Codes, which are the outputs of EntityResolvers, as input. When creating a pipeline that contains ‘Mapper’, it is necessary to use the ChunkMapperModel after an EntityResolverModel.
Predicted Entities
definition
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")
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_augmented", "en", "clinical/models")\
.setInputCols(["abbr_ner_chunk"])\
.setOutputCol("mappings")\
.setRels(["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.
VDRL: Nonreactive
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 = new NerConverter()
.setInputCols(Array("sentence", "token", "abbr_ner"))
.setOutputCol("abbr_ner_chunk")
val chunkerMapper = ChunkMapperModel.pretrained("abbreviation_mapper_augmented", "en", "clinical/models")
.setInputCols("abbr_ner_chunk")
.setOutputCol("mappings")
.setRels(Array("definition"))
val pipeline = new Pipeline().setStages(Array(
document_assembler,
sentence_detector,
tokenizer,
word_embeddings,
abbr_ner,
abbr_converter,
chunkerMapper))
val sample_text = """Gravid with estimated fetal weight of 6-6/12 pounds.
LABORATORY DATA: Laboratory tests include a CBC which is normal.
VDRL: Nonreactive
HIV: Negative. One-Hour Glucose: 117. Group B strep has not been done as yet."""
val data = Seq(sample_text).toDS.toDF("text")
val result= pipeline.fit(data).transform(data)
import nlu
nlu.load("en.map_entity.abbreviation_augmented").predict("""Gravid with estimated fetal weight of 6-6/12 pounds.
LABORATORY DATA: Laboratory tests include a CBC which is normal.
VDRL: Nonreactive
HIV: Negative. One-Hour Glucose: 117. Group B strep has not been done as yet.""")
Results
+---------+--------------------------------------+
|ner_chunk|abbreviation |
+---------+--------------------------------------+
|CBC |complete blood count |
|VDRL |Venereal Disease Research Laboratories|
|HIV |human immunodeficiency virus |
+---------+--------------------------------------+
Model Information
Model Name: | abbreviation_mapper_augmented |
Compatibility: | Spark NLP for Healthcare 4.2.1+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [abbr_ner_chunk] |
Output Labels: | [mappings] |
Language: | en |
Size: | 319.6 KB |