NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

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

Scrollbar
iconsfalse

Page info
title
title

Panel
titleContents of this Page

Table of Contents
maxLevel3
minLevel2

...

We recommend using the free community edition of Intellij

Multiexcerpt include
MultiExcerptNameExitDisclaimer
nopaneltrueMultiExcerptNameExitDisclaimer
PageWithExcerptwikicontent:Exit Disclaimer to Include
. Download and install the Scala plugin according to the directions. Then follow instructions for creating a Scala project and an object like the following. Change the URL to whatever CTS2 service is available

...

Three code snippets that can stand alone. Two return XML and one returns JSON. Python must be installed on your system. Download the third party library python-rest-client

Multiexcerpt include
MultiExcerptNameExitDisclaimer
nopaneltrueMultiExcerptNameExitDisclaimer
PageWithExcerptwikicontent:Exit Disclaimer to Include
. Add python-rest-client to the PYTHONPATH environment variable to your system. Create a python script file and run as above.

...

  • Download JQuery 1.10.x
    Multiexcerpt include
    MultiExcerptNameExitDisclaimer
    nopaneltrueMultiExcerptNameExitDisclaimer
    PageWithExcerptwikicontent:Exit Disclaimer to Include
    and Bootstrap 3.0.x
    Multiexcerpt include
    MultiExcerptNameExitDisclaimer
    nopaneltrueMultiExcerptNameExitDisclaimer
    PageWithExcerptwikicontent:Exit Disclaimer to Include
  • Create a CTSRest directory for your files
  • Add directories bootstrap and cts2 to this root
  • Add subdirectories js and css to both directories you've just created
  • Add bootstrap.js to the bootstrap/js directory
  • Add bootstrap.min.css to the bootstrap/css directory
  • Add jquery-1.10.2.js to the cts2/js library
  • Create a codeSystem.js text file and add the following text (adjust the serviceUrl to point to a convenient CTS2 service)

...

Code Block
      <repository>
            <id>edu.informatics.maven.release</id>
            <name>Informatics Maven Release Repository</name>
            <url>http<url>https://informaticsncimvn.nci.mayonih.edugov/mavennexus/content/repositories/releases<LexEVSRelease</url>
      </repository>

      <dependency>
            <groupId>edu.mayo.cts2.framework</groupId>
            <artifactId>core</artifactId>
            <version>0<version>1.2.81.0<FINAL</version>
      </dependency>

A Mapping of CTS2 REST Calls to CTS2 Framework Model Elements

...

Info

Generally returned summary lists are returned as Directories and single elements are returned as messages such as "EntryMsg"

DescriptionRESTModel Element Class
Code System Versions<base url>codesystemversions?format=jsonCodeSystemVersionCatalogEntryDirectory
Code System Read
<base url>/codesystem/NCI_Thesaurus/version/10.07e
CodeSystemVersionCatalogEntryMsg
Code System Version Query<base url>/codesystemversions?matchvalue=nci_thesaurus&filtercomponent=resourceName&format=jsonCodeSystemVersionCatalogEntryDirectory
Value Sets<base url>resolvedvaluesets?format=jsonResolvedValueSetDirectory
Value Set Definition Read<base url>/cts2/valueset/CDISC%20ADaM%20Date%20Imputation%20Flag%20Terminology/definition/c38261e5?format=jsonValueSetDefinitionMsg
Value Set Query
<base url>/resolvedvaluesets?matchvalue=imputation&filtercomponent=resourceName&format=json
ResolvedValueSetDirectory
Value Set Entries<base url>/valueset/NICHD Newborn Screening Terminology/definition/4125c982/resolution/1?format=json
IteratableResolvedValueSet
Entities
<base url>/codesystem/NCI_Thesaurus/version/10.10a/entities?format=json
EntityDirectory
Entity Read<base url>/codesystem/NCI_Thesaurus/version/10.10a/entity/C3399?format=jsonEntityDescriptionMsg
Entity Query
          <base url>/codesystem/NCI_Thesaurus/version/10.10a/entities?matchvalue=swelling&format=json
EntityDirectory
Association parents<base url>/codesystem/NCI_Thesaurus/version/10.10a/entity/C3399?format=json

EntityDescriptionMsg
with an instance entity with method calls:

entity.getEntityDescription().getNamedEntity().getParent()

returning an instance of URIAndEntityName[]

