Mapping RXNORM Codes with Their Corresponding UMLS Codes

Description

This pretrained model maps RXNORM codes to corresponding UMLS codes.

Predicted Entities

umls_code

Open in Colab Copy S3 URI

How to use

documentAssembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("ner_chunk")

sbert_embedder = BertSentenceEmbeddings\
.pretrained("sbiobert_base_cased_mli", "en","clinical/models")\
.setInputCols(["ner_chunk"])\
.setOutputCol("sbert_embeddings")

rxnorm_resolver = SentenceEntityResolverModel\
.pretrained("sbiobertresolve_rxnorm_augmented", "en", "clinical/models")\
.setInputCols(["ner_chunk", "sbert_embeddings"])\
.setOutputCol("rxnorm_code")\
.setDistanceFunction("EUCLIDEAN")

chunkerMapper = ChunkMapperModel\
.pretrained("rxnorm_umls_mapper", "en", "clinical/models")\
.setInputCols(["rxnorm_code"])\
.setOutputCol("umls_mappings")\
.setRels(["umls_code"])


pipeline = Pipeline(stages = [
documentAssembler,
sbert_embedder,
rxnorm_resolver,
chunkerMapper
])

model = pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))

light_pipeline= LightPipeline(model)

result = light_pipeline.fullAnnotate("amlodipine 5 MG")
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("ner_chunk")

val sbert_embedder = BertSentenceEmbeddings
.pretrained("sbiobert_base_cased_mli", "en", "clinical/models")
.setInputCols("ner_chunk")
.setOutputCol("sbert_embeddings")

val rxnorm_resolver = SentenceEntityResolverModel
.pretrained("sbiobertresolve_rxnorm_augmented", "en", "clinical/models")
.setInputCols(Array("ner_chunk", "sbert_embeddings"))
.setOutputCol("rxnorm_code")
.setDistanceFunction("EUCLIDEAN")

val chunkerMapper = ChunkMapperModel
.pretrained("rxnorm_umls_mapper", "en", "clinical/models")
.setInputCols("rxnorm_code")
.setOutputCol("umls_mappings")
.setRels(Array("umls_code"))

val pipeline = new Pipeline(stages = Array(
documentAssembler,
sbert_embedder,
rxnorm_resolver,
chunkerMapper
))

val data = Seq("amlodipine 5 MG").toDS.toDF("text")

val result= pipeline.fit(data).transform(data)
import nlu
nlu.load("en.rxnorm_to_umls").predict("""amlodipine 5 MG""")

Results

|    | ner_chunk       |   rxnorm_code | umls_mappings   |
|---:|:----------------|--------------:|:----------------|
|  0 | amlodipine 5 MG |        329528 | C1124796        |

Model Information

Model Name: rxnorm_umls_mapper
Compatibility: Healthcare NLP 3.5.3+
License: Licensed
Edition: Official
Input Labels: [rxnorm_code]
Output Labels: [mappings]
Language: en
Size: 1.9 MB

References

This pretrained model maps RXNORM codes to corresponding UMLS codes under the Unified Medical Language System (UMLS).