Mapping RxNorm Codes with Their Corresponding UMLS Codes

Description

This pretrained model maps RxNorm codes to corresponding UMLS codes.

Predicted Entities

umls_code

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(["sbert_embeddings"])\
    .setOutputCol("rxnorm_code")\
    .setDistanceFunction("EUCLIDEAN")

resolver2chunk = Resolution2Chunk()\
    .setInputCols(["rxnorm_code"])\
    .setOutputCol("rxnorm2chunk")

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

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

data = spark.createDataFrame([['amlodipine 5 MG'], ['magnesium hydroxide 100 MG'], ['metformin 1000 MG'], ['dilaudid']]).toDF("text")

result = mapper_pipeline.fit(data).transform(data)


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

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

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

resolver2chunk = medical.Resolution2Chunk()\
    .setInputCols(["rxnorm_code"])\
    .setOutputCol("rxnorm2chunk")

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

mapper_pipeline = nlp.Pipeline(stages = [
    documentAssembler,
    sbert_embedder,
    rxnorm_resolver,
    resolver2chunk,
    chunkerMapper
])

data = spark.createDataFrame([['amlodipine 5 MG'], ['magnesium hydroxide 100 MG'], ['metformin 1000 MG'], ['dilaudid']]).toDF("text")

result = mapper_pipeline.fit(data).transform(data)


val documentAssembler = 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("sbert_embeddings"))
    .setOutputCol("rxnorm_code")
    .setDistanceFunction("EUCLIDEAN")

val resolver2chunk = Resolution2Chunk()
    .setInputCols(Array("rxnorm_code"))
    .setOutputCol("rxnorm2chunk")

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


val mapper_pipeline = Pipeline().setStages(Array(
    documentAssembler,
    sbert_embedder,
    rxnorm_resolver,
    resolver2chunk,
    chunkerMapper)

val data = Seq(
  ("amlodipine 5 MG"),
  ("magnesium hydroxide 100 MG"),
  ("metformin 1000 MG"),
  ("dilaudid")
).toDF("text")

val result = mapper_pipeline.fit(data).transform(data)

Results


+--------------------------+-----------+---------+
|chunk                     |rxnorm_code|umls_code|
+--------------------------+-----------+---------+
|amlodipine 5 MG           |197361     |C0687883 |
|magnesium hydroxide 100 MG|337012     |C1134402 |
|metformin 1000 MG         |316255     |C0987664 |
|dilaudid                  |224913     |C0728755 |
+--------------------------+-----------+---------+

Model Information

Model Name: rxnorm_umls_mapper
Compatibility: Healthcare NLP 5.5.1+
License: Licensed
Edition: Official
Input Labels: [ner_chunk]
Output Labels: [mappings]
Language: en
Size: 3.0 MB

References

Trained on concepts from RXNORM for the 2024AB release of the Unified Medical Language System® (UMLS) Knowledge Sources: https://www.nlm.nih.gov/research/umls/index.html