NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Enclosed contents of page in Lorenzo's custom macro instead of the standard numbered headings macro.

Include Page
caDSR API Examples Overview include
caDSR API Examples Overview include

This page includes the following topics.

Custom nh
start-numbering-with1
start-numbering-ath2
Panel
titleContents of This Page

Table of Contents
maxLevel3

Find Data Element by Public ID and Version

The following examples find a data element where Public ID = 62 and Version=6, displaying the basic metadata attributes. 

Results Displayed in XML

The URL for the results from the caDSR II REST API is

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetXML?query=DataElement[@publicId=62,@version=6]

Results Displayed in HTML

The URL for the results from the caDSR II REST API is

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetHTML?query=DataElement[@publicId=62,@version=6]

Results Displayed in JSON

The URL for the results from the caDSR II REST API is

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetJSON?query=DataElement[@publicId=62,@version=6]

Allow Machine-to-machine Retrieval of a

...

The following topics are included in this page.

Table of Contents
minLevel2

Overview

Using the API, developers can allow an application to connect to caDSR and search the database. The API is available at the Domain Class Browser. The caDSR REST-like (XML-HTTP) API and CDE Browser provide access to, and a means of linking to, caDSR metadata through a standard internet browser.

  • You can display caDSR REST-like results in HTML or XML format.
  • You can display XML in an internet browser or by means of an XSLT stylesheet.
  • The caDSR 4.0 Technical Guide describes the caDSR REST-like (XML-HTTP) API and provides a catalog of the caDSR operations and search criteria. To switch formats simply change the URL in the address line from getHTML to getXML.
Info
titleMultiple AND IN Note

You cannot enter multiple and or in values for search criteria when using the REST (XML-HTTP) API.

Setting Result Set and Page Size for REST-like API

For a caDSR RESTlike API:

  • You can expand or limit the result set using the resultCounter parameter. By default, the result set for a RESTlike call is limited to 1,000 records, with the set number of records appearing per page, either as the default or as a specified page size.
  • To change the maximum number of results returned for a query, add the resultCounter=## parameter to the call. 
  • If your total results are less than the page size, the first page of results contain all the returned items.
  • The resultCounter and pageSize capabilities are available for use in RESTlike API calls.
  • For REST-like (XML-HTTPS) calls, page size information is cached, so that if you make a call that identifies a particular page size, subsequent calls will also use that same page size, even without the parameter.
  • To change the number of results appearing on each page, include a different pageSize parameter in a call, or clear the cache to return to the default.

The following example is how to set the result set and page size.

Code Block
titleResult Set and Page Size
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=gov.nih.nci.cadsr.domain.Form&gov.nih.nci.cadsr.domain.Form[@workflowStatusName=RELEASED]&startIndex=0&pageSize=30&resultCounter=300 

You can also add the startIndex parameter to indicate which record should be the first on the page. This means you can alter a query to return the second or third page of results. Generally speaking, however, the startIndex parameter is "zero based" - you start at zero and subsequent pages begin with a startIndex of the next result page. Using the above query as an example, the second page of the results would show startIndex=31, because the page size is 30.

Info
titlePage Size Note

Page size information is cached, so that if you make a call that identifies a particular page size, subsequent calls will also use that same page size, even without the parameter. To change the number of results appearing on each page, include a different size parameter in a call, or clear the cache to return to the default.

Retrieving the Corresponding EVS Concept Codes for the Value Domain

Given a data element, you can retrieve the corresponding EVS concept codes for the values in a Value Domain. 

If there is a  data element with longName My DE and the permissible values are Never, Former, Current, etc. and the CDE Browser shows the code for Never as C70543, Former as C0750523, and Current as C25471, your application can navigate the objects starting at the value domain and work to the corresponding code."

