You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by Nick Nikandish <sn...@emerginghealthit.com> on 2014/06/25 17:37:38 UTC

OrangeBookFilterConsumerImpl

Hi There,

I am using Ctakes and have added my own annotators that utilize CTakes. I need to use the medication annotator so I can retrieve the medication names. In OrangeBookFilterConsumerImpl class , consumeHits() method has a statements:
final boolean isValid = isValid( "trade_name", text ) || isValid( "ingredient", text );

It filters out some medication that I actually need. I made this change "boolean isValid= ture"  to the code and made it work but I was wondering if there was another way like changing something in the xml files that  have the same impact  without changing the code?


Thanks,
Nick Nikandish
Product Development Software Engineer
Clinical Research Informatics

Emerging Health
Montefiore Information Technology
6 Executive Blvd. Suite 290, Yonkers, NY 10701
914-457-6792 Office
snikandi@montefiore.org<ma...@montefiore.org>
www.emerginghealthit.com<http://www.emerginghealthit.com/>
www.montefiore.org<http://www.montefiore.org/>

[logo-montefiore-it]


RE: OrangeBookFilterConsumerImpl

Posted by Nick Nikandish <sn...@emerginghealthit.com>.
I had a mistake, I needed to added this line: <property key="luceneFilterExtResrcKey" value="NamedEntityLookupConsumer"/>

I worked now, Many thanks for your help.
-Nick



-----Original Message-----
From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu] 
Sent: Wednesday, June 25, 2014 12:14 PM
To: dev@ctakes.apache.org
Subject: RE: OrangeBookFilterConsumerImpl

1) Could you debug/confirm that MedicationMentions are created by Annotator and the new consumer?   If not, attach the db config xml and version of cTAKES you are using?
2) Just an FYI: did you know you can use uimaFIT's JCasUtil to simplify the example code you had?
Collection< MedicationMention> mentions = JCasUtil.select(jcas, MedicationMention.class);
	    for(MedicationMention mention : mentions) {
		//some work here
	    }

> -----Original Message-----
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 12:04 PM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Hi Pei,
> 
> Thanks, I used NamedEntityLookupConsumerImpl that you mentioned now 
> that but I am getting an error here:
> 
> Map<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept>
> medicationAnnotator(JCas aJCas){
>     	Map<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept> ocMap =
>         		new HashMap<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept>();
>         FSIndex medIndex =
> aJCas.getAnnotationIndex(MedicationMention.type);
>         Iterator<MedicationMention> medIter = medIndex.iterator();
> 
>         while (medIter.hasNext())
>         {
>         	MedicationMention medMen = medIter.next();
>         	ocMap.put(medMen.getCoveredText().toLowerCase(),
> medMen.getOntologyConceptArr(0));
>     	}
>         System.out.println("Medication: "+ 
> patternLists.createPatternList(ocMap.keySet()).toLowerCase());
>         return ocMap;
> 
>     }
> 
> I wrote this code in my own annotator to retrieve  the medication 
> names but this is not returning anything now. Which class should I  
> use now to get medication names?
> 
> -----Original Message-----
> From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu]
> Sent: Wednesday, June 25, 2014 11:53 AM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Nick,
> If I'm reading it correctly, that code change essentially tells it to 
> bypass the OrangeBookFilter completely.
> If that is the behavior you're looking for (i.e. return all of the 
> drugs bypassing the OrangeBookFilter, then you can just modify the 
> lookupConsumer className in your LookupDesc_Db.xml.  Try something 
> like the NamedEntityLookupConsumerImpl.class or similar (i.e. no 
> filters) I don't recall the exact name on the top of my head.
> --Pei
> 
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 11:38 AM
> To: dev@ctakes.apache.org
> Subject: OrangeBookFilterConsumerImpl
> 
> Hi There,
> 
> I am using Ctakes and have added my own annotators that utilize 
> CTakes. I need to use the medication annotator so I can retrieve the 
> medication names. In OrangeBookFilterConsumerImpl class , 
> consumeHits() method has a statements:
> final boolean isValid = isValid( "trade_name", text ) || isValid( 
> "ingredient", text );
> 
> It filters out some medication that I actually need. I made this 
> change "boolean isValid= ture"  to the code and made it work but I was 
> wondering if there was another way like changing something in the xml 
> files that  have the same impact  without changing the code?
> 
> 
> Thanks,
> Nick Nikandish
> Product Development Software Engineer
> Clinical Research Informatics
> 
> Emerging Health
> Montefiore Information Technology
> 6 Executive Blvd. Suite 290, Yonkers, NY 10701
> 914-457-6792 Office
> snikandi@montefiore.org<ma...@montefiore.org>
> www.emerginghealthit.com<http://www.emerginghealthit.com/>
> www.montefiore.org<http://www.montefiore.org/>
> 
> [logo-montefiore-it]


