Mapping RxNorm Codes with Their Corresponding UMLS Codes

Description

This pretrained model maps RxNorm codes to corresponding UMLS codes.

Predicted Entities

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"])


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")

model = pipeline.fit(data)
result = model.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 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 model = pipeline.fit(data)
val result = model.transform(data)

Results

+--------------------------+-----------+---------+
|chunk                     |rxnorm_code|umls_code|
+--------------------------+-----------+---------+
|amlodipine 5 MG           |329528     |C1124796 |
|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.3.0+
License: Licensed
Edition: Official
Input Labels: [ner_chunk]
Output Labels: [mappings]
Language: en
Size: 3.0 MB