For example

  • Each enumerated value domain (My DE) has a getValueDomainPermissibleValueCollection
  • Each ValueDomainPermissibleValue in the collection has a getPermissibleValue (F)
  • Each permissibleValue has a getValueMeaning (Former)
  • Each valueMeaning has a getConceptDerivationRule in which the list of concepts and their ordering is stored
  • Each conceptDerivationRule has a getComponentConceptCollection (the primary concept and any qualifier concepts, in this case Former has only a Primary Concept)
  • Each componentConcept in the collection has a getConcept (returns the Concept Object)
  • Each concept has an attribute, preferredName in which the corresponding EVS concept code is stored (C0750523).

Searching for a Common EVS Concept Code or Name but Restricting to Primary

To search for data elements using a common EVS concept code or name, but restrict the results to only Primary concepts in the CDE object class, refer to the following the examples.

  1. Retrieve data elements with object class, Primary, and concept, Blood and Blood Products (result in HTML).

    Code Block
    titleRetrieve Data Elements
    http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElement,DataElementConcept,ObjectClass,ConceptDerivationRule&ComponentConcept[Concept[@preferredName=C19448]][@primaryFlag=Yes]
    

    EXTENSION 1: Additionally, you can find all data elements where the concept is used either as a primary OR qualifier concept. This is accomplished by removing the last qualifier in the query. Removing this criteria in Example 1 returns 104 results instead of 88.

    Code Block
    titleExtension 1
    [@primaryFlag=Yes]
  2. Retrieve data elements with property Primary, and concept, E-Mail Address.

    Code Block
    titleRetrieve Data Elements
    http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElement,DataElementConcept,Property,ConceptDerivationRule&ComponentConcept[Concept[@longName=E-mail%20Address]][@primaryFlag=Yes]
    

    EXTENSION 2:  To retrieve the next higher order "type" administered items, remove the name of the item(s) before it in the query argument list. For example, to get Data Element Concepts (DECs) with E-Mail address as the primary concept, remove DataElement (the first item in the query argument list in Example 2):

    Retrieve DECs with property Primary, and concept E-Mail Address.

    Code Block
    titleExtension 2
    http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElementConcept,Property,ConceptDerivationRule&ComponentConcept[Concept[@longName=E-mail%20Address]][@primaryFlag=Yes]
    
  3. Retrieve data elements with value domain's value meaning Primary concept code= C19448 (Blood and Blood Products”) (result in XML).

    Code Block
    titleRetrieve Data Elements
    http://cadsrapi.nci.nih.gov/cadsrapi40/GetXML?query=DataElement,EnumeratedValueDomain,ValueDomainPermissibleValue,PermissibleValue,ValueMeaning,ConceptDerivationRule&ComponentConcept[Concept[@longName=Blood and Blood Products]][@primaryFlag=Yes]
    

Examples

...

Data Element by Public ID and Version

The following

...

caDSR II example allows machine-to-machine retrieval of a data element by public ID and version. (You can test this URL only in a machine-to-machine scenario, not in a browser.)

Code Block

Example 1a Results Displayed in the CDE Browser

This method can be used to retrieve Data Elements only when you know both the Public ID and Version number (If you have trouble with the following link into Firefox).

...

Example 1a
Code Block
title
https://
cdebrowser
cadsrapi.
nci.nih
cancer.gov/
CDEBrowser/search?dataElementDetails=9/&cdeId=2178693&version=2.1&PageId=DataElementsGroup&queryDE=yes&FirstTimer=yes

Or alternatively...

Code Block
http://freestyle.nci.nih.gov/freestyle/do/cdebrowser?publicId=2178693&version=2.1

Sample CDE Browser Output from Example 1

Example 1b Results Displayed in XML

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 1b URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=DataElement[@publicId=2178693][@version=2.1]
rad/caDSR.restapi:GetXML_rad/GetXML/query=DataElement[@publicId=62,@version=6]

If you want to create a REST API call from machine to machine or application to application, start your URL as follows: 

Code Block
https://cadsrapi.cancer.gov/rad/caDSR.restapi:GetXML_rad/

Find Data Element by Public ID

The following example finds a

...

data element with Public

...

ID =

...

62,

...

displaying the basic metadata attributes

