Versions Compared

Key

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

Table of Contents

Executing Any AQL

...

ItemValue
HTTP MethodGET
URI/rest/ng/saved-queries
ResponseJSON containing detailed list of saved queries 

Parameters

ParameterDescription
cpId

The cpId is used to filter the saved queries based on the CP. This is helpful in running the queries in background using scheduled jobs for initialisation of CP specific custom fields/forms.

Note: This is the CP that you select in the top-left dropdown of the add/edit query wizard.

searchString

Matches a substring in the title of the saved query.

start

Used for paginating the results. If start=5, the output result will start from row number 5.

max

Used for paginating the results. If max=10, the output result will be maximum 10 rows

countReq

Boolean type parameter, if specified as 'true' output will show the total number of saved-queries. Otherwise it won't.

Sample response

Get URL: 'rest/ng/saved-queries?countReq=true&start=0&max=10'

Code Block
languagejs
collapsetrue
{
    "count": 23,
    "queries": [
        {
            "id": 23,
            "title": "Show details of tissue specimen having frozen event",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273075000
        },
        {
            "id": 22,
            "title": "Show list of tissue specimens frozen within 15 mins of received time",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273075000
        },
        {
            "id": 21,
            "title": "Show specimens stored in a Container",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273075000
        },
        {
            "id": 20,
            "title": "Show list of Specimens based on SCG Label",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273075000
        },
        {
            "id": 19,
            "title": "Show list of specimens based on participant demographics",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273074000
        },
        {
            "id": 18,
            "title": "Show list of Specimens based on participant info (PPID or MRN)",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273074000
        },
        {
            "id": 17,
            "title": "Show specimen information based on Specimen Label",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273074000
        },
        {
            "id": 16,
            "title": "Specimen kit report query",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273074000
        },
        {
            "id": 15,
            "title": "Specimen Catalog",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273073000
        },
        {
            "id": 14,
            "title": "Show list of specimens based on specimen details",
            "createdBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedBy": {
                "id": 1,
                "type": null,
                "firstName": "System",
                "lastName": null,
                "loginName": null,
                "domain": null,
                "emailAddress": null,
                "instituteName": null,
                "primarySite": null,
                "admin": null,
                "instituteAdmin": null,
                "manageForms": null,
                "cpCount": 0,
                "creationDate": null,
                "activityStatus": null
            },
            "lastModifiedOn": 1575273073000
        }
    ]
}

...

ItemValue
HTTP MethodPOST
URI/rest/ng/query/{savedQueryId}
Body


Code Block
languagejs
{
	"drivingForm":"Participant",
	"wideRowMode": "DEEP",
	"startAt": 0,
	"maxResults": 20
}


ResponseJSON containing the output of the saved queries

...

ParameterDescriptionAllowed Values

drivingForm

Driving form determines the search perspective. When left empty, it defaults to Participant.

(For example when drivingForm is Participant, the root table is 'catissue_coll_prot_reg' which is then used to join with the other tables.Similarly when drivingForm is Specimen, the root table will be catissue_specimen, which will be joined with the other tables.)

Participant, Specimen

startAt

Used for paginating the results. If startAt=5, the output result will startAt from row number 5.

Integer

maxResults

Used for paginating the results. If maxResults=10, the output result will be maximum 10 rowsInteger

wideRowMode

Specifies whether multi-valued attributes result in a single row or one row per value. Default value is OFF. Other permitted values are SHALLOW and DEEP. Try out to see what fits best for your use case.

DEEP, SHALLOW, OFF

Sample response

