Description
This model maps extracted medical entities to Healthcare Common Procedure Coding System (HCPCS)
codes using ‘sbiobert_base_cased_mli’ sentence embeddings. It also returns the domain information of the codes in the all_k_aux_labels parameter in the metadata of the result.
Predicted Entities
HCPCS Codes
Live Demo Open in Colab Copy S3 URI
How to use
sbiobertresolve_hcpcs resolver model must be used with sbiobert_base_cased_mli as embeddings ner_jsl as NER model. Procedure set in .setWhiteList().
documentAssembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("ner_chunk")
sbert_embedder = BertSentenceEmbeddings\
.pretrained('sbiobert_base_cased_mli', 'en','clinical/models')\
.setInputCols(["ner_chunk"])\
.setOutputCol("sentence_embeddings")
hcpcs_resolver = SentenceEntityResolverModel\
.pretrained("sbiobertresolve_hcpcs", "en", "clinical/models") \
.setInputCols(["ner_chunk", "sentence_embeddings"]) \
.setOutputCol("hcpcs_code")\
.setDistanceFunction("EUCLIDEAN")
hcpcs_pipelineModel = PipelineModel(
stages = [
documentAssembler,
sbert_embedder,
hcpcs_resolver])
data = spark.createDataFrame([["Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, unilateral, any size, any type"]]).toDF("text")
results = hcpcs_pipelineModel.fit(data).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("sentence_embeddings")
val hcpcs_resolver = SentenceEntityResolverModel
.pretrained("sbiobertresolve_hcpcs", "en", "clinical/models")
.setInputCols(Array("ner_chunk", "sentence_embeddings"))
.setOutputCol("hcpcs_code")
.setDistanceFunction("EUCLIDEAN")
val hcpcs_pipeline = new Pipeline().setStages(Array(documentAssembler, sbert_embedder, hcpcs_resolver))
val data = Seq("Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, unilateral, any size, any type").toDF("text")
val results = hcpcs_pipeline.fit(data).transform(data)
import nlu
nlu.load("en.resolve.hcpcs").predict("""Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, unilateral, any size, any type""")
Results
+--+---------------------------------------------------------------------------------------------------------+----------+----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+
| |ner_chunk |hcpcs_code|all_codes |resolutions |domain |
+--+---------------------------------------------------------------------------------------------------------+----------+----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+
|0 |Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, unilateral, any size, any type|L8001 |[L8001, L8002, L8000, L8033, L8032, ...]|'Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, unilateral, any size, any type', 'Breast prosthesis, mastectomy bra, with integrated breast prosthesis form, bilateral, any size, any type', 'Breast prosthesis, mastectomy bra, without integrated breast prosthesis form, any size, any type', 'Nipple prosthesis, custom fabricated, reusable, any material, any type, each', ...|Device, Device, Device, Device, Device, ...|
+--+---------------------------------------------------------------------------------------------------------+----------+----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Model Information
| Model Name: | sbiobertresolve_hcpcs |
| Compatibility: | Healthcare NLP 3.2.3+ |
| License: | Licensed |
| Edition: | Official |
| Input Labels: | [sentence_embeddings] |
| Output Labels: | [hcpcs_code] |
| Language: | en |
| Case sensitive: | false |