Mapping LOINC Codes with Their Corresponding UMLS Codes

Description

This pretrained model maps LOINC 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")\
    .setCaseSensitive(False)

loinc_resolver = SentenceEntityResolverModel.pretrained("sbiobertresolve_loinc_augmented", "en", "clinical/models")\
    .setInputCols(["sbert_embeddings"])\
    .setOutputCol("loinc_code")\
    .setDistanceFunction("EUCLIDEAN")

resolver2chunk = Resolution2Chunk()\
    .setInputCols(["loinc_code"])\
    .setOutputCol("loinc2chunk")

chunkMapper = ChunkMapperModel.pretrained("loinc_umls_mapper", "en", "clinical/models")\
    .setInputCols(["loinc2chunk"])\
    .setOutputCol("mappings")\

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

data = spark.createDataFrame([["aspirin"]]).toDF("text")

mapper_model = pipeline.fit(data)
result= mapper_model.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 loinc_resolver = SentenceEntityResolverModel.pretrained("sbiobertresolve_loinc_augmented", "en", "clinical/models")
  .setInputCols(Array("sbert_embeddings"))
  .setOutputCol("loinc_code")
  .setDistanceFunction("EUCLIDEAN")

val resolver2chunk = new Resolution2Chunk()
  .setInputCols(Array("loinc_code"))
  .setOutputCol("loinc2chunk")

val chunkMapper = ChunkMapperModel.pretrained("loinc_umls_mapper", "en", "clinical/models")
  .setInputCols(Array("loinc2chunk"))
  .setOutputCol("mappings")

val pipeline = new Pipeline().setStages(Array(
  documentAssembler,
  sbert_embedder,
  loinc_resolver,
  resolver2chunk,
  chunkMapper
))

val data = spark.createDataFrame(Seq(("aspirin"))).toDF("text")

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

Results

+-------+----------+---------+
|chunk  |loinc_code|umls_code|
+-------+----------+---------+
|aspirin|LA26702-3 |C0004057 |
+-------+----------+---------+

Model Information

Model Name: loinc_umls_mapper
Compatibility: Healthcare NLP 5.2.1+
License: Licensed
Edition: Official
Input Labels: [ner_chunk]
Output Labels: [mappings]
Language: en
Size: 1.9 MB