Association children
<base url>/codesystem/NCI_Thesaurus/version/10.10a/entity/C3399/children
EntityDirectory
Association subjectOf
<base url>/codesystem/npo/version/TestForMultiNamespace/entity/GO:NPO_1607/subjectof
AssociationDirectory
Association targetOf
<base url>/codesystem/NCI_Thesaurus/version/10.10a/entity/C3399/targetof
AssociationDirectory
Maps
<base url>/mapversions
MapVersionDirectory
Map Version Query<base url>/mapversions?matchvalue=ncit&filtercomponent=resourceSynopsisMapVersionDirectory
Map Version Read
<base url>/map/NCIt_to_ICD9CM_Mapping/version/NCIt_to_ICD9CM_Mapping-1.0
MapVersionDirectory
Map Entities
<base urel>/map/NCIt_to_ICD9CM_Mapping/version/NCIt_to_ICD9CM_Mapping-1.0/entries
MapVersionDirectory
Map Restriction To, From, or Both Role
<base url>/mapversions?codesystem=ICD9CM&codesystemsmaprole=MAP_TO_ROLE
MapVersionDirectory
Complete Code Example
Code Block
languagejava
collapsetrue
package cts2.mayo.example;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;

import edu.mayo.cts2.framework.core.json.JsonConverter;
import edu.mayo.cts2.framework.model.codesystemversion.CodeSystemVersionCatalogEntryDirectory;
import edu.mayo.cts2.framework.model.codesystemversion.CodeSystemVersionCatalogEntrySummary;
import edu.mayo.cts2.framework.model.core.EntitySynopsis;
import edu.mayo.cts2.framework.model.core.URIAndEntityName;
import edu.mayo.cts2.framework.model.entity.EntityDescriptionMsg;
import edu.mayo.cts2.framework.model.entity.EntityDirectory;
import edu.mayo.cts2.framework.model.entity.EntityDirectoryEntry;
import edu.mayo.cts2.framework.model.mapversion.MapVersionDirectory;
import edu.mayo.cts2.framework.model.mapversion.MapVersionDirectoryEntry;
import edu.mayo.cts2.framework.model.valuesetdefinition.IteratableResolvedValueSet;
import edu.mayo.cts2.framework.model.valuesetdefinition.ResolvedValueSetDirectory;
import edu.mayo.cts2.framework.model.valuesetdefinition.ResolvedValueSetDirectoryEntry;

public class RESTFromCTS2Framework {
	String baseUri = "http://lexevscts2.nci.nih.gov/lexevscts2/";
	String format = "?format=json";
	