RE: OrangeBookFilterConsumerImpl

Posted by Nick Nikandish <sn...@emerginghealthit.com>.
Hi Pei,

I debugged NamedEntityLookupConsumerImpl and it seems that it never hits neAnnot = new MedicationMention( jcas ); so the MedicationMentioned never gets populated. 
And yes, I am aware of uimaFit and I acutely  developed my code in uimaFit them I migrated them to CTakes. Here is my xml.


-----Original Message-----
From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu] 
Sent: Wednesday, June 25, 2014 12:14 PM
To: dev@ctakes.apache.org
Subject: RE: OrangeBookFilterConsumerImpl

1) Could you debug/confirm that MedicationMentions are created by Annotator and the new consumer?   If not, attach the db config xml and version of cTAKES you are using?
2) Just an FYI: did you know you can use uimaFIT's JCasUtil to simplify the example code you had?
Collection< MedicationMention> mentions = JCasUtil.select(jcas, MedicationMention.class);
	    for(MedicationMention mention : mentions) {
		//some work here
	    }

> -----Original Message-----
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 12:04 PM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Hi Pei,
> 
> Thanks, I used NamedEntityLookupConsumerImpl that you mentioned now 
> that but I am getting an error here:
> 
> Map<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept>
> medicationAnnotator(JCas aJCas){
>     	Map<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept> ocMap =
>         		new HashMap<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept>();
>         FSIndex medIndex =
> aJCas.getAnnotationIndex(MedicationMention.type);
>         Iterator<MedicationMention> medIter = medIndex.iterator();
> 
>         while (medIter.hasNext())
>         {
>         	MedicationMention medMen = medIter.next();
>         	ocMap.put(medMen.getCoveredText().toLowerCase(),
> medMen.getOntologyConceptArr(0));
>     	}
>         System.out.println("Medication: "+ 
> patternLists.createPatternList(ocMap.keySet()).toLowerCase());
>         return ocMap;
> 
>     }
> 
> I wrote this code in my own annotator to retrieve  the medication 
> names but this is not returning anything now. Which class should I  
> use now to get medication names?
> 
> -----Original Message-----
> From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu]
> Sent: Wednesday, June 25, 2014 11:53 AM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Nick,
> If I'm reading it correctly, that code change essentially tells it to 
> bypass the OrangeBookFilter completely.
> If that is the behavior you're looking for (i.e. return all of the 
> drugs bypassing the OrangeBookFilter, then you can just modify the 
> lookupConsumer className in your LookupDesc_Db.xml.  Try something 
> like the NamedEntityLookupConsumerImpl.class or similar (i.e. no 
> filters) I don't recall the exact name on the top of my head.
> --Pei
> 
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 11:38 AM
> To: dev@ctakes.apache.org
> Subject: OrangeBookFilterConsumerImpl
> 
> Hi There,
> 
> I am using Ctakes and have added my own annotators that utilize 
> CTakes. I need to use the medication annotator so I can retrieve the 
> medication names. In OrangeBookFilterConsumerImpl class , 
> consumeHits() method has a statements:
> final boolean isValid = isValid( "trade_name", text ) || isValid( 
> "ingredient", text );
> 
> It filters out some medication that I actually need. I made this 
> change "boolean isValid= ture"  to the code and made it work but I was 
> wondering if there was another way like changing something in the xml 
> files that  have the same impact  without changing the code?
> 
> 
> Thanks,
> Nick Nikandish
> Product Development Software Engineer
> Clinical Research Informatics
> 
> Emerging Health
> Montefiore Information Technology
> 6 Executive Blvd. Suite 290, Yonkers, NY 10701
> 914-457-6792 Office
> snikandi@montefiore.org<ma...@montefiore.org>
> www.emerginghealthit.com<http://www.emerginghealthit.com/>
> www.montefiore.org<http://www.montefiore.org/>
> 
> [logo-montefiore-it]


