diff --git a/docs/_posts/C-K-Loan/2023-06-21-medication_resolver_pipeline_en.md b/docs/_posts/C-K-Loan/2023-06-21-medication_resolver_pipeline_en.md index 6a07375b8e..ac376b510e 100644 --- a/docs/_posts/C-K-Loan/2023-06-21-medication_resolver_pipeline_en.md +++ b/docs/_posts/C-K-Loan/2023-06-21-medication_resolver_pipeline_en.md @@ -38,6 +38,7 @@ This pipeline can be used as Lightpipeline (with `annotate/fullAnnotate`). You c
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -64,47 +65,16 @@ nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopi
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -med_resolver_pipeline = PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") - -text = """The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""" - -result = med_resolver_pipeline.fullAnnotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val med_resolver_pipeline = new PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") - -val result = med_resolver_pipeline.fullAnnotate("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` - -{:.nlu-block} -```python -import nlu -nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` -
## Results ```bash -Results - - | | chunks | entities | ADE | RxNorm | Action | Treatment | UMLS | SNOMED_CT | NDC_Product | NDC_Package | |---:|:-----------------------------|:-----------|:----------------------------|---------:|:---------------------------|:-------------------------------------------|:---------|:------------|:--------------|:--------------| | 0 | Amlodopine Vallarta 10-320mg | DRUG | Gynaecomastia | 722131 | NONE | NONE | C1949334 | 425838008 | 00093-7693 | 00093-7693-56 | | 1 | Eviplera | DRUG | Anxiety | 217010 | Inhibitory Bone Resorption | Osteoporosis | C0720318 | NONE | NONE | NONE | | 2 | Lescol 40 MG | DRUG | NONE | 103919 | Hypocholesterolemic | Heterozygous Familial Hypercholesterolemia | C0353573 | NONE | 00078-0234 | 00078-0234-05 | | 3 | Everolimus 1.5 mg tablet | DRUG | Acute myocardial infarction | 2056895 | NONE | NONE | C4723581 | NONE | 00054-0604 | 00054-0604-21 | - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/C-K-Loan/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md b/docs/_posts/C-K-Loan/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md index fcdbb57a02..affd599718 100644 --- a/docs/_posts/C-K-Loan/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md +++ b/docs/_posts/C-K-Loan/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Clinical Findings) with their correspond
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -62,40 +63,11 @@ nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -text = 'HTG-induced pancreatitis associated with an acute hepatitis, and obesity' - -result = pipeline.annotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val pipeline = new PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -val text = "HTG-induced pancreatitis associated with an acute hepatitis, and obesity" - -val result = pipeline.annotate(text) -``` -{:.nlu-block} -```python -import nlu -nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced pancreatitis associated with an acute hepatitis, and obesity""") -``` -
## Results ```bash -Results - - +------------------------+---------+---------+ |chunk |ner_label|umls_code| +------------------------+---------+---------+ @@ -103,9 +75,6 @@ Results |an acute hepatitis |PROBLEM |C4750596 | |obesity |PROBLEM |C1963185 | +------------------------+---------+---------+ - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/C-K-Loan/2023-06-23-umls_drug_substance_resolver_pipeline_en.md b/docs/_posts/C-K-Loan/2023-06-23-umls_drug_substance_resolver_pipeline_en.md index 46ca294f69..bbe2e724b2 100644 --- a/docs/_posts/C-K-Loan/2023-06-23-umls_drug_substance_resolver_pipeline_en.md +++ b/docs/_posts/C-K-Loan/2023-06-23-umls_drug_substance_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Drug Substances) with their correspondin
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -49,39 +50,12 @@ val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") ``` -{:.nlu-block} -```python -+-----------------------------+---------+---------+ -|chunk |ner_label|umls_code| -+-----------------------------+---------+---------+ -|metformin |DRUG |C0025598 | -|lenvatinib |DRUG |C2986924 | -|Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | -+-----------------------------+---------+---------+ -``` -
- -{:.model-param} - -
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") - -result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline -val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") +
-val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` +## Results -{:.nlu-block} -```python +```bash +-----------------------------+---------+---------+ |chunk |ner_label|umls_code| +-----------------------------+---------+---------+ @@ -90,7 +64,7 @@ val result = pipeline.annotate("The patient was given metformin, lenvatinib and |Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | +-----------------------------+---------+---------+ ``` - + {:.model-param} ## Model Information diff --git a/docs/_posts/Cabir40/2023-06-21-medication_resolver_pipeline_en.md b/docs/_posts/Cabir40/2023-06-21-medication_resolver_pipeline_en.md index 3a8479d4a5..a27216da7d 100644 --- a/docs/_posts/Cabir40/2023-06-21-medication_resolver_pipeline_en.md +++ b/docs/_posts/Cabir40/2023-06-21-medication_resolver_pipeline_en.md @@ -38,6 +38,7 @@ This pipeline can be used as Lightpipeline (with `annotate/fullAnnotate`). You c
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -64,47 +65,16 @@ nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopi
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -med_resolver_pipeline = PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") - -text = """The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""" - -result = med_resolver_pipeline.fullAnnotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val med_resolver_pipeline = new PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") - -val result = med_resolver_pipeline.fullAnnotate("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` - -{:.nlu-block} -```python -import nlu -nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` -
## Results ```bash -Results - - | | chunks | entities | ADE | RxNorm | Action | Treatment | UMLS | SNOMED_CT | NDC_Product | NDC_Package | |---:|:-----------------------------|:-----------|:----------------------------|---------:|:---------------------------|:-------------------------------------------|:---------|:------------|:--------------|:--------------| | 0 | Amlodopine Vallarta 10-320mg | DRUG | Gynaecomastia | 722131 | NONE | NONE | C1949334 | 425838008 | 00093-7693 | 00093-7693-56 | | 1 | Eviplera | DRUG | Anxiety | 217010 | Inhibitory Bone Resorption | Osteoporosis | C0720318 | NONE | NONE | NONE | | 2 | Lescol 40 MG | DRUG | NONE | 103919 | Hypocholesterolemic | Heterozygous Familial Hypercholesterolemia | C0353573 | NONE | 00078-0234 | 00078-0234-05 | | 3 | Everolimus 1.5 mg tablet | DRUG | Acute myocardial infarction | 2056895 | NONE | NONE | C4723581 | NONE | 00054-0604 | 00054-0604-21 | - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/Cabir40/2023-06-22-summarizer_clinical_laymen_pipeline_en.md b/docs/_posts/Cabir40/2023-06-22-summarizer_clinical_laymen_pipeline_en.md index 52ec19b045..993169a016 100644 --- a/docs/_posts/Cabir40/2023-06-22-summarizer_clinical_laymen_pipeline_en.md +++ b/docs/_posts/Cabir40/2023-06-22-summarizer_clinical_laymen_pipeline_en.md @@ -34,72 +34,7 @@ This pretrained pipeline is built on the top of [summarizer_clinical_laymen](htt
{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("summarizer_clinical_laymen_pipeline", "en", "clinical/models") - -text = """ -Olivia Smith was seen in my office for evaluation for elective surgical weight loss on October 6, 2008. Olivia Smith is a 34-year-old female with a BMI of 43. She is 5'6" tall and weighs 267 pounds. She is motivated to attempt surgical weight loss because she has been overweight for over 20 years and wants to have more energy and improve her self-image. She is not only affected physically, but also socially by her weight. When she loses weight she always regains it and she always gains back more weight than she has lost. At one time, she lost 100 pounds and gained the weight back within a year. She has tried numerous commercial weight loss programs including Weight Watcher's for four months in 1992 with 15-pound weight loss, RS for two months in 1990 with six-pound weight loss, Slim Fast for six weeks in 2004 with eight-pound weight loss, an exercise program for two months in 2007 with a five-pound weight loss, Atkin's Diet for three months in 2008 with a ten-pound weight loss, and Dexatrim for one month in 2005 with a five-pound weight loss. She has also tried numerous fat reduction or fad diets. She was on Redux for nine months with a 100-pound weight loss. - -PAST MEDICAL HISTORY: She has a history of hypertension and shortness of breath. - -PAST SURGICAL HISTORY: Pertinent for cholecystectomy. - -PSYCHOLOGICAL HISTORY: Negative. - -SOCIAL HISTORY: She is single. She drinks alcohol once a week. She does not smoke. - -FAMILY HISTORY: Pertinent for obesity and hypertension. - -MEDICATIONS: Include Topamax 100 mg twice daily, Zoloft 100 mg twice daily, Abilify 5 mg daily, Motrin 800 mg daily, and a multivitamin. -ALLERGIES: She has no known drug allergies. - -REVIEW OF SYSTEMS: Negative. - -PHYSICAL EXAM: This is a pleasant female in no acute distress. Alert and oriented x 3. HEENT: Normocephalic, atraumatic. Extraocular muscles intact, nonicteric sclerae. Chest is clear to auscultation bilaterally. Cardiovascular is normal sinus rhythm. Abdomen is obese, soft, nontender and nondistended. Extremities show no edema, clubbing or cyanosis. - -ASSESSMENT/PLAN: This is a 34-year-old female with a BMI of 43 who is interested in surgical weight via the gastric bypass as opposed to Lap-Band. Olivia Smith will be asking for a letter of medical necessity from Dr. Andrew Johnson. She will also see my nutritionist and social worker and have an upper endoscopy. Once this is completed, we will submit her to her insurance company for approval. -""" - -result = pipeline.fullAnnotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val pipeline = new PretrainedPipeline("summarizer_clinical_laymen_pipeline", "en", "clinical/models") - -val text = """ -Olivia Smith was seen in my office for evaluation for elective surgical weight loss on October 6, 2008. Olivia Smith is a 34-year-old female with a BMI of 43. She is 5'6" tall and weighs 267 pounds. She is motivated to attempt surgical weight loss because she has been overweight for over 20 years and wants to have more energy and improve her self-image. She is not only affected physically, but also socially by her weight. When she loses weight she always regains it and she always gains back more weight than she has lost. At one time, she lost 100 pounds and gained the weight back within a year. She has tried numerous commercial weight loss programs including Weight Watcher's for four months in 1992 with 15-pound weight loss, RS for two months in 1990 with six-pound weight loss, Slim Fast for six weeks in 2004 with eight-pound weight loss, an exercise program for two months in 2007 with a five-pound weight loss, Atkin's Diet for three months in 2008 with a ten-pound weight loss, and Dexatrim for one month in 2005 with a five-pound weight loss. She has also tried numerous fat reduction or fad diets. She was on Redux for nine months with a 100-pound weight loss. - -PAST MEDICAL HISTORY: She has a history of hypertension and shortness of breath. - -PAST SURGICAL HISTORY: Pertinent for cholecystectomy. - -PSYCHOLOGICAL HISTORY: Negative. - -SOCIAL HISTORY: She is single. She drinks alcohol once a week. She does not smoke. - -FAMILY HISTORY: Pertinent for obesity and hypertension. - -MEDICATIONS: Include Topamax 100 mg twice daily, Zoloft 100 mg twice daily, Abilify 5 mg daily, Motrin 800 mg daily, and a multivitamin. - -ALLERGIES: She has no known drug allergies. - -REVIEW OF SYSTEMS: Negative. - -PHYSICAL EXAM: This is a pleasant female in no acute distress. Alert and oriented x 3. HEENT: Normocephalic, atraumatic. Extraocular muscles intact, nonicteric sclerae. Chest is clear to auscultation bilaterally. Cardiovascular is normal sinus rhythm. Abdomen is obese, soft, nontender and nondistended. Extremities show no edema, clubbing or cyanosis. - -ASSESSMENT/PLAN: This is a 34-year-old female with a BMI of 43 who is interested in surgical weight via the gastric bypass as opposed to Lap-Band. Olivia Smith will be asking for a letter of medical necessity from Dr. Andrew Johnson. She will also see my nutritionist and social worker and have an upper endoscopy. Once this is completed, we will submit her to her insurance company for approval. -""" - -val result = pipeline.fullAnnotate(text) -``` -
- -
-{% include programmingLanguageSelectScalaPythonNLU.html %} ```python from sparknlp.pretrained import PretrainedPipeline @@ -164,18 +99,11 @@ val result = pipeline.fullAnnotate(text) ```
+ ## Results ```bash -Results - - - This is a clinical note about a 34-year-old woman who is interested in having weight loss surgery. She has been overweight for over 20 years and wants to have more energy and improve her self-image. She has tried many diets and weight loss programs, but has not been successful in keeping the weight off. She has a history of hypertension and shortness of breath, but is not allergic to any medications. She will have an upper endoscopy and will be contacted by a nutritionist and social worker. The plan is to have her weight loss surgery through the gastric bypass, rather than Lap-Band. - - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/Cabir40/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md b/docs/_posts/Cabir40/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md index c3f91a24e2..1749e62401 100644 --- a/docs/_posts/Cabir40/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md +++ b/docs/_posts/Cabir40/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Clinical Findings) with their correspond
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -62,40 +63,11 @@ nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -text = 'HTG-induced pancreatitis associated with an acute hepatitis, and obesity' - -result = pipeline.annotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val pipeline = new PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -val text = "HTG-induced pancreatitis associated with an acute hepatitis, and obesity" - -val result = pipeline.annotate(text) -``` -{:.nlu-block} -```python -import nlu -nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced pancreatitis associated with an acute hepatitis, and obesity""") -``` -
## Results ```bash -Results - - +------------------------+---------+---------+ |chunk |ner_label|umls_code| +------------------------+---------+---------+ @@ -103,9 +75,6 @@ Results |an acute hepatitis |PROBLEM |C4750596 | |obesity |PROBLEM |C1963185 | +------------------------+---------+---------+ - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/Cabir40/2023-06-23-umls_drug_substance_resolver_pipeline_en.md b/docs/_posts/Cabir40/2023-06-23-umls_drug_substance_resolver_pipeline_en.md index 096d2107a8..b63bb5e1e5 100644 --- a/docs/_posts/Cabir40/2023-06-23-umls_drug_substance_resolver_pipeline_en.md +++ b/docs/_posts/Cabir40/2023-06-23-umls_drug_substance_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Drug Substances) with their correspondin
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -48,9 +49,10 @@ val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") ``` +
-{:.nlu-block} -```python +## Results +```bash +-----------------------------+---------+---------+ |chunk |ner_label|umls_code| +-----------------------------+---------+---------+ @@ -59,38 +61,8 @@ val result = pipeline.annotate("The patient was given metformin, lenvatinib and |Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | +-----------------------------+---------+---------+ ``` - - -{:.model-param} - -
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") - -result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") -val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` -{:.nlu-block} -```python -+-----------------------------+---------+---------+ -|chunk |ner_label|umls_code| -+-----------------------------+---------+---------+ -|metformin |DRUG |C0025598 | -|lenvatinib |DRUG |C2986924 | -|Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | -+-----------------------------+---------+---------+ -``` -
{:.model-param} ## Model Information diff --git a/docs/_posts/Cabir40/2023-10-03-multiclassifierdl_respiratory_disease_en.md b/docs/_posts/Cabir40/2023-10-03-multiclassifierdl_respiratory_disease_en.md index 258456deb4..cb32eafde5 100644 --- a/docs/_posts/Cabir40/2023-10-03-multiclassifierdl_respiratory_disease_en.md +++ b/docs/_posts/Cabir40/2023-10-03-multiclassifierdl_respiratory_disease_en.md @@ -4,7 +4,7 @@ title: Multilabel Text Classification For Respiratory Disease author: John Snow Labs name: multiclassifierdl_respiratory_disease date: 2023-10-03 -tags: [en, licensed, text_classification, multiclassifier, respiratory_disease, asthma, emphysema, chronic_bronchitis, tensorflow] +tags: [en, licensed, text_classification, multiclassifier, respiratory_disease, asthma, emphysema, chronic_bronchitis, COPD, tensorflow] task: Text Classification language: en edition: Healthcare NLP 5.1.1 @@ -34,8 +34,8 @@ The PHS-BERT Respiratory Disease Classifier Model is a specialized text classifi `Astham`,`COPD`, `Emphysema`, `Chronic bronchitis`, `Other/Unknown`, `No` {:.btn-box} - - +[Live Demo](https://demo.johnsnowlabs.com/healthcare/CLASSIFICATION_RESPIRATORY/){:.button.button-orange} +[Open in Colab](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/PUBLIC_HEALTH_CLASSIFIER_DL.ipynb){:.button.button-orange.button-orange-trans.co.button-icon} [Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/multiclassifierdl_respiratory_disease_en_5.1.1_3.0_1696348950217.zip){:.button.button-orange.button-orange-trans.arr.button-icon.hidden} [Copy S3 URI](s3://auxdata.johnsnowlabs.com/clinical/models/multiclassifierdl_respiratory_disease_en_5.1.1_3.0_1696348950217.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3} @@ -66,7 +66,8 @@ sentence_embeddings = SentenceEmbeddings()\ multiclassifierdl = MultiClassifierDLModel.pretrained("multiclassifierdl_respiratory_disease", "en", "clinical/models")\ .setInputCols(["sentence_embeddings"])\ - .setOutputCol("predicted_class") + .setOutputCol("predicted_class")\ + .setThreshold(0.999) clf_pipeline = Pipeline( stages=[ @@ -79,14 +80,10 @@ clf_pipeline = Pipeline( data = spark.createDataFrame([ - ["""The patient, experiencing recurrent episodes of wheezing and shortness of breath, has been diagnosed with Asthma and is advised to use a daily controller inhaler to manage the symptoms."""], - ["""Due to the patient's long history of tobacco use and persistent cough producing large amounts of sputum, a diagnosis of Chronic Obstructive Pulmonary Disease (COPD) has been established, necessitating bronchodilators for management."""], - ["""The presence of dyspnea, chronic cough, and a history of smoking have led to the diagnosis of Emphysema for the patient, warranting the initiation of long-term oxygen therapy."""], - ["""The patient has been diagnosed with Chronic Bronchitis following the prolonged occurrence of cough and mucus production, and is recommended to undergo pulmonary rehabilitation and pharmacotherapy."""], - ["""With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has been conclusively diagnosed with Asthma, necessitating immediate commencement of anti-inflammatory medications."""], - ["""Manifesting prolonged symptoms of breathlessness and a productive cough, the patient has received a diagnosis of Chronic Obstructive Pulmonary Disease (COPD), and a comprehensive treatment involving bronchodilators and lifestyle modifications has been recommended."""], - ["""The patient, exhibiting extensive lung damage and significant shortness of breath, has been diagnosed with Emphysema, requiring meticulous management with bronchodilators and pulmonary rehabilitation to improve lung function."""], - ["""Chronic Bronchitis has been diagnosed in the patient presenting with a chronic cough and frequent respiratory infections, necessitating a treatment plan inclusive of antibiotics and chest physiotherapy."""], + ["""The patient takes inhalers for COPD management, weight loss medications, and disease-modifying antirheumatic drugs (DMARDs) for rheumatoid arthritis."""], + ["""The patient was on Metformin for DM2, mood stabilizers for Bipolar II Disorder, and inhaled corticosteroids for Asthma."""], + ["""The patient was diagnosed with Chronic Bronchitis after a series of pulmonary function tests."""], + ["""Chest CT imaging revealed significant bullae and airspace enlargement, consistent with a diagnosis of emphysema."""], ]).toDF("text") @@ -113,7 +110,8 @@ val sentence_embeddings = new SentenceEmbeddings()\ val multiclassifierdl = MultiClassifierDLModel.pretrained("multiclassifierdl_respiratory_disease", "en", "clinical/models")\ .setInputCols("sentence_embeddings")\ - .setOutputCol("predicted_class") + .setOutputCol("predicted_class")\ + .setThreshold(0.999) val clf_pipeline = new Pipeline().setStages(Array( documentAssembler, @@ -124,14 +122,10 @@ val clf_pipeline = new Pipeline().setStages(Array( )) val data = Seq(Array( - """The patient, experiencing recurrent episodes of wheezing and shortness of breath, has been diagnosed with Asthma and is advised to use a daily controller inhaler to manage the symptoms.""", - """Due to the patient's long history of tobacco use and persistent cough producing large amounts of sputum, a diagnosis of Chronic Obstructive Pulmonary Disease (COPD) has been established, necessitating bronchodilators for management.""", - """The presence of dyspnea, chronic cough, and a history of smoking have led to the diagnosis of Emphysema for the patient, warranting the initiation of long-term oxygen therapy.""", - """The patient has been diagnosed with Chronic Bronchitis following the prolonged occurrence of cough and mucus production, and is recommended to undergo pulmonary rehabilitation and pharmacotherapy.""", - """With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has been conclusively diagnosed with Asthma, necessitating immediate commencement of anti-inflammatory medications.""", - """Manifesting prolonged symptoms of breathlessness and a productive cough, the patient has received a diagnosis of Chronic Obstructive Pulmonary Disease (COPD), and a comprehensive treatment involving bronchodilators and lifestyle modifications has been recommended.""", - """The patient, exhibiting extensive lung damage and significant shortness of breath, has been diagnosed with Emphysema, requiring meticulous management with bronchodilators and pulmonary rehabilitation to improve lung function.""", - """Chronic Bronchitis has been diagnosed in the patient presenting with a chronic cough and frequent respiratory infections, necessitating a treatment plan inclusive of antibiotics and chest physiotherapy,""", + """The patient takes inhalers for COPD management, weight loss medications, and disease-modifying antirheumatic drugs (DMARDs) for rheumatoid arthritis.""", + """The patient was on Metformin for DM2, mood stabilizers for Bipolar II Disorder, and inhaled corticosteroids for Asthma.""", + """The patient was diagnosed with Chronic Bronchitis after a series of pulmonary function tests.""", + """Chest CT imaging revealed significant bullae and airspace enlargement, consistent with a diagnosis of emphysema.""", )).toDS.toDF("text") val result = clf_pipeline.fit(data).transform(data) @@ -141,22 +135,14 @@ val result = clf_pipeline.fit(data).transform(data) ## Results ```bash -+----------------------------------------------------------------------------------------------------+-------------------------------------+ -| result| result| -+----------------------------------------------------------------------------------------------------+-------------------------------------+ -|[The patient, experiencing recurrent episodes of wheezing and shortness of breath, has been diagn...| [Asthma, Chronic bronchitis]| -|[Due to the patient's long history of tobacco use and persistent cough producing large amounts of...| [COPD, Chronic bronchitis]| -|[The presence of dyspnea, chronic cough, and a history of smoking have led to the diagnosis of Em...|[Emphysema, COPD, Chronic bronchitis]| -|[The patient has been diagnosed with Chronic Bronchitis following the prolonged occurrence of cou...| [Chronic bronchitis]| -|[With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has ...| [Asthma, Other/Unknown]| -|[Manifesting prolonged symptoms of breathlessness and a productive cough, the patient has receive...| [COPD, Chronic bronchitis]| -|[The patient, exhibiting extensive lung damage and significant shortness of breath, has been diag...| [Emphysema, COPD, Other/Unknown]| -|[Chronic Bronchitis has been diagnosed in the patient presenting with a chronic cough and frequen...| [Chronic bronchitis]| -|[To manage the symptoms of Asthma, the patient has been advised to use inhaled corticosteroids re...| [COPD, Asthma, Chronic bronchitis]| -|[In light of the COPD diagnosis, a comprehensive pulmonary rehabilitation program, coupled with l...| [COPD]| -|[The patient with Emphysema has been recommended to undergo oxygen therapy and regular use of bro...| [Emphysema, COPD]| -|[For the effective management of Chronic Bronchitis, a course of appropriate antibiotics, coupled...| [Chronic bronchitis]| -+----------------------------------------------------------------------------------------------------+-------------------------------------+ ++----------------------------------------------------------------------------------------------------+--------------------+ +| text| result| ++----------------------------------------------------------------------------------------------------+--------------------+ +|The patient takes inhalers for COPD management, weight loss medications, and disease-modifying an...| [COPD]| +|The patient was on Metformin for DM2, mood stabilizers for Bipolar II Disorder, and inhaled corti...| [Asthma]| +| The patient was diagnosed with Chronic Bronchitis after a series of pulmonary function tests.|[Chronic bronchitis]| +|Chest CT imaging revealed significant bullae and airspace enlargement, consistent with a diagnosi...| [Emphysema]| ++----------------------------------------------------------------------------------------------------+--------------------+ ``` {:.model-param} diff --git a/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_heart_disease_en.md b/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_heart_disease_en.md index 133bff0123..e51c8248bb 100644 --- a/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_heart_disease_en.md +++ b/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_heart_disease_en.md @@ -32,8 +32,8 @@ The PHS-BERT Heart Disease Classifier Model is a specialized text classification `Hypertension`, `MI`, `CAD`, `Other/Unknown`, `No` {:.btn-box} - - +[Live Demo](https://demo.johnsnowlabs.com/healthcare/CLASSIFICATION_HEART_DISEASE/){:.button.button-orange} +[Open in Colab](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/PUBLIC_HEALTH_CLASSIFIER_DL.ipynb){:.button.button-orange.button-orange-trans.co.button-icon} [Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/multiclassifierdl_heart_disease_en_5.1.1_3.0_1697443096682.zip){:.button.button-orange.button-orange-trans.arr.button-icon.hidden} [Copy S3 URI](s3://auxdata.johnsnowlabs.com/clinical/models/multiclassifierdl_heart_disease_en_5.1.1_3.0_1697443096682.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3} @@ -64,7 +64,8 @@ sentence_embeddings = SentenceEmbeddings()\ multiclassifierdl = MultiClassifierDLModel.pretrained("multiclassifierdl_heart_disease", "en", "clinical/models")\ .setInputCols(["sentence_embeddings"])\ - .setOutputCol("predicted_class") + .setOutputCol("predicted_class")\ + .setThreshold(0.999) clf_pipeline = Pipeline( stages=[ @@ -77,9 +78,9 @@ clf_pipeline = Pipeline( data = spark.createDataFrame([ - ["""Mr. Daniels was diagnosed with hypertension during a routine check-up at the age of 45. He had consistently high blood pressure readings over several visits, indicative of hypertension. Often experiencing headaches and occasional bouts of dizziness, these could be linked to his elevated blood pressure. He has been prescribed antihypertensive medications and advised to adopt lifestyle modifications, such as reducing salt intake and engaging in regular exercise, to manage his hypertension effectively."""], - ["""Mrs. Martinez, a 58-year-old, began experiencing chest discomfort and shortness of breath during physical exertion. After undergoing an angiogram, she was diagnosed with coronary artery disease due to significant blockage in her coronary arteries. Her family history reveals her father had a similar condition, making her predisposed to CAD. Along with prescribed medications to reduce her risk of a heart attack, Mrs. Martinez will undergo a cardiac rehabilitation program and make dietary changes to manage her coronary artery disease."""], - ["""Mr. Jackson, at the age of 52, suddenly experienced severe chest pain while at work and was immediately rushed to the emergency department. The ECG and elevated cardiac enzymes confirmed a diagnosis of myocardial infarction. Recounting the event, Mr. Jackson mentioned that he felt a crushing pain in his chest, radiating to his left arm, typical symptoms of a heart attack. Post-treatment, he was advised to engage in cardiac rehabilitation, maintain a heart-healthy diet, and take prescribed medications diligently to prevent another myocardial infarction in the future."""], + ["""Mrs. Allen was diagnosed with hypertension after consistently recording blood pressure readings above 140/90 mmHg."""], + ["""Following a series of diagnostic tests, Mr. Harris was confirmed to have CAD (Coronary Artery Disease)."""], + ["""After presenting with crushing chest pain and diaphoresis, Mr. Stevens was diagnosed with an MI (Myocardial Infarction)."""] ]).toDF("text") @@ -105,7 +106,8 @@ val sentence_embeddings = new SentenceEmbeddings()\ val multiclassifierdl = MultiClassifierDLModel.pretrained("multiclassifierdl_heart_disease", "en", "clinical/models")\ .setInputCols("sentence_embeddings")\ - .setOutputCol("predicted_class") + .setOutputCol("predicted_class")\ + .setThreshold(0.999) val clf_pipeline = new Pipeline().setStages(Array( documentAssembler, @@ -116,9 +118,9 @@ val clf_pipeline = new Pipeline().setStages(Array( )) val data = Seq(Array( - """Mr. Daniels was diagnosed with hypertension during a routine check-up at the age of 45. He had consistently high blood pressure readings over several visits, indicative of hypertension. Often experiencing headaches and occasional bouts of dizziness, these could be linked to his elevated blood pressure. He has been prescribed antihypertensive medications and advised to adopt lifestyle modifications, such as reducing salt intake and engaging in regular exercise, to manage his hypertension effectively.""", - """Mrs. Martinez, a 58-year-old, began experiencing chest discomfort and shortness of breath during physical exertion. After undergoing an angiogram, she was diagnosed with coronary artery disease due to significant blockage in her coronary arteries. Her family history reveals her father had a similar condition, making her predisposed to CAD. Along with prescribed medications to reduce her risk of a heart attack, Mrs. Martinez will undergo a cardiac rehabilitation program and make dietary changes to manage her coronary artery disease.""", - """Mr. Jackson, at the age of 52, suddenly experienced severe chest pain while at work and was immediately rushed to the emergency department. The ECG and elevated cardiac enzymes confirmed a diagnosis of myocardial infarction. Recounting the event, Mr. Jackson mentioned that he felt a crushing pain in his chest, radiating to his left arm, typical symptoms of a heart attack. Post-treatment, he was advised to engage in cardiac rehabilitation, maintain a heart-healthy diet, and take prescribed medications diligently to prevent another myocardial infarction in the future.""", + """Mrs. Allen was diagnosed with hypertension after consistently recording blood pressure readings above 140/90 mmHg.""", + """Following a series of diagnostic tests, Mr. Harris was confirmed to have CAD (Coronary Artery Disease).""", + """After presenting with crushing chest pain and diaphoresis, Mr. Stevens was diagnosed with an MI (Myocardial Infarction).""" )).toDS.toDF("text") val result = clf_pipeline.fit(data).transform(data) @@ -128,13 +130,13 @@ val result = clf_pipeline.fit(data).transform(data) ## Results ```bash -+----------------------------------------------------------------------------------------------------+------------------+ -| result| result| -+----------------------------------------------------------------------------------------------------+------------------+ -|[Mr. Daniels was diagnosed with hypertension during a routine check-up at the age of 45. He had c...| [Hypertension]| -|[Mrs. Martinez, a 58-year-old, began experiencing chest discomfort and shortness of breath during...| [MI, CAD]| -|[Mr. Jackson, at the age of 52, suddenly experienced severe chest pain while at work and was imme...|[MI, Hypertension]| -+----------------------------------------------------------------------------------------------------+------------------+ ++----------------------------------------------------------------------------------------------------+--------------+ +| text| result| ++----------------------------------------------------------------------------------------------------+--------------+ +|Mrs. Allen was diagnosed with hypertension after consistently recording blood pressure readings a...|[Hypertension]| +|Following a series of diagnostic tests, Mr. Harris was confirmed to have CAD (Coronary Artery Dis...| [CAD]| +|After presenting with crushing chest pain and diaphoresis, Mr. Stevens was diagnosed with an MI (...| [MI]| ++----------------------------------------------------------------------------------------------------+--------------+ ``` {:.model-param} diff --git a/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_mental_disorder_en.md b/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_mental_disorder_en.md index ca2c25d968..8875184a0f 100644 --- a/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_mental_disorder_en.md +++ b/docs/_posts/Cabir40/2023-10-16-multiclassifierdl_mental_disorder_en.md @@ -33,7 +33,7 @@ The Mental Disorder Classifier Model is a specialized text classification system ## Predicted Entities -`Anxiety Disorder`, `No`, `Schizophrenia`, `Depression`, `Other/Unknown` +`Anxiety Disorder`, `Bipolar disorder`, `No`, `Schizophrenia`, `Depression`, `Other/Unknown` {:.btn-box} [Live Demo](https://demo.johnsnowlabs.com/healthcare/CLASSIFICATION_MENTAL_DISORDER/){:.button.button-orange} @@ -70,7 +70,8 @@ sentence_embeddings = SentenceEmbeddings()\ # 3. Mental Disorder MultiClassifier (Using the provided model name) multilabel_classifier = MultiClassifierDLModel.pretrained("multiclassifierdl_mental_disorder", "en", "clinical/models") \ .setInputCols(["sentence_embeddings"]) \ - .setOutputCol("prediction") + .setOutputCol("prediction")\ + .setThreshold(0.999) # Creating the pipeline clf_pipeline = Pipeline(stages=[ @@ -83,10 +84,11 @@ clf_pipeline = Pipeline(stages=[ # Sample text list text_list = [ - "My brother’s hallucinations, a symptom of his schizophrenia, make daily tasks challenging for him.", - "The heavy weight of depression often leaves me struggling to find joy in activities I once loved.", - "Bipolar disorder has my mood swinging from exhilarating happiness to debilitating lows without warning.", - "My anxiety disorder frequently sets my heart racing and mind spiralling over mere hypothetical scenarios." + """The patient verbalizes feelings of worthlessness and recurrent thoughts of death, necessitating immediate intervention for severe depression.""", + """Monitoring the patient for potential side effects of lithium therapy, initiated to manage the mood fluctuations of bipolar disorder.""", + """Commenced CBT to equip the patient with coping strategies for persistent irrational fears and nervousness stemming from their anxiety disorder.""", + """Michael Anderson takes medications for schizophrenia, hypertension, hyperlipidemia, and migraines.""", + """With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has been conclusively diagnosed with Asthma, necessitating immediate commencement of anti-inflammatory medications.""" ] # Creating a DataFrame @@ -126,10 +128,11 @@ val clf_pipeline = new Pipeline().setStages(Array( )) val data = Seq(Array( - """My brother’s hallucinations, a symptom of his schizophrenia, make daily tasks challenging for him.""", - """The heavy weight of depression often leaves me struggling to find joy in activities I once loved.""", - """Bipolar disorder has my mood swinging from exhilarating happiness to debilitating lows without warning.""", - """My anxiety disorder frequently sets my heart racing and mind spiralling over mere hypothetical scenarios.""", + """The patient verbalizes feelings of worthlessness and recurrent thoughts of death, necessitating immediate intervention for severe depression.""", + """Monitoring the patient for potential side effects of lithium therapy, initiated to manage the mood fluctuations of bipolar disorder.""", + """Commenced CBT to equip the patient with coping strategies for persistent irrational fears and nervousness stemming from their anxiety disorder.""", + """Michael Anderson takes medications for schizophrenia, hypertension, hyperlipidemia, and migraines.""", + """With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has been conclusively diagnosed with Asthma, necessitating immediate commencement of anti-inflammatory medications.""", )).toDS.toDF("text") val result = clf_pipeline.fit(data).transform(data) @@ -140,14 +143,15 @@ val result = clf_pipeline.fit(data).transform(data) ## Results ```bash -+----------------------------------------------------------------------------------------------------+---------------------------------------------------+ -| text| result| -+----------------------------------------------------------------------------------------------------+---------------------------------------------------+ -| My brother’s hallucinations, a symptom of his schizophrenia, make daily tasks challenging for him.| [Anxiety disorder, Depression, Schizophrenia]| -| The heavy weight of depression often leaves me struggling to find joy in activities I once loved.| [Anxiety disorder, Depression]| -|Bipolar disorder has my mood swinging from exhilarating happiness to debilitating lows without wa...| [Anxiety disorder, Bipolar disorder]| -|My anxiety disorder frequently sets my heart racing and mind spiralling over mere hypothetical sc...|[Anxiety disorder, Schizophrenia, Bipolar disorder]| -+----------------------------------------------------------------------------------------------------+---------------------------------------------------+ ++------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ +| text| result| ++------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ +| The patient verbalizes feelings of worthlessness and recurrent thoughts of death, necessitating immediate intervention for severe depression.| [Depression]| +| Monitoring the patient for potential side effects of lithium therapy, initiated to manage the mood fluctuations of bipolar disorder.|[Bipolar disorder]| +| Commenced CBT to equip the patient with coping strategies for persistent irrational fears and nervousness stemming from their anxiety disorder.|[Anxiety disorder]| +| Michael Anderson takes medications for schizophrenia, hypertension, hyperlipidemia, and migraines.| [Schizophrenia]| +|With a clinical presentation of persistent wheezing and respiratory discomfort, the patient has been conclusively diagnosed with Asthma, necessitat...| [No]| ++------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+ ``` {:.model-param} diff --git a/docs/_posts/ahmedlone127/2023-06-21-medication_resolver_pipeline_en.md b/docs/_posts/ahmedlone127/2023-06-21-medication_resolver_pipeline_en.md index cc80035cc3..5623a73f1a 100644 --- a/docs/_posts/ahmedlone127/2023-06-21-medication_resolver_pipeline_en.md +++ b/docs/_posts/ahmedlone127/2023-06-21-medication_resolver_pipeline_en.md @@ -38,6 +38,7 @@ This pipeline can be used as Lightpipeline (with `annotate/fullAnnotate`). You c
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -64,47 +65,17 @@ nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopi
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -med_resolver_pipeline = PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") - -text = """The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""" - -result = med_resolver_pipeline.fullAnnotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val med_resolver_pipeline = new PretrainedPipeline("medication_resolver_pipeline", "en", "clinical/models") -val result = med_resolver_pipeline.fullAnnotate("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` - -{:.nlu-block} -```python -import nlu -nlu.load("en.resolve.medication").predict("""The patient was prescribed Amlodopine Vallarta 10-320mg, Eviplera. The other patient is given Lescol 40 MG and Everolimus 1.5 mg tablet.""") -``` -
## Results ```bash -Results - - | | chunks | entities | ADE | RxNorm | Action | Treatment | UMLS | SNOMED_CT | NDC_Product | NDC_Package | |---:|:-----------------------------|:-----------|:----------------------------|---------:|:---------------------------|:-------------------------------------------|:---------|:------------|:--------------|:--------------| | 0 | Amlodopine Vallarta 10-320mg | DRUG | Gynaecomastia | 722131 | NONE | NONE | C1949334 | 425838008 | 00093-7693 | 00093-7693-56 | | 1 | Eviplera | DRUG | Anxiety | 217010 | Inhibitory Bone Resorption | Osteoporosis | C0720318 | NONE | NONE | NONE | | 2 | Lescol 40 MG | DRUG | NONE | 103919 | Hypocholesterolemic | Heterozygous Familial Hypercholesterolemia | C0353573 | NONE | 00078-0234 | 00078-0234-05 | | 3 | Everolimus 1.5 mg tablet | DRUG | Acute myocardial infarction | 2056895 | NONE | NONE | C4723581 | NONE | 00054-0604 | 00054-0604-21 | - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/ahmedlone127/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md b/docs/_posts/ahmedlone127/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md index 688456ae77..fd2ca9c208 100644 --- a/docs/_posts/ahmedlone127/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md +++ b/docs/_posts/ahmedlone127/2023-06-23-umls_clinical_findings_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Clinical Findings) with their correspond
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -62,40 +63,9 @@ nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced
-
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -text = 'HTG-induced pancreatitis associated with an acute hepatitis, and obesity' - -result = pipeline.annotate(text) -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline - -val pipeline = new PretrainedPipeline("umls_clinical_findings_resolver_pipeline", "en", "clinical/models") - -val text = "HTG-induced pancreatitis associated with an acute hepatitis, and obesity" - -val result = pipeline.annotate(text) -``` - -{:.nlu-block} -```python -import nlu -nlu.load("en.map_entity.umls_clinical_findings_resolver").predict("""HTG-induced pancreatitis associated with an acute hepatitis, and obesity""") -``` -
- ## Results ```bash -Results - - +------------------------+---------+---------+ |chunk |ner_label|umls_code| +------------------------+---------+---------+ @@ -103,9 +73,6 @@ Results |an acute hepatitis |PROBLEM |C4750596 | |obesity |PROBLEM |C1963185 | +------------------------+---------+---------+ - - -{:.model-param} ``` {:.model-param} diff --git a/docs/_posts/ahmedlone127/2023-06-23-umls_drug_substance_resolver_pipeline_en.md b/docs/_posts/ahmedlone127/2023-06-23-umls_drug_substance_resolver_pipeline_en.md index 8f302e257f..6b2f35ed59 100644 --- a/docs/_posts/ahmedlone127/2023-06-23-umls_drug_substance_resolver_pipeline_en.md +++ b/docs/_posts/ahmedlone127/2023-06-23-umls_drug_substance_resolver_pipeline_en.md @@ -34,6 +34,7 @@ This pretrained pipeline maps entities (Drug Substances) with their correspondin
{% include programmingLanguageSelectScalaPythonNLU.html %} + ```python from sparknlp.pretrained import PretrainedPipeline @@ -48,9 +49,10 @@ val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") ``` +
-{:.nlu-block} -```python +## Results +```bash +-----------------------------+---------+---------+ |chunk |ner_label|umls_code| +-----------------------------+---------+---------+ @@ -59,38 +61,10 @@ val result = pipeline.annotate("The patient was given metformin, lenvatinib and |Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | +-----------------------------+---------+---------+ ``` - -{:.model-param} - -
-{% include programmingLanguageSelectScalaPythonNLU.html %} -```python -from sparknlp.pretrained import PretrainedPipeline - -pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") - -result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` -```scala -import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline -val pipeline = PretrainedPipeline("umls_drug_substance_resolver_pipeline", "en", "clinical/models") -val result = pipeline.annotate("The patient was given metformin, lenvatinib and Magnesium hydroxide 100mg/1ml") -``` -{:.nlu-block} -```python -+-----------------------------+---------+---------+ -|chunk |ner_label|umls_code| -+-----------------------------+---------+---------+ -|metformin |DRUG |C0025598 | -|lenvatinib |DRUG |C2986924 | -|Magnesium hydroxide 100mg/1ml|DRUG |C1134402 | -+-----------------------------+---------+---------+ -``` -
{:.model-param} ## Model Information