ontoportal-lirmm / annotators

Web service to add functionalities to the http://bioportal.bioontology.org and similar ontology annotators
5 stars 6 forks source link

Use NegEx/Context to post process the annotations #18

Closed jonquet closed 7 years ago

jonquet commented 7 years ago

This tasks consists in postprocessing the results of the Annotators (with the proxy) in order to apply NegEx/Context (cf emails with Wendy's group and Louise).

This will take the form of a new parameter &negex-context=true

Depending on the annotator being called (NCBO or SIFR) we will need to use the right implementation of NegEx/Context.

Task followed by @amineabdaoui

amineabdaoui commented 7 years ago

Three new parameters have been added to the proxy (issues_14_16) to handle the ConText.

For now, only the original English version of ConText is called. We are using the java source code available on: https://github.com/Blulab-Utah/ConText

When the parameter(s) negation=true (or temporality=true or experiencer=true), the corresponding ConText is called for each annotation and added to the annotation. For instance when the parameters negation and experience are turned on, the json result should be similar to:

"annotations":[{"matchType":"PREF","negationContext":"Affirmed","from":4,"to":10,"text":"CANCER","experiencerContext":"Patient"}]

The ConText is available only in the json.

Since ConText works on sentences, we first segment the text into sentences using the full stop (we may add other separators). Then, we match each annotated concept to his sentence using the available indexes. Finally, we call the desired ConText with two parameters: the concept and the sentence.

When we will finish adapting ConText to French, we will have to call the appropriate ConText according to the queried bioportal.

jonquet commented 7 years ago

What's the JSON result for temporality ? temporalityContext ? Ok for JSON only. This is the default format.

So what's the status, of this right now ? deploy locally on your machine ? on stage ?

amineabdaoui commented 7 years ago

Yes, we call it temporalityContext. It may be Recent, Historical or Hypothetical.

We are testing this on our machines by running the servlet locally which may call either the lirmm bioportal annotator or ncbo bioportal annotator and It works well.

Andon modified the structure of the annotators project and created a new branch called "issues_14_16". I am using the models he defined and working on this branch.

For now, this branch is being tested locally on our personal laptops and has not been tested on stage.

twktheainur commented 7 years ago

I have written to Vincent to do a deployment on staging, meanwhile you can run the proxy in local mode for simple tests.

In the annotators project: git pull git checkout issues_14_16 mvn clean install cd sifr-bioportal-annotator-proxy/ edit annotatorProxy.properties.sample and put the right URL for the annotator, NCBO bioportal annotator to test with context ./build_with_local_mode.sh ./run_local.sh

jonquet commented 7 years ago

Available on stage server for testing on the NCBO Annotator+:

http://services.stageportal.lirmm.fr/ncbo_annotatorplus/?text=the%20patient%20does%20not%20have%20fever&longest_only=false&exclude_numbers=false&whole_word_only=true&exclude_synonyms=false&expand_mappings=false&negation=true&ontologies=MESH&display_links=false&display_context=false

@twktheainur To deploy also on local annotator on stageportal

@amineabdaoui Could you summarize the new parameters and their possible values (as well as results) here + add a small sentence of what they mean (for the UI & documentation)

Assign to @vemonet then for UI and documentation update.

twktheainur commented 7 years ago

@jonquet Done for the deployment on /annotator on stageportal

amineabdaoui commented 7 years ago

Three parameters have been added (negation, temporality and experiencer). These parameters may take only two values (true or false). They define the context of a clinical condition (e.g. cancer).

  1. When (negation=true), the field "negationContext" is added to each annotation. It takes three possible values: a. Affirmed (default value): the annotated condition is affirmed (e.g. the patient has cancer). b. Negated: the annotated condition is negated (e.g. the patient does not have cancer). c. Possible: the annotated condition is possible (e.g. the patient may have cancer).

  2. When (temporality=true), the field "temporalityContext" is added to each annotation. It takes three possible values: **a. Recent (default value): the annotated condition is recent (e.g. the patient has cancer now). b. Historical: the annotated condition is historical (e.g. the patient had cancer during his childhood). The condition is considered historical if it is defined as beginning at least 14 days before the visit. c. Hypothetical:** the annotated condition is hypothetical, which covers all conditions that temporally are neither recent nor historical. (e.g. the patient should return if any tumor is detected).

  3. When (experiencer=true), the field "experiencerContext" is added to each annotation. It takes two possible values: a. Patient (default value): the annotated condition is experienced by the patient (e.g. the patient has cancer). b. Other: the annotated condition is experienced by someone other than the patient.(e.g. the patient's father has cancer).

jonquet commented 7 years ago

Pour la phrase: Le patient ne montre aucun signe de fièvre. Son père a déjà eu de l’arthrose. Il a des antécédents de dépression.

Test sur le web service direct, ok. http://data.stageportal.lirmm.fr/annotator/?

Mais test sur le proxy pas ok: http://services.stageportal.lirmm.fr/annotator/?text=Le%20patient%20ne%20montre%20aucun%20signe%20de%20fi%C3%A8vre.%20Son%20p%C3%A8re%20a%20d%C3%A9j%C3%A0%20eu%20de%20l%E2%80%99arthrose.%20Il%20a%20des%20ant%C3%A9c%C3%A9dents%20de%20d%C3%A9pression.&ontologies=MSHFRE&longest_only=false&exclude_numbers=false&whole_word_only=true&exclude_synonyms=false&expand_mappings=false&display_links=false&display_context=false&negation=true&temporality=true&experiencer=true&apikey=[STAGEPORTAL APIKEY] It seems there is a problem with the API key transfered.

But this example on the NCBO Annotator Plus works (partially) http://services.stageportal.lirmm.fr/ncbo_annotatorplus/?text=The%20patient%20shows%20no%20signs%20of%20fever.%20His%20father%20already%20had%20osteoarthritis.%20He%20has%20a%20history%20of%20depression.&ontologies=MESH&longest_only=false&exclude_numbers=false&whole_word_only=true&exclude_synonyms=false&expand_mappings=false&display_links=false&display_context=false&negation=true&temporality=true&experiencer=true&apikey=[NCBO BIOPORTAL APIKEY]

@amineabdaoui This looks like a bug: The previous example retunrs negation, temportality and experiencer only for the first sentence.

twktheainur commented 7 years ago

The proxy I deployed used services.bioportal.lirmm.fr as the URL for the annotator, that is the production server proxy annotator. That's why the API key didn't work. I have deployed it again with http://data.stageportal.lirmm.fr/annotator? as the annotator URI. It should solve part of the problem.

There was a bug in Context starting from the second sentence, it's now fixed. All the examples here will work.

jonquet commented 7 years ago

Sounds good! Assigning to @vemonet for the UI development.

twktheainur commented 7 years ago

@jonquet We pushed the modified UI on stageportal with @vemonet, you can now make demos and test the interface. If it's ok, we can move it to production.

jonquet commented 7 years ago

Closed as moved to production end of March. We have to evaluate the results now!