RE: OrangeBookFilterConsumerImpl

Posted by "Chen, Pei" <Pe...@childrens.harvard.edu>.
1) Could you debug/confirm that MedicationMentions are created by Annotator and the new consumer?   If not, attach the db config xml and version of cTAKES you are using?
2) Just an FYI: did you know you can use uimaFIT's JCasUtil to simplify the example code you had?
Collection< MedicationMention> mentions = JCasUtil.select(jcas, MedicationMention.class);
	    for(MedicationMention mention : mentions) {
		//some work here
	    }

> -----Original Message-----
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 12:04 PM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Hi Pei,
> 
> Thanks, I used NamedEntityLookupConsumerImpl that you mentioned now
> that but I am getting an error here:
> 
> Map<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept>
> medicationAnnotator(JCas aJCas){
>     	Map<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept> ocMap =
>         		new HashMap<String,
> org.apache.ctakes.typesystem.type.refsem.OntologyConcept>();
>         FSIndex medIndex =
> aJCas.getAnnotationIndex(MedicationMention.type);
>         Iterator<MedicationMention> medIter = medIndex.iterator();
> 
>         while (medIter.hasNext())
>         {
>         	MedicationMention medMen = medIter.next();
>         	ocMap.put(medMen.getCoveredText().toLowerCase(),
> medMen.getOntologyConceptArr(0));
>     	}
>         System.out.println("Medication: "+
> patternLists.createPatternList(ocMap.keySet()).toLowerCase());
>         return ocMap;
> 
>     }
> 
> I wrote this code in my own annotator to retrieve  the medication names but
> this is not returning anything now. Which class should I  use now to get
> medication names?
> 
> -----Original Message-----
> From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu]
> Sent: Wednesday, June 25, 2014 11:53 AM
> To: dev@ctakes.apache.org
> Subject: RE: OrangeBookFilterConsumerImpl
> 
> Nick,
> If I'm reading it correctly, that code change essentially tells it to bypass the
> OrangeBookFilter completely.
> If that is the behavior you're looking for (i.e. return all of the drugs bypassing
> the OrangeBookFilter, then you can just modify the lookupConsumer
> className in your LookupDesc_Db.xml.  Try something like the
> NamedEntityLookupConsumerImpl.class or similar (i.e. no filters) I don't
> recall the exact name on the top of my head.
> --Pei
> 
> From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
> Sent: Wednesday, June 25, 2014 11:38 AM
> To: dev@ctakes.apache.org
> Subject: OrangeBookFilterConsumerImpl
> 
> Hi There,
> 
> I am using Ctakes and have added my own annotators that utilize CTakes. I
> need to use the medication annotator so I can retrieve the medication
> names. In OrangeBookFilterConsumerImpl class , consumeHits() method has
> a statements:
> final boolean isValid = isValid( "trade_name", text ) || isValid( "ingredient",
> text );
> 
> It filters out some medication that I actually need. I made this change
> "boolean isValid= ture"  to the code and made it work but I was wondering if
> there was another way like changing something in the xml files that  have the
> same impact  without changing the code?
> 
> 
> Thanks,
> Nick Nikandish
> Product Development Software Engineer
> Clinical Research Informatics
> 
> Emerging Health
> Montefiore Information Technology
> 6 Executive Blvd. Suite 290, Yonkers, NY 10701
> 914-457-6792 Office
> snikandi@montefiore.org<ma...@montefiore.org>
> www.emerginghealthit.com<http://www.emerginghealthit.com/>
> www.montefiore.org<http://www.montefiore.org/>
> 
> [logo-montefiore-it]


RE: OrangeBookFilterConsumerImpl

Posted by Nick Nikandish <sn...@emerginghealthit.com>.
Hi Pei,

Thanks, I used NamedEntityLookupConsumerImpl that you mentioned now  that but I am getting an error here: 

