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

...

Download Exported File - Attempt 1 of N

Download Exported File


FAQ

Let’s assume we've the following data:

  • A specimen record with label L

  • Specimen L has 2 biohazards - H1, H2

  • Specimen L has 2 frozen events F1, F2

  • Output includes specimen label (L), biohazards, and one or more fields of frozen event.

  1. What does OFF, SHALLOW and DEEP do? What are the differences between them?

    Let's assume we've a specimen record L with biohazards H1 and H2. Also, let's assume the specimen L has 2 frozen events F1 and F2.Using above, it is easy to explain the various wide row modes:

    1. wideRowMode = OFF. There will be one row for each combination of biohazard and frozen event. That is - 

      (L, H1, F1), (L, H1, F2), (L, H2, F1), (L, H2, F2)

    2. wideRowMode = SHALLOW. There will be one row for each frozen event. That is - 

      (L, H1, H2, F1), (L, H1, H2, F2)

    3. wideRowMode = DEEP. There will be one row for each specimen irrespective of the number of biohazards and frozen events. That is - 

      (L, H1, H2, F1, F2)

  2. Why is it so hard to get the same results from the same query in both the API and in OpenSpecimen?

    The UI uses either SHALLOW or DEEP. It does not use OFF.

    When the “Enable Wide Rows” checkbox is ticked, the wideRowMode=DEEP. When it is unticked, wideRowMode=SHALLOW.