You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ctakes.apache.org by Bandeep Singh <bs...@phemi.com> on 2016/10/26 18:19:38 UTC

Re: Finding Medical terms given a string through ctakes(UMLS).

Hi Shyam,

As per the output you are getting, *all* the terms are indeed medical terms.

For example, shark bite is infact a medical term with a valid UMLS and
SNOWMED CT codes.

So, the output you are getting is correct

I am in no way an expert on this, however, The little knowledge i have on
this topic i would like to suggest few things:
1) Check the IdentifiedAnnotation.java class since it contains all the
getters/setters  for the annotations. You can select probably the ones you
want.
2) Also, There is a parameter in *JcasTermAnnotator* *class* called
*PARAM_EXC_TAGS_KEY, *which has default values like which words in the
sentence to annotate like verbs, nouns adjectives etc, you can play around
with that parameter to include only specific parts of speech.

Really sorry for giving such naive solutions, since i am also new in the
world of cTakes.

Hope it Helps,
Bandeep

On Thu, Oct 20, 2016 at 10:29 PM, Ks Sunder <sh...@gmail.com> wrote:

> Hi All,
> Please help me on this issue,
>
> I have written below code..
>
> package com.shyam.Test;
>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collection;
>
> import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory;
> import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupA
> nnotator;
> import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
> import org.apache.uima.UIMAException;
> import org.apache.uima.analysis_engine.AnalysisEngineDescription;
> import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
> import org.apache.uima.cas.CASRuntimeException;
> import org.apache.uima.fit.factory.JCasFactory;
> import org.apache.uima.fit.pipeline.SimplePipeline;
> import org.apache.uima.fit.util.JCasUtil;
> import org.apache.uima.jcas.JCas;
> import org.apache.uima.resource.ResourceInitializationException;
>
> public class DefaultPipeLine {
> public static void main(String[] args) {
>       try {
>   final String note = " History of diabetes and hypertension."
>                           + " Mother had breast cancer."
>                           + " Sister with multiple sclerosis."
>                           + " The patient is suffering from extreme pain
> due to shark bite."
>                           + " Recommend continuing use of aspirin,
> oxycodone, and coumadin."
>                           + " Continue exercise for obesity and
> hypertension.";
>
>
>   final JCas jcas = JCasFactory.createJCas();
>   jcas.setDocumentText( note );
>    // final AnalysisEngineDescription aed = ClinicalPipelineFactory.getDef
> aultPipeline();
>             final AnalysisEngineDescription aed =
> ClinicalPipelineFactory.getFastPipeline();  // Outputs from default and
> fast pipelines are identical
>             // final AnalysisEngineDescription uml =
> UmlsDictionaryLookupAnnotator.createAnnotatorDescription();
>
>
>              SimplePipeline.runPipeline( jcas, aed );
>
>   final Collection<String> codes = new ArrayList<>();
>   for ( IdentifiedAnnotation entity : JCasUtil.select( jcas,
> IdentifiedAnnotation.class ) ) {
>
>      System.out.println( "Entity: " + entity.getCoveredText()
>                          + " === Polarity: " + entity.getPolarity()
>      );
>                //  System.out.println("!!!!!!!!!! Task is Completed
> !!!!!!!!!!!!!!!");
>
>
>   }
>
>
> } catch (CASRuntimeException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (AnalysisEngineProcessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (ResourceInitializationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (UIMAException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>    }
> }
>
>
> o/p is :
>
> Entity: History of === Polarity: 1
> Entity: History === Polarity: 1
> Entity: diabetes === Polarity: 1
> Entity: hypertension === Polarity: 1
> Entity: breast cancer === Polarity: 1
> Entity: breast === Polarity: 1
> Entity: cancer === Polarity: 1
> Entity: multiple sclerosis === Polarity: 1
> Entity: sclerosis === Polarity: 1
> Entity: pain === Polarity: 1
> Entity: shark bite === Polarity: 1
> Entity: bite === Polarity: 1
> Entity: bite === Polarity: 1
> Entity: aspirin === Polarity: 1
> Entity: oxycodone === Polarity: 1
> Entity: oxycodone === Polarity: 1
> Entity: coumadin === Polarity: 1
> Entity: exercise === Polarity: 1
> Entity: obesity === Polarity: 1
> Entity: hypertension === Polarity: 1
>
> im getting non medical and medical terms , so how can avoid non medical
> terms , i want o/p is only medical terms .
>
> please help me.
>
> regards,
> shyam k.
>

RE: Finding Medical terms given a string through ctakes(UMLS).

Posted by "Finan, Sean" <Se...@childrens.harvard.edu>.
Hi Shyam,

Instead of getting all Identified annotations:
	JCasUtil.select( jcas, IdentifiedAnnotation.class )

You can get desired subclasses:
	JCasUtil.select( jcas, AnatomicalSiteMention.class )
	JCasUtil.select( jcas, DiseaseDisorderMention.class )
	JCasUtil.select( jcas, MedicationMention.class )
	JCasUtil.select( jcas, ProcedureMention.class )
	JCasUtil.select( jcas, SignSymptomMention.class )

Sean


-----Original Message-----
From: Bandeep Singh [mailto:bsingh@phemi.com] 
Sent: Wednesday, October 26, 2016 2:20 PM
To: Ks Sunder
Cc: dev@ctakes.apache.org; user@ctakes.apache.org
Subject: Re: Finding Medical terms given a string through ctakes(UMLS).

Hi Shyam,

As per the output you are getting, *all* the terms are indeed medical terms.

For example, shark bite is infact a medical term with a valid UMLS and SNOWMED CT codes.

So, the output you are getting is correct

I am in no way an expert on this, however, The little knowledge i have on this topic i would like to suggest few things:
1) Check the IdentifiedAnnotation.java class since it contains all the getters/setters  for the annotations. You can select probably the ones you want.
2) Also, There is a parameter in *JcasTermAnnotator* *class* called *PARAM_EXC_TAGS_KEY, *which has default values like which words in the sentence to annotate like verbs, nouns adjectives etc, you can play around with that parameter to include only specific parts of speech.

Really sorry for giving such naive solutions, since i am also new in the world of cTakes.

Hope it Helps,
Bandeep

On Thu, Oct 20, 2016 at 10:29 PM, Ks Sunder <sh...@gmail.com> wrote:

> Hi All,
> Please help me on this issue,
>
> I have written below code..
>
> package com.shyam.Test;
>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collection;
>
> import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory;
> import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupA
> nnotator;
> import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
> import org.apache.uima.UIMAException;
> import org.apache.uima.analysis_engine.AnalysisEngineDescription;
> import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
> import org.apache.uima.cas.CASRuntimeException;
> import org.apache.uima.fit.factory.JCasFactory;
> import org.apache.uima.fit.pipeline.SimplePipeline;
> import org.apache.uima.fit.util.JCasUtil;
> import org.apache.uima.jcas.JCas;
> import org.apache.uima.resource.ResourceInitializationException;
>
> public class DefaultPipeLine {
> public static void main(String[] args) {
>       try {
>   final String note = " History of diabetes and hypertension."
>                           + " Mother had breast cancer."
>                           + " Sister with multiple sclerosis."
>                           + " The patient is suffering from extreme 
> pain due to shark bite."
>                           + " Recommend continuing use of aspirin, 
> oxycodone, and coumadin."
>                           + " Continue exercise for obesity and 
> hypertension.";
>
>
>   final JCas jcas = JCasFactory.createJCas();
>   jcas.setDocumentText( note );
>    // final AnalysisEngineDescription aed = 
> ClinicalPipelineFactory.getDef aultPipeline();
>             final AnalysisEngineDescription aed = 
> ClinicalPipelineFactory.getFastPipeline();  // Outputs from default 
> and fast pipelines are identical
>             // final AnalysisEngineDescription uml = 
> UmlsDictionaryLookupAnnotator.createAnnotatorDescription();
>
>
>              SimplePipeline.runPipeline( jcas, aed );
>
>   final Collection<String> codes = new ArrayList<>();
>   for ( IdentifiedAnnotation entity : JCasUtil.select( jcas, 
> IdentifiedAnnotation.class ) ) {
>
>      System.out.println( "Entity: " + entity.getCoveredText()
>                          + " === Polarity: " + entity.getPolarity()
>      );
>                //  System.out.println("!!!!!!!!!! Task is Completed 
> !!!!!!!!!!!!!!!");
>
>
>   }
>
>
> } catch (CASRuntimeException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (AnalysisEngineProcessException e) { // TODO Auto-generated 
> catch block e.printStackTrace(); } catch 
> (ResourceInitializationException e) { // TODO Auto-generated catch 
> block e.printStackTrace(); } catch (UIMAException e) { // TODO 
> Auto-generated catch block e.printStackTrace(); }
>    }
> }
>
>
> o/p is :
>
> Entity: History of === Polarity: 1
> Entity: History === Polarity: 1
> Entity: diabetes === Polarity: 1
> Entity: hypertension === Polarity: 1
> Entity: breast cancer === Polarity: 1
> Entity: breast === Polarity: 1
> Entity: cancer === Polarity: 1
> Entity: multiple sclerosis === Polarity: 1
> Entity: sclerosis === Polarity: 1
> Entity: pain === Polarity: 1
> Entity: shark bite === Polarity: 1
> Entity: bite === Polarity: 1
> Entity: bite === Polarity: 1
> Entity: aspirin === Polarity: 1
> Entity: oxycodone === Polarity: 1
> Entity: oxycodone === Polarity: 1
> Entity: coumadin === Polarity: 1
> Entity: exercise === Polarity: 1
> Entity: obesity === Polarity: 1
> Entity: hypertension === Polarity: 1
>
> im getting non medical and medical terms , so how can avoid non 
> medical terms , i want o/p is only medical terms .
>
> please help me.
>
> regards,
> shyam k.
>