...

. Since the version is not known, this query can only be handled via a caDSR REST API query getting all versions.

The URL for the results from the caDSR

...

II REST API is

http
Code Block
titleExample 2 URL for Results
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetXML
GetHTML?query=DataElement[@publicId=
2178693
62]

...

Or the query can retrieve only the latest version.

http
Code Block
titleExample 2
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetXML
GetHTML?query=DataElement[@publicId=
2178693][
62,@latestVersionIndicator=
Yes
yes]

...

Find Data Element by Public ID,

...

Display All Related Components

The following example finds a

...

data element with Public ID = 62, displaying all the metadata associated with the

...

data element's related components, not just the basic attributes. This is handled in the caDSR REST API using a parameter that produces expanded ("heavy") XML.

The URL for the results from the caDSR

...

II REST API is

http
Code Block
titleExample 3 URL for Results
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/GetXML?query=DataElement
&DataElement
[@publicId=
2178693
62]&returnHeavyXML=true

...

...

Find DEC Using Public ID, Display All Associated Data Elements

...

The following example finds all the

...

data elements associated with the

...

DEC with Public

...

ID = 2178546,

...

displaying the basic metadata of the

...

DEC and its

...

data elements.

The URL for the results from the caDSR

...

II REST API is

http
Code Block
titleExample 4 URL for Results
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetXML
GetHTML?query=DataElement&DataElementConcept[@publicId=2178546]

...

Find Data Elements

...

Associated with a

...

Particular DEC Public ID and Version

The following example finds only

...

data elements associated with

...

Version 2.1 of

...

DEC with Public

...

ID = 2178546.

The URL for the results from the caDSR

...

II REST API is

http
Code Block
titleExample 5 URL for Results
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/GetXML?query=DataElement&DataElementConcept[@publicId=2178546
][@version=2.1]

Sample caDSR REST XML Output from Example 4 and 5

Example 6 - Find a Form using Form public ID and Version and display basic metadata attributes

The following examples find a Form where Public Id = 2392775 and Version=1.0 and display the basic metadata attributes. Either the Form Builder or the caDSR 4.1 REST-like API can be used to satisfy this query and results from both are shown below.

Example 6a Results Displayed in the Form Builder

This method can be used to retrieve Forms only when you know both the Public ID and Version number.  (If you have trouble with the following link in Firefox, cut and paste it into IE.)

https://formbuilder.nci.nih.gov/FormBuilder/formDetailsAction.do?method=getFormDetails&formIdSeq=FF04F699-FE6A-56AA-E034-0003BA3F9857

Example 6b Results Displayed in XML

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 6b URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=Form[@publicId=2392775][@version=1.0]

Example 7 - Find a Form using only public ID

The following example finds a Form with Public Id = 2392775, display the basic metadata attributes, version is not known. Since the version is not known, this query can only be handled via a caDSR REST API query.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 7 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=Form[@publicId=2392775]

Example 8 - Find a Form using public ID, display all the metadata associated with the Data Elements

The following example finds a Form with Public Id = 2392775, display all the metadata associated with the Data Element's related components, not just the basic attributes. This is handled in the caDSR REST API using a parameter that produces expanded ("heavy") XML.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 8 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=Form&Form[@publicId=2392775]&returnHeavyXML=true

Example 9 - Find all the Forms associated with a particular Data Element public ID and version

The following example finds all the Forms associated with the CDE with Public Id = 2183364, Version 1.0, display the basic metadata of the Form.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 9 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=Form&Module&Question&DataElement[@publicId=2183364][@version=1.0]

Example 10 - Get all Modules associated with a Form using Form public ID

The following example gets all the modules for form with publicID = 2392775.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 10 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=gov.nih.nci.cadsr.domain.Module&gov.nih.nci.cadsr.domain.Form[@version=1.0][@publicID=2392775]

Example 11 - Get all the Questions for a Module using Module public ID and version

