Example query 3: Find cases with given age at diagnosis

QUERY DATASETS > About the Datasets API > Query via the Datasets API > Example query 3: find cases with...

Use the following query to see all cases for which the age at diagnosis is between 10 and 50.

POST /datasets/tcga/v0/query HTTP/1.1
Host: cgc-datasets-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9304ea9d9273156740f74
{
   "entity":"cases",
   "hasAgeAtDiagnosis": {
       "filter": {
           "gt": 10,
           "lt": 50
       }
   }
}

Note that the value of the metadata field hasAgeAtDiagnosis is a dictionary containing the key filter, whose value is a further dictionary with keys gt (greater than) and lt (less than) for the upper and lower bounds to filter by.

👍

You can use either integers or strings (like "10") as the upper and lower bounds in filter, in the query above.

Response body

The response shows the matching cases.

{
  "count": 100,
  "_embedded": {
    "cases": [
      {
        "_links": {
          "self": {
            "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/cases/029CE789-123A-45B6-8596-CD94300E7EF5"
          }
        },
        "id": "029CE789-123A-45B6-8596-CD94300E7EF5",
        "label": "029CE789-123A-45B6-8596-CD94300E7EF5"
      },
      {
        "_links": {
          "self": {
            "href": "https://cgc-datasets-api.sbgenomics.com/datasets/tcga/v0/cases/02B5012E-45B6-4423-7890-0B2F5E50926E"
          }
        },
        "id": "02B5012E-45B6-4423-7890-0B2F5E50926E",
        "label": "02B5012E-45B6-4423-7890-0B2F5E50926E"
      },
  
        <snip>
  
    ]
  }
}

👍

For brevity, we have omitted part some of the returned cases.

For each case matching the query, the following information is listed:

Language