	public void getValueSets(){

		URL url;
		try {
			url = new URL(baseUri + "resolvedvaluesets" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			ResolvedValueSetDirectory valuesetdir = converter.fromJson(
					builder.toString(), ResolvedValueSetDirectory.class);
			List<ResolvedValueSetDirectoryEntry> sum = valuesetdir
					.getEntryAsReference();
			for (ResolvedValueSetDirectoryEntry s : sum) {
				System.out.println(s.getResolvedHeader().getResolutionOf()
						.getValueSet().getContent());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
	public void getValueSetEntries(){
		URL url;
		try {
			url = new URL(baseUri + "valueset/NICHD%20Newborn%20Screening%20Terminology/definition/4125c982/resolution/1" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			IteratableResolvedValueSet valuesetdir = converter.fromJson(
					builder.toString(), IteratableResolvedValueSet.class);
			List<EntitySynopsis> sum = valuesetdir.getEntryAsReference();
			for (EntitySynopsis s : sum) {
				System.out.println(s.getName());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
	public void getCodeSystems(){

		URL url;
		try {
			url = new URL(baseUri + "codesystemversions" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			CodeSystemVersionCatalogEntryDirectory valuesetdir = converter.fromJson(
					builder.toString(), CodeSystemVersionCatalogEntryDirectory.class);
			List<CodeSystemVersionCatalogEntrySummary> sum = valuesetdir
					.getEntryAsReference();
			for (CodeSystemVersionCatalogEntrySummary s : sum) {
				System.out.println(s.getFormalName());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
	public void getEntities(){
		URL url;
		try {
			url = new URL(baseUri + "codesystem/NCI_Thesaurus/version/10.10a/entities" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			EntityDirectory valuesetdir = converter.fromJson(
					builder.toString(), EntityDirectory.class);
			List<EntityDirectoryEntry> sum = valuesetdir
					.getEntryAsReference();
			for (EntityDirectoryEntry s : sum) {
				System.out.println(s.getName());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void entityReadParent(){
		URL url;
		try {
			url = new URL(baseUri + "codesystem/NCI_Thesaurus/version/10.10a/entity/C3399" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			EntityDescriptionMsg entity = converter.fromJson(
					builder.toString(), EntityDescriptionMsg.class);
			URIAndEntityName[] sum = entity.getEntityDescription().getNamedEntity().getParent();
			for (URIAndEntityName s : sum) {
				System.out.println(s.getName());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void getMaps(){
		URL url;
		try {
			url = new URL(baseUri + "mapversions" + format);
			HttpURLConnection connection = (HttpURLConnection) url
					.openConnection();
			connection.setRequestProperty("Accept", "text/json");
			if (connection.getResponseCode() != 200) {
				throw new RuntimeException("Failed : The HTTP error code is : "
						+ connection.getResponseCode());
			}
			BufferedReader br = new BufferedReader(new InputStreamReader(
					(connection.getInputStream())));
			String output;
			StringBuilder builder = new StringBuilder();
			while ((output = br.readLine()) != null) {
				builder.append(output);
			}
			JsonConverter converter = new JsonConverter();
			MapVersionDirectory maps = converter.fromJson(
					builder.toString(), MapVersionDirectory.class);
			List<MapVersionDirectoryEntry> sum = maps.getEntryAsReference();
			for (MapVersionDirectoryEntry s : sum) {
				System.out.println(s.getFormalName());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new RESTFromCTS2Framework().getCodeSystems();
		new RESTFromCTS2Framework().getValueSets();
		new RESTFromCTS2Framework().getEntities();
		new RESTFromCTS2Framework().entityReadParent();
		new RESTFromCTS2Framework().getMaps();
		new RESTFromCTS2Framework().getValueSetEntries();
	}

}

...

examples

Multiexcerpt include
MultiExcerptNameExitDisclaimer
nopaneltrueMultiExcerptNameExitDisclaimer
PageWithExcerptwikicontent:Exit Disclaimer to Include

...

Code Block
collapsetrue
<IteratableResolvedValueSet xmlns="http://schema.omg.org/spec/CTS2/1.0/ValueSetDefinition" xmlns:core="http://schema.omg.org/spec/CTS2/1.0/Core"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/CTS2/1.0/ValueSetDefinition http://www.omg.org/spec/cts2/201206/valuesetdefinition/ValueSetDefinition.xsd" complete="PARTIAL" numEntries="50" next="http://<base url>/valueset/NICHD Newborn Screening Terminology/definition/4125c982/resolution/1?page=1&maxtoreturn=50">
<core:heading>
<core:resourceRoot>
valueset/NICHD Newborn Screening Terminology/definition/4125c982/resolution/1
</core:resourceRoot>


<core:resourceURI>
http://<base url>/valueset/NICHD Newborn Screening Terminology/definition/4125c982/resolution/1
</core:resourceURI>


<core:accessDate>2013-09-13T16:54:52.357-05:00</core:accessDate>

</core:heading>


<resolutionInfo>
<resolutionOf>
<core:valueSetDefinition uri="http://ncit:C89506" href="http://<base url>/valueset/NICHD Newborn Screening Terminology/definition/4125c982">4125c982</core:valueSetDefinition>
<core:valueSet>NICHD Newborn Screening Terminology</core:valueSet>

</resolutionOf>



</resolutionInfo>


<entry uri="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C16847" href="http://<base url>/codesystem/NCI_Thesaurus/version/10.07e/entity/NCI_Thesaurus:C16847">
<core:namespace>NCI_Thesaurus</core:namespace>
<core:name>C16847</core:name>
<core:designation>Technique</core:designation>

</entry>


<entry uri="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C34816" href="http://<base url>/codesystem/NCI_Thesaurus/version/10.07e/entity/NCI_Thesaurus:C34816">
<core:namespace>NCI_Thesaurus</core:namespace>
<core:name>C34816</core:name>
<core:designation>Congenital Metabolic Disorder</core:designation>

</entry>


<entry uri="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C81178" href="http://<base url>/codesystem/NCI_Thesaurus/version/10.07e/entity/NCI_Thesaurus:C81178">
<core:namespace>NCI_Thesaurus</core:namespace>
<core:name>C81178</core:name>
<core:designation>Newborn Screening</core:designation>

</entry>


<entry uri="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C50644" href="http://<base url>/codesystem/NCI_Thesaurus/version/10.07e/entity/NCI_Thesaurus:C50644">
<core:namespace>NCI_Thesaurus</core:namespace>
<core:name>C50644</core:name>
<core:designation>Lung Overinflation</core:designation>

</entry>


<entry uri="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C13235" href="http://<base url>/codesystem/NCI_Thesaurus/version/10.07e/entity/NCI_Thesaurus:C13235">
<core:namespace>NCI_Thesaurus</core:namespace>
<core:name>C13235</core:name>
<core:designation>Fetus</core:designation>

</entry>



Scrollbar
iconsfalse