The following example gets all the questions for module with publicID = 2392777 and version = 1.0.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 11 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=gov.nih.nci.cadsr.domain.Question&gov.nih.nci.cadsr.domain.Module[@version=1.0][@publicID=2392777]

Example 12 - Get all the Data Elements for a Question using Question public ID and version

The following example gets all the data elements for question with publicID = 2392779 and version = 1.0.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 12 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=gov.nih.nci.cadsr.domain.DataElement&gov.nih.nci.cadsr.domain.Question[@version=1.0][@publicID=2392779]

Example 13 - Retrieve all Administered Components associated with a ClassSchemeClassSchemeItem with a particular ID

The following example gets all Administered Components for ClassSchemeClassSchemeItem with ID = A55C551C-1866-5ED1-E034-080020C9C0E0. This retrieve all AC's and sort them according to type (Form, DE, DEC, etc.).

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 13 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetXML?query=AdministeredComponent,AdministeredComponentClassSchemeItem,ClassSchemeClassSchemeItem&ClassSchemeClassSchemeItem[@ID=A55C551C-1866-5ED1-E034-080020C9C0E0]

Example 14 - Retrieve all ClassSchemeClassSchemeItem associated with a ClassificationSchemeItem and a ClassificationScheme

The following example gets all ClassSchemeClassSchemeItem for ClassificationSchemeItem with longName starting with 2014r1 and ClassificationScheme with preferredName starting with NMDP.

Info
titleSpecifying an Association
The association can be specified either through using square brackets '[]' or by using the backslash '\' however, association within the square brackets cannot have further associations as attributes.

The URL for the results from the caDSR 4.1 REST API is

Code Block
titleExample 14 URL for Results
http://cadsrapi.nci.nih.gov/cadsrapi41/GetHTML?query=ClassSchemeClassSchemeItem&ClassSchemeClassSchemeItem[ClassificationScheme[@preferredName=NMDP*]]\ClassificationSchemeItem[@longName=2014r1*]

Examples 15-17  - Get Data Elements using Concept Code or Concept Name

...

,@version=2.1]

Get Data Elements Using Concept Code or Concept Name

The following examples show how to retrieve data elements using either the concept code or the concept name where the concept is the Primary concept of the related caDSR item. In these examples, results are returned in

...

XML. 

Find All Data Elements Where Associated Concept is

...

Primary Concept of

...

Data Element's Object Class

This example shows the use of

...

the Concept Code (C19448)

...

. Results

...

are returned in

...

XML.

Code Block
titleExample 15

The URL for the results from the caDSR II REST API is

Code Block
https
http
://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetHTML
GetXML?query=DataElement,DataElementConcept,ObjectClass
,ConceptDerivationRule
&ComponentConcept[Concept[@preferredName=C19448
]][@primaryFlag=Yes
]
http://cadsrapi.nci.nih.gov/cadsrapi41/GetHTML?query=DataElement,DataElementConcept,ObjectClass
,
ConceptDerivationRule&ComponentConcept[Concept[@longName=Blood and Blood Products]][
@primaryFlag=Yes]

...

Find

...

All Data Elements

...

Where Associated Concept is Primary Concept of

...

Data Element's Property

The URL for the results from the caDSR II REST API is

http
Code Block
titleExample 16
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetHTML
GetXML?query=DataElement,DataElementConcept,Property
,ConceptDerivationRule
&ComponentConcept[Concept[@preferredName=C42775
]][@primaryFlag=Yes
]
http://cadsrapi.nci.nih.gov/cadsrapi41/GetHTML?query=DataElement,DataElementConcept
,
Property,ConceptDerivationRule&ComponentConcept[Concept[@longName=E-mail%20Address]][
@primaryFlag=Yes]

...

Find

...

All Data Elements

...

Where Associated Concept is Primary Concept of

...

One of

...

Data Element's Value Domain Value Meanings

The URL for the results from the caDSR II REST API is

