Mapping RxNorm Codes with Corresponding National Drug Codes(NDC)

Description

This pretrained model maps RxNorm and RxNorm Extension codes with corresponding National Drug Codes (NDC).

Predicted Entities

Product NDC, Package NDC

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_ndc_mapper", "en", "clinical/models")\
.setInputCols(["rxnorm_code"])\
.setOutputCol("ndc_mappings")\
.setRels(["Product NDC", "Package NDC"])


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

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

light_pipeline = LightPipeline(model)

result = light_pipeline.annotate(["doxycycline hyclate 50 MG Oral Tablet", "macadamia nut 100 MG/ML"])
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_ndc_mapper", "en", "clinical/models")
.setInputCols("rxnorm_code")
.setOutputCol("ndc_mappings")
.setRels("Product NDC", "Package NDC")

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

val data = Seq(Array("doxycycline hyclate 50 MG Oral Tablet", "macadamia nut 100 MG/ML")).toDS.toDF("text")

val result= pipeline.fit(data).transform(data)
import nlu
nlu.load("en.rxnorm_to_ndc").predict("""doxycycline hyclate 50 MG Oral Tablet""")

Results

|    | ner_chunk                             |   rxnorm_code | Package NDC   | Product NDC   |
|---:|:--------------------------------------|--------------:|:--------------|:--------------|
|  0 | doxycycline hyclate 50 MG Oral Tablet |       1652674 | 62135-0625-60 | 46708-0499    |
|  1 | macadamia nut 100 MG/ML               |        259934 | 13349-0010-39 | 13349-0010    |

Model Information

Model Name: rxnorm_ndc_mapper
Compatibility: Healthcare NLP 3.5.3+
License: Licensed
Edition: Official
Input Labels: [chunk]
Output Labels: [mappings]
Language: en
Size: 2.0 MB