Code Block
languagejs
collapsetrue
{
    "columnMetadata": [
        {
            "expr": "CollectionProtocol.Title",
            "aggregate": false
        },
        {
            "expr": "Participant.ppid",
            "aggregate": false
        },
        {
            "expr": "Participant.gender",
            "aggregate": false
        },
        {
            "expr": "Participant.medicalRecord.medicalRecordNumber",
            "aggregate": false
        },
        {
            "expr": "Participant.medicalRecord.mrnSiteName",
            "aggregate": false
        },
        {
            "expr": "Participant.race",
            "aggregate": false
        },
        {
            "expr": "SpecimenCollectionGroup.name",
            "aggregate": false
        },
        {
            "expr": "SpecimenCollectionGroup.clinicalDiagnosis",
            "aggregate": false
        },
        {
            "expr": "SpecimenCollectionGroup.site",
            "aggregate": false
        },
        {
            "expr": "Specimen.label",
            "aggregate": false
        },
        {
            "expr": "Specimen.extensions.SpecimenCollectionEvent.time",
            "aggregate": false
        },
        {
            "expr": "Specimen.class",
            "aggregate": false
        },
        {
            "expr": "Specimen.type",
            "aggregate": false
        },
        {
            "expr": "Specimen.specimenPosition.containerName",
            "aggregate": false
        },
        {
            "expr": "Specimen.specimenPosition.positionDimensionOneString",
            "aggregate": false
        },
        {
            "expr": "Specimen.specimenPosition.positionDimensionTwoString",
            "aggregate": false
        },
        {
            "expr": "Specimen.pathologicalStatus",
            "aggregate": false
        },
        {
            "expr": "Specimen.tissueSite",
            "aggregate": false
        },
        {
            "expr": "Specimen.availableQty",
            "aggregate": false
        }
    ],
    "columnLabels": [
        "Collection Protocol# Title",
        "Participant# PPID",
        "Participant# Gender",
        "Participant# MRN",
        "Participant# MRN Site",
        "Participant# Race",
        "Visit# Name",
        "Visit# Clinical Diagnosis (Deprecated)",
        "Visit# Visit Site",
        "Specimen# Specimen Label",
        "Specimen# Collection Event# Date and Time",
        "Specimen# Class",
        "Specimen# Type",
        "Specimen# Container Name",
        "Specimen# Container Column",
        "Specimen# Container Row",
        "Specimen# Pathological Status",
        "Specimen# Anatomic Site",
        "Specimen# Available Quantity"
    ],
    "columnTypes": [
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "DATE",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "STRING",
        "FLOAT"
    ],
    "columnUrls": [
        "#/object-state-params-resolver?stateName=cp-detail.overview&objectName=collection_protocol&key=title&value={{$value}}",
        "#/object-state-params-resolver?stateName=participant-detail.overview&objectName=collection_protocol_registration&key=id&value={{$cprId}}",
        null,
        null,
        "#/object-state-params-resolver?stateName=site-detail.overview&objectName=site&key=name&value={{$value}}",
        null,
        "#/object-state-params-resolver?stateName=visit-detail.overview&objectName=visit&key=name&value={{$value}}",
        null,
        "#/object-state-params-resolver?stateName=site-detail.overview&objectName=site&key=name&value={{$value}}",
        "#/object-state-params-resolver?stateName=specimen-detail.overview&objectName=specimen&key=id&value={{$specimenId}}",
        null,
        null,
        null,
        "#/object-state-params-resolver?stateName=container-detail.locations&objectName=storage_container&key=name&value={{$value}}",
        null,
        null,
        null,
        null,
        null
    ],
    "rows": [
        [
            "TCP",
            "$$cp_reg_1$$",
            null,
            null,
            null,
            null,
            "$$cp_visit_1$$",
            null,
            "Pune Site",
            "0000004",
            "02-12-2019 16:03",
            "Fluid",
            "Buffy Coat",
            "test_box1",
            "4",
            "1",
            "Not Specified",
            "Not Specified",
            "6.00"
        ]
    ],
    "columnIndices": null,
    "dbRowsCount": 1
}


Exporting Query Data

Request

MethodPOST
URLrest/ng/query/export
Body


Code Block
languagejs
{
  "aql": "select Participant.ppid, Participant.regDate, Participant.gender, Participant.race, Specimen.label, Specimen.type where  Participant.participantId exists",
  "wideRowMode": "DEEP"
}


Response


Code Block
languagejs
{
  "dataFile": "query_0_61e59bc2-9350-47db-9af8-a1e7a3b65bc2",
  "completed": false
}



Parameters

aqlValid AQL query whose output needs to be exported to a CSV file
dataFileHandle or file ID to use for downloading the exported CSV file
completedBoolean indicating whether the exported CSV file can be downloaded right away

Download Exported Data File

Request

MethodGET
URLrest/ng/query/export?fileId=<dataFile>
Response

Scenario 1: When the exported data file is not ready


HTTP 400 with the following error message in the response body


Code Block
languagejs
[
  {
    "code":"QUERY_EXPORT_DATA_IN_PROGRESS",
    "message":"The query result data export is in progress. Retry downloading the file after some time."
  }
]


Scenario 2: When the exported data file is ready

HTTP 200 with the ZIP binary stream in the response body

Parameters

fileIdThe handle or file ID returned by the export API

Query Export in Action

Initiate Export

Image Added

Download Exported File - Attempt 1 of N

Image Added

Download Exported File

Image Added