Mapping MedDRA LLT (Lowest Level Term) Codes with Their Corresponding SNOMED Codes

Description

This pretrained model maps MedDRA LLT (Lowest Level Term) codes to corresponding SNOMED codes.

Predicted Entities

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")\
    .setCaseSensitive(False)

meddra_resolver = SentenceEntityResolverModel.load("sbiobertresolve_meddra_lowest_level_term") \
    .setInputCols(["sbert_embeddings"]) \
    .setOutputCol("meddra_llt_code")\
    .setDistanceFunction("EUCLIDEAN")

resolver2chunk = Resolution2Chunk()\
    .setInputCols(["meddra_llt_code"])\
    .setOutputCol("meddra_llt_code2chunk")

chunkMapper = ChunkMapperModel.load('meddra_llt_snomed_mapper')\
    .setInputCols(["meddra_llt_code2chunk"])\
    .setOutputCol("mappings")\
    .setRels(["snomed_code"])

pipeline = Pipeline(stages = [
    documentAssembler,
    sbert_embedder,
    meddra_resolver,
    resolver2chunk,
    chunkMapper])

data = spark.createDataFrame([["Chronic renal insufficiency"], ["Gastritis"], ["Transient ischemic attack"]]).toDF("text")

result = pipeline.fit(data).transform(data)
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")
    .setCaseSensitive(false)
	
val snomed_resolver = new SentenceEntityResolverModel.load("sbiobertresolve_meddra_lowest_level_term")
    .setInputCols(Array("sbert_embeddings"))
    .setOutputCol("meddra_llt_code")
    .setDistanceFunction("EUCLIDEAN")
	
val resolver2chunk = new Resolution2Chunk()
    .setInputCols(Array("meddra_llt_code"))
    .setOutputCol("meddra_llt_code2chunk")
	
val chunkMapper = new ChunkMapperModel.load("meddra_llt_snomed_mapper")
    .setInputCols(Array("meddra_llt_code2chunk"))
    .setOutputCol("mappings")
    .setRels(Array("snomed_code"))
	
val newPipeline().setStages(Array(
     documentAssembler,
     sbert_embedder,
     meddra_resolver,
     resolver2chunk,
     chunkMapper))
	
val data = Seq("Chronic renal insufficiency","Gastritis","Transient ischemic attack") .toDF("text")
	
val result = pipeline.fit(data).transform(data)

Results

+---------------------------+-----------+------------------------------------------------+
|                      chunk|meddra_code|                                     snomed_code|
+---------------------------+-----------+------------------------------------------------+
|Chronic renal insufficiency|   10050441|723190009:Chronic renal insufficiency (disorder)|
|                  Gastritis|   10017853|                    4556007:Gastritis (disorder)|
|  Transient ischemic attack|   10072760|  266257000:Transient ischemic attack (disorder)|
+---------------------------+-----------+------------------------------------------------+

Model Information

Model Name: meddra_llt_snomed_mapper
Compatibility: Healthcare NLP 5.3.2+
License: Licensed
Edition: Official
Input Labels: [ner_chunk]
Output Labels: [mappings]
Language: en
Size: 173.1 KB