Hi Chris,

Sounds good.  

Sean

-----Original Message-----
From: Chris Hinkle [mailto:hin...@all-turtles.com] 
Sent: Tuesday, August 08, 2017 6:44 PM
To: dev@ctakes.apache.org
Subject: Re: default clinical pipeline: questions about polarity [EXTERNAL]

Thanks Sean,

I was able to achieve what I wanted by adding the ContextAnnotator to the 
default clinical pipeline like so:

public class Pipeline

{

  public static AggregateBuilder getAggregateBuilder( ) throws Exception

     {

          AggregateBuilder builder = new AggregateBuilder( );

builder.add( ClinicalPipelineFactory.getDefaultPipeline( ) );

  builder.add( ContextAnnotator.createAnnotatorDescription( ) );

  return builder;

  }

}


-Chris

On Tue, Aug 8, 2017 at 2:36 PM, Finan, Sean < sean.fi...@childrens.harvard.edu> 
wrote:

> Hi Chris,
>
> No, you are not missing anything.
>
> The example on the wiki was concocted to display what ctakes should do.
> There are a few different negation modules (and you can write your own).
> Using the Assertion module you will not get negated lesions.  Using 
> the ContextAnnotator you will.
>
> I did the following:
>
> In ctakes-examples , edit org.apache.ctakes.examples.pipeline.
> HelloWorldPropsPiperRunner.java
> HelloWorldPropsPiperRunner uses the ContextAnnotator for negation.
> Change DOC_TEXT to be the example sentence.  The output is:
>
>                 4,11        patient
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 24,26     CT
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 27,31     Scan
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 35,40     April
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 47,50     did
>                                 | negated | certain | not conditional 
> | not generic | Patient | history of: 0
>                 47,54     did not
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 51,54     not
>                                 | affirmed | certain | not conditional 
> | not generic | Patient | history of: 0
>                 62,69     lesions
>                                 | negated | certain | not conditional 
> | not generic | Patient | history of: 0
>                 77,82     liver
>                                 | negated | certain | not conditional 
> | not generic | Patient | history of: 0
>
> Notice that the context annotator marked lesions as negated.
>
> I hope that makes sense.
> Sean
>
>
> From: Chris Hinkle [mailto:hin...@all-turtles.com]
> Sent: Tuesday, August 08, 2017 5:00 PM
> To: dev@ctakes.apache.org
> Subject: default clinical pipeline: questions about polarity 
> [EXTERNAL]
>
> Hi cTAKES Team,
>
> I've recently started exploring cTAKES and I'm excited about the 
> potential. However, I'm having trouble seeing the results as they're 
> exemplified in the documentation using the example input "The patient 
> underwent a CT Scan in April which did not reveal lesions in his liver."
>
> Specifically negation (polarity) values don't seem to be populated as 
> they are shown in the Default Clinical Pipeline documentation wiki 
> page< 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_
> confluence_display_CTAKES_Default-2BClinical-2BPipeline&
> d=DwMFaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> dTK9VzFknYGrOowQ4jIqy8xeqw9DIClZjRUaj_xs894&s=26Dy4rIl2LIwaRk5o3q8pmAh
> ISj_ lyCX90hVe2sAV58&e=>. I've built a simple java class which 
> instantiates the Default Pipeline like so
>
>
> static AnalysisEngine pipeline;
>
> …
>
> log.info( "Initilizing Pipeline..." );
>
>
>
> try
>
> {
>
>      AggregateBuilder builder = new AggregateBuilder( );
>
>      builder.add( ClinicalPipelineFactory.getDefaultPipeline( ) );
>
>      pipeline = builder.createAggregate( );
>
> }
>
> catch( Exception e )
>
> {
>
>      log.error( e );
>
> }
>
> …
>
>
>
> I then instantiate a CAS and process it like so:
>
>
>
> try
>
> {
>
>      JCas jcas = pipeline.newJCas( );
>
>      jcas.setDocumentText( "The patient underwent a CT Scan in April 
> which did not reveal lesions in his liver." );
>
>      pipeline.process( jcas );
>
> }
>
> catch( Exception e )
>
> {
>
>      log.error( e );
>
> }
>
> …
>
>
>
> I've set my UMLS username and password as environment variables, and 
> UMLS lookups are working just fine. The CAS contains the same 
> identified annotations as the example, i.e. The 
> AnatomicalSiteMentions, SignSymptomMentions, etc, however, the fields 
> for polarity are all 1. The documentation on the wiki page for 
> Assertion Component Use Guide< 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_
> confluence_display_CTAKES_cTAKES-2B4.0-2B-2D-2BAssertion&d=DwMFaQ&c=
> qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=
> fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=
> dTK9VzFknYGrOowQ4jIqy8xeqw9DIClZjRUaj_xs894&s=
> AdLHU8Zne1EOqbGocT4o22Ylyl32B-xRHMtogDho9r4&e=>, and the 
> aforementioned wiki page for the default clinical pipeline lead me to 
> think that the polarity field for the 'lesions' concept would be set 
> to 1, and leave the rest -1.
>
>
>
> Is there something I'm missing? Perhaps I'm not looking in the right 
> place, or haven't done all of the configuration required to exercise 
> those features of cTAKES?
>
>
>
> I've attached the serialized CAS object to this email for reference.
>
>
>
>
>
>
>
> Best,
>
> Chris
>
>
> --
> Chris Hinkle
> All Turtles
> 347-407-4993
>



--
Chris Hinkle
All Turtles
347-407-4993

Reply via email to