From 18fb633e3db2d3d7e58efa56972b7294b2db4081 Mon Sep 17 00:00:00 2001
From: Cabir C <64752006+Cabir40@users.noreply.github.com>
Date: Mon, 13 Feb 2023 15:56:22 +0300
Subject: [PATCH] Models hub internal (#13509)
---
.../Meryem1425/2023-02-11-ner_sdoh_wip_en.md | 228 ++++++++++++++++++
1 file changed, 228 insertions(+)
create mode 100644 docs/_posts/Meryem1425/2023-02-11-ner_sdoh_wip_en.md
diff --git a/docs/_posts/Meryem1425/2023-02-11-ner_sdoh_wip_en.md b/docs/_posts/Meryem1425/2023-02-11-ner_sdoh_wip_en.md
new file mode 100644
index 00000000000000..fed63ca1f1dac1
--- /dev/null
+++ b/docs/_posts/Meryem1425/2023-02-11-ner_sdoh_wip_en.md
@@ -0,0 +1,228 @@
+---
+layout: model
+title: Social Determinants of Health
+author: John Snow Labs
+name: ner_sdoh_wip
+date: 2023-02-11
+tags: [licensed, clinical, en, social_determinants, ner, public_health, sdoh]
+task: Named Entity Recognition
+language: en
+edition: Healthcare NLP 4.2.8
+spark_version: 3.0
+supported: true
+annotator: MedicalNerModel
+article_header:
+ type: cover
+use_language_switcher: "Python-Scala-Java"
+---
+
+## Description
+
+This model extracts terminology related to Social Determinants of Health from various kinds of biomedical documents.
+
+## Predicted Entities
+
+`Other_SDoH_Keywords`, `Education`, `Population_Group`, `Quality_Of_Life`, `Housing`, `Substance_Frequency`, `Smoking`, `Eating_Disorder`, `Obesity`, `Healthcare_Institution`, `Financial_Status`, `Age`, `Chidhood_Event`, `Exercise`, `Communicable_Disease`, `Hypertension`, `Other_Disease`, `Violence_Or_Abuse`, `Spiritual_Beliefs`, `Employment`, `Social_Exclusion`, `Access_To_Care`, `Marital_Status`, `Diet`, `Social_Support`, `Disability`, `Mental_Health`, `Alcohol`, `Insurance_Status`, `Substance_Quantity`, `Hyperlipidemia`, `Family_Member`, `Legal_Issues`, `Race_Ethnicity`, `Gender`, `Geographic_Entity`, `Sexual_Orientation`, `Transportation`, `Sexual_Activity`, `Language`, `Substance_Use`
+
+{:.btn-box}
+
+
+[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/ner_sdoh_wip_en_4.2.8_3.0_1676135569606.zip){:.button.button-orange}
+[Copy S3 URI](s3://auxdata.johnsnowlabs.com/clinical/models/ner_sdoh_wip_en_4.2.8_3.0_1676135569606.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
+
+## How to use
+
+
+
+
+{% include programmingLanguageSelectScalaPythonNLU.html %}
+```python
+document_assembler = DocumentAssembler()\
+ .setInputCol("text")\
+ .setOutputCol("document")
+
+sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "en")\
+ .setInputCols(["document"])\
+ .setOutputCol("sentence")
+
+tokenizer = Tokenizer()\
+ .setInputCols(["sentence"])\
+ .setOutputCol("token")
+
+clinical_embeddings = WordEmbeddingsModel.pretrained("embeddings_clinical", "en", "clinical/models")\
+ .setInputCols(["sentence", "token"])\
+ .setOutputCol("embeddings")
+
+ner_model = MedicalNerModel.pretrained("ner_sdoh_wip", "en", "clinical/models")\
+ .setInputCols(["sentence", "token", "embeddings"])\
+ .setOutputCol("ner")
+
+ner_converter = NerConverterInternal()\
+ .setInputCols(["sentence", "token", "ner"])\
+ .setOutputCol("ner_chunk")
+
+pipeline = Pipeline(stages=[
+ document_assembler,
+ sentence_detector,
+ tokenizer,
+ clinical_embeddings,
+ ner_model,
+ ner_converter
+ ])
+
+sample_texts = [["Smith is a 55 years old, divorced Mexcian American woman with financial problems. She speaks spanish. She lives in an apartment. She has been struggling with diabetes for the past 10 years and has recently been experiencing frequent hospitalizations due to uncontrolled blood sugar levels. Smith works as a cleaning assistant and does not have access to health insurance or paid sick leave. She has a son student at college. Pt with likely long-standing depression. She is aware she needs rehab. Pt reprots having her catholic faith as a means of support as well. She has long history of etoh abuse, beginning in her teens. She reports she has been a daily drinker for 30 years, most recently drinking beer daily. She smokes a pack of cigarettes a day. She had DUI back in April and was due to be in court this week."]]
+
+data = spark.createDataFrame(sample_texts).toDF("text")
+
+result = pipeline.fit(data).transform(data)
+```
+```scala
+val document_assembler = new DocumentAssembler()
+ .setInputCol("text")
+ .setOutputCol("document")
+
+val sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "en")
+ .setInputCols("document")
+ .setOutputCol("sentence")
+
+val tokenizer = new Tokenizer()
+ .setInputCols("sentence")
+ .setOutputCol("token")
+
+val clinical_embeddings = WordEmbeddingsModel.pretrained("embeddings_clinical", "en", "clinical/models")
+ .setInputCols(Array("sentence", "token"))
+ .setOutputCol("embeddings")
+
+val ner_model = MedicalNerModel.pretrained("ner_sdoh_wip", "en", "clinical/models")
+ .setInputCols(Array("sentence", "token", "embeddings"))
+ .setOutputCol("ner")
+
+val ner_converter = new NerConverterInternal()
+ .setInputCols(Array("sentence", "token", "ner"))
+ .setOutputCol("ner_chunk")
+
+val pipeline = new Pipeline().setStages(Array(
+ document_assembler,
+ sentence_detector,
+ tokenizer,
+ clinical_embeddings,
+ ner_model,
+ ner_converter
+))
+
+val data = Seq("He continues to smoke one pack of cigarettes daily, as he has for the past 28 years.").toDS.toDF("text")
+
+val result = pipeline.fit(data).transform(data)
+```
+