http
Code Block
titleExample 17
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetHTML
GetXML?query=DataElement,
EnumeratedValueDomain
ValueDomain,ValueDomainPermissibleValue,PermissibleValue,ValueMeaning
,ConceptDerivationRule
&ComponentConcept[Concept[@preferredName=C19448
]][@primaryFlag=Yes
]
http://cadsrapi.nci.nih.gov/cadsrapi41 /GetHTML?query=DataElement,EnumeratedValueDomain,ValueDomainPermissibleValue,PermissibleValue,ValueMeaning
,
ConceptDerivationRule&ComponentConcept[Concept[@longName=Blood and Blood Products]][
@primaryFlag=Yes]

...

Find All Enumerated Permissible Values for a Data Element

The following

...

examples find all enumerated permissible values for a data element using the data element's public ID and version or the data element's public ID (and getting latest version). You must specify either version or latestVersionIndicator. If you specify latestVersionIndicator=No, the query returns all permissible values across all versions of the CDE.

The URL for the results from the caDSR II REST API is

http
Code Block
titleExample 18
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetHTML
GetXML?query=PermissibleValue,ValueDomainPermissibleValue
,EnumeratedValueDomain
,ValueDomain&DataElement[
@publicID
@publicId=106
][
,@version=5.1]

http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi41
caDSR/
GetHTML
GetXML?query=PermissibleValue,ValueDomainPermissibleValue
,EnumeratedValueDomain
,ValueDomain&DataElement[
@publicID
@publicId=106
][@latestVersionIndicator=Yes]

Example 19 - Find a Concept by Concept Code

The following example finds a concept with the concept code.

Code Block
titleExample 19
http://cadsrapi.nci.nih.gov/cadsrapi41/GetHTML?query=Concept[@preferredName=C42614]

Can you retrieve all Data Elements using a common EVS concept code or name, but restrict results to only those where the concept is “Primary” in the CDE’s Object Class?

Yes. This can be done through any of the caDSR APIs, as well as for restricting to Property or a Value Meaning in the CDEs Enumerated Value Domain.

Example

...

Retrieve Data Elements with Object Class “Primary” concept named “Blood and Blood Products” (result in HTML).

Code Block
titleRetrieve Data Elements
http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElement,DataElementConcept,ObjectClass,ConceptDerivationRule&ComponentConcept[Concept[@preferredName=C19448]][@primaryFlag=Yes]

EXTENSION 1: An extension finds all Data Elements where the concept is used either as a primary OR qualifier concept. This is accomplished by removing last qualifier in the query.

Code Block
titleExtension 1
[@primaryFlag=Yes]

Removing this criteria in Example 1 returns 104 results instead of 88.

...

Retrieve Data Elements with Property “Primary” concept named “E-Mail Address”.

Code Block
titleRetrieve Data Elements
http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElement,DataElementConcept,Property,ConceptDerivationRule&ComponentConcept[Concept[@longName=E-mail%20Address]][@primaryFlag=Yes]

EXTENSION 2:  To retrieve the next higher order "type" administered items, remove the name of the item(s) before it in the query argument list, for example, to get DECs with E-Mail address as the primary concept, remove "DataElement" (the first item in the query argument list in Example 2).

...

Retrieve Data Element Concepts with Property “Primary” concept named “E-Mail Address”.

Code Block
titleExtension 2
http://cadsrapi.nci.nih.gov/cadsrapi40/GetHTML?query=DataElementConcept,Property,ConceptDerivationRule&ComponentConcept[Concept[@longName=E-mail%20Address]][@primaryFlag=Yes]

Retrieve Data Elements with Value Domain's Value Meaning "Primary" concept code= C19448 (Blood and Blood Products”) (result in XML).

Code Block
titleRetrieve Data Elements
http://cadsrapi.nci.nih.gov/cadsrapi40/GetXML?query=DataElement,EnumeratedValueDomain,ValueDomainPermissibleValue,PermissibleValue,ValueMeaning,ConceptDerivationRule&ComponentConcept[Concept[@longName=Blood and Blood Products]][@primaryFlag=Yes]

...

,@latestVersionIndicator=Yes]