Map<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept> medicationAnnotator(JCas aJCas){
    	Map<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept> ocMap = 
        		new HashMap<String, org.apache.ctakes.typesystem.type.refsem.OntologyConcept>();
        FSIndex medIndex = aJCas.getAnnotationIndex(MedicationMention.type); 
        Iterator<MedicationMention> medIter = medIndex.iterator();
        
        while (medIter.hasNext())
        {
        	MedicationMention medMen = medIter.next();  
        	ocMap.put(medMen.getCoveredText().toLowerCase(), medMen.getOntologyConceptArr(0));
    	} 
        System.out.println("Medication: "+ patternLists.createPatternList(ocMap.keySet()).toLowerCase());
        return ocMap;
        		
    }

I wrote this code in my own annotator to retrieve  the medication names but this is not returning anything now. Which class should I  use now to get medication names?

-----Original Message-----
From: Chen, Pei [mailto:Pei.Chen@childrens.harvard.edu] 
Sent: Wednesday, June 25, 2014 11:53 AM
To: dev@ctakes.apache.org
Subject: RE: OrangeBookFilterConsumerImpl

Nick,
If I'm reading it correctly, that code change essentially tells it to bypass the OrangeBookFilter completely.
If that is the behavior you're looking for (i.e. return all of the drugs bypassing the OrangeBookFilter, then you can just modify the lookupConsumer className in your LookupDesc_Db.xml.  Try something like the NamedEntityLookupConsumerImpl.class or similar (i.e. no filters) I don't recall the exact name on the top of my head.
--Pei

From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
Sent: Wednesday, June 25, 2014 11:38 AM
To: dev@ctakes.apache.org
Subject: OrangeBookFilterConsumerImpl

Hi There,

I am using Ctakes and have added my own annotators that utilize CTakes. I need to use the medication annotator so I can retrieve the medication names. In OrangeBookFilterConsumerImpl class , consumeHits() method has a statements:
final boolean isValid = isValid( "trade_name", text ) || isValid( "ingredient", text );

It filters out some medication that I actually need. I made this change "boolean isValid= ture"  to the code and made it work but I was wondering if there was another way like changing something in the xml files that  have the same impact  without changing the code?


Thanks,
Nick Nikandish
Product Development Software Engineer
Clinical Research Informatics

Emerging Health
Montefiore Information Technology
6 Executive Blvd. Suite 290, Yonkers, NY 10701
914-457-6792 Office
snikandi@montefiore.org<ma...@montefiore.org>
www.emerginghealthit.com<http://www.emerginghealthit.com/>
www.montefiore.org<http://www.montefiore.org/>

[logo-montefiore-it]


RE: OrangeBookFilterConsumerImpl

Posted by "Chen, Pei" <Pe...@childrens.harvard.edu>.
Nick,
If I'm reading it correctly, that code change essentially tells it to bypass the OrangeBookFilter completely.
If that is the behavior you're looking for (i.e. return all of the drugs bypassing the OrangeBookFilter, then you can just modify the lookupConsumer className in your LookupDesc_Db.xml.  Try something like the NamedEntityLookupConsumerImpl.class or similar (i.e. no filters) I don't recall the exact name on the top of my head.
--Pei

From: Nick Nikandish [mailto:snikandi@emerginghealthit.com]
Sent: Wednesday, June 25, 2014 11:38 AM
To: dev@ctakes.apache.org
Subject: OrangeBookFilterConsumerImpl

Hi There,

I am using Ctakes and have added my own annotators that utilize CTakes. I need to use the medication annotator so I can retrieve the medication names. In OrangeBookFilterConsumerImpl class , consumeHits() method has a statements:
final boolean isValid = isValid( "trade_name", text ) || isValid( "ingredient", text );

It filters out some medication that I actually need. I made this change "boolean isValid= ture"  to the code and made it work but I was wondering if there was another way like changing something in the xml files that  have the same impact  without changing the code?


Thanks,
Nick Nikandish
Product Development Software Engineer
Clinical Research Informatics

Emerging Health
Montefiore Information Technology
6 Executive Blvd. Suite 290, Yonkers, NY 10701
914-457-6792 Office
snikandi@montefiore.org<ma...@montefiore.org>
www.emerginghealthit.com<http://www.emerginghealthit.com/>
www.montefiore.org<http://www.montefiore.org/>

[logo-montefiore-it]