Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Once you have finished installing cTAKES and its separately-bundled resources, you will be able to see what cTAKES is capable of.

Prerequisites

 

 

Step

 

 

Example

1. Make sure you have Java 1.7 or higher.

Run this command to check your version.

Windows and Linux:

Code Block
languagenone
java -version

Windows:

Code Block
languagenone
C:\>java -version 
java version "1.7.0_20" Java(TM) SE Runtime Environment ...


Linux:

Code Block
languagenone
user@system:/$ java -version
java version "1.7.0_22"
OpenJDK Runtime Environment ...

Install cTAKES

 

 

Step

 

 

Example

1. Do no try this until AFTER cTAKES 4.0 is released (this 4.0 document is still a DRAFT): On the cTAKES d ownloads downloads page, download the the User Installation package.

Info

The download time will be commensurate with ~650 MB of data.

 

2. (Recommended) Verify the downloaded files against a signature to ensure you have the proper and complete file.

From the following directory, download the signature file that corresponds to your download from step 1

https://www.apache.org/dist/ctakes/ctakes-4.0.0/ 

 Please do not download any of the files that end with .zip or .gz directly from apache.org/dist - use the downloads page listed in step 1 if you need to download cTAKES itself so that a mirror can be used.

No example

3. Unzip the file you downloaded into a directory that you want to be the cTAKES install location. The compressed files contain a single directory at the top level. This folder we will call <cTAKES_HOME>. You will need to refer to this directory later.

Windows:

Code Block
languagenone
C:\apache-ctakes-4.0.0

Linux:

Code Block
languagenone
/usr/local/apache-ctakes-4.0.0

Windows:

Linux:

Code Block
languagenone
tar -xvf apache-ctakes-4.0.0.bin.tar.gz -C /usr/local 

4. Download the cTAKES resources ZIP file with a matching version from the ctakesresources project (More information on cTAKES models). These resources are required to operate cTAKES.

Info

Due to licensing considerations, resources are hosted at an external location. For ease of installation, a single package was created with all the resources you will need. Licensing for these resources is found within the download.

Info

Download time will be commensurate with 1GB of data.


Unzip the cTAKES resources file into a temporary location.

Windows:


Linux:

Code Block
langnone
cd /tmp
wget http://sourceforge.net/projects/ctakesresources/files/ctakes-resources-4.0.0.zip
sudo unzip ctakes-resources-4.0.0.zip

5. Copy (or move) the resources to cTAKES_HOME.
Copy the contents of the temporary resources directory (and all sub-directories) to <cTAKES_HOME>/resources.

Info

There may be conflicts while taking this action. Overwrite the cTAKES_HOME files with those in the resources download.

Windows:

Code Block
langnone
xcopy /s C:\temp\ctakes-resources-4.0.0\resources C:\apache-ctakes-4.0.0\resources

Linux:

Code Block
langnone
cp -R /tmp/resources/* /usr/local/apache-ctakes-4.0.0/resources

Mac OSX:

Code Block
langnone
ditto /tmp/resources/* /usr/local/apache-ctakes-4.0.0/resources

(Recommended) Add UMLS access rights

Note

In the initial setup cTAKES will recognize only few sample concepts in text. If you wish to perform named entity recognition or concept identification for anything other than these few words, you will need to 1) obtain the rights to use UMLS resources 2) add those credentials to cTAKES, and 3) use a cTAKES pipeline that makes use of those UMLS resources. If you don't, cTAKES will work but won't recognize much.

 

 

Step

 

 

Example

1. If you do not have a UMLS username and password, you may request one at UMLS Terminology Services.

No example

2. Once you have your UMLS username and password, edit the following files. Find the lines in each script that runs java and add the ctakes.umlsuser and ctakes.umlspw parameters to the java command with your credentials. Make sure you substitute your actual ID and password if you cut and paste the example.

Windows:

Code Block
languagenone
<cTAKES_HOME>\bin\runctakesCVD.bat
<cTAKES_HOME>\bin\runctakesCPE.bat

Linux:

Code Block
languagenone
<cTAKES_HOME>/bin/runctakesCVD.sh
<cTAKES_HOME>/bin/runctakesCPE.sh
Code Block
languagenone
java -Dctakes.umlsuser=<YOUR_UMLS_ID_HERE> -Dctakes.umlspw=<YOUR_UMLS_PASSSWORD_HERE> -cp ... 

If you use special characters in your user name or password, you may need to escape them or for windows, place the string in quotes

For example, if your username and password were literally myusername and mypassword, you could insert them before the -cp option so the start of the java command would look like this:

 

Code Block
java  -Dctakes.umlsuser=myusername  -Dctakes.umlspw=mypassword  -cp ... 

Windows:

 If you use special characters in your umls user name or password, you can place them in double-quotes:

Code Block
java  -Dctakes.umlsuser="myuser!!!!"  -Dctakes.umlspw="mypass!!!!"  -cp ... 

 

Linux:

 If you use special characters in your user name or password, you may need to escape them

Process documents using cTAKES

This version allows you to test most components bundled in cTAKES in two different ways:

...

On Linux, you will need a windowing environment to run these tools.

CAS Visual Debugger (CVD)

 

 

Step

 

 

Example

1. Open a command prompt and change to the cTAKES_HOME directory, which is the directory that contains subdirectories like bin, desc, resources, lib.

Depending on how you extracted the files,

Note

It is best if <cTAKES_HOME> is your current directory. The scripts will change directories, so being home to run the command is best.


Windows:

Code Block
languagenone
cd \apache-ctakes-4.0.0
  -- or --
cd \apache-ctakes-4.0.0-bin\apache-ctakes-4.0.0\

Linux:

Code Block
languagenone
cd /usr/local/apache-ctakes-4.0.0
  -- or --
cd /usr/local/apache-ctakes-4.0.0-bin/apache-ctakes-4.0.0

2. Start the CAS Visual Debugger and load the AggregatePlaintextFastUMLSProcessor pipeline by running this command:


The application may take a minute to start on slower hardware.

The GUI opens and then loads the AggregatePlaintextFastUMLSProcessor pipeline. If it appears to be hung, look at the window where you entered the command and you will see what is happening.

Once the analysis engine has successfully loaded you should see a tree in the Analysis Results frame:

CAS Index Repository
* SofaIndex [0]
* AnnotationIndex [1]

 

Windows:

Code Block
languagenone
bin\runctakesCVD.bat  desc\ctakes-clinical-pipeline\desc\analysis_engine\AggregatePlaintextFastUMLSProcessor.xml

Linux:

Code Block
languagenone
bin/runctakesCVD.sh  desc/ctakes-clinical-pipeline/desc/analysis_engine/AggregatePlaintextFastUMLSProcessor.xml

3. Copy the example text from the next cell in this table and paste the contents into the Text section of CVD, replacing the text that is already there.

You can also download a copy of the file from here

Code Block
langnone
Dr. Nutritious Medical Nutrition Therapy for Hyperlipidemia Referral from: Julie Tester, RD, LD, CNSD Phone contact: (555) 555-1212 Height: 144 cm Current Weight: 45 kg Date of current weight: 02-29-2001 Admit Weight: 53 kg BMI: 18 kg/m2 Diet: General Daily Calorie needs (kcals): 1500 calories, assessed as HB + 20% for activity. Daily Protein needs: 40 grams, assessed as 1.0 g/kg. Pt has been on a 3-day calorie count and has had an average intake of 1100 calories. She was instructed to drink 2-3 cans of liquid supplement to help promote weight gain. She agrees with the plan and has my number for further assessment. May want a Resting Metabolic Rate as well. She takes an aspirin a day for knee pain.

4. From the menu bar, click Run -> Run AggregatePlaintextFastUMLSProcessor.

 

Note: If you would like to TEST some simple annotators to ensure it's working without UMLS, you can just load:

/desc/ctakes-core/desc/analysis_egine/SentencesAndTokensAggregate.xml

5. You'll get a list of all the annotations for this clinical document in the Analysis Results frame. Annotations such as named entities, division by sentence, etc from the pipeline are viewable. To see one, in the Analysis Results frame, click on the key in front of:

CAS Index Repository
* AnnotationIndex
 * uima.tcas.Annotation
  * org.apache.ctakes.typsystem.type.textsem.IdentifiedAnnotation
   * org.apache.ctakes.typsystem.type.textsem.EventMention

This will show an AnnotationIndex in the lower frame. Select any annotation in that lower frame and you will see the text discovered in
the text frame on the right like the concept of the disease/disorder Hyperlipidemia.

For a medication example select this

CAS Index Repository
* AnnotationIndex
 * uima.tcas.Annotation
  * org.apache.ctakes.typsystem.type.textsem.IdentifiedAnnotation
   * org.apache.ctakes.typsystem.type.textsem.EventMention
    * org.apache.ctakes.typsystem.type.textsem.MedicationMention

Now select items in the lower frame to see the text being annotated. 

To run other pipelines, use the Run-> Load AE menu bar command.

Navigate to the file you wish to load, such as

 

<cTAKES_HOME>
  /desc
    /ctakes-clinical-pipeline
      /desc
        /analysis_engine
          /AggregatePlaintextProcessor.xml

 

Click Open
Loading the analysis engine may take a minute. The lower right corner of the window shows the name of the currently-loaded pipeline if a pipeline was loaded successfully.

                                                    


 You may close the CAS Visual Debugger (CVD) application if you wish.

 

Collection Processing Engine (CPE)

 

 

Step

 

 

Example

1. Open a command prompt and change to the cTAKES_HOME directory:

Note

It is best if <cTAKES_HOME> is your current directory. The scripts will change directories, so being home to run the command is best.


Windows:

Code Block
languagenone
cd \apache-ctakes-4.0.0

Linux:

Code Block
languagenone
cd /usr/local/apache-ctakes-4.0.0

2. Create a directory for some test data.

mkdir testdata

3. Download this sample file and place it into the testdata directory.

No example

4. Start the collection processing engine by running this command:
The application may take a minute to start on slower hardware.

Windows:

Code Block
languagenone
bin\runctakesCPE.bat

Linux:

Code Block
languagenone
bin/runctakesCPE.sh

5. This will bring up the Collection Processing Engine Configurator. In the Menu bar click File >Open CPE Descriptor

6. Navigate to the following file, which uses the AggregateCdaProcessor

Code Block
langnone
<cTAKES_HOME>
  /desc
    /ctakes-clinical-pipeline
      /desc
        /collection_processing_engine
          /test1.xml


Click Open.

No example

7. Change the Collection Reader input directory to testdata, which contains a CDA file(s).

Within the CAS Consumers pane of the same window, change the output directory to testdata/output

8. Click the Play button (green/blue play arrow near the bottom).

Info

What just happened? You placed a sample CDA document into the input of a pipeline. The pipeline used a file system reader that will process all files in a directory. The processing was accomplished by a pipeline of cTAKES components. The AggregateCdaProcessor allows for a parameter (Chunk Creator Class) to be passed to the Chunker annotator. For each input file, one resultant file was placed into the output directory. Each output file is an XML file that includes the annotations made by each component within the pipeline.

9. You should see that one document was processed. You did process a collection of documents. In this case the collection only contained one just to show how to do it. Close the results window.

Note

This example of using the CPE GUI did not use the UMLS resources. If you wish to perform named entity recognition or concept identification for anything other than a few words, you will need to 1) obtain the rights to use UMLS resources 2) add those credentials to cTAKES, and 3) use a pipeline that makes use of those UMLS resources (see above).

10. Close the CPE application. You may be prompted to save changes. Since this was just a test you may click the No button.

No example

 

cTAKES GUI and Piper Files

The cTAKES GUI can be launched using bin\runctakesGUI.bat or bin\runctakesGUI.sh

...

Step 7: Examine your output. 

Analysis Engines/Pipelines

The analysis engines and collection processing engines shipped with cTAKES for some of the annotators are described in the following table.

...

Annotator

Description

Example Piper file

Example Collection processing Engine (CPE)

Clinical Pipeline

The pipeline to obtain concepts and their attributes

<cTAKES_HOME>/TBD

<cTAKES_HOME>/desc/ctakes-clinical-pipeline/desc/collection_processing_engine/test1.xml

Chunker

Obtains phrasal chunk annotations

<cTAKES_HOME>/TBD

NA

Dependency Parser

Obtains dependency parsing tree

<cTAKES_HOME>/TBD

<cTAKES_HOME>/desc/ctakes-dependency-parser/desc/collection_processing_engine/ClearParserTestCPE.xml

Drug NER

Finds mentions of medications and medication attributes such as dose, strength, frequency...

<cTAKES_HOME>/TBD

<cTAKES_HOME>/desc/ctakes-drug-ner/desc/collection_processing_engine/DrugNER_PlainText_CPE.xml

Dictionary Lookup

Finds mentions of concepts from a dictionary (e.g., SNOMED CT or RxNorm

<cTAKES_HOME>/TBD

NA

Dictionary Lookup Fast

Finds mentions of concepts from a dictionary (e.g., SNOMED CT or RxNorm

<cTAKES_HOME>/TBD

NA

Relation Extractor

Finds certain relations (location of and degree of) between certain Event, Entity, and Modifier annotations

<cTAKES_HOME>/TBD

N/A

Smoking Status

Finds document or patient-level smoking status

<cTAKES_HOME>/TBD

<cTAKES_HOME>/desc/ctakes-smoking-status/desc/collection_processing_engine/Sample_SmokingStatus_output_flatfile.xml

Side Effect

Finds side effect mentions and sentences from clinical documents

<cTAKES_HOME>/TBD

<cTAKES_HOME>/desc/ctakes-side-effect/desc/collection_processing_engine/SideEffectCPE.xml

Next Steps

The cTAKES 4.0 Component Use Guide will help you to understand each of the cTAKES components that have been installed. In some cases you can learn how to improve the components.

Also, before you go on to process text in production, you will want to consider dictionaries and models. If you did not obtain the rights yet to the UMLS resources and models, you will want to do so. Be aware, the models within cTAKES have been trained on data that may not match your data well enough to be effective. In some cases you might want to modify the dictionaries and train models using your own data.