NIH | National Cancer Institute | NCI Wiki  

Introduction

LexEVS CTS2 Code System Query API provides capability to query contents of Code System that are available in the system.

Interface

org.lexevs.cts2.query.CodeSystemQueryOperation is the main interface for all the queries against Code System. This interface can be accessed using main LexEVSCTS2 interface, like:

org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();

Query Functions

Here are the major query functions available using CodeSystemQueryOperation interface:

listCodeSystems

This function lists the coding systems that are available in cts 2 system. Optionally, return list can be restricted to Code System URI, version, local name, formal name or entity description.

listCodeSystems(CodingSchemeSummary queryByExample)

Description:

List the coding systems that are available in cts 2 system.

Input:

org.LexGrid.LexBIG.DataModel.Core.CodingSchemeSummary queryByExample - (Optional) Restrict the return list only to those that matches the supplied data. return list can be restricted to Code System URI, version, local name, formal name or entity description. If empty, all the code systems available in the system will be returned.

Output:

org.LexGrid.LexBIG.DataModel.Collections.CodingSchemeRenderingList - List of Code Systems

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2a: To get all the code systems:
    org.LexGrid.LexBIG.DataModel.Collections.CodingSchemeRenderingList csrList = csQuery..listCodeSystems(new CodingSchemeSummary());
    
  • Step 2b: To restrict to code system URI:
    CodingSchemeSummary() queryByExample = new CodingSchemeSummary();
    queryByExample.setCodingSchemeURI("urn:oid:cts:1.1.1");
    org.LexGrid.LexBIG.DataModel.Collections.CodingSchemeRenderingList csrList= query.listCodeSystems(queryByExample);
    

getCodeSystemDetails

This function provides the ability to retrieve detailed code system.

getCodeSystemDetails(String codingSchemeName, CodingSchemeVersionOrTag versionOrTag)

Description:

Return a detailed codingScheme according to provided codingName and versionOrTag

Input:

  • java.lang.String codingSchemeName - (Mandatory) Name of the code system.
  • org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag versionOrTag - (Optional) Version or tag (like 'dev', 'production' etc) of the code system.

Output:

org.LexGrid.codingSchemes.CodingScheme - detailed Code System

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2: Populate CodeSystemVersionOrTag object:
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    
    versionOrTag.setVersion("1.0");
    
  • Step 3: Call getCodeSystemDetails method to get detailed code system:
    CodingScheme result = query.getCodeSystemDetails("Automobiles", versionOrTag);
    

listCodeSystemConcepts

This function provides the ability to list concepts in specific code system.

listCodeSystemConcepts(String codingSchemeName, CodingSchemeVersionOrTag versionOrTag, LocalNameList entityTypes, SortOptionList sortOptionList)

Description:

List the concepts in a specific codingSystem

Input:

  • java.lang.String codingSchemeName - (Mandatory) Name of the code system.
  • org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag versionOrTag - (Optional) Version or tag (like 'dev', 'production' etc) of the code system.
  • org.LexGrid.LexBIG.DataModel.Collections.LocalNameList entityTypes - (Optional) List of entity types to restrict. Ex. 'concept', instance' etc.
  • org.LexGrid.LexBIG.DataModel.Collections.SortOptionList sortOptionList - (Optional) Sort option to apply on the returned list.

Output:

org.LexGrid.LexBIG.Utility.Iterators.ResolvedConceptReferencesIterator - An iterator for resolved concepts list

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2: Populate CodeSystemVersionOrTag object:
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    versionOrTag.setVersion("1.0");
    
  • Step 3a: Without SortOptions, call listCodeSystemConcepts method to get code system concepts:
    ResolvedConceptReferencesIterator conceptIterator = csQueryOp.listCodeSystemConcepts("Automobiles", versionOrTag,
    org.LexGrid.LexBIG.Utility.Constructors.createLocalNameList(org.LexGrid.commonTypes.types.EntityTypes.CONCEPT.toString()), null);
    
  • Step 3a: With SortOptions, call listCodeSystemConcepts method to get code system concepts:
    ResolvedConceptReferencesIterator conceptIterator = csQueryOp.listCodeSystemConcepts("Automobiles", versionOrTag,
    org.LexGrid.LexBIG.Utility.Constructors.createLocalNameList(org.LexGrid.commonTypes.types.EntityTypes.CONCEPT.toString()), Constructors.createSortOptionList(new String[VKC:) ( "code" ), new Boolean(] { new Boolean(true) }));
    

getConceptDetails

This function returns details of an entity specified.

getConceptDetails(String codingSchemeName, CodingSchemeVersionOrTag versionOrTag, String code, String namespace)

Description:

Return an instance of Entity according the requests.

Input:

  • java.lang.String codingSchemeName - (Mandatory) Name of the code system.
  • org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag versionOrTag - (Optional) Version or tag (like 'dev', 'production' etc) of the code system.
  • java.lang.String code - (Mandatory) Entity code.
  • java.lang.String namespace - (Optional) Namespace of an entity code.

Output:

org.LexGrid.concepts.Entity - Detailed Entity object

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2: Populate CodeSystemVersionOrTag object:
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    versionOrTag.setVersion("1.0");
    
  • Step 3: Call getConceptDetails method by providing code system version and entity code:
    Entity entity = csQueryOp.getConceptDetails("Automobiles", versionOrTag, "C0001", "Automobiles");
    

listAssociationTypes

This function returns all the supported association types with in the specified code system version.

listAssociationTypes(String codingSchemeName, CodingSchemeVersionOrTag versionOrTag)

Description:

List all the associationTypes in a specific code system.

Input:

java.lang.String codingSchemeName - (Mandatory) Name of the code system.
org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag versionOrTag - (Optional) Version or tag (like 'dev', 'production' etc) of the code system.

Output:

java.util.List<org.LexGrid.naming.SupportedAssociation> - List of all supported association types in supplied code system version

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2: Populate CodeSystemVersionOrTag object:
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    versionOrTag.setVersion("1.0");
    
  • Step 3: Call listAssociationTypes method by providing code system version and entity code:
    List<SupportedAssociation> associationList = csQueryOp.listAssociationTypes("Automobiles", versionOrTag);
    

getAssociationTypeDetails

This function returns detailed information for a certain association type with in the specified code system version.

getAssociationTypeDetails(String codingSchemeName, CodingSchemeVersionOrTag versionOrTag, String associationName)

Description:

Return detailed information for a certain associationType in a specific code system.

Input:

  • java.lang.String codingSchemeName - (Mandatory) Name of the code system.
  • org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag versionOrTag - (Optional) Version or tag (like 'dev', 'production' etc) of the code system.
  • java.lang.String associationName - (Mandatory) Name of an association

Output:

org.LexGrid.relations.AssociationEntity - Association type details

Exception:

org.LexGrid.LexBIG.Exceptions.LBException

Sample Call:

  • Step 1: Instantiate CodeSystemQueryOperation if it is not done yet:
    org.lexevs.cts2.query.CodeSystemQueryOperation csQueryOp = new org.lexevs.cts2.LexEvsCTS2Impl().getQueryOperation().getCodeSystemQueryOperation();
    
  • Step 2: Populate CodeSystemVersionOrTag object:
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    versionOrTag.setVersion("1.0");
    
  • Step 3: Call getAssociationTypeDetailsmethod by providing code system version and entity code:
    AssociationEntity associationEntity = csQueryOp.getAssociationTypeDetails("Automobiles", versionOrTag, "uses");