Mapping RxNorm and RxNorm Extension Codes with Corresponding Drug Brand Names

Description

This pretrained model maps RxNorm and RxNorm Extension codes with their corresponding drug brand names. It returns 2 types of brand names for the corresponding RxNorm or RxNorm Extension code.

Predicted Entities

rxnorm_brandname, rxnorm_extension_brandname

Open in Colab Copy S3 URI

How to use

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

sbert_embedder = BertSentenceEmbeddings\
      .pretrained("sbiobert_base_cased_mli", "en","clinical/models")\
      .setInputCols(["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("rxnorm_chunk")\

chunkerMapper = ChunkMapperModel.pretrained("rxnorm_drug_brandname_mapper", "en", "clinical/models")\
      .setInputCols(["rxnorm_chunk"])\
      .setOutputCol("mappings")\
      .setRels(["rxnorm_brandname", "rxnorm_extension_brandname"])


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

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

pipeline = LightPipeline(model)

result = pipeline.fullAnnotate(['metformin', 'advil'])

val documentAssembler = new DocumentAssembler()\
      .setInputCol("text")\
      .setOutputCol("chunk")

val sbert_embedder = BertSentenceEmbeddings\
      .pretrained("sbiobert_base_cased_mli", "en","clinical/models")\
      .setInputCols(["chunk"])\
      .setOutputCol("sbert_embeddings")
    
val rxnorm_resolver = SentenceEntityResolverModel\
      .pretrained("sbiobertresolve_rxnorm_augmented", "en", "clinical/models")\
      .setInputCols(["chunk", "sbert_embeddings"])\
      .setOutputCol("rxnorm_code")\
      .setDistanceFunction("EUCLIDEAN")

val resolver2chunk = new Resolution2Chunk()\
    .setInputCols(["rxnorm_code"]) \
    .setOutputCol("rxnorm_chunk")\

val chunkerMapper = ChunkMapperModel.pretrained("rxnorm_drug_brandname_mapper", "en", "clinical/models")\
      .setInputCols(["rxnorm_chunk"])\
      .setOutputCol("mappings")\
      .setRels(["rxnorm_brandname", "rxnorm_extension_brandname"])



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

val data = Seq(Array("metformin", "advil")).toDS.toDF("text")

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

Results

+--------------+-------------+--------------------------------------------------+--------------------------+
|     drug_name|rxnorm_result|                                    mapping_result|                 relation |
+--------------+-------------+--------------------------------------------------+--------------------------+
|     metformin|         6809|Actoplus Met (metformin):::Avandamet (metformin...|          rxnorm_brandname|
|     metformin|         6809|A FORMIN (metformin):::ABERIN MAX (metformin)::...|rxnorm_extension_brandname|
|         advil|       153010|                                     Advil (Advil)|          rxnorm_brandname|
|         advil|       153010|                                              NONE|rxnorm_extension_brandname|
+--------------+-------------+--------------------------------------------------+--------------------------+

Model Information

Model Name: rxnorm_drug_brandname_mapper
Compatibility: Healthcare NLP 4.3.0+
License: Licensed
Edition: Official
Input Labels: [rxnorm_chunk]
Output Labels: [mappings]
Language: en
Size: 4.0 MB