Mapping RxNorm Codes with Corresponding UMLS Codes

Description

This pretrained model maps RxNorm codes with corresponding UMLS Codes.

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

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("mappings")\
.setRels(["umls_code"])


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

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

lp= LightPipeline(model)
result = lp.fullAnnotate(["amlodipine 5 MG", "hydrochlorothiazide 25 MG"])
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("ner_chunk")

val sbert_embedder = BertSentenceEmbeddings
.pretrained("sbiobert_base_cased_mli", "en","clinical/models")
.setInputCols(Array("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(Array("rxnorm_code"))
.setOutputCol("mappings")
.setRels(Array("umls_code"))

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

val model = pipeline.fit(Seq("").toDF("text"))

val lp= LightPipeline(model)
val result = lp.fullAnnotate(Seq("amlodipine 5 MG", "hydrochlorothiazide 25 MG"))
import nlu
nlu.load("en.rxnorm_to_umls").predict("""hydrochlorothiazide 25 MG""")

Results

|    | chunk                     |   rxnorm_code | umls_mappings   |
|---:|:--------------------------|--------------:|:----------------|
|  0 | amlodipine 5 MG           |        329528 | C1124796        |
|  1 | hydrochlorothiazide 25 MG |        310798 